forked from saahphire/NeopetsUserscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremoveToDFFSpam.js
More file actions
43 lines (41 loc) · 3.04 KB
/
Copy pathremoveToDFFSpam.js
File metadata and controls
43 lines (41 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// ==UserScript==
// @name Neopets: Remove Tales of Dacardia and Faerie Fragments Spam
// @namespace https://github.com/saahphire/NeopetsUserscripts
// @version 1.1.0
// @description Automatically deletes neomail about Tales of Dacardia and Faerie Fragments rewards
// @author saahphire
// @homepageURL https://github.com/saahphire/NeopetsUserscripts
// @downloadURL https://github.com/saahphire/NeopetsUserscripts/blob/main/removeToDFFSpam.js
// @updateURL https://github.com/saahphire/NeopetsUserscripts/blob/main/removeToDFFSpam.js
// @match *://*.neopets.com/neomessages.phtml
// @match *://*.neopets.com/neomessages.phtml?*folder=Inbox*
// @icon https://www.google.com/s2/favicons?sz=64&domain=neopets.com
// @license The Unlicense
// ==/UserScript==
/*
•:•.•:•.•:•:•:•:•:•:•:••:•.•:•.•:•:•:•:•:•:•:•:•.•:•.•:•:•:•:•:•:•:••:•.•:•.•:•.•:•:•:•:•:•:•:•:•.•:•:•.•:•.••:•.•
..................................................................................................................
☆ ⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂✦ ⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂☆ ⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂✦ ⠂⠄⠄⠂⠁⠁⠂⠄⠂⠄⠄⠂☆ ⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂✦ ⠂⠄⠄⠂⠁⠁⠂⠄⠂⠄⠄⠂☆
This script does the following:
1. Detects neomail about Tales of Dacardia and Faerie Fragments rewards
2. Selects all fitting neomail once you open your inbox
3. Focuses the "Go!" button so they'll be deleted as soon as you press Enter
This only works on one page at a time.
The last step can be problematic for accessibility. If you don't wish to autofocus, comment out the last line
by adding a // in front of it, like so:
// sel.nextElementSibling.focus();
✦ ⌇ saahphire
☆ ⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂✦ ⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂☆ ⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂✦ ⠂⠄⠄⠂⠁⠁⠂⠄⠂⠄⠄⠂☆ ⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂✦ ⠂⠄⠄⠂⠁⠁⠂⠄⠂⠄⠄⠂☆
..................................................................................................................
•:•.•:•.•:•:•:•:•:•:•:••:•.•:•.•:•:•:•:•:•:•:•:•.•:•.•:•:•:•:•:•:•:••:•.•:•.•:•.•:•:•:•:•:•:•:•:•.•:•:•.•:•.••:•.•
*/
(function() {
'use strict';
const filtered = [...document.querySelectorAll('table[align="center"] tr:not(:first-child):not(:last-child)')]
.filter(tr => tr.querySelector("td:nth-child(3) b").innerText === "theneopetsteam" && tr.querySelector("td:nth-child(4)")?.innerText.endsWith("Reward Unlocked!"));
if(filtered.length === 0) return;
filtered.forEach(tr => {tr.querySelector("input[type='checkbox']").checked = true});
const sel = document.querySelector("[name='action']");
sel.selectedIndex = [...sel.options].findIndex(opt => opt.value == "Delete Messages");
sel.nextElementSibling.focus();
})();