Google Maps Satellite View Auto-Toggle

Automatically toggle to satellite view in Google Maps

  1. // ==UserScript==
  2. // @name Google Maps Satellite View Auto-Toggle
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.6
  5. // @description Automatically toggle to satellite view in Google Maps
  6. // @author You
  7. // @match *://www.google.com/maps*
  8. // @grant none
  9. // @run-at document-idle
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function simulateClick(element) {
  17. const evt = new MouseEvent("click", {
  18. bubbles: true,
  19. cancelable: true,
  20. view: window
  21. });
  22. element.dispatchEvent(evt);
  23. }
  24.  
  25. function activateSatelliteView() {
  26. // Locate the button by its 'aria-labelledby' attribute pointing to 'widget-minimap-icon-overlay'
  27. const layerButton = document.querySelector('button[aria-labelledby="widget-minimap-icon-overlay"]');
  28. if (layerButton) {
  29. simulateClick(layerButton); // This should toggle the satellite view directly
  30. }
  31. }
  32.  
  33. setTimeout(activateSatelliteView, 3000); // Delay initial run to ensure elements are loaded
  34. })();

QingJ © 2025

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