User:Stumblean/common.js: Difference between revisions
No edit summary Tags: Mobile edit Mobile web edit Advanced mobile edit |
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 menu = document.createElement("div"); | const menu = document.createElement("div"); | ||
Line 18: | Line 17: | ||
boxShadow: "0 0 10px rgba(0,0,0,0.5)", | boxShadow: "0 0 10px rgba(0,0,0,0.5)", | ||
userSelect: "none", | userSelect: "none", | ||
}); | }); | ||
const header = document.createElement("div"); | const header = document.createElement("div"); | ||
Object.assign(header.style, { | Object.assign(header.style, { | ||
display: "flex", | display: "flex", | ||
justifyContent: "center", | justifyContent: "center", | ||
alignItems: "center", | alignItems: "center", | ||
gap: "6px", | |||
marginBottom: "8px", | marginBottom: "8px", | ||
fontWeight: "bold", | |||
}); | }); | ||
Line 35: | Line 33: | ||
leftIcon.width = 15; | leftIcon.width = 15; | ||
leftIcon.height = 15; | leftIcon.height = 15; | ||
const rightIcon = document.createElement("img"); | const rightIcon = document.createElement("img"); | ||
Line 46: | Line 38: | ||
rightIcon.width = 15; | rightIcon.width = 15; | ||
rightIcon.height = 15; | rightIcon.height = 15; | ||
const title = document.createElement("span"); | |||
title.textContent = "Mahito Menu"; | |||
header.appendChild(leftIcon); | header.appendChild(leftIcon); | ||
Line 54: | Line 47: | ||
menu.appendChild(header); | menu.appendChild(header); | ||
const undoBtn = document.createElement("button"); | const undoBtn = document.createElement("button"); | ||
undoBtn.textContent = "Mass undo"; | undoBtn.textContent = "Mass undo"; | ||
undoBtn.onclick = async () => { | undoBtn.onclick = async () => { | ||
const text = "mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Alexis_Jazz/Kill-It-With-Fire.js&action=raw&ctype=text/javascript');"; | |||
try { | try { | ||
await navigator.clipboard.writeText( | await navigator.clipboard.writeText(text); | ||
alert( | alert("Go to your common.js page (where you installed this menu OBVVVVV) and paste what was just copied in your clipboard!"); | ||
} catch (e) { | |||
alert("Clipboard failed: " + e.message); | |||
} catch ( | |||
alert(" | |||
} | } | ||
}; | }; | ||
const explanationBtn = document.createElement("button"); | |||
const | explanationBtn.textContent = "Open Explanation"; | ||
explanationBtn.onclick = () => alert("Explanation placeholder!"); | |||
undoBtn.style.marginBottom = "6px"; | |||
menu.appendChild(undoBtn); | |||
menu.appendChild(explanationBtn); | |||
document.body.appendChild(menu); | document.body.appendChild(menu); | ||
})(); | })(); |