Auto-Espande Google Search Tools

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

目前為 2023-11-13 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 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        20.6
// @match          https://*.google.com/*
// @match          https://*.google.it/*
// @match          https://*.google.fr/*
// @match          https://*.google.es/*
// @match          *://www.google.de/*
// @include     https://consent.google.*/*
// @include     https://www.google.tld/*
// @match          https://consent.google.it/m?continue=https://translate.google.it/?hl%3Dit&gl=IT&m=0&pc=t&cm=2&hl=it&src=1
// @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==
//disable safesearch
(function() {
    'use strict';
    //accetta cookie consent non da problemi sul traduttore
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();
    });

   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';
    console.log('create', link.textContent);
  }
}
///ricerche correlate
GM_addStyle('#brs {display:none !important;}');
GM_addStyle('.commercial-unit-desktop-top {display:none !important;}');
///////////////cookie consent//////////////novembre 2023 accetta cookie
//accetta consent traduttore
//setTimeout(function(){document.querySelector("#yDmH0d > c-wiz > div > div > div > div.NIoIEf > div.G4njw > div.AIC7ge > div.CxJub > div.VtwTSb > form:nth-child(1) > div > div > button > span").click();},1000);

if (!document.cookie.match("(^|;)\\s*CONSENT=YES\\+")) {
    document.cookie="CONSENT=YES+domain=.google.com;max-age=31536000";
    document.cookie="CONSENT=YES+domain=.google.it;max-age=31536000";
    document.cookie="CONSENT=YES+domain=.google.fr;max-age=31536000";//francia
    document.cookie="CONSENT=YES+domain=.google.es;max-age=31536000";//spagna
    document.cookie="CONSENT=YES+domain=.google.de;max-age=31536000";//tedesco
  location.reload();
}
/////////////////////////////ricarica tema anche su google.com  storage
if (GM_getValue('color-theme')) {
        if (GM_getValue('color-theme') === 'light') {
            document.documentElement.classList.add('dark');
            GM_setValue('color-theme', 'dark');
        } else {
            document.documentElement.classList.remove('dark');
            GM_setValue('color-theme', 'light');
        }
    // se NON impostato in precedenza tramite archiviazione locale
    } else {
        if (document.documentElement.classList.contains('dark')) {
            document.documentElement.classList.remove('dark');
            GM_setValue('color-theme', 'light');
        } else {
            document.documentElement.classList.add('dark');
           GM_setValue('color-theme', 'dark');
        }
    }

////////////////////////////////
//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
})();
///////////////////////time-list///////////
var $ = window.jQuery;
var j = $.noConflict();
//avvia la funzione dopo che la pagina e stata caricata
$(document).ready(function() {
var body=document.body;
var style="position:fixed; top:-13px;margin-left:850px;z-index:99999;"
var box=document.createElement("div");

box.id="googleok";
box.style=style;
j(box).draggable();
body.append(box);

 //mostra/nascondi box
function provag() {
var box = document.getElementById('googleok');
box.style.display = ((box.style.display!='none') ? 'none' : 'block');
}
GM_registerMenuCommand("nascondi/mostra time",provag);

///////////////////////////////////////////////////////////////
   //Imposta lo stile CSS degli elementi nel menu
  GM_addStyle(`
  #setui{width:460px;height:19px; margin-top:0px;margin-left:-165px;margin-right:-50px;margin-bottom:0px;border-width:1px;}
  #dynamic_select{background:#3b3b3b;color:lime;border:1px solid yellow; border-radius:5px;cursor:pointer;}
  #datePickerx{background:#3b3b3b;color:lime;border:1px solid yellow; border-radius:5px;margin:-18px;margin-left:305px;text-align:center;cursor:pointer;width:max-content;}
  #ricarica{background:#3b3b3b;color:lime;border:1px solid yellow; border-radius:5px;cursor:pointer;}
  .chiudi {padding: 3px 6px; line-height:16px;margin-top:-5px;margin-right:-545px;display:inline-block;border:1px solid yellow;border-radius:3px;cursor:pointer;background:chocolate;}

            `);

var myVar = setInterval(function(){ myTimer() }, 70);
function myTimer() {
var d = new Date();
var t = d.toLocaleTimeString();
var mm = d.getMilliseconds();//millisecondi ottobre 2023
    ////////////////short  long
var date = new Date().toLocaleString('it', {'weekday': 'short', 'month': '2-digit', 'day': '2-digit','year':'numeric'});

document.getElementById("datePickerx").innerHTML =date +" "+ t +":"+ mm;
}
    //stile list colorata
$(function(){
$("select").change(function(){
    var $selectedOption = $(this).find("option:selected");
    $(this).removeAttr("style").attr("style", $selectedOption.attr("style"));
});

});

/////////////////////menu ha tendina(change url)
    $(function() {
      $('#dynamic_select').on('change',function() {
        window.location.href = $(this).val();
          //apre in nuova scheda
         //window.open(this.value)
      });
});
////////////////////reflesh pagina
    $(document).ready(function(){
        $("#ricarica").click(function(){
            location.reload(true);
        });
    });
    ////////////////
 //elemento html nel div readonly datatime non fa comparire licona del calendario width:310px evita che spostandolo hai lati cambi di dimensioni
    box.innerHTML=`
                      </p>
                   <fieldset style="background:#3b3b3b; border: 2px solid red;color:lime;border-radius:7px;text-align:center;width:340px;">
                   <legend>DATA-TIME</legend>
   <div id=setui>
                           <button id="ricarica" title="Reflesh"<button type="button">Reflesh</button>

    <select id="dynamic_select" title="Selezione siti">
    <option value="#">Scegli ...</option>
    <option style="background-color:Green"title="Vai su facebook" value="https://www.facebook.com/?sk=h_chr">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>
    </select>
 <div id="datePickerx"  title="Data-ora"></div>

 <span class="chiudi" title="Chiudi" id='close'>x</span>
                                                    </p>
                    </div>
                    </fieldset>
            `;
 //////////////////////////////
            //aggiunta span close per chiudere il box direttamente
            var Close=document.querySelector('#close');
            Close.addEventListener('click',provag,false);
})();
////////////////////////////////