- // ==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 26.2
- // @match https://*.google.com/*
- // @match https://*.google.it/*
- // @match https://*.google.fr/*
- // @match https://*.google.es/*
- // @match https://*.google.de/*
- // @exclude https://drive.google.com/*
- // @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
- // @require http://code.jquery.com/jquery-latest.js
- // @require https://code.jquery.com/ui/1.13.2/jquery-ui.js
- // @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
- // ==/UserScript==
- (function() {
- 'use strict';
- //scorrimento continuo pagine
- console.log('goo goo');
- window.onscroll = function() {
- var doc = document.documentElement;
- var current = doc.scrollTop + window.innerHeight;
- var height = doc.offsetHeight;
-
- if (current === height) {
- console.log('In fondo alla pagina');
- var nextButton = document.getElementById('pnnext');
- if (nextButton) {
- nextButton.click();
- } else {
- console.log('Nessun pulsante per la pagina successiva trovato.');
- }
- }
- };
- ////////////////////
- miglioralo();
- function miglioralo() {
- if (document.readyState !== 'loading') {
- consent();
- } else {
- document.addEventListener('DOMContentLoaded', consent);
- }
- }
-
- function consent() {
- var consentButton = document.querySelector('#introAgreeButton');
-
- if (!consentButton) {
- consentButton = 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 (!consentButton) {
- let otherButtons = document.querySelectorAll('div.lssxud button.nCP5yc:not(:disabled)');
- if (otherButtons.length > 1) {
- consentButton = otherButtons[1];
- }
- }
-
- if (consentButton) {
- consentButton.click();
- }
- }
- //////////////////////////////////////////////////////////////////////
- // Funzione per cercare e cliccare sull'elemento tema scuro on
- function clickOnDarkTheme() {
- const elements = document.querySelectorAll('*');
- elements.forEach(element => {
- if (element.textContent.includes('Tema scuro: disattivato')) {
- element.click();
- }
- });
- }
-
- // Esegui la funzione al caricamento della pagina
- window.addEventListener('load', clickOnDarkTheme);
- //////////////////////////////////////////////////////////////////////
- /////////////////////disattiva SafeSearch giugno 2024
- (function() {
- var url = new URL(window.location.href);
- var params = url.searchParams;
-
- // Controlla se il parametro 'safe' è già impostato su 'off'
- if (params.get('safe') !== 'off') {
- params.set('safe', 'off');
- window.location.replace(url.toString());
- }
- /////////////////////////////////////////
- // Controlla se il parametro 'newwindows' è già impostato su '1'
- if (params.get('newwindow') !== '1') {
- params.set('newwindow', '1');
- window.location.replace(url.toString());
- }
- //30 risultati per pagina
- if (params.get('num') !== '30') {
- params.set('num', '30');
- window.location.replace(url.toString());
- }
- })();
- //////////////////////////
- //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
-
- 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;}");
- //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
- //colore link immag notiz libri mappe
- GM_addStyle('.YmvwI{color:red!important; background:yellow!important;border-radius:8px;border:2px solid blue!important;}');
- GM_addStyle('.YmvwI:hover{color:green!important;}');
- GM_addStyle('.Lu57id{color:red!important; background:yellow!important;border-radius:8px;border:2px solid blue!important;}');//altro
- GM_addStyle('.Lu57id:hover{color:green!important;}');//altro al passaggio mouse
-
- //////////////////////////////////////////////////////////
- GM_addStyle('.KTBKoe{color:red!important; background:yellow!important;border-radius:8px;border:px solid !important;}');//colori qualsiasi paese lingua data ecc
- GM_addStyle('.KTBKoe:hover{color:green!important;}');//al passaggio mouse
- GM_addStyle('.AozSsc{color:red!important; background:yellow!important;border-radius:8px;border:px solid !important;}');//cancella
- GM_addStyle('.AozSsc:hover{color:green!important;}');//cancella al pass mouse
-
- //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;}');
- //Promemoria sulla privacy di Google
- GM_addStyle('#cnsh,#cnso,#cnsi{display:none!important}');
- //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;}');
-
- //////////////////////////////////////////////////aggiunto youtube
- // Trova gli elementi div e textarea di destinazione
- const targetDiv = document.querySelector('#hdtb-sc > div > div > div.crJ18e > div');
- const searchInput = document.querySelector('textarea.gLFyf');
-
- // Create a button element
- const youtube = document.createElement('button');
- youtube.innerText = 'Youtube';
-
- // Apply CSS styling to the button
- youtube.style.color = 'red';
- youtube.style.padding = '10px';
- youtube.style.background = 'yellow';
- youtube.style.border = '2px solid blue';
- youtube.style.borderRadius = '8px';
- youtube.style.cursor = 'pointer';
- youtube.style.padding = '5px';
- youtube.style.marginTop ='9px';
- youtube.href = 'https://www.youtube.com/results?search_query';
- // Aggiungi event listener per l'effetto al passaggio del mouse
- youtube.addEventListener('mouseover', function () {
- this.style.color = 'green';
- });
-
- // Reimposta il colore quando il mouse se ne va
- youtube.addEventListener('mouseout', function () {
- this.style.color = 'red';
- });
- //Gestisci l'evento clic sul pulsante
- youtube.addEventListener('click', function() {
- // Ottieni la query di ricerca corrente dall'area di testo
- const searchQuery = searchInput.value.trim();
-
- // Sostituisci gli spazi con '+'
- const modifiedQuery = searchQuery.replace(/ /g, '+');
-
- // Create the YouTube search URL
- const youtubeURL = `https://www.youtube.com/results?search_query=${modifiedQuery}`;
-
- // Open the YouTube URL in a new tab
- window.open(youtubeURL);
- });
-
- // Append the button to the target div
- targetDiv.appendChild(youtube);
-
- // Aggiungere un listener di eventi di scorrimento
- window.addEventListener('scroll', function() {
- // Controlla se l'utente si trova in cima alla pagina
- const isAtTop = window.pageYOffset === 0;
-
- // Aggiorna il raggio del bordo del pulsante in base alla posizione di scorrimento
- youtube.style.borderRadius = isAtTop ? '24px' : '16px';
- });
-
- // Set the URL as the tooltip when hovering over the button
- youtube.addEventListener('mouseenter', function() {
- const searchQuery = searchInput.value.trim();
- const modifiedQuery = searchQuery.replace(/ /g, '+');
- const youtubeURL = `https://www.youtube.com/results?search_query=${modifiedQuery}`;
- });
-
- //Rimuovi il suggerimento quando non passi il mouse sopra il pulsante
- youtube.addEventListener('mouseleave', function() {
- youtube.removeAttribute('title');
- });
- ///////////////////////////////////
- (function() {
- 'use strict';
- ///////////////////// Mostra il menu Strumenti di ricerca
- const interval = setInterval(() =>
- {var toolsButton = document.getElementById('hdtb-tls');
- if (toolsButton.getAttribute("aria-expanded") === "true") {
-
- clearInterval(interval);
- }
- else{toolsButton.click();
- }
- }, 250);
- ///////////////////////////////////////////
- // Funzione per inizializzare la finestra
- function initializeWindow() {
- // Crea la finestra e aggiunge il contenuto
- var $ = window.jQuery;
- $('body').append(`
- <div id="googleok" style="position:fixed;top:5px;left:850px;width:430px;height:auto;z-index:9999;color:lime;">
- <fieldset style="background-color:#3b3b3b;border:2px solid red;border-radius:5px;">
- <legend style="text-align:center;color:lime;">Clock</legend>
- <div style="display: flex; align-items: center;">
- <div id="datePickerx" title="Data-ora" style="border:1px solid yellow;border-radius:5px;cursor:pointer;">
- </div>
- <div>
- <label title="Cambia lingua data" style="color:lime;display:inline-flex;cursor:pointer">
- <input type="radio" name="options" title="Cambia lingua data" value="changeLanguage" style="cursor:pointer;">Lingua
- </label>
- <label title="Cambia 12/24h" style="color:lime;display:inline-flex;cursor:pointer">
- <input type="radio" name="options" title="Cambia 12/24h" value="toggleFormat" style="cursor:pointer;">12/24h
- </label>
- <span class="chiudi" title="Chiudi" id="close" style="background-color:red;color:lime;border:1px solid yellow;border-radius:50%;cursor:pointer;font-size:14px;padding:3px 6px;margin-left:4px;">X</span>
-
- </div>
- </div>
- </fieldset>
- </div>
- `);
-
- // Event listener for radio button selection
- $('input[name="options"]').on('change', function() {
- const selectedValue = $(this).val();
- if (selectedValue === 'changeLanguage') {
- changeLanguage();
- } else if (selectedValue === 'toggleFormat') {
- toggleFormat();
- }
-
- // Disable the radio buttons temporarily
- $('input[name="options"]').prop('disabled', true);
-
- // Re-enable the radio buttons after a short delay
- setTimeout(() => {
- $('input[name="options"]').prop('disabled', false).prop('checked', false);
- }, 300); // Milliseconds
- });
-
- // Imposta la posizione iniziale della finestra
- let windowPosition = {
- x: 50,
- y: 50
- };
-
- // Carica la posizione salvata precedentemente, se disponibile
- if (GM_getValue('userscript_window_position')) {
- windowPosition = JSON.parse(GM_getValue('userscript_window_position'));
- $('#googleok').css({top: windowPosition.y, left: windowPosition.x});
- }
-
- // Funzione per salvare la posizione della finestra
- function saveWindowPosition() {
- const position = $('#googleok').position();
- GM_setValue('userscript_window_position', JSON.stringify({x: position.left, y: position.top}));
- }
-
- let use12HourFormat = GM_getValue('use12HourFormat', true); // Default è il formato 24 ore true
- let language = GM_getValue('language') || 'it'; // Recupera la lingua dal localStorage o usa 'it' come predefinita
-
- const languages = {
- en: { weekday: 'short', month: 'short', day: '2-digit', year: 'numeric' },
- it: { weekday: 'short', month: '2-digit', day: '2-digit', year: 'numeric' }
- };
-
- // Funzione per aggiornare l'ora
- function updateClock() {
- const now = new Date();
- let hours = now.getHours();
- const minutes = String(now.getMinutes()).padStart(2, "0");
- const seconds = String(now.getSeconds()).padStart(2, "0");
- const milliseconds = String(now.getMilliseconds()).padStart(3, "0");
- const date = now.toLocaleString(language, languages[language]); // Usa la lingua selezionata per la data
- let period = "";
-
- if (use12HourFormat) { // Condizione corretta per il formato 12 ore
- period = hours >= 12 ? " PM" : " AM";
- hours = hours % 12 || 12; // Converte in formato 12 ore
- }
-
- hours = String(hours).padStart(2, "0"); // Aggiunge lo zero iniziale per ore
- document.querySelector('#datePickerx').textContent = `${date} ${hours}:${minutes}:${seconds}:${milliseconds}${period}`;
- }
-
- function changeLanguage() {
- language = (language === 'it') ? 'en' : 'it'; // Alterna tra 'it' e 'en'
- GM_setValue('language', language); // Salva la lingua scelta
- }
-
- function toggleFormat() {
- use12HourFormat = !use12HourFormat; // Alterna il formato orario
- GM_setValue('use12HourFormat', use12HourFormat); // Salva lo stato del formato
- }
- // Chiama la funzione di inizializzazione e avvia il timer
- const intervalTime = 90; // Imposta l'intervallo di tempo
- setInterval(updateClock, intervalTime);
- // Chiudi la finestra quando il pulsante di chiusura viene cliccato
- var Close=document.querySelector('#close');
- Close.addEventListener('click',provag,false);
- // Nascondi o mostra la finestra dal menu
- function provag() {
- var box = document.getElementById('googleok');
- box.style.display = ((box.style.display!='none') ? 'none' : 'block');
- }
- GM_registerMenuCommand("nascondi/mostra time",provag);
-
- // Rendi la finestra trascinabile
- $('#googleok').draggable({
- containment: 'window',
- stop: saveWindowPosition
- });
- }
- // Chiama la funzione di inizializzazione della finestra
- initializeWindow();
- })();
- })();