Improved safe search

09/11/2025, 09:34:21

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        Improved safe search
// @namespace   Violentmonkey Scripts
// @match       https://www.google.com/search*
// @grant       none
// @version     1.0
// @author      SHA
// @license     GNU GPLv3
// @description 09/11/2025, 09:34:21
// ==/UserScript==

window.addEventListener("load", async (event) => {
//  const wordList = ["ok1", "test2"];
//  const searchInput = await waitForElement('#APjFqb');
//  console.log(searchInput);
//  const didYouMean = await waitForElement('#oFNiHe a[href^="/search?"]');
//  console.log(didYouMean);

if (document.querySelector('[data-notice="SAFESEARCH_LOCKED"]')) {
  console.log('found')
  const searchInput = document.getElementById('APjFqb');
  history.replaceState(null, null, "q");
  document.querySelector("[jsname=pkjasb]").click();
  document.querySelector("title").innerHTML = "Quote";
  document.body.click();
  document.getElementById('main').innerHTML = `
   <iframe src="https://www.nodi.so/widgets/embed/public/quotes" style="margin: auto; display: block; width: 500px; height: 300px"></iframe>
  `;
}
});

function waitForElement(selector) {
    return new Promise(resolve => {
        if (document.querySelector(selector)) {
            return resolve(document.querySelector(selector));
        }
        const observer = new MutationObserver(mutations => {
            const element = document.querySelector(selector);
            console.log('performed querey selection');
            if (element) {
                observer.disconnect();
                resolve(element);
            }
        });
        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    });
}