DuckDuckGo Search Sidebar

Effettua una ricerca su DuckDuckGo nella parte laterale destra della pagina

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==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);
})();