DuckDuckGo Search Sidebar

Effettua una ricerca su DuckDuckGo nella parte laterale destra della pagina

Από την 16/09/2024. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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         DuckDuckGo Search Sidebar
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Effettua una ricerca su DuckDuckGo nella parte laterale destra della pagina
// @author       Magneto1
// @license      MIT
// @match        *://*/*
// @grant        GM_registerMenuCommand
// ==/UserScript==

(function() {
    'use strict';

    // Funzione per effettuare una ricerca su DuckDuckGo
    function searchDuckDuckGo() {
        const query = prompt('Inserisci il termine di ricerca per DuckDuckGo:');
        if (query) {
            const searchUrl = `https://duckduckgo.com/?q=${encodeURIComponent(query)}`;
            const width = 800; // Larghezza della finestra
            const height = 600; // Altezza della finestra
            const left = window.screenX + window.innerWidth; // Posizione a destra della pagina corrente
            const top = window.screenY; // Posizione in alto

            // Apri la finestra pop-up
            const newWindow = window.open(searchUrl, 'DuckDuckGoSearch', `width=${width},height=${height},left=${left},top=${top},resizable=yes`);

            // Controlla se il pop-up è stato bloccato
            if (!newWindow) {
                alert('Il pop-up è stato bloccato. Assicurati di consentire i pop-up per questo sito.');
            }
        } else {
            alert('Per favore, inserisci un termine di ricerca valido.');
        }
    }

    // Aggiungi un comando al menu di Violentmonkey per la ricerca su DuckDuckGo
    GM_registerMenuCommand("Cerca su DuckDuckGo", searchDuckDuckGo);
})();