Auto-Espande Google Search Tools

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

当前为 2023-04-21 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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
// @match          https://*.google.com/*
// @match          https://*.google.it/*
// @exclude        https://translate.google.it/?hl=it
// @exclude        https://drive.google.com/*
// @version        18.5
// @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/s2/favicons?domain=google.it
// @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==
//////////////////////////////////////////////non togliere set timeout
//Filtro alcuni  risultati potrebbero essere espliciti click automatico su ignora dopo 4sec /1sec
setTimeout(function(){
//document.querySelector("#appbar > div.zNFAfd > div > div.zRHtD > div.O6QT3d > g-raised-button > div").click();},1000);
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:68px !important;}");
GM_addStyle("#result-stats{display:none!important;}");/* Circa 261.000.000 risultati (0,61 secondi) nascosto */

//Accelera la visibilità del menu Strumenti di ricerca rimuovendo l'animazione.
GM_addStyle("#hdtbMenus { transition: none !important; }");
//pulsante Strumenti di ricerca rosso
GM_addStyle("#hdtb-tls { color:red !important;background:green!important; border-radius:12px;border:2px solid red!important}");

//testo altro,immagini.ecc colore rosso spondo arancione
GM_addStyle('#hdtb .hdtb-mitem a {color:red!important;background:orange!important;border-radius:8px;padding:4px 4px;border:2px solid green!important}');

           //altro
GM_addStyle('.hdtb-mitem .GOE98c{color:red!important;background:orange!important;border-radius:8px;padding:4px 4px!important;border:2px solid green!important}');

    //link altro,immagini.maps ecc colore rosso che cambia colore al passaggio mouse diventa verde
GM_addStyle('#hdtb .hdtb-mitem a:hover{color:green!important}');

GM_addStyle('#hdtb-msb {min-width:0px!important}');//pulsanti impostazioni e strumenti avvicinati al pulsante altro
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//colori testo strumenti colore verde Search Tools
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('.hdtbItm.hdtbSel, .hdtbItm a,#hdtb-more-mn a,#cdrlnk, .hdtb-mn-o {color:lime!important;background:red !important;}');
GM_addStyle('.hdtb-mn-o {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//////////////giugno 2022 rifunziona
(function(){
"use strict";
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');
  e && e.click();
  }

})();
///////////////////////ricarica per impostare il tema scuro predefinito
 if(!localStorage.reload) {
 setTimeout(function(){document.location.reload();}, 2000);
 localStorage.reload = 1;
    }
/////////////////////
/////////colori menu ingranaggio e menu che compare quando clicco tipo su qualsiasi data ecc
GM_addStyle('.gLSAk {background-color:!important;color:!important;border:2px solid green!important}');

//di nuovo publicita e correlati a destra
GM_addStyle('#rhs {display:none !important;}');

GM_addStyle('.YTDezd {display:none !important;}');
//////////////////////////////////////////////
//scorrimento pagine senza ricarica endless google 2023
const currentSearchTab = document.querySelector('[aria-current]')
const checkAllResultsPage = currentSearchTab !== null && currentSearchTab.previousSibling == null
let pageCounter = document.createElement('style')
pageCounter.innerText = `

g-section-with-header,
#botstuff ~ #res[role="main"] video-voyager{display: none!important;}

/* contatore di pagine linea colore verde */
#botstuff ~ #res[role="main"] {counter-increment: number 2; border-top: solid green 1px; }
/* numero pag linea 135 colore rosso */
#botstuff ~ #res[role="main"]:before {content: counter(number);
font-size: 14px; position: absolute; right: 0; margin-top: -10px; padding-right: 8px; padding-left:12px;color:red;background-color: rgb(32, 33, 36);

    }}`

let removeNavNumbs = document.createElement('style')
removeNavNumbs.innerText = `#botstuff [role="navigation"] {visibility: hidden; height: 0;}`
document.head.appendChild(removeNavNumbs)

if ( checkAllResultsPage ) {
    function createFavicons(target) {
for (let i = 0; i < target.querySelectorAll('cite').length; ++i) {

        };
    };

    if (!document.querySelector('a > h3 + div > span > div > img')) {
    }

    // carica le pagine quando è in fondo
    let pageNumber = 0
    let loadNewResults = _ => {
        let nextURL = new URL((document.querySelector('[role="navigation"]>[role="presentation"] a:first-child').href).replace(/(?<=start=)(.*?)(?=\&)/g,pageNumber * 10));
        fetch( nextURL.href )
            .then(response => response.text())
            .then(text => {
            let newDocument = (new DOMParser()).parseFromString( text, 'text/html')
            let newResults = newDocument.documentElement.querySelector('#center_col > [role="main"]')


            let checkMoreResults = newDocument.querySelector('#topstuff p > span > em') == null
            if ( checkMoreResults ) {
                document.createElement('div').appendChild(newResults)
                document.querySelector('#center_col > [role="main"]').parentElement.appendChild(newResults)
            };
        });

        if ( pageNumber = 1 ) {
            document.head.appendChild(pageCounter)
        };
    };

    document.addEventListener('scroll', _ => {
        if (window.innerHeight + window.pageYOffset >= document.body.offsetHeight) {
            pageNumber = pageNumber + 1
            loadNewResults();
        };
    });
};
//////////////////////30 risultati per pagina +apre risultati in new scheda
(function() {
  'use strict';
  if (GM_getValue('Amount of results to Show') === undefined) //Se la quantità di risultati da mostrare non è definita
  { //Avvia la condizione if
    GM_setValue('Amount of results to Show', 30); //Imposta la quantità predefinita di risultati da mostrare come 30/100
    GM_setValue('Open in new window?', 1); //Imposta lo script per aprire i siti Web in una nuova scheda 1apre 0 no
  } //Termina la condizione if

  if (location.pathname === '/search' && location.href.match('&num=' + GM_getValue('Amount of results to Show') + '&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 += '&num=' + GM_getValue('Amount of results to Show') + '&newwindow=' + GM_getValue('Open in new window?'); //Reindirizza per aggiungere le scelte dell'utente
  } //Termina la condizione if
})();

///////////////////////time///////////
var $g = jQuery.noConflict();
$g(document).ready(function() {
'use strict';
var $ = window.jQuery;
var jg = $.noConflict();
var body=document.body;
var style="position:fixed; top:-13px;margin-left:890px;z-index:99999;"
var box=document.createElement("div");

box.id="googleok";
box.style=style;
jg(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:340px;height:29px; margin-top:-12px;margin-left:-12px; margin-right:-20px;margin-bottom:0px;border-width:1px;}
  #dynamic_select{background:#3b3b3b;color:lime;border:1px solid yellow; border-radius:5px;cursor:pointer;}
  input[type="datetime-local"] {background:#3b3b3b;color:lime;border:1px solid yellow; border-radius:5px;margin:9px;margin-left:0px;text-align:center;cursor:pointer;}

            `);

setInterval(function(){
let today = new Date();
today.setMinutes(today.getMinutes() - today.getTimezoneOffset());
document.getElementById('datePickerx').value = today.toISOString().slice(0, -1);
}, 70);
    //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)
      });
});

 //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:310px;">
                   <legend>DATA-TIME</legend>
   <div id=setui>

    <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>

<input readonly id="datePickerx" type="datetime-local" title="Data-ora" />

                                                    </p>
                    </div>
                    </fieldset>
            `;

})();
////////////////////////////////