User:Wayoshi/monobook.js

/* credit: http://en.wikipedia.org/wiki/User:Astronouth7303/monobook.js Nothing to see here, just a lot of code!! -Wayoshi function addTab(id, after, caption, url) { if (!document.getElementById(id)) { var edit = document.getElementById(after); if (!edit) return; //If the previous tab doesn't exist, don't add this one var editparent = edit.parentNode; var aseclinkcaption = document.createTextNode(caption) var aseclink = document.createElement('a'); aseclink.setAttribute('href',url); var addsectionlinkcaption = aseclink.appendChild(aseclinkcaption); var asec = document.createElement('li'); asec.setAttribute('id',id); var addsectionlink = asec.appendChild(aseclink); var addsection = editparent.insertBefore(asec,edit.nextSibling); } }

function addEditSection { var arti = wgPageName; addTab("ca-addsection", 'ca-edit', '+', wgScriptPath+"/index.php?title="+escape(arti)+"&action=edit&section=new"); addTab("ca-editfirst", 'ca-edit', '0', wgScriptPath+"/index.php?title="+escape(arti)+"&action=edit&section=0"); } if (window.addEventListener) window.addEventListener("load",addEditSection,false); else if (window.attachEvent) window.attachEvent("onload",addEditSection);

// Credit to http://en.wikipedia.org/wiki/User:Chocolateboy/smart_quotes.user.js var currentQM = "\u201d";

var toggleQM = { "\u201c" : "\u201d", "\u201d" : "\u201c" };

var replacements = [ [ /\.\.\./g, "\u2026" ], // Horizontal ellipsis [ /--/g,    "\u2014" ],  // Em dash [ /-/g,     "\u2013" ]   // En dash ];

var textnodes = document.evaluate(   "//body//text[not(ancestor::pre or ancestor::code)]",    document,    null,    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

for (var i = 0; i < textnodes.snapshotLength; ++i) { var node = textnodes.snapshotItem(i); var s = node.data;

for (var j = 0; j < replacements.length; ++j) { var key = replacements[j][0]; var val = replacements[j][1]; s = s.replace(key, val); }

while (s.indexOf('"') != -1) {       currentQM = toggleQM[currentQM];        s = s.replace('"', currentQM); }

node.data = s; }

// credit to http://en.wikipedia.org/wiki/User:Cacycle/wikEdDiff.js document.write(' ');

//source: http://en.wikipedia.org/wiki/User:Flex/welcome_newuser.js function welcome { // Find the edit box var txt = document.editform.wpTextbox1; //The welcome *template* you want to use var welcome_user = 'Wayoshi'; var welcome_summary = 'welcomed new user'; var welcome_watch   = false;

var tag = '';

if (txt.value.indexOf(tag) == -1) {

txt.value += tag;

document.editform.wpSummary.value    = welcome_summary; document.editform.wpWatchthis.checked = welcome_watch;

document.editform.submit; }    else { document.getElementById('ca-unverified').firstChild.style.backgroundColor = "#ff4444"; document.getElementById('ca-unverified').style.backgroundColor           = "#ff4444"; } } addOnloadHook(   function     {     if(document.title.indexOf("Editing User talk:") == 0)      {       addPortletLink('p-cactions', 'javascript:welcome', 'welcome', 'ca-welcome', 'Adds a welcome note to a new user', , );     }   } );

/*  */