User:Elnuko/patrol scipts.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:Elnuko/patrol scipts. |
//<nowiki>
function addLink(where, url, name, id, title, key, after){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
if(after)
{
tabs.insertBefore(li,document.getElementById(after));
}
else
{
tabs.appendChild(li);
}
if(id)
{
if (key && title)
{
ta[id] = [key, title];
}
else if (key)
{
ta[id] = [key, ''];
}
else if (title)
{
ta[id] = ['', title];
}
}
akeytt();
return li;
}
function utils()
{
if (document.editform != null)
{
var action = '';
if (location.search)
{
var l = location.search.substring(1).split('&');
for (var i = 0; i < l.length; ++i)
{
var eq = l[i].indexOf('=');
var name = l[i].substring(0, eq);
if (name == 'subaction')
{
action = l[i].substring(eq + 1);
break;
}
}
}
if (action == 'autocleanup')
{
doCleanup();
}
else if (action == 'autogcheck')
{
doGcheck();
}
else if (action == 'autoterminas')
{
doTerminas();
}
else if (action == 'autounknown')
{
doUnk();
}
else if (action == 'autowelcome')
{
doWelcome();
}
else if (action == 'autovw')
{
doVW();
}
else if (action == 'autobv')
{
doBV();
}
else if (action == 'autobeviltiskas')
{
doBeviltiskas();
}
}
addLink( 'p-tb', 'javascript:clean()', '+cleanup', 't-a-clean',
'+cleanup', null, null);
addLink( 'p-tb', 'javascript:beviltiskas()', '+beviltiskas', 't-a-bevilt',
'+beviltiskas', null, null);
addLink('p-tb', 'javascript:gcheck()', '+gcheck', 't-a-gcheck',
'+gcheck', null, null);
addLink('p-tb', 'javascript:terminas()', '+terminas', 't-a-terminas',
'+terminas', null, null);
addLink('p-tb', 'javascript:unk()', '+unknown', 't-a-unk',
'+unknown', null, null);
addLink('p-tb', 'javascript:welcome()', '+welcome', 't-a-welc',
'+welcome', null, null);
addLink('p-tb', 'javascript:vw()', '+vw', 't-a-vw',
'+vw', null, null);
addLink('p-tb', 'javascript:bv()', '+bv', 't-a-bv',
'+bv', null, null);
}
function clean()
{
if (document.editform != null)
{
doCleanup();
}
else
{
var editLinkBox = document.getElementById("ca-edit");
var editLink = editLinkBox.childNodes[0].href + '&subaction=autocleanup';
location.assign(editLink);
}
}
function gcheck()
{
if (document.editform != null)
{
doGcheck();
}
else
{
var editLinkBox = document.getElementById("ca-edit");
var editLink = editLinkBox.childNodes[0].href + '&subaction=autogcheck';
location.assign(editLink);
}
}
function terminas()
{
if (document.editform != null)
{
doTerminas();
}
else
{
var editLinkBox = document.getElementById("ca-edit");
var editLink = editLinkBox.childNodes[0].href + '&subaction=autoterminas';
location.assign(editLink);
}
}
function unk()
{
if (document.editform != null)
{
doUnk();
}
else
{
var editLinkBox = document.getElementById("ca-edit");
var editLink = editLinkBox.childNodes[0].href + '&subaction=autounknown';
location.assign(editLink);
}
}
function welcome()
{
if (document.editform != null)
{
doWelcome();
}
else
{
var editLinkBox = document.getElementById("ca-edit");
var editLink = editLinkBox.childNodes[0].href + '&subaction=autowelcome';
location.assign(editLink);
}
}
function vw()
{
if (document.editform != null)
{
doVW();
}
else
{
var editLinkBox = document.getElementById("ca-edit");
var editLink = editLinkBox.childNodes[0].href + '&subaction=autovw';
location.assign(editLink);
}
}
function bv()
{
if (document.editform != null)
{
doBV();
}
else
{
var editLinkBox = document.getElementById("ca-edit");
var editLink = editLinkBox.childNodes[0].href + '&subaction=autobv';
location.assign(editLink);
}
}
function beviltiskas()
{
if (document.editform != null)
{
doBeviltiskas();
}
else
{
var editLinkBox = document.getElementById("ca-edit");
var editLink = editLinkBox.childNodes[0].href + '&subaction=autobeviltiskas';
location.assign(editLink);
}
}
function doWelcome()
{
document.editform.wpTextbox1.value = '{{' + 'welcome}} ' + '~' + '~' + '~' + '~' + '\n\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = 'Welcome';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}
function doUnk()
{
document.editform.wpTextbox1.value = '{{' + 'unknown}}\n\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = 'Nenurodytos autorines teises';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}
function doTerminas()
{
document.editform.wpTextbox1.value = '{{' + 'terminas}}\n\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = '+terminas';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}
function doGcheck()
{
document.editform.wpTextbox1.value = '{{' + 'gcheck}}\n\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = '+gcheck';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}
function doCleanup()
{
document.editform.wpTextbox1.value = '{{' + 'cleanup}}\n\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = '+cleanup';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}
function doVW()
{
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{{' + 'vw}}';
document.editform.wpSummary.value = 'Ispejimas';
document.editform.submit();
}
function doBV()
{
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{{' + 'bv}}';
document.editform.wpSummary.value = 'Ispejimas';
document.editform.submit();
}
function doBeviltiskas()
{
document.editform.wpTextbox1.value = '{{' + 'beviltiškas}}\n\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = '+beviltiskas';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}
$(utils);
//</nowiki>