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 1: Line 1:
(function () {
(function () {
   const iconURL = "https://files.catbox.moe/wk78nl.jpg";
   const iconURL = "https://files.catbox.moe/wk78nl.jpg";
  const killScript = "mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Alexis_Jazz/Kill-It-With-Fire.js&action=raw&ctype=text/javascript');";


   const menu = document.createElement("div");
   const menu = document.createElement("div");
Line 55: Line 56:
   const content = document.createElement("div");
   const content = document.createElement("div");


   const massEditBtn = document.createElement("button");
  // Mass Undo button
   massEditBtn.textContent = "Mass edit";
   const undoBtn = document.createElement("button");
   massEditBtn.title = "It allows you to edit any line on any page(s)";
   undoBtn.textContent = "Mass undo";
   Object.assign(massEditBtn.style, {
   undoBtn.title = "Copy mass undo script to clipboard";
   Object.assign(undoBtn.style, {
     background: "#555",
     background: "#555",
     color: "#fff",
     color: "#fff",
Line 68: Line 70:
     textAlign: "left",
     textAlign: "left",
   });
   });
   massEditBtn.onclick = () => {
   undoBtn.onclick = async () => {
     alert("Mass edit clicked (not implemented)");
     try {
      await navigator.clipboard.writeText(killScript);
      alert(
        "Go to your common.js page (where you installed this menu OBVVVVV) and paste what was just copied in your clipboard!"
      );
    } catch (err) {
      alert("Failed to copy to clipboard: " + err.message);
    }
   };
   };


  // Open Explanation button
   const openBtn = document.createElement("button");
   const openBtn = document.createElement("button");
   openBtn.textContent = "Open Explanation";
   openBtn.textContent = "Open Explanation";
Line 87: Line 97:
   };
   };


   content.appendChild(massEditBtn);
   content.appendChild(undoBtn);
   content.appendChild(openBtn);
   content.appendChild(openBtn);
   menu.appendChild(content);
   menu.appendChild(content);
   document.body.appendChild(menu);
   document.body.appendChild(menu);


   // Drag logic
   // Dragging
   let isDragging = false,
   let isDragging = false,
     offsetX = 0,
     offsetX = 0,