DuckDuckGo Search Sidebar

Effettua una ricerca su DuckDuckGo nella parte laterale destra della pagina

Stan na 16-09-2024. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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