User:Elnuko/patrol scipts.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
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(); } addOnloadHook(utils);