JagarZoom

Zoom for Jagar.io Ctrl – Zoom in, Alt – Zoom out DRIK ONTOP

  1. // ==UserScript==
  2. // @name JagarZoom
  3. // @namespace Violentmonkey Scripts
  4. // @version 1.0.2
  5. // @description Zoom for Jagar.io Ctrl – Zoom in, Alt – Zoom out DRIK ONTOP
  6. // @author Drik
  7. // @match https://jagar.io/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. let zoom = 1.0;
  15. const minZoom = 0.1;
  16. const maxZoom = 3.0;
  17.  
  18. function setZoom(level) {
  19. zoom = Math.max(minZoom, Math.min(maxZoom, level));
  20. if (window.jagarZoomTarget?.scale?.set) {
  21. window.jagarZoomTarget.scale.set(zoom, zoom);
  22. }
  23. const el = document.getElementById("zoomInfo");
  24. if (el) el.textContent = `Zoom: ${zoom.toFixed(1)}x`;
  25. }
  26.  
  27. function addUI() {
  28. const el = document.createElement("div");
  29. el.id = "zoomInfo";
  30. el.style.position = "absolute";
  31. el.style.bottom = "10px";
  32. el.style.right = "10px";
  33. el.style.background = "rgba(0,0,0,0.7)";
  34. el.style.color = "#fff";
  35. el.style.padding = "6px 10px";
  36. el.style.fontFamily = "monospace";
  37. el.style.fontSize = "14px";
  38. el.style.zIndex = "9999";
  39. el.style.borderRadius = "8px";
  40. el.textContent = "Zoom: 1.0x";
  41. document.body.appendChild(el);
  42. }
  43.  
  44. window.addEventListener("keydown", (e) => {
  45. if (!window.jagarZoomTarget) return;
  46.  
  47. if (e.ctrlKey) {
  48. setZoom(zoom + 0.1);
  49. } else if (e.altKey) {
  50. setZoom(zoom - 0.1);
  51. }
  52. });
  53.  
  54. const interval = setInterval(() => {
  55. if (window.mouseObject?.parent?.scale?.set) {
  56. window.jagarZoomTarget = mouseObject.parent;
  57. console.log("Zoom camera found:", jagarZoomTarget);
  58. addUI();
  59. clearInterval(interval);
  60. }
  61. }, 500);
  62. })();