User:Ugur Basak/monobook.js

/* */

function addForceSummary {   if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return; if(/&section=new/.test(window.location.href)) return; if(!document.forms.editform) return; document.forms.editform.wpSave.onclick = forceSummary; }

function forceSummary {   if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))   {        var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value); if(r == null) { return false; } document.forms.editform.wpSummary.value = r;   } return true; }

$(addForceSummary); /* */

/* */

function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; return addlilink(tabs, url, name, id, title, key); }

function addlilink(tabs, url, name, id, title, key){ 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); tabs.appendChild(li); if(id) {       if(key && title) {           ta[id] = [key, title]; }       else if(key) {           ta[id] = [key, '']; }       else if(title) {           ta[id] = ['', title]; }   }    // re-render the title and accesskeys from existing code in wikibits.js    akeytt; return li; }

if (document.title.indexOf("Editing User talk:") != -1) { addOnloadHook(addTest); }

if (document.title.indexOf("Editing Wikipedia:Administrator intervention against vandalism") != -1) { addOnloadHook(addVandal); }

//function doQwikify { // document.editform.wpTextbox1.value = "\n\n" + document.editform.wpTextbox1.value; // document.editform.wpSummary.value = "Marked for wikification."; // document.editform.wpMinoredit.checked = true; // document.editform.submit; //}

function addTest {

addTab("javascript:testn(1)", "t1", "ca-t1", "t1", ""); addTab("javascript:testn(2)", "t2", "ca-t2", "t2", ""); addTab("javascript:testn(3)", "t3", "ca-t3", "t3", ""); addTab("javascript:testn(4)", "t4", "ca-t4", "t4", ""); addTab("javascript:blank(2)", "b2", "ca-b2", "b2", ""); addTab("javascript:blank(3)", "b3", "ca-b3", "b3", ""); addTab("javascript:blank(4)", "b4", "ca-b4", "b4", ""); addTab("javascript:attack", "attack", "ca-attack", "attack", ""); addTab("javascript:welcome", "welcome", "ca-welcome", "welcome", "");

akeytt; }

// Add test-n templates to user talk pages function testn(number) { var page = prompt("Vandalism to which article?") if(page != null) {  var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "" + page + " ~"; //f.wpSummary.value = "(test" + number + "-n:) "+"Your edits to " + page + "" f.wpSummary.value = "Your edits to " + page + "" document.editform.wpWatchthis.checked = false; document.editform.submit; } }

function welcome { document.editform.wpTextbox1.value = " --~\n\n" + document.editform.wpTextbox1.value; document.editform.wpSummary.value = "Welcome to Wikipedia"; document.editform.wpMinoredit.checked = true; document.editform.submit; }

function vandal { var vandalizer = prompt("Vandalizer ip or username") if(vandalizer != null) { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "* continuously vandalizing pages, despite warnings --~"; f.wpSummary.value = "Vandal report: "+vandalizer; document.editform.wpWatchthis.checked = true; document.editform.submit; } }

function addVandal {

addTab("javascript:vandal", "vandal", "ca-vandal", "vandal", ""); akeytt; }

// Add test-n templates to user talk pages function blank(number) { var page = prompt("Vandalism to which article?") if(page != null) { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; if(number==2) t.value += "" + page + " ~"; else t.value += "" + page + " ~"; f.wpSummary.value = "(blank" + number + ":) "+"Your edits to " + page + "" document.editform.wpWatchthis.checked = false; document.editform.submit; } }

function attack { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += " ~"; f.wpSummary.value = "attack" document.editform.wpWatchthis.checked = false; document.editform.submit; }

/* */

//  //Please leave the following line //user:Where/usertabs//modified addOnloadHook(function {  if (document.title.search("/") != -1 || document.title.search("- History -") != -1) { //no subpages or history      return;   }   if (document.title.indexOf("User:") == 0 || document.title.indexOf("User talk:") == 0) {      username_a = document.URL.match(/:.*:(.*)/);      username=username_a[1];      addTab("http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user="+ username+ "&dbname=enwiki_p", "interiot", "ca-interiot", "interiot edit counts", "");   } }); //

/* */

function getPname { z=document.getElementById("content").childNodes; for (var n=0;n<z.length;n++) { //if (z[n].className=="firstHeading") return z[n].textContent; if (z[n].className=="firstHeading") prompt(z[n].textContent); }; } //function addName { // // addTab("javascript:getPname", "pname", "ca-pname", "pname", ""); // akeytt; //} /* */

// // If you are editing a page, click the wikify button on your tab bar to add "" to the top, set "Marked for wikification." as the edit summary, mark it as a minor edit, and submit.

function doQwikify { document.editform.wpTextbox1.value = "\n\n" + document.editform.wpTextbox1.value; document.editform.wpSummary.value = "Marked for wikification."; document.editform.wpMinoredit.checked = true; document.editform.submit; } function addQwikify { addTab("javascript:doQwikify", "wikify", "ca-wikify", "Mark for wikification", ""); akeytt; }

function doCleanup { document.editform.wpTextbox1.value = "\n\n" + document.editform.wpTextbox1.value; document.editform.wpSummary.value = "Marked for clean up."; document.editform.wpMinoredit.checked = true; document.editform.submit; } function addCleanup { addTab("javascript:doCleanup", "cleanup", "ca-cleanup", "Mark for clean up", ""); akeytt; }

//if (document.title.indexOf("Editing ") == 0) //{ // addOnloadHook(addQwikify); //} //addOnloadHook(addName);

// by raylu //

//

function doInterwiki { var pageTitle = document.title.split(" - ")[0]; var pagename = pageTitle.replace("Editing ", ""); var str_interwiki=""+pagename+""; if(document.editform.wpTextbox1.value.indexOf("[[tr:")==-1) {   document.editform.wpTextbox1.value = document.editform.wpTextbox1.value+"\n"+str_interwiki;   document.editform.wpSummary.value = "interwiki "+str_interwiki;   document.editform.wpMinoredit.checked = true;   document.editform.submit;  } } function addInterwiki {  addTab("javascript:doInterwiki", "interwiki", "ca-interwiki", "interwiki", "");  akeytt; }

//alert(document.title);

if (document.title.indexOf("Editing ") == 0 && document.title.indexOf("User:") == -1 && document.title.indexOf("User talk:") == -1 ) { if (window.addEventListener) {   window.addEventListener("load", addQwikify, false); window.addEventListener("load", addCleanup, false); window.addEventListener("load", addInterwiki, false); } else if (window.attachEvent) {   window.attachEvent("onload", addQwikify); window.attachEvent("onload", addCleanup); window.attachEvent("onload", addInterwiki); } }

//Interiot's javascript edit counter if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) { mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); }

////copied rollback part from User:VoA/monobook.js // Admin-like RC Patrol tools

document.write(' ');

//peerreviewer document.write(' ');

//