User:Frietjes/historysummary.js

/// History summary /// Adapted from User:Timotheus_Canens/massedit.js /// Once installed, go to Special:HistorySummary and provide a list of pages

function doHistorySummary { document.getElementById("wpHistorySummarySubmit").disabled = true; var templates = document.getElementById("wpHistorySummary").value.split("\n"); var seen = {}; var userlist = []; if(templates.length > 0) { for(var j=0;j 1) { cstr = "&rvcontinue=" + ckey; }				req.open("GET", mw.config.get('wgScriptPath') + "/api.php?format=json" +					"&action=query&continue=" + cstr + 					"&prop=revisions&rvlimit=500&titles=" + 					encodeURIComponent(templates[j]), false); req.send; var response = JSON.parse(req.responseText).query.pages; for(var pindex in response) { var response2 = response[pindex].revisions; for(var index in response2) { var e = 'User:' + response2[index].user; if (seen.hasOwnProperty(e) == false) { if (e.search(/(bot|repeat|frietjes)$/i) < 0 ) { seen[e] = true; userlist.push(e); }						}					}				}				if(JSON.parse(req.responseText).continue) { loopflag = true; ckey = JSON.parse(req.responseText).continue.rvcontinue; } else { loopflag = false; }			}		}	}	document.getElementById("wpQueryUsers").innerHTML = userlist.join(', '); }

function HistorySummaryform { var bodyContent = 'bodyContent'; switch (mw.config.get('skin')) { case 'modern': bodyContent = 'mw_contentholder'; break; case 'cologneblue': bodyContent = 'article'; break; case 'vector': case 'monobook': case 'vector': default: bodyContent = 'bodyContent'; break; }	document.getElementsByTagName("h1")[0].textContent = "History summary"; document.title = "History summary tool - Wikipedia, the free encyclopedia"; document.getElementById(bodyContent).innerHTML = 'From Wikipedia, the free encyclopedia

'		+ '' + 'If you abuse this tool, it\'s your fault, not mine.' + ' ' + 'Pages to summarize (one on each line, with namespace prefix): '			+ ' ' + ' '		+ '' + ' '		+ ' '; } if(mw.config.get('wgNamespaceNumber') === -1 && (mw.config.get('wgPageName') === "Special:HistorySummary" || mw.config.get('wgPageName') === "Special:Historysummary") ) { $.when( $.ready, mw.loader.using(['mediawiki.util'])).done( HistorySummaryform ); }