Greasy Fork 支持简体中文。

google location auto update

update google location automatically

  1. // ==UserScript==
  2. // @name google location auto update
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4.2
  5. // @description update google location automatically
  6. // @author Door Ma
  7. // @match https://www.google.com/search?q=*
  8. // @match https://bard.google.com/chat*
  9. // @match https://gemini.google.com/app*
  10. // @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. // 对于 search 的提交时间间隔
  18. setInterval(function() {
  19. if (window.location.href.includes('www.google.com/search?q=')) {
  20. let element_search = document.querySelector('update-location');
  21. if (element_search) {
  22. element_search.click();
  23. } else {
  24. console.log('未找到更新按钮');
  25. alert('未找到更新按钮');
  26. }
  27. }
  28. }, 600000); // 毫秒,执行一次位置提交
  29.  
  30. // 对于 gemini 的提交时间间隔
  31. setInterval(function() {
  32. if (window.location.href.includes('gemini.google.com/app')) {
  33. let element_gemini = document.querySelector('.update-location-text.location-clickable');
  34. if (element_gemini) {
  35. element_gemini.click();
  36. } else {
  37. console.log('未找到更新按钮');
  38. alert('未找到更新按钮');
  39. }
  40. }
  41. }, 3600000); // 毫秒,执行一次位置提交
  42.  
  43. })();