Skip to content

Instantly share code, notes, and snippets.

@rztprog
Last active April 29, 2024 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rztprog/e3bc27006feee3fc71b1b44537a46aab to your computer and use it in GitHub Desktop.
Save rztprog/e3bc27006feee3fc71b1b44537a46aab to your computer and use it in GitHub Desktop.
Tampermonkey - Auto refuse google cookies consent
// ==UserScript==
// @name Google cookies cleaner
// @namespace http://github.com/rztprog
// @version 0.4
// @description Auto refuse cookies consent on Google
// @author Rztprog
// @match https://www.google.com
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.fr
// @grant none
// ==/UserScript==
(function() {
'use strict';
let timer = null;
let counter = 0;
const cleanCookies = () => {
++counter;
const element = document.getElementById("W0wltc");
if (element) {
const searchBar = document.getElementById("APjFqb");
element.click();
searchBar.focus();
clearInterval(timer);
}
if (counter > 50) {
timer = null;
counter = 0;
clearInterval(timer);
}
}
timer = setInterval(cleanCookies, 50);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment