Auto-Espande Google Search Tools

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

目前为 2021-08-03 提交的版本。查看 最新版本

// ==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
// @include      https://www.google.tld/*
// @version     14.3
// @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
// @noframes
// ==/UserScript==
// Show the Search Tools menu.
waitForKeyElements ("#hdtb-tls", clickNodeUntilItSticks);

function clickNodeUntilItSticks (jNode) {
    var searchToolbar = $("#hdtbMenus")[0];
    var sanityCount = 1;
    var menusVisiblePoller = setInterval ( function () {
            if (sanityCount < 20 && searchToolbar.offsetWidth === 0 && searchToolbar.offsetHeight === 0) {
                jNode[0].click()
            } else {
                clearInterval (menusVisiblePoller);
            }
        },
        1000
    );
}
//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}");

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

//link espansione strumenti colore verde
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 verde
GM_addStyle('.WE0UJf {background:green!important;width:700px;border-radius:12px;border:2px dotted 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;}');

//funzione endless google
$(window).scroll(function() {
   if($(window).scrollTop() + $(window).height() == $(document).height()) {
       document.getElementById('pnnext').click();
   }
});

   //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 = link.textContent.replace(/\S+/, 'YouTube');;
    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//////////////
(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');
  e && e.click();
  }

})();

/////////menu che compare quando clicco tipo su qualsiasi data ecc
GM_addStyle('.gLSAk {background-color:brown!important;color:blue!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;}');

//scrollbar nera
(function() {var css = "";
	css += [
		"/*####----BROWSER SCROLL BAR----####*/",
		"::-webkit-scrollbar {",
		"background: -webkit-linear-gradient(40deg , #040404 , #0C0C0C , #040404 100%)!important;",
		"border-left: 1px solid #1A1A1A !important; width:19px!important;",
		"}",
		"::-webkit-scrollbar-thumb {background-color: #272727!important;border-radius: 16px!important;box-shadow: inset 0 0 0 2px green!important;}",
        ///////////////////pulsanti sotto freccine su e giu
       "::-webkit-scrollbar-button {  background-color: red; }",
         ///////////////////////freccia nera sopra
        "::-webkit-scrollbar-button:vertical:decrement {",
       "background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QgFDgo6IB/FRgAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAc0lEQVQoz+XRoQ2DYBiE4YfUkEDqEfW1TNA5EFUdAM0aTNEpSKqwKAZogkJgmpDUgPkFqFa3py757r1PHP+jEgPqb4ELGizocf0EnHDHO0ALHjhvQ4eNT3BDgSPmcE8RoQ1lOyhHhRgjXpjCtwwdnr864go2lhOp4XYeZgAAAABJRU5ErkJggg==)!important;",
		"background-size: cover!important;",
		"background-repeat: no-repeat!important;",
		"}",
        ////////////////////freccia nera sotto
        "::-webkit-scrollbar-button:vertical:increment {",
        "background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QgFDgUlKo/UfAAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAaUlEQVQoz+XPsQmDUAAE0NfHFdI7gZ1kEmdI6Q6WTuEUQiZIl8o0CYGAvYUg3+aXitZ6zcFxx91xbOR44oMO78jfqGdLoQQVekwYEPBHictaW4pHNAeMaHDdmlngFUMtbnv/1fjh7iSYAfRHFgTlUa3mAAAAAElFTkSuQmCC)!important;",
		"background-size: cover!important;",
		"background-repeat: no-repeat!important;",
		"}",
	].join("\n");

if (typeof GM_addStyle != "undefined") {
	GM_addStyle(css);
} else if (typeof PRO_addStyle != "undefined") {
	PRO_addStyle(css);
} else if (typeof addStyle != "undefined") {
	addStyle(css);
} else {
	var node = document.createElement("style");
	node.type = "text/css";
	node.appendChild(document.createTextNode(css));
	var heads = document.getElementsByTagName("head");
	if (heads.length > 0) {
		heads[0].appendChild(node);
	} else {
		// no head yet, stick it whereever
		document.documentElement.appendChild(node);
	}
}
})();
//////////////////////test 30risultati per pagina
(function() {
  'use strict';
  if (GM_getValue('Amount of results to Show') === undefined) //Se la quantità di risultati da mostrare non è definita
  {GM_setValue('Amount of results to Show', 30);} //Imposta la quantità predefinita di risultati da mostrare come 30/100

  if (location.pathname === '/search' && location.href.match('&num=' + GM_getValue('Amount of results to Show') + '&newwindow=') === null)
  {location.href = location.href += '&num=' + GM_getValue('Amount of results to Show') + '&newwindow=';} //Reindirizza per aggiungere le scelte dell'utente
})();