Auto-Espande Google Search Tools

Mostra il menu Strumenti di ricerca nei risultati di ricerca di Google

目前為 2024-03-17 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name           Auto-Espande Google Search Tools
// @description    Mostra il menu Strumenti di ricerca nei risultati di ricerca di Google
// @namespace      https://greasyfork.org/users/237458
// @author         figuccio
// @version        22.3
// @match          https://*.google.com/*
// @match          https://*.google.it/*
// @match          https://*.google.fr/*
// @match          https://*.google.es/*
// @match          https://*.google.de/*
// @exclude        https://translate.google.it/?hl=it
// @exclude        https://drive.google.com/*
// @require        https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @require        https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=19641
// @grant          GM_addStyle
// @grant          GM_setValue
// @grant          GM_getValue
// @run-at         document-start
// @icon           https://www.google.com/favicon.ico
// @noframes
// @license        MIT
// @grant          GM_registerMenuCommand
// @require        http://code.jquery.com/jquery-latest.js
// @require        https://code.jquery.com/ui/1.12.1/jquery-ui.js
// ==/UserScript==
(function() {
    'use strict';
var $ = window.jQuery;
if (document.readyState != 'loading') consent();
else document.addEventListener('DOMContentLoaded', consent);

function consent() {
  var e=document.querySelector('#introAgreeButton');
  if (!e) e=document.querySelector('div.jw8mI button#zV9nZe.tHlp8d, div.VDity button#L2AGLb.tHlp8d, div.GzLjMd button#L2AGLb.tHlp8d, form[action="https://consent.google.com/s"] button');
  if (!e) {
    let A=document.querySelectorAll('div.lssxud button.nCP5yc:not(:disabled)');
    if (A.length > 1) e=A[1];
    }
  e && e.click();
  }

    /////////////////////////////////////
    window.addEventListener("load",function(){
        disableSafesearch();
        addClockFieldset();
        makeClockDraggable();
    });
    // Aggiungi un fieldset per l'orologio
    function addClockFieldset() {
    var fieldset = document.createElement('fieldset');
    fieldset.setAttribute('id', 'clockFieldset');
    fieldset.style.position = 'fixed'; // Usa 'fixed' invece di 'absolute'
    fieldset.style.top = '5px'; // Posizione iniziale
    fieldset.style.left = '850px'; // Posizione iniziale
    fieldset.style.zIndex = '99999'; // Imposta un indice z elevato per assicurarti che sia sopra agli altri elementi
    fieldset.style.background = '#3b3b3b';
    fieldset.style.color = 'lime';
    fieldset.style.padding = '';//10px  risultava un po grande
    fieldset.style.border = '2px solid red';
    fieldset.style.borderRadius = '5px';
    fieldset.style.width='390px';
    fieldset.style.display='flex';

    var button = document.createElement('button');
    button.textContent = 'Ricarica';
    button.id = 'ricarica';
    button.style.color = 'lime'; // Colore rosso per il testo del pulsante
    button.style.backgroundColor = '#3b3b3b'; // Background lime per il pulsante
    button.style.cursor='pointer';
    button.title='Ricarica';
    button.style.border = '1px solid yellow';
    button.style.borderRadius = '5px';
    button.style.marginLeft = '9px';// Aggiungere il margine sinistro per distanziarlo
    button.style.padding='4px';//padding sul pulsante ricarica

    //Aggiunto un div vuoto per lo spazio tra lorologio e il menu
    fieldset.innerHTML = '<legend style="text-align:center;">Data-Time </legend><div id="clock"></div><div style="width:10px;"></div>'; // Aggiunto un div vuoto per lo spazio

     ///////////////////////////
     var selectMenu = document.createElement('select');
     selectMenu.innerHTML ='<option value="#">Scegli ...</option>'+
    '<option style="background-color:Green" title="Vai su facebook" value="https://www.facebook.com/">Facebook</option>' +
    '<option style="background-color:Brown" title="Vai su youtube" value="https://www.youtube.com/">Youtube</option>' +
    '<option style="background-color:Red" title="Vedi altri script" value="https://greasyfork.org/it/users/237458-figuccio">Autore</option>';

    selectMenu.addEventListener('change', function() {
        var selectedOption = this.options[this.selectedIndex];
        //location.href = selectedOption.value;//apre nella stessa scheda
        window.open(selectedOption.value, '_blank');//apre in una nuova scheda
    });

    fieldset.appendChild(selectMenu);
// Aggiungi questo codice dopo la creazione del menu select
selectMenu.style.background = '#3b3b3b';
selectMenu.style.color = 'lime';
selectMenu.style.border = '1px solid yellow';
selectMenu.style.borderRadius = '5px';
selectMenu.style.cursor = 'pointer';
selectMenu.title = "Menù";//titolo sul menu di scelta

fieldset.appendChild(button);

// Aggiungi l'evento click per ricaricare la pagina
    button.addEventListener('click', function() {
        location.reload(true);
    });
       //////////////////// x
    // Aggiungi il testo per chiudere l'orologio
    var closeClock = document.createElement('span');
    closeClock.id = 'closeClock';
    closeClock.title = 'Chiudi';
    closeClock.style.cursor = 'pointer';
    closeClock.style.color = 'lime';
    closeClock.style.background = 'chocolate';
    closeClock.style.border = '1px solid yellow';
    closeClock.style.borderRadius = '4px';
    closeClock.style.padding = '3px 6px';
    closeClock.style.marginLeft = '9px';// Aggiungere il margine sinistro per distanziarlo
    closeClock.textContent = 'x';

    closeClock.addEventListener('click', function() {
        fieldset.style.visibility = 'hidden';
    });

    fieldset.appendChild(closeClock);
       //////////////////////
    document.body.appendChild(fieldset);
    updateClock();
    setInterval(updateClock, 70); // Aggiorna l'orologio ogni 100 millisecondi
       /////////////////
        // Gestore di eventi per nascondere l'elemento quando l'icona viene cliccata
    document.getElementById('closeClock').addEventListener('click', function() {
    fieldset.style.visibility = 'hidden';//funziona impedisce che il menu cambi la posizione se mostrato nascosto
    });
}

    //////////////////////////
    // Aggiorna l'orologio
function updateClock() {
var d = new Date();
var tem = d.toLocaleTimeString();
var mm = d.getMilliseconds();//millisecondi settembre 2023
    ////////////////short  long
var date = new Date().toLocaleString('it', {'weekday': 'short', 'month': '2-digit', 'day': '2-digit','year':'numeric'});
document.getElementById('clock').innerHTML =date +" "+ tem +":"+ mm;
    //////////////////////////
     // Aggiunta del bordo e del bordo arrotondato
    var clockElement = document.getElementById('clock');
    clockElement.style.border = '1px solid yellow';
    clockElement.style.borderRadius = '7px';
    clockElement.style.color = '';
    clockElement.style.cursor = 'pointer';
    clockElement.title = "Data-Ora";
    clockElement.style.padding='4px';//varia il padding delorologio e del menu scegli
    /////////////////////
    }

    // Rendi il fieldset dragabile
    function makeClockDraggable() {
        $('#clockFieldset').draggable({
            containment: 'window',
            stop: function(event, ui) {
                var position = ui.position;
                GM_setValue('clockPosition', JSON.stringify(position)); // Salva la posizione
            }
        });

        // Ripristina la posizione memorizzata
        var storedPosition = GM_getValue('clockPosition');
        if (storedPosition) {
            var position = JSON.parse(storedPosition);
            $('#clockFieldset').css({ top: position.top + 'px', left: position.left + 'px' });
        }
    }

        //disable safesearch
   function disableSafesearch() {
        var safeui = document.querySelector("a[aria-label][href*='setprefs?sig']");
        if(safeui != null){
            if(safeui.href.match(/safeui=off$/) == null){
                window.location = safeui.href.replace(/safeui=(on|images)$/,"safeui=off");
                console.log("Google disable safesearch: done!");
            } else {
                console.log("Google disable safesearch: nothing to do!");
            }
        } else {
            safeui = document.querySelector("a[href*='setprefs?sig'][href$='safeui=off']");
            if(safeui != null) {
                window.location = safeui.href;
                console.log("Google disable safesearch: done!");
            } else {
                if(document.querySelector("a[href*='setprefs?sig'][href$='safeui=on']") != null){
                    console.log("Google disable safesearch: nothing to do!");
                } else {
                    console.log("Google disable safesearch: failed!");
                }
            }
        }
    }
})();
/////////////////////////////////////////////////////////////////////////
//popup accedi a google (invasivo)settembre 2023
GM_addStyle(".nD2EKb{display:none!important;}");
//Filtro alcuni  risultati potrebbero essere espliciti click automatico su ignora
setTimeout(function(){document.querySelector("#appbar > div.zNFAfd > div > div.zRHtD > div.O6QT3d > div > div").click();},1000);//8marzo 2023
              // Show the Search Tools menu
GM_addStyle("#hdtbMenus{display:block !important;position:absolute !important;top:8px !important;right:500px!important;}");//giugno 2023 riposizionato
GM_addStyle("#result-stats{display:none!important;}");/* Circa 261.000.000 risultati (0,61 secondi) nascosto */

//pulsante Strumenti di ricerca rosso
GM_addStyle("#hdtb-tls {color:red!important;background:green!important;border-radius:12px;border:2px solid red!important}");
GM_addStyle("#hdtb-tls:hover{color:gold!important;}");
                             //pulsante tutti i filtri
GM_addStyle(".fKmH1e {color:red!important;background:green!important;border-radius:12px;border:2px solid red!important;height:36px;}");//pulsante tutti i filtri
GM_addStyle(".fKmH1e:hover{color:gold!important;}");
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                             //safesearch
GM_addStyle(".F75bid {color:red!important;}");//link
GM_addStyle(".F75bid:hover {color:gold!important;}");//al passaggio mouse
GM_addStyle(".fFI3rb {background:green!important;border-radius:10px;border:2px solid red!important;}");//background
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
GM_addStyle('.IUOThf{background-color:#303134!important;width:723px;border-radius:12px;border:2px solid red!important}');
   //colore link immag notiz libri mappe
GM_addStyle('.GKS7s .FMKtTb, .GKS7s .RWhoyd.mol54e{color:red!important;}');
   //al passaggio mouse link
GM_addStyle('.GKS7s :hover {color:green!important;}');
GM_addStyle('.GKS7s{background:gold!important;border:2px solid blue!important;}');
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//colori testo strumenti colore verde Search Tools (qualsiasi paese-lingua -data-tutti i risultati)
GM_addStyle('.hdtb-mn-hd {color:green!important;background:gold!important;border-radius:9px;border:2px solid blue!important}');
//link espansione strumenti colore verde che diventa rosso al passaggio mouse
GM_addStyle('.hdtb-mn-hd:hover {color:red!important}');
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//topbar espansioni strumenti colorata Search Tools
GM_addStyle('.WE0UJf {background:#303134!important;width:700px;border-radius:12px;border:1px solid red!important}');//ok
//pulsante tutti
GM_addStyle('#hdtb-msb .hdtb-mitem.hdtb-msel{color:red!important;background:orange!important;border-radius:8px;border:2px solid green!important;padding:4px 4px;border-bottom:6px solid blue!important}');
//triangolini rossi
GM_addStyle('.gTl8xb {border-color:red transparent!important}');
//menu colorato
GM_addStyle('.cF4V5c {color:lime!important;background:red !important;}');
GM_addStyle('.cF4V5c {border:2px solid blue!important}');//bordo blu

//no publicita correlate
GM_addStyle('#rcnt .col:nth-of-type(3) {display:none !important;}');

   //le persone anno chiesto anche
GM_addStyle('.OJXvsb.Wnoohf.cUnQKe.kp-blk {display:none !important;}');

//Promemoria sulla privacy di Google
GM_addStyle('#cnsh,#cnso,#cnsi{display:none!important}');
//////////////////////////////////////////////////aggiunto youtube
process();
new MutationObserver(process).observe(document.body || document.documentElement, { childList: true, subtree: true });

function process(mutations) {
  let q,
    queryElement = document.querySelector('input[name="q"]');// selector for the Google search input textbox

  if (queryElement?.value) q = encodeURIComponent(queryElement.value);
  else if (q = location.href.match(/^.+?(?:[#/&?](?:q|query))=(.+?)(?:|&.+|\|.+)$/)) q = q[1];

  let link = document.querySelector(`a[href*='tbm=vid']`);

  if (q && link?.href) {
    link.href = 'https://www.youtube.com/results?search_query=' + q;
    link.textContent = 'YouTube';
      /////////////////////
    link.style.backgroundColor = 'yellow';
    link.style.color = 'red';
    link.style.borderRadius = '12px';
    link.style.border = '2px solid blue';
    link.style.padding = '9px';
    // Aggiungi l'effetto al passaggio del mouse
    link.addEventListener('mouseover', function () {
      this.style.color = 'green';
    });
    // Reimposta il colore quando il mouse se ne va
    link.addEventListener('mouseout', function () {
      this.style.color = 'red';
    });

      ////////////////////
    console.log('create', link.textContent);
  }
}
///ricerche correlate
GM_addStyle('#brs {display:none !important;}');
GM_addStyle('.commercial-unit-desktop-top {display:none !important;}');

////////////////////////////////
//di nuovo publicita e correlati a destra
GM_addStyle('#rhs {display:none!important;}');
GM_addStyle('.YTDezd {display:none!important;}');
/////////////////////////////////////////////////
(function() {
  'use strict';
  if (GM_getValue('Open in new window?') === undefined)
 { //Avvia la condizione if

    GM_setValue('Open in new window?', 1); //Imposta lo script per aprire i siti Web in una nuova scheda 1 apre 0 no
  } //Termina la condizione if

  if (location.pathname === '/search' && location.href.match('&newwindow=' + GM_getValue('Open in new window?')) === null) //If the current search doesn't have the user choices applied
  { //Avvia la condizione if
    location.href = location.href += '&newwindow=' + GM_getValue('Open in new window?'); //Reindirizza per aggiungere le scelte dell'utente
  } //Termina la condizione if
////////////////////////
    //mostra/nascondi box
function provag() {
    var box = document.getElementById('clockFieldset');
    box.style.visibility = (box.style.visibility !== 'hidden') ? 'hidden' : 'visible';
}
GM_registerMenuCommand("nascondi/mostra time", provag);

})();