Google US Region Setter and License Acceptor with Persistent US Setting

Keep Google region set to US and language to English persistently

  1. // ==UserScript==
  2. // @name Google US Region Setter and License Acceptor with Persistent US Setting
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.9
  5. // @description Keep Google region set to US and language to English persistently
  6. // @author Shadow_Kurgansk
  7. // @match https://www.google.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Function to persistently set Google region to US and language to English
  16. function setGoogleRegionToUS() {
  17. const url = new URL(window.location.href);
  18. const params = url.searchParams;
  19.  
  20. // Check if the language is already set to English and the region to US
  21. if (params.get('hl') !== 'en' || params.get('gl') !== 'us') {
  22. params.set('hl', 'en'); // Set language to English
  23. params.set('gl', 'us'); // Set region to US
  24. // If the URL has changed, reload the page with the new parameters
  25. if (window.location.href !== url.href) {
  26. window.location.href = url.href;
  27. }
  28. }
  29. }
  30.  
  31. // Function to accept the license agreement with a delay
  32. function acceptLicenseAgreement() {
  33. // Wait for 200 milliseconds (0.2 seconds) before trying to click the button
  34. setTimeout(function() {
  35. const acceptButton = document.querySelector('#L2AGLb.tHlp8d');
  36. if (acceptButton) {
  37. acceptButton.click();
  38. }
  39. }, 200); // Adjust the time as needed
  40. }
  41.  
  42. // Execute the acceptLicenseAgreement function when the page includes 'google.com'
  43. if (window.location.href.includes('google.com')) {
  44. acceptLicenseAgreement();
  45. }
  46.  
  47. // Set an interval to check the region and language every 3 seconds
  48. setInterval(setGoogleRegionToUS, 500);
  49. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址