// ==UserScript== // @name Neopets - Trading Post Bulk Delete Helper // @version 1.1 // @description Adds a panel to select, delete selected, or delete all of your visible Trading Post lots. // @author Fixed Version // @match *://www.neopets.com/island/tradingpost.phtml* // @match *://neopets.com/island/tradingpost.phtml* // @grant none // @icon https://images.neopets.com/tradingpost/assets/images/trade_icon.png // @downloadURL https://www.scriptneo.com/scripts/download.php?id=28 // @updateURL https://www.scriptneo.com/scripts/download.php?id=28 // ==/UserScript== (function () { "use strict"; const TPBH = { panelId: "tpbh-panel", statusId: "tpbh-status", listId: "tpbh-list", endpointLots: "/np-templates/ajax/island/tradingpost/get-lots.php?sort=newest", endpointDelete: "/np-templates/ajax/island/tradingpost/delete-lot.php", delayBetweenDeletesMs: 900, requireTypedConfirm: true }; let lots = []; let selectedLotIds = new Set(); let isDeleting = false; ready(function () { addCSS(); addPanel(); loadLots(); }); function ready(fn) { if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", fn); } else { fn(); } } function qs(selector, root = document) { return root.querySelector(selector); } function qsa(selector, root = document) { return Array.from(root.querySelectorAll(selector)); } function sleep(ms) { return new Promise(function (resolve) { window.setTimeout(resolve, ms); }); } function setStatus(message, type = "") { const status = qs("#" + TPBH.statusId); if (!status) { return; } status.textContent = message; status.className = "tpbh-status"; if (type) { status.classList.add(type); } } function addPanel() { if (qs("#" + TPBH.panelId)) { return; } const panel = document.createElement("div"); panel.id = TPBH.panelId; panel.innerHTML = `