User:Gerbrant/edit/blame.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:Gerbrant/edit/blame. |
new function()
{
var settings, self = this, myWin = null, div;
try{ settings = Gerbrant.edit.blame; }catch(nosettings){}
if(!settings) settings = {};
//Test settings here, like this: if(!settings.onAllPages && !isJsPage) return;
function refreshWindow()
{
var i, t = [
'<form action="http://wikipedia.ramselehof.de/wikiblame.php" method="post">\
<input type="hidden" name="lang" value="en">\
<input type="hidden" name="project" value="wikipedia">\
<table style="background:none">\
<tr><td align="right">Article</td><td><input type="text" name="article" value="',
wgPageName,
'" size="21"></td></tr>\
<tr><td align="right">Search for</td><td><input type="text" name="needle" value="" size="21"></td></tr>\
<tr><td align="right">Always skip</td><td><input type="text" name="skipversions" value="0" size="11"> versions</td></tr>\
<tr><td align="right">Ignore first</td><td><input type="text" name="ignorefirst" value="0" size="11"> versions</td></tr>\
<tr><td align="right">Check</td><td><input type="text" name="limit" value="500" size="11"> versions</td></tr>\
<tr><td align="right">Starting date</td><td><select name="offtag" size="auto">'];
var f = function(a, b, s)
{
for(i = a; i < s; i++) t.push('<option value="', i, '">', i, '</option>');
t.push('<option value="', s, '" selected>', s, '</option>');
for(i = s + 1; i <= b; i++) t.push('<option value="', i, '">', i, '</option>');
}, d = new Date(), y = d.getFullYear();
f(1, 31, d.getDate());
t.push(
'</select> <select name="offmon" size="auto">');
f(1, 12, d.getMonth() + 1);
t.push(
'</select> <select name="offjahr" size="auto">');
f(2002, y, y);
t.push(
'</select></td>\
<tr><td align="right">Start with</td><td>\
<input id="Gerbrant-edit-blame-desc" type="radio" name="order" value="desc" checked><label for="Gerbrant-edit-blame-desc">latest</label>\
<input id="Gerbrant-edit-blame-asc" type="radio" name="order" value="asc"><label for="Gerbrant-edit-blame-asc">oldest</label></td></tr>\
<tr><td align="right">Search method</td><td>\
<input id="Gerbrant-edit-blame-lin" type="radio" name="searchmethod" value="lin"><label for="Gerbrant-edit-blame-lin">linear</label>\
<input id="Gerbrant-edit-blame-int" type="radio" name="searchmethod" value="int" checked><label for="Gerbrant-edit-blame-int">interpolated</label></td></tr>\
<tr><td colspan="2" align="center"><input type="submit" value="Start"></td></table></form>');
div.innerHTML = t.join("");
}
this.show = function()
{
if(myWin == null)
{
myWin = new Gerbrant.gui.window("Blame");
div = myWin.getContent();
}
refreshWindow();
}
this.caption = "Blame";
loadModules(["Gerbrant.gui.window", "Gerbrant.gui.toolbox"], function()
{
module("Gerbrant.edit.blame", self);
if(!settings.notInToolbox) Gerbrant.gui.toolbox.addObject(self);
});
}