clean-search-extension

Auto-clean popular search engine URLs for a faster, cleaner experience. | made by conflicted

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         clean-search-extension
// @namespace    http://tampermonkey.net/
// @version      2.1
// @description  Auto-clean popular search engine URLs for a faster, cleaner experience. | made by conflicted
// @author       conflicted @kittenware on discord
// @match        *://www.google.com/search*
// @match        *://www.google.*.*/search*
// @match        *://search.yahoo.com/search*
// @match        *://*.search.yahoo.com/search*
// @match        *://www.bing.com/search*
// @match        *://duckduckgo.com/*
// @match        *://yandex.com/search/*
// @match        *://yandex.ru/search/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const url = new URL(window.location.href);

    let cleaned = false; // Flag to detect if cleaning happened

    // GOOGLE
    if (url.hostname.includes('google.')) {
        if (url.searchParams.get('udm') !== '14') {
            url.searchParams.set('udm', '14');
            window.location.replace(url.toString());
        }
    }

    // YAHOO
    else if (url.hostname.includes('yahoo.com')) {
        const p = url.searchParams.get('p');
        if (p) {
            const cleanUrl = `${url.origin}${url.pathname}?p=${encodeURIComponent(p)}`;
            if (window.location.href !== cleanUrl) {
                window.location.replace(cleanUrl);
            }
        }
    }

    // BING
    else if (url.hostname.includes('bing.com')) {
        const q = url.searchParams.get('q');
        if (q) {
            const cleanUrl = `${url.origin}${url.pathname}?q=${encodeURIComponent(q)}`;
            if (window.location.href !== cleanUrl) {
                window.location.replace(cleanUrl);
            }
        }
    }

    // DUCKDUCKGO
    else if (url.hostname.includes('duckduckgo.com')) {
        const q = url.searchParams.get('q');
        if (q) {
            const cleanUrl = `${url.origin}${url.pathname}?q=${encodeURIComponent(q)}`;
            if (window.location.href !== cleanUrl) {
                window.location.replace(cleanUrl);
            }
        }
    }

    // YANDEX
    else if (url.hostname.includes('yandex.com') || url.hostname.includes('yandex.ru')) {
        const text = url.searchParams.get('text');
        if (text) {
            const cleanUrl = `${url.origin}${url.pathname}?text=${encodeURIComponent(text)}`;
            if (window.location.href !== cleanUrl) {
                window.location.replace(cleanUrl);
            }
        }
    }

    // AFTER THE PAGE LOADS
    window.addEventListener('load', () => {
        showPopup();
    });

    // Little Popup
    function showPopup() {
        const popup = document.createElement('div');
        popup.innerText = 'Results Cleaned by Conflicted @kittenware';
        popup.style.position = 'fixed';
        popup.style.top = '20px';
        popup.style.right = '20px';
        popup.style.backgroundColor = '#222';
        popup.style.color = '#fff';
        popup.style.padding = '10px 15px';
        popup.style.borderRadius = '10px';
        popup.style.boxShadow = '0px 0px 10px rgba(0,0,0,0.5)';
        popup.style.zIndex = '99999';
        popup.style.fontFamily = 'Arial, sans-serif';
        popup.style.fontSize = '14px';
        popup.style.opacity = '0.9';
        document.body.appendChild(popup);

        setTimeout(() => {
            popup.remove();
        }, 2000); // Remove popup after 2 seconds
    }
})();