Jump to content

User:Stumblean/common.js: Difference between revisions

From Domination Earth
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 8: Line 8:
     right: "20px",
     right: "20px",
     padding: "0",
     padding: "0",
     background: "transparent",
     background: "white", // Added background back
     border: "none",
     border: "none",
    borderRadius: "12px", // Rounded square
     zIndex: 9998,
     zIndex: 9998,
     cursor: "pointer"
     cursor: "pointer"
Line 20: Line 21:
     width: "48px",
     width: "48px",
     height: "48px",
     height: "48px",
     borderRadius: "12px", // <-- Rounded square (not circle)
     borderRadius: "12px",
     boxShadow: "0 0 8px rgba(0,0,0,0.4)"
     display: "block" // Removes small spacing around img inside button
   });
   });
   toggle.appendChild(icon);
   toggle.appendChild(icon);

Revision as of 00:08, 29 June 2025

(function () {
  // Create toggle button with image icon
  const toggle = document.createElement("button");
  toggle.id = "delta-toggle";
  Object.assign(toggle.style, {
    position: "fixed",
    bottom: "20px",
    right: "20px",
    padding: "0",
    background: "white",  // Added background back
    border: "none",
    borderRadius: "12px", // Rounded square
    zIndex: 9998,
    cursor: "pointer"
  });

  const icon = document.createElement("img");
  icon.src = "https://files.catbox.moe/uodscw.png";
  icon.alt = "Delta";
  Object.assign(icon.style, {
    width: "48px",
    height: "48px",
    borderRadius: "12px",
    display: "block"  // Removes small spacing around img inside button
  });
  toggle.appendChild(icon);

  // Create Delta menu
  const menu = document.createElement("div");
  menu.id = "delta-menu";
  Object.assign(menu.style, {
    display: "none",
    position: "fixed",
    bottom: "80px",
    right: "20px",
    width: "300px",
    background: "#2b2b2b",
    color: "#fff",
    borderRadius: "10px",
    padding: "15px",
    boxShadow: "0 0 10px rgba(0,0,0,0.5)",
    zIndex: 9999,
    fontFamily: "monospace"
  });

  const title = document.createElement("div");
  title.textContent = "Delta Online";
  Object.assign(title.style, {
    textAlign: "center",
    fontSize: "18px",
    marginBottom: "10px"
  });

  const textarea = document.createElement("textarea");
  textarea.placeholder = "Enter JavaScript...";
  Object.assign(textarea.style, {
    width: "100%",
    height: "120px",
    background: "#1e1e1e",
    color: "#fff",
    border: "none",
    borderRadius: "6px",
    padding: "10px",
    resize: "none",
    boxSizing: "border-box"
  });

  const runBtn = document.createElement("button");
  runBtn.textContent = "Run Code";
  Object.assign(runBtn.style, {
    marginTop: "10px",
    width: "100%",
    padding: "10px",
    background: "#4caf50",
    color: "#fff",
    border: "none",
    borderRadius: "6px",
    cursor: "pointer"
  });

  runBtn.onclick = () => {
    try {
      eval(textarea.value);
    } catch (e) {
      alert("Error: " + e.message);
    }
  };

  toggle.onclick = () => {
    menu.style.display = menu.style.display === "none" ? "block" : "none";
  };

  // Add everything to page
  menu.appendChild(title);
  menu.appendChild(textarea);
  menu.appendChild(runBtn);
  document.body.appendChild(toggle);
  document.body.appendChild(menu);
})();
Cookies help us deliver our services. By using our services, you agree to our use of cookies.