Wasteof Plugins

It's like vendetta but not for Discord, for wasteof, and it doesn't have themes or over a hundred plugins or is the cutest client mod for wasteof, and is basically nothing like vendetta

// ==UserScript==
// @name         Wasteof Plugins
// @namespace    http://tampermonkey.net/
// @version      2024-08-03
// @description  It's like vendetta but not for Discord, for wasteof, and it doesn't have themes or over a hundred plugins or is the cutest client mod for wasteof, and is basically nothing like vendetta
// @author       MrOwlsss
// @match        https://wasteof.money/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    const pink = "#ec4899";
const purple = "#8b5cf6";
const violet = "#8b5cf6";
const green = "#22c55e";
const blue = "#3b82f6";
// yes, default blue and theme-blue are different colors
const red = "#ef4444";
const orange = "#f97316";
function createSettingModule(id) {
  const settingsElement = document.createElement("div");
  const footer = document.getElementById("footer");
  settingsElement.classList.add("bg-gray-100");
  settingsElement.classList.add("dark:bg-gray-800");
  settingsElement.classList.add("p-4");
  settingsElement.classList.add("rounded-xl");
  settingsElement.classList.add("my-2");
  settingsElement.id = id;
  document.getElementsByTagName("main")[0].insertBefore(settingsElement, footer);
}
function addHeaderNode(id, content) {
  const settingsElement = document.getElementById(id);
  const header = document.createElement("h2");
  header.classList.add("font-bold");
  header.classList.add("text-2xl");
  header.classList.add("mb-2");
  header.innerHTML = content;
  settingsElement.appendChild(header);
}
function addTextNode(id, content) {
  const settingsElement = document.getElementById(id);
  const header = document.createElement("p");
  header.innerHTML = content;
  settingsElement.appendChild(header);
}
function addButtonNode(id, content, colorOrID, color) {
  const settingsElement = document.getElementById(id);
  const button = document.createElement("button");
  button.classList.add("bg-primary-500", "text-white", "block", "mt-2", "text-center", "font-bold", "p-2", "h-10", "rounded-lg", "cursor-pointer")
  button.innerHTML = content;
  if (colorOrID) {
    if (colorOrID.startsWith("#" || "rgb(" || "rgba(")) {
      button.style.background = colorOrID;
    } else {
      button.id = colorOrID
    }
  }
  if (color) {
    button.style.background = color;
  }

  settingsElement.appendChild(button);
}
function addMenuDropdown(oldid, title, newid) {
  const settingsElement = document.getElementById(oldid);
  const menu = document.createElement("div");
  menu.classList.add("select-none");
  menu.classList.add("my-2");
  menu.id = newid;

  menu.innerHTML = `<div id="${newid}-top" class="bg-white dark:bg-gray-700 p-4 mb-2 rounded-xl flex cursor-pointer hover:bg-white transition-colors bg-gray-50">
  <span class="inline-block font-semibold w-full">${title}</span>
  <span class="inline-block secondary-text"
    ><span
      ><svg
        xmlns="http://www.w3.org/2000/svg"
        class="h-5 w-5"
        viewBox="0 0 20 20"
        fill="currentColor"
      >
        <path
          fill-rule="evenodd"
          d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
          clip-rule="evenodd"
        ></path></svg></span
  ></span>
</div>
<div class="bg-white dark:bg-gray-700 p-4 rounded-xl" id="${newid}-menu">
  <div id="${newid}-content">
    <span class="block">
    </span>
  </div>
</div>
`;
  settingsElement.appendChild(menu);
  document.getElementById(`${newid}-top`).onclick = function () { if (opened) { document.getElementById(`${newid}-menu`).style.display = "none"; opened = false; } else { document.getElementById(`${newid}-menu`).style.display = "block"; opened = true } }
  document.getElementById(`${newid}-menu`).style.display = "none";
  let opened = false;
}
const pluginLoop = window.setInterval(() => {
  clearInterval(pluginLoop);
}, 100);
if (window.location.href == "https://wasteof.money/settings") {
  document.getElementsByClassName("w-full")[13].id = "footer";
  createSettingModule("plugins");
  addHeaderNode("plugins", "Wasteof Plugins");

  addMenuDropdown("plugins", "Leaderboard Pin", "lbpin");
  addHeaderNode("lbpin-content", "Leaderboard Pin");
  addTextNode("lbpin-content", "Pins the Leaderboard post to the top of the feed");
  addTextNode("lbpin-content", "<b>By</b> MrOwlsss");
  addTextNode("lbpin-content", "<b>Version</b> 1.0");
  addButtonNode("lbpin-content", "Enable", "lbpinonoff");

  addMenuDropdown("plugins", "More Images", "more-images");
  addHeaderNode("more-images-content", "More Images");
  addTextNode("more-images-content", "Adds another way to embed images in Wasteof");
  addTextNode("more-images-content", "<b>By</b> MrOwlsss");
  addTextNode("more-images-content", "<b>Version</b> 1.0");
  addButtonNode("more-images-content", "Enable", "more-imagesonoff")

  createSettingModule("colors");
  addMenuDropdown("colors", "Colors", "thecolors");
  addButtonNode("thecolors-content", "Default", "default");
  addButtonNode("thecolors-content", "Pink", pink);
  addButtonNode("thecolors-content", "Violet", violet);
  addButtonNode("thecolors-content", "Green", green);
  addButtonNode("thecolors-content", "Blue", blue);
  addButtonNode("thecolors-content", "Red", red);
  addButtonNode("thecolors-content", "Orange", orange);
}
function createDialog(title, id) {
  const anewDialog = document.createElement("div");
  anewDialog.id = id;
  anewDialog.innerHTML = `<div class="vfm vfm--inset vfm--fixed" style="z-index: 1000;" data-v-02823e40="" value="true"><div class="vfm__overlay vfm--overlay vfm--absolute vfm--inset" style="" data-v-02823e40=""></div> <div aria-expanded="true" role="dialog" aria-modal="true" tabindex="-1" class="vfm__container vfm--absolute vfm--inset vfm--outline-none flex justify-center items-center" style="" data-v-02823e40=""><div class="vfm__content relative flex flex-col max-h-full mx-4 rounded w-full h-full md:w-1/2 md:h-1/2" data-v-02823e40="" style="touch-action: none; position: relative; top: 23px; left: -159px; margin: unset;"><span id="modal-header" class="mr-8 w-full bg-primary-500 dark:bg-gray-800 text-white p-2 rounded-t-xl dark:border-t-2 dark:border-l-2 dark:border-r-2 border-gray-700 font-semibold cursor-move">${title}</span><div
  class="flex-grow overflow-y-auto bg-white dark:bg-gray-900 dark:border-b-2 dark:border-l-2 dark:border-r-2 border-gray-700 p-2 flex flex-col rounded-b" id="${id}-content"></div><button onclick="document.getElementById('${id}').remove();" class="absolute top-0 right-0 mt-2 mr-2 text-white"><span><svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
  <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path>
</svg></span></button> </div>`
  document.body.appendChild(anewDialog)
}
//createDialog("Add account", "addAccount");
//document.getElementById("addAccount-content").innerHTML = `<p>Add an account:</p><br><input placeholder="Username"><input placeholder="Password">`;

if (window.location.href == "https://wasteof.money/settings") {
  if (localStorage.getItem("lbpin") == "enabled") {
    document.getElementById("lbpinonoff").style.background = "#ef4444";
    document.getElementById("lbpinonoff").innerText = "Disable";
  } else {
    document.getElementById("lbpinonoff").style.background = "#22c55e";
    document.getElementById("lbpinonoff").innerText = "Enable";
  }
  document.getElementById("lbpinonoff").addEventListener("click", () => {
    let enabled = localStorage.getItem("lbpin");
    if (enabled != "enabled") {
      document.getElementById("lbpinonoff").style.background = "#ef4444";
      document.getElementById("lbpinonoff").innerText = "Disable";
      localStorage.setItem("lbpin", "enabled");
    } else {
      document.getElementById("lbpinonoff").style.background = "#22c55e";
      document.getElementById("lbpinonoff").innerText = "Enable ";
      localStorage.setItem("lbpin", "disabled");
    }
  });

  if (localStorage.getItem("more-images") == "enabled") {
    document.getElementById("more-imagesonoff").style.background = "#ef4444";
    document.getElementById("more-imagesonoff").innerText = "Disable";
  } else {
    document.getElementById("more-imagesonoff").style.background = "#22c55e";
    document.getElementById("more-imagesonoff").innerText = "Enable";
  }
  document.getElementById("more-imagesonoff").addEventListener("click", () => {
    let enabled = localStorage.getItem("more-images");
    if (enabled != "enabled") {
      document.getElementById("more-imagesonoff").style.background = "#ef4444";
      document.getElementById("more-imagesonoff").innerText = "Disable";
      localStorage.setItem("more-images", "enabled");
    } else {
      document.getElementById("more-imagesonoff").style.background = "#22c55e";
      document.getElementById("more-imagesonoff").innerText = "Enable ";
      localStorage.setItem("more-images", "disabled");
    }
  });
}

    //Leaderboard pin
    try {
if (window.location.href == "https://wasteof.money/" && localStorage.getItem("lbpin") == "enabled") {
  const leaderboard = document.createElement("div");
  const postList = document.getElementsByClassName("max-w-2xl")[0];
  const lastPost = document.getElementsByClassName("max-w-2xl")[0].getElementsByClassName("rounded-xl")[0];

  leaderboard.classList.add("bg-gray-100");
  leaderboard.classList.add("dark:bg-gray-800");
  leaderboard.classList.add("px-8");
  leaderboard.classList.add("border-2");
  leaderboard.classList.add("dark:border-gray-700");
  leaderboard.classList.add("rounded-xl");
  leaderboard.style = "margin-bottom: 15px;"

  const requestOptions = {
    method: "GET",
    redirect: "follow"
  };

  let postText;
  let comments;
  let loves;
  let reposts;
  const timestamp = 1717612305874;
  const date = new Date(timestamp);
  const monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  const year = date.getFullYear();
  const month = monthNames[date.getMonth() + 1]; // Months are zero-based
  const day = date.getDate();
  const hours = date.getHours();
  const minutes = date.getMinutes();

  fetch("https://api.wasteof.money/posts/6660af119adc44a7ef3853a2", requestOptions)
    .then((response) => response.text())
    .then((result) => {
      postText = JSON.parse(result);
      return postText;
    })
    .then((parsedData) => {
      postText = parsedData["content"];
      comments = parsedData["comments"];
      loves = parsedData["loves"];
      reposts = parsedData["reposts"]
      leaderboard.innerHTML = `<a href="/posts/6660af119adc44a7ef3853a2" class="block"><div class="w-full mt-4 mb-2 pb-1 border-b-2 dark:border-gray-700 font-semibold"><a href="/users/leaderboard" class="w-full block"><img src="https://api.wasteof.money/users/leaderboard/picture" alt="burrito's profile picture" class="h-8 inline-block bg-white dark:border-gray-700 rounded-full border-2"> <span class="ml-1 inline-block theme-indigo">
          @leaderboard
          <span class="inline-flex h-2 w-2 rounded-full bg-primary-500 ml-1"></span> <!----></span></a></div> <span class="prose dark:prose-light max-w-none break-words"><details><summary>Leaderboard</summary>${postText}</details></span> <!----> <!----> <div class="mt-3 mb-5"><span class="block mb-2 secondary-text italic">
        Jun 5, 2024, 1:31 PM
        <span class="cursor-pointer"></span> <!----></span> <div class="select-none"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="inline h-5 w-5 cursor-pointer active:scale-125 active:text-red-400 hover:scale-110 transition"><path fill-rule="evenodd" d="M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z" clip-rule="evenodd"></path></svg> <span class="mr-2">${loves}</span> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 24 24" class="inline h-5 w-5 cursor-pointer active:scale-125 active:text-yellow-400 hover:scale-110 transition"><path d="M11.6 3.4l-.8-.8c-.5-.6-.4-1.5.3-1.8.4-.3 1-.2 1.4.2a509.8 509.8 0 012.7 2.7c.5.4.5 1.2.1 1.6l-2.8 2.9c-.5.5-1.3.5-1.8-.1-.3-.5-.2-1 .2-1.5l.8-1H7a4.3 4.3 0 00-4.1 4.7 2036.2 2036.2 0 01.2 8h2.4c.5 0 .8.2 1 .6.2.4.2.9 0 1.2-.2.4-.6.6-1 .6H1.8c-.7 0-1.2-.5-1.2-1.1v-.2V10c0-1.3.3-2.5 1-3.6 1.3-2 3.2-3 5.6-3h4.4zM12.3 18.3h4.6c2.3 0 4.2-2 4.2-4.3V5.9c0-.2 0-.2-.2-.2h-2.3c-.6 0-1-.3-1.2-.8a1.2 1.2 0 011.1-1.6h3.6c.8 0 1.3.5 1.3 1.3v9c0 1.1-.1 2.2-.6 3.2a6.4 6.4 0 01-5.6 3.7l-4.6.1h-.2l.7.8c.4.4.5.9.3 1.3-.3.8-1.3 1-1.9.4L9 20.6l-.4-.5c-.3-.4-.3-1 0-1.4l2.9-3c.6-.6 1.7-.3 2 .6 0 .4 0 .7-.3 1l-.9 1z" fill="currentColor"></path></svg> <span class="mr-2">${reposts}</span> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="inline h-5 w-5"><path fill-rule="evenodd" d="M18 13V5a2 2 0 00-2-2H4a2 2 0 00-2 2v8a2 2 0 002 2h3l3 3 3-3h3a2 2 0 002-2zM5 7a1 1 0 011-1h8a1 1 0 110 2H6a1 1 0 01-1-1zm1 3a1 1 0 100 2h3a1 1 0 100-2H6z" clip-rule="evenodd"></path></svg> <span>${comments}</span> <span class="float-right relative inline-block z-20"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="h-5 w-5 cursor-pointer"><path d="M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z"></path></svg> <!----></span></div></div></a> <div class="v-portal" style="display: none;"></div></div>`;
    })
    .catch((error) => console.error(error));

  postList.insertBefore(leaderboard, lastPost);
}} catch(error) {console.error(error)}

    //more images
if (localStorage.getItem("more-images") == "enabled") {
    window.setInterval(() => {
        let pElements = Array.from(document.getElementsByTagName("p"));
        pElements.forEach((ele) => {
            const pText = ele.innerText;
            if (pText.startsWith("{img}") && ele.parentElement.contentEditable != "true") {
                console.log("more image code");
                const imgURL = pText.slice(5);
                const newImg = document.createElement("img");
                newImg.src = imgURL;
                ele.innerText = "";
                ele.appendChild(newImg);
                ele.style.maxHeight = "250px";
                ele.style.maxWidth = "250px";
            }
        })
    }, 100);
    }
})();