Geotastic Helper

Helps you in the game Geotastic

  1. // ==UserScript==
  2. // @name Geotastic Helper
  3. // @match *://*.geotastic.net/*
  4. // @grant none
  5. // @version 1.0
  6. // @license GPL-3
  7. // @author dharmik2319
  8. // @description Helps you in the game Geotastic
  9. // @run-at document-start
  10. // @namespace getreadytoslumbeeeeeeeeeerrrrrrrrrrrrrrrrrrrr
  11. // ==/UserScript==
  12.  
  13. window.myMap;
  14.  
  15. let map;
  16.  
  17. // Hijacking the `google` module so that we can access an initialized google.maps.Map instance
  18. var checkInterval = setInterval(function() {
  19. if (typeof google === 'object' && typeof google.maps === 'object' && typeof google.maps.Map === 'function') {
  20. var originalMap = google.maps.Map;
  21. google.maps.Map = function() {
  22. var instance = new originalMap(...arguments);
  23. window.myMap = instance
  24. return instance
  25. }
  26. clearInterval(checkInterval); // Stop checking once the module is loaded
  27. }
  28. }, 10); // Check every 10 ms
  29.  
  30.  
  31. let globalCoordinates = { // keep this stored globally, and we'll keep updating it for each API call.
  32. lat: 0,
  33. lng: 0
  34. }
  35.  
  36. var originalOpen = XMLHttpRequest.prototype.open;
  37. XMLHttpRequest.prototype.open = function(method, url) {
  38. if (url.startsWith('https://maps.googleapis.com/$rpc/google.internal.maps.mapsjs.v1.MapsJsInternalService/GetMetadata')) {
  39. this.addEventListener('load', function () {
  40. let interceptedResult = this.responseText
  41. let parsed = interceptedResult.replace("null","")
  42. const pattern = /-*\d+\.\d+,-*\d+\.\d+/g;
  43. let match = parsed.match(pattern)[0];
  44. let split = match.split(",")
  45.  
  46. let lat = Number.parseFloat(split[0])
  47. let lng = Number.parseFloat(split[1])
  48. globalCoordinates.lat = lat
  49. globalCoordinates.lng = lng
  50. markers();
  51. });
  52. }
  53. // Call the original open function
  54. return originalOpen.apply(this, arguments);
  55.  
  56. };
  57.  
  58. function mapsFromCoords() { // opens new Google Maps location using coords.
  59.  
  60. const {lat,lng} = globalCoordinates;
  61. window.open(`https://www.google.com/maps/place/${lat},${lng}`);
  62.  
  63. }
  64. let optsMarker;
  65. let marker;
  66. function markers() {
  67. if (typeof marker!="undefined") {
  68. marker.setMap(null)
  69. marker = null
  70. }
  71. map = window.myMap
  72. optsMarker = {type:"drop",position:new google.maps.LatLng(globalCoordinates.lat,globalCoordinates.lng),clickable:!1,map:map,id:"test"}
  73. marker = new google.maps.Marker(optsMarker)
  74.  
  75. }
  76.  
  77.  
  78.  
  79. let onKeyDown = (e) => {
  80. if (e.keyCode === 50) {
  81. mapsFromCoords();
  82. }
  83. if (e.keyCode === 49) {
  84. alert(`${globalCoordinates.lat}, ${globalCoordinates.lng}`);
  85. }
  86. }
  87. document.addEventListener("keydown", onKeyDown);
  88.  

QingJ © 2025

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