User:JPxG/OpenAllNPP.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:JPxG/OpenAllNPP. |
// This is a very stupid script.
// Allows you to open every page listed at [[Special:NewPagesFeed]].
// Also, if you click "accept", it automatically completes the accept dialogue and closes the page.
// This only makes sense to use if you're patrolling a very large number of redirects.
// - JPxG, 2021 08 31
$( function() {
function gtfo() {
//sidebar = document.getElementsByClassName("mwe-pt-tool-pokey")[0];
//alert(sidebar.style);
//alert(sidebar.style.display);
//sidebar = document.getElementsByClassName("element-that-clearly-does-not-exist")[0];
//alert(sidebar.style);
//alert(sidebar.style.display);
window.close();
}
function clickThing() {
spinner = document.getElementById("mw-spinner-mark-spinner");
if(typeof(spinner) != 'undefined' && spinner != null) {
//alert("REFUSING to click, as spinner is displaying...");
return;
} // If there's a spinner, you already clicked the darn thing.
sidebar = document.getElementsByClassName("mwe-pt-tool-pokey")[0];
if (!sidebar) return;
sidebar = sidebar.style.display;
if(typeof(sidebar) != 'undefined' && sidebar == "none") {
//alert("REFUSING to click, as sidebar is hidden...");
var nothing = "nothing";
//return;
} // If the sidebar's hidden, you already clicked the darn thing.
buttonToClick = document.getElementById("mwe-pt-mark-as-reviewed-button");
if(typeof(buttonToClick) != 'undefined' && buttonToClick != null) {
document.getElementById("mwe-pt-mark-as-reviewed-button").click();
setTimeout(gtfo, 900);
} // If it exists, click it and GTFO.
} // Cheeky clicker.
function autoClick() {
ptMark = document.getElementById("mwe-pt-mark");
ptMark.getElementsByClassName("mwe-pt-tool-icon")[0].click();
$('#firstHeading').append("Autoclicking!");
//alert(document.getElementById("mwe-pt-mark"));
} // Automatically open thing.
//<div class="mwe-pt-tool-pokey mwe-pt-tool-pokey-not-flipped" style="display:none;"></div>
function hover() {
//alert(document.getElementsByClassName("redirectText")[0].querySelectorAll("a")[0].href);
// This actually works, somehow.
var hoverEvent = new MouseEvent('mouseover', {
'view': window,
'bubbles': true,
'cancelable': true
}); // defines hoverEvent
//document.getElementsByClassName("redirectText")[0].dispatchEvent(hoverEvent);
//document.getElementsByClassName("redirectText")[0].dispatchEvent(hoverEvent);
// Doesn't work.
//document.getElementsByClassName("redirectText")[0].focus();
//mouseOverWikiLink(hoverEvent);
//alert("Huh?")
} // End of "hover".
if( window.location.href.indexOf("User:" ) >= 0 ) {
rcatMove = document.getElementsByClassName("rcat-R_from_move")[0];
if(typeof(rcatMove) != 'undefined' && rcatMove != null) {
setInterval(autoClick, 500);
} // If rcat from move
} // If it's a userspace redirect.
if( window.location.href.indexOf("redirect=no" ) >= 0 ) {
setInterval(clickThing, 300);
setTimeout(hover, 500);
} // If it's a redirect.
if( window.location.href.indexOf("NewPagesFeed" ) >= 0 ) {
z = ""
// NOT AN EMPTY STRING! THIS IS A ZERO-WIDTH SPACE.
$('#firstHeading').append(' <button id="openAll">open all links</button>');
document.getElementById("openAll").style = "font-family: monospace; font-size: 50%; padding: 1px; border: 1px; background:#B58900; color:#002b36";
$('#openAll').click(function(e) {
//alert("Sup");
ts = document.getElementsByClassName('mwe-pt-page-title');
//alert("Yo");
//alert(ts.length);
var goAhead = confirm("Hey buddy, are you sure you want to open " + ts.length + " tabs?");
if (ts.length > 100) { goAhead = confirm("Bruh... like for real?"); }
if (goAhead != false) {
for (var each in ts) {
window.open(ts[each].querySelectorAll('a')[0].href);
} // For all in ts
} // If you agreed to open that many tabs.
}); // End of button listener.
} // End of function for if it's the NPF page.
} ); // End of the line. That's all folks!