Geogussr Resolver

A Geogussr location resolver.

当前为 2022-08-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Geogussr Resolver
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description A Geogussr location resolver.
  6. // @author 0X69ED75
  7. // @match https://www.geoguessr.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=geoguessr.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. let Grab = () => {
  13. let x = document.getElementsByClassName("game-layout__panorama")[0]
  14. let y = document.getElementsByClassName("game-layout__panorama-canvas")[0].textContent.trim();
  15. let z = Object.keys(x)
  16. let a = z.find(g => g.startsWith("__reactFiber$"))
  17. let b = document.getElementsByClassName("game-layout__panorama")[0][a].child.memoizedProps.children.props
  18. let c = b.lat
  19. let d = b.lng
  20.  
  21. getAddress(c,d).then(f => {
  22. alert(`
  23. Country: ${f.address.country}
  24. County: ${f.address.county}
  25. Road: ${f.address.road}
  26. State: ${f.address.state}
  27. Latitude: ${c}
  28. Longitude: ${d}
  29. `) } );
  30.  
  31. }
  32.  
  33. let getAddress = async(e,w) => {
  34. let response = await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${e}&lon=${w}&format=json`)
  35. let data = await response.json()
  36. return data;
  37. }
  38.  
  39.  
  40.  
  41. let onKeyDown = (e) => {
  42. if(e.keyCode === 86){Grab()}
  43. }
  44.  
  45.  
  46. document.addEventListener("keydown", onKeyDown);