[Florr.io] Map Script (TAB)

Press TAB to display a map for easier navigation.

  1. // ==UserScript==
  2. // @name [Florr.io] Map Script (TAB)
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.3
  5. // @description Press TAB to display a map for easier navigation.
  6. // @author Sn0w#0346
  7. // @match https://florr.io
  8. // @icon https://cdn.discordapp.com/attachments/668939882416308274/1081213961338372237/Map_17_-_Mar_3.png
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. const styleSheet = `
  14. #florrMap {
  15. display:none;
  16. position: absolute;
  17. top: 50%;
  18. left: 50%;
  19. max-width: 100vw;
  20. max-height: 100vh;
  21. transform: translate(-50%, -50%);
  22. opacity:1;
  23. pointer-events: none;
  24. }`
  25.  
  26. const img = document.createElement("img");
  27. img.src = "https://cdn.discordapp.com/attachments/668939882416308274/1081213961338372237/Map_17_-_Mar_3.png";
  28. img.id = "florrMap";
  29. document.body.appendChild(img);
  30. let s = document.createElement('style');
  31. s.type = "text/css";
  32. s.innerHTML = styleSheet;
  33. (document.head || document.documentElement).appendChild(s);
  34.  
  35. let mapOpen = false;
  36. let opacity = 1;
  37. window.addEventListener('load', function() {
  38. document.onkeydown = function(evt) {
  39. evt = evt || window.event;
  40. if (evt.keyCode == '9' && mapOpen === false) {
  41. mapOpen = true;
  42. document.getElementById("florrMap").style.display = "inline";
  43. } else if (evt.keyCode == '9' && mapOpen === true) {
  44. mapOpen = false;
  45. document.getElementById("florrMap").style.display = "none";
  46. }
  47.  
  48. if (evt.keyCode == 189 && opacity > 0.2) {
  49. opacity -= 0.1;
  50. document.getElementById("florrMap").style.opacity = `${opacity}`;
  51. }
  52. if (evt.keyCode == 187) {
  53. opacity += 0.1;
  54. document.getElementById("florrMap").style.opacity = `${opacity}`;
  55. }
  56. };
  57. });