Tags: Mobile edit Mobile web edit Advanced mobile edit |
Tags: Mobile edit Mobile web edit Advanced mobile edit |
Line 1: |
Line 1: |
| (function () { | | (function () { |
| const defaultSettings = { | | // Create toggle button |
| menuTitle: "Mahito Menu",
| | const toggle = document.createElement("button"); |
| iconURL: "https://files.catbox.moe/wk78nl.jpg",
| | toggle.id = "delta-toggle"; |
| backgroundColor: "#7889B2",
| | toggle.textContent = "Δ"; |
| buttonColor: "#45A8C5",
| | Object.assign(toggle.style, { |
| textColor: "#ffffff",
| |
| borderColor: "#ffffff",
| |
| iconSize: 15,
| |
| minimizedSize: 30
| |
| };
| |
| | |
| const defaultPrefs = {
| |
| showMassUndo: true,
| |
| showExplanation: true,
| |
| showEncouragement: true,
| |
| showYujify: true,
| |
| showCustomize: true,
| |
| showUndoChanges: true,
| |
| showPreferences: true // always true so button never hides
| |
| // watermark removed from prefs so cannot be toggled off
| |
| };
| |
| | |
| const settings = JSON.parse(localStorage.getItem("mahitoMenuSettings")) || defaultSettings; | |
| const prefs = JSON.parse(localStorage.getItem("mahitoMenuPrefs")) || defaultPrefs; | |
| | |
| function saveSettings() {
| |
| localStorage.setItem("mahitoMenuSettings", JSON.stringify(settings));
| |
| }
| |
| function savePrefs() {
| |
| localStorage.setItem("mahitoMenuPrefs", JSON.stringify(prefs));
| |
| }
| |
| | |
| const menu = document.createElement("div");
| |
| menu.id = "mahitoMenu"; | |
| Object.assign(menu.style, { | |
| position: "fixed", | | position: "fixed", |
| top: "20px", | | bottom: "20px", |
| right: "20px", | | right: "20px", |
| background: settings.backgroundColor,
| |
| color: settings.textColor,
| |
| border: `2px solid ${settings.borderColor}`,
| |
| borderRadius: "10px",
| |
| padding: "10px", | | padding: "10px", |
| fontFamily: "monospace", | | background: "#1e1e1e", |
| zIndex: "99999", | | color: "#fff", |
| boxShadow: "0 0 10px black",
| |
| width: "200px",
| |
| userSelect: "none"
| |
| });
| |
| | |
| function makeDraggable(el) {
| |
| let offsetX = 0, offsetY = 0, isDragging = false;
| |
| | |
| el.addEventListener("mousedown", startDrag);
| |
| el.addEventListener("touchstart", startDrag);
| |
| | |
| function startDrag(e) {
| |
| isDragging = true;
| |
| const evt = e.type.startsWith("touch") ? e.touches[0] : e;
| |
| offsetX = evt.clientX - el.offsetLeft;
| |
| offsetY = evt.clientY - el.offsetTop;
| |
| | |
| document.addEventListener("mousemove", onDrag);
| |
| document.addEventListener("mouseup", stopDrag);
| |
| document.addEventListener("touchmove", onDrag);
| |
| document.addEventListener("touchend", stopDrag);
| |
| }
| |
| | |
| function onDrag(e) {
| |
| if (!isDragging) return;
| |
| const evt = e.type.startsWith("touch") ? e.touches[0] : e;
| |
| el.style.left = evt.clientX - offsetX + "px";
| |
| el.style.top = evt.clientY - offsetY + "px";
| |
| el.style.right = "auto";
| |
| }
| |
| | |
| function stopDrag() {
| |
| isDragging = false;
| |
| document.removeEventListener("mousemove", onDrag);
| |
| document.removeEventListener("mouseup", stopDrag);
| |
| document.removeEventListener("touchmove", onDrag);
| |
| document.removeEventListener("touchend", stopDrag);
| |
| }
| |
| }
| |
| | |
| makeDraggable(menu);
| |
| | |
| const header = document.createElement("div");
| |
| header.style.display = "flex";
| |
| header.style.justifyContent = "space-between";
| |
| header.style.alignItems = "center";
| |
| header.style.marginBottom = "8px";
| |
| | |
| const titleWrap = document.createElement("div");
| |
| titleWrap.style.display = "flex";
| |
| titleWrap.style.alignItems = "center";
| |
| titleWrap.style.gap = "6px";
| |
| | |
| const leftIcon = document.createElement("img");
| |
| leftIcon.src = settings.iconURL;
| |
| leftIcon.width = settings.iconSize;
| |
| leftIcon.height = settings.iconSize;
| |
| | |
| const title = document.createElement("div");
| |
| title.textContent = settings.menuTitle;
| |
| title.style.fontWeight = "bold";
| |
| title.style.color = settings.textColor;
| |
| | |
| const rightIcon = document.createElement("img");
| |
| rightIcon.src = settings.iconURL;
| |
| rightIcon.width = settings.iconSize;
| |
| rightIcon.height = settings.iconSize;
| |
| | |
| titleWrap.appendChild(leftIcon);
| |
| titleWrap.appendChild(title);
| |
| titleWrap.appendChild(rightIcon);
| |
| | |
| const minimizeBtn = document.createElement("button");
| |
| minimizeBtn.textContent = "–";
| |
| Object.assign(minimizeBtn.style, {
| |
| background: settings.buttonColor,
| |
| border: "none", | | border: "none", |
| color: settings.textColor, | | borderRadius: "8px", |
| | zIndex: 9998, |
| cursor: "pointer", | | cursor: "pointer", |
| borderRadius: "5px", | | fontSize: "16px" |
| width: "25px",
| |
| height: "25px"
| |
| }); | | }); |
|
| |
|
| header.appendChild(titleWrap); | | // Create menu |
| header.appendChild(minimizeBtn);
| | const menu = document.createElement("div"); |
| | | menu.id = "delta-menu"; |
| const minimizedIcon = document.createElement("img"); | | Object.assign(menu.style, { |
| minimizedIcon.src = settings.iconURL; | | display: "none", |
| Object.assign(minimizedIcon.style, { | |
| position: "fixed", | | position: "fixed", |
| top: "20px", | | bottom: "70px", |
| right: "20px", | | right: "20px", |
| zIndex: "99999", | | width: "300px", |
| display: "none", | | background: "#2b2b2b", |
| cursor: "pointer", | | color: "#fff", |
| borderRadius: "8px", // rounded square | | borderRadius: "10px", |
| width: settings.minimizedSize + "px", | | padding: "15px", |
| height: settings.minimizedSize + "px" | | boxShadow: "0 0 10px rgba(0,0,0,0.5)", |
| | zIndex: 9999, |
| | fontFamily: "monospace" |
| }); | | }); |
|
| |
|
| minimizedIcon.addEventListener("click", () => { | | const title = document.createElement("div"); |
| minimizedIcon.style.display = "none";
| | title.textContent = "Delta Online"; |
| menu.style.display = "block";
| | title.style.textAlign = "center"; |
| }); | | title.style.fontSize = "18px"; |
| | title.style.marginBottom = "10px"; |
|
| |
|
| minimizeBtn.addEventListener("click", () => { | | const textarea = document.createElement("textarea"); |
| menu.style.display = "none"; | | textarea.placeholder = "Enter JavaScript..."; |
| minimizedIcon.style.display = "block"; | | Object.assign(textarea.style, { |
| | width: "100%", |
| | height: "120px", |
| | background: "#1e1e1e", |
| | color: "#fff", |
| | border: "none", |
| | borderRadius: "6px", |
| | padding: "10px", |
| | resize: "none", |
| | boxSizing: "border-box" |
| }); | | }); |
|
| |
|
| makeDraggable(minimizedIcon); | | const runBtn = document.createElement("button"); |
| | | runBtn.textContent = "Run Code"; |
| function makeButton(text, action) {
| | Object.assign(runBtn.style, { |
| const btn = document.createElement("button");
| | marginTop: "10px", |
| btn.textContent = text;
| | width: "100%", |
| btn.onclick = action;
| | padding: "10px", |
| Object.assign(btn.style, {
| | background: "#4caf50", |
| marginBottom: "6px",
| | color: "#fff", |
| width: "100%",
| | border: "none", |
| cursor: "pointer",
| |
| background: settings.buttonColor,
| |
| color: settings.textColor,
| |
| border: "none",
| |
| padding: "5px 10px",
| |
| borderRadius: "5px"
| |
| }); | |
| return btn;
| |
| }
| |
| | |
| const btnMassUndo = makeButton("Mass undo", () => {
| |
| navigator.clipboard.writeText(
| |
| "mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Alexis_Jazz/Kill-It-With-Fire.js&action=raw&ctype=text/javascript');"
| |
| );
| |
| alert("Go to your common.js and paste what was just copied!");
| |
| });
| |
| | |
| const btnExplain = makeButton("Open Explanation", () => {
| |
| window.open("https://hpd0v2.mimo.run/index.html", "_blank");
| |
| });
| |
| | |
| const btnEncouragement = makeButton("Encouragement", () => {
| |
| ytContainer.style.display = ytContainer.style.display === "none" ? "block" : "none";
| |
| });
| |
| | |
| const btnYujify = makeButton("YUJIFY", () => {
| |
| const confirmKill = confirm("Are you sure you want to YUJIFY this menu? This will kill the script.");
| |
| if (!confirmKill) return;
| |
| | |
| console.log("I'll admit it, mahito, I am you. (script killed)");
| |
| menu.remove();
| |
| minimizedIcon.remove();
| |
| ytContainer.remove();
| |
| prefsPanel.remove();
| |
| watermark.remove();
| |
| });
| |
| | |
| const btnCustomize = makeButton("Customize Menu", () => {
| |
| const newTitle = prompt("New menu title:", settings.menuTitle);
| |
| const newIcon = prompt("New icon URL:", settings.iconURL);
| |
| const newBg = prompt("Background color (hex):", settings.backgroundColor); | |
| const newBtn = prompt("Button color (hex):", settings.buttonColor);
| |
| const newTxt = prompt("Text color (hex):", settings.textColor); | |
| const newBorder = prompt("Border color (hex):", settings.borderColor);
| |
| | |
| if (newTitle) settings.menuTitle = newTitle;
| |
| if (newIcon) settings.iconURL = newIcon;
| |
| if (newBg) settings.backgroundColor = newBg;
| |
| if (newBtn) settings.buttonColor = newBtn;
| |
| if (newTxt) settings.textColor = newTxt;
| |
| if (newBorder) settings.borderColor = newBorder;
| |
| | |
| saveSettings();
| |
| alert("Changes saved! Refresh to apply.");
| |
| });
| |
| | |
| const btnReset = makeButton("Undo Changes", () => {
| |
| const confirmReset = confirm("Are you sure you want to undo all customizations?");
| |
| if (!confirmReset) return;
| |
| | |
| localStorage.removeItem("mahitoMenuSettings");
| |
| alert("Customizations reset! Reloading...");
| |
| location.reload();
| |
| });
| |
| | |
| // Preferences Button (always visible)
| |
| const btnPreferences = makeButton("Preferences", () => {
| |
| prefsPanel.style.display = prefsPanel.style.display === "block" ? "none" : "block";
| |
| });
| |
| | |
| // Preferences Panel
| |
| const prefsPanel = document.createElement("div");
| |
| Object.assign(prefsPanel.style, {
| |
| backgroundColor: "#333a66",
| |
| padding: "8px",
| |
| borderRadius: "6px", | | borderRadius: "6px", |
| marginTop: "10px", | | cursor: "pointer" |
| display: "none",
| |
| color: "#eee",
| |
| fontSize: "13px"
| |
| }); | | }); |
|
| |
|
| function createCheckbox(labelText, prefKey) { | | runBtn.onclick = () => { |
| const label = document.createElement("label"); | | try { |
| label.style.display = "block"; | | new Function(textarea.value)(); |
| label.style.marginBottom = "6px"; | | } catch (e) { |
| label.style.cursor = "pointer";
| | alert("Error: " + e.message); |
| | } |
| | }; |
|
| |
|
| const checkbox = document.createElement("input");
| | toggle.onclick = () => { |
| checkbox.type = "checkbox"; | | menu.style.display = menu.style.display === "none" ? "block" : "none"; |
| checkbox.checked = prefs[prefKey];
| | }; |
| checkbox.style.marginRight = "6px";
| |
|
| |
|
| checkbox.addEventListener("change", () => {
| | // Assemble the UI |
| prefs[prefKey] = checkbox.checked;
| | menu.appendChild(title); |
| savePrefs();
| | menu.appendChild(textarea); |
| applyPreferences();
| | menu.appendChild(runBtn); |
| });
| | document.body.appendChild(toggle); |
| | |
| label.appendChild(checkbox);
| |
| label.appendChild(document.createTextNode(labelText));
| |
| return label;
| |
| }
| |
| | |
| prefsPanel.appendChild(createCheckbox("Show Mass undo Button", "showMassUndo"));
| |
| prefsPanel.appendChild(createCheckbox("Show Explanation Button", "showExplanation"));
| |
| prefsPanel.appendChild(createCheckbox("Show Encouragement Button", "showEncouragement"));
| |
| prefsPanel.appendChild(createCheckbox("Show YUJIFY Button", "showYujify"));
| |
| prefsPanel.appendChild(createCheckbox("Show Customize Menu Button", "showCustomize"));
| |
| prefsPanel.appendChild(createCheckbox("Show Undo Changes Button", "showUndoChanges"));
| |
| prefsPanel.appendChild(createCheckbox("Show Preferences Button (cannot be hidden)", "showPreferences"));
| |
| // Removed watermark checkbox from prefsPanel | |
| | |
| function applyPreferences() {
| |
| btnMassUndo.style.display = prefs.showMassUndo ? "block" : "none";
| |
| btnExplain.style.display = prefs.showExplanation ? "block" : "none";
| |
| btnEncouragement.style.display = prefs.showEncouragement ? "block" : "none";
| |
| btnYujify.style.display = prefs.showYujify ? "block" : "none";
| |
| btnCustomize.style.display = prefs.showCustomize ? "block" : "none";
| |
| btnReset.style.display = prefs.showUndoChanges ? "block" : "none";
| |
| btnPreferences.style.display = "block"; // never hide preferences
| |
| watermark.style.display = "block"; // always show watermark
| |
| }
| |
| | |
| // Create YouTube encouragement container
| |
| const ytContainer = document.createElement("div");
| |
| Object.assign(ytContainer.style, {
| |
| position: "fixed",
| |
| right: "20px",
| |
| top: "150px",
| |
| zIndex: "99998",
| |
| display: "none",
| |
| background: "#000",
| |
| padding: "5px",
| |
| borderRadius: "10px",
| |
| boxShadow: "0 0 10px black"
| |
| });
| |
| | |
| const ytIframe = document.createElement("iframe");
| |
| ytIframe.width = "280";
| |
| ytIframe.height = "157";
| |
| ytIframe.src = "https://www.youtube.com/embed/VKfyq_hOL0c?autoplay=1";
| |
| ytIframe.title = "Self Embodiment of Perfection OST";
| |
| ytIframe.frameBorder = "0";
| |
| ytIframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture";
| |
| ytIframe.allowFullscreen = true;
| |
| ytContainer.appendChild(ytIframe);
| |
| | |
| // 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"
| |
| });
| |
| | |
| // Append buttons and elements
| |
| menu.appendChild(header); | |
| menu.appendChild(btnMassUndo); | |
| menu.appendChild(btnExplain); | |
| menu.appendChild(btnEncouragement); | |
| menu.appendChild(btnYujify);
| |
| menu.appendChild(btnCustomize);
| |
| menu.appendChild(btnReset);
| |
| menu.appendChild(btnPreferences);
| |
| menu.appendChild(prefsPanel);
| |
| | |
| // Append everything to body
| |
| document.body.appendChild(menu); | | document.body.appendChild(menu); |
| document.body.appendChild(minimizedIcon);
| |
| document.body.appendChild(ytContainer);
| |
| document.body.appendChild(watermark);
| |
|
| |
| // Apply preferences initially
| |
| applyPreferences();
| |
| })(); | | })(); |