User:Connel MacKenzie/beNice.js
Jump to navigation
Jump to search
Note: You may have to bypass your browser’s cache to see the changes. In addition, after saving a sitewide CSS file such as MediaWiki:Common.css, it will take 5-10 minutes before the changes take effect, even if you clear your cache.
- Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
- Konqueror and Chrome: click Reload or press F5;
- Opera: clear the cache in Tools → Preferences;
- Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.
- This script lacks a documentation subpage. Please create it.
- Useful links: root page • root page’s subpages • links • redirects • your own
//This is the window opener, fired off every few seconds when a batch needs HUMAN editing
function openNext() {
var ok = true;
while (ok) {
i++;
var h = document.links[i] ; //.getAttribute(%22href%22);
var url = h.toString();
if (url.search(/\/todo/) == -1) {
if (url.search(/action=edit/) != -1) {
if (url.search(/edit_conflict/i) == -1) {
var z = window.open(url);
ok = false;
}
}
}
}
}
function beNiceToWikiServers() {
/*
Every few seconds load a new window in edit mode for HUMAN editing, and
let the other portions of this javascript do the dirtywork to the given page.
So, when I load one of my three special cleanup pages...my generated "todo" list,
this section of code will start opening new windows like a porn site gone mad.
The auto-formatting of those pages is not perfect (especially considering that
these are "cleanup" lists) so I'll have to come back and ALT-S them each after
the show changes, anyway.
This is actually much nicer to the servers. They seem to choke when I try
to manually open 35 pages. At least this way, there'll be *some* delay between
each new page open.
*/
var windows = 220 ;
i = 0;
numOpened = 0; //offset to start right away; several skipped links
var intI, h, url, z, cntLinks=0 ;
delay = 2718; // + 1000 ; // [[e]] secs + 1 sec
for (intI=0; intI < windows; intI++) {
h = document.links[intI] ;
if (h) {
url = h.toString();
if (url.search(/action=edit/) != -1) {
if (url.search(/edit_conflict/i) == -1)
if (url.search(/\/todo/) == -1) {
cntLinks++;
}
}
}
}
if ( windows > cntLinks ) windows = cntLinks ;
if ( windows > 5 )
if (windows=prompt("Number of new windows to open:", windows))
if ( windows < 11) delay = delay - 500 ;
for (intI=0; intI < (windows+50); intI++) {
h = document.links[intI] ; //.getAttribute(%22href%22);
if (h) {
url = h.toString();
if (url.search(/\/todo/) == -1) {
if (url.search(/action=edit/) != -1) {
numOpened++;
if (numOpened > windows) return;
z = setTimeout('openNext()', ( delay * (numOpened -1) ) );
}
}
}
}
}