User:Stumblean/common.js: Difference between revisions

Stumblean (talk | contribs)
No edit summary
Tags: Mobile edit Mobile web edit Advanced mobile edit
Stumblean (talk | contribs)
No edit summary
Tags: Mobile edit Mobile web edit Advanced mobile edit
Line 34: Line 34:
   });
   });


  // === DRAGGABLE LOGIC
   function makeDraggable(el) {
   function makeDraggable(el) {
     let offsetX = 0, offsetY = 0, isDragging = false;
     let offsetX = 0, offsetY = 0, isDragging = false;
Line 58: Line 57:
       el.style.left = evt.clientX - offsetX + "px";
       el.style.left = evt.clientX - offsetX + "px";
       el.style.top = evt.clientY - offsetY + "px";
       el.style.top = evt.clientY - offsetY + "px";
       el.style.right = "auto"; // prevent auto snapping
       el.style.right = "auto";
     }
     }


Line 141: Line 140:
   });
   });


   makeDraggable(minimizedIcon); // draggable icon too
   makeDraggable(minimizedIcon);


   function makeButton(text, action) {
   function makeButton(text, action) {
Line 236: Line 235:
   ytContainer.appendChild(ytIframe);
   ytContainer.appendChild(ytIframe);


   // === Add to page
   // Add buttons to menu
   menu.appendChild(header);
   menu.appendChild(header);
   menu.appendChild(btnUndo);
   menu.appendChild(btnUndo);
Line 244: Line 243:
   menu.appendChild(btnCustomize);
   menu.appendChild(btnCustomize);
   menu.appendChild(btnReset);
   menu.appendChild(btnReset);
  // Add everything to page
   document.body.appendChild(menu);
   document.body.appendChild(menu);
   document.body.appendChild(minimizedIcon);
   document.body.appendChild(minimizedIcon);
   document.body.appendChild(ytContainer);
   document.body.appendChild(ytContainer);
  // Transparent watermark footer
  const watermark = document.createElement("div");
  watermark.textContent = "Mahito Menu. Made by Radarhump/Washweans. Do not republish, do not reskin and republish.";
  Object.assign(watermark.style, {
    position: "fixed",
    bottom: "2px",
    left: "5px",
    fontSize: "10px",
    color: "#ffffff",
    opacity: "0.05",
    zIndex: "9999",
    pointerEvents: "none",
    fontFamily: "monospace"
  });
  document.body.appendChild(watermark);
})();
})();