您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Block google precise location question popup ("See results closer to you?") by automatically telling it no
// ==UserScript== // @name Deny google precise location question // @version 2024-03-08 // @description Block google precise location question popup ("See results closer to you?") by automatically telling it no // @match *://*.google.com/* // @license MIT // @namespace https://greasyfork.org/users/1272292 // ==/UserScript== var interval = 2; // ms, how often the loop should run var maxTime = 5000; // ms, max time to try to run the loop for var startTime = new Date().getTime(); var checkTimer = setInterval(TimeLoop, interval); checkTimer(); function TimeLoop() { const warning = document.getElementsByClassName("cMeQ8e b9SLDc"); //class of the popup if (warning[0] !== undefined){ //see if it exists yet if (warning[0].innerText == ("To get the closest results, let Google use your device's precise location.")) { document.querySelector('[jsaction="click:O6N1Pb"]').click(); //click the 'Not now' button clearInterval(checkTimer); //kill the timer once complete } } if (new Date().getTime() - startTime > maxTime) { clearInterval(checkTimer); //kill the timer if the popup hasnt shown after maxTime milliseconds } }