google location auto update

update google location automatically

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