Auto Click "Change to English" on Google

Automatically clicks the "Change to English" link when it appears on Google.

  1. // ==UserScript==
  2. // @name Auto Click "Change to English" on Google
  3. // @version 1.0
  4. // @description Automatically clicks the "Change to English" link when it appears on Google.
  5. // @match *://www.google.com/*
  6. // @grant none
  7. // @namespace https://greasyfork.org/users/1435046
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12.  
  13. function clickChangeToEnglish() {
  14. const link = document.querySelector('a[style*="display:inline-block"][href*="/setprefs"]');
  15. if (link) {
  16. link.click();
  17. }
  18. }
  19.  
  20. // Run once on page load
  21. clickChangeToEnglish();
  22.  
  23. // Observe changes in case the element appears later
  24. const observer = new MutationObserver(() => clickChangeToEnglish());
  25. observer.observe(document.body, { childList: true, subtree: true });
  26. })();