User:Kipmaster/monobook.js

//

// ACCESKEYS // modify ta['n-recentchanges'] = new Array('s','Recent changes'); ta['n-mainpage'] = new Array('p','Visit the Main Page'); ta['ca-edit'] = new Array('²','You can edit this page.'); ta['ca-watch'] = new Array('','Add this page to your watchlist'); ta['pt-logout'] = new Array('','Log out'); ta['ca-move'] = new Array('','Move this page'); ta['ca-talk'] = new Array('','Discussion about the content page'); ta['ca-delete'] = new Array('','Delete this page');

// NAVBOX EXPANSION - from Connel // add "favourites" to navigation box function addToNav { var pagetitle = document.getElementById('p-cactions').getElementsByTagName('ul').item(0).getElementsByTagName('li').item(0).firstChild.href;

var lastnav = document.getElementById('n-sitesupport'); var newnav; var newa;

// get page title var pagetitle = document.getElementById('content').getElementsByTagName('h1').item(0).firstChild.nodeValue; if (pagetitle.search(/Search/) != -1) { pagetitle = document.getElementById('contentSub').firstChild.nodeValue; pagetitle = pagetitle.replace(/For query /g, ""); pagetitle = pagetitle.replace(/\"/g, ""); }  pagetitle = pagetitle.replace(/Editing /g, "");  var pageexternal = pagetitle.replace(/\ /g, "_");  var pageext =      pagetitle.replace(/\ /g, "+"); // All pages starting from this page newnav = document.createElement('li'); newa = document.createElement('a'); newa.href='/wiki/Special:Allpages/' + pagetitle; newa.appendChild(document.createTextNode('SP:All pages')); newnav.appendChild(newa); lastnav.parentNode.appendChild(newnav);

// Contribs:Newbies newnav = document.createElement('li'); newa = document.createElement('a'); newa.href='/w/index.php?title=Special:Contributions&target=newbies&limit=500'; newa.appendChild(document.createTextNode('SP:Contribs/newbies')); newnav.appendChild(newa); lastnav.parentNode.appendChild(newnav);

// Log for this page newnav = document.createElement('li'); newa = document.createElement('a'); newa.href='/w/index.php?title=Special%3ALog&page=' + pagetitle; newa.appendChild(document.createTextNode('SP:Log')); newnav.appendChild(newa); lastnav.parentNode.appendChild(newnav);

// Purge newnav = document.createElement('li'); newa = document.createElement('a'); newa.href='/w/index.php?title=' + pagetitle + '&action=purge'; newa.appendChild(document.createTextNode('Purge')); newnav.appendChild(newa); lastnav.parentNode.appendChild(newnav);

// fr: newnav = document.createElement('li'); newa = document.createElement('a'); newa.href='/wiki/fr:' + pagetitle; newa.appendChild(document.createTextNode('fr:' + pagetitle)); newnav.appendChild(newa); lastnav.parentNode.appendChild(newnav); }

// PERSONAL TOOLBAR EXPANSION - from Mike function addTools { var myprefs = document.getElementById('pt-preferences'); var newpt; var newa;

var username = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;

newpt = document.createElement('li'); newa = document.createElement('a'); newa.href='/wiki/User:Kipmaster/monobook.css' ; newa.appendChild(document.createTextNode('css')); newpt.appendChild(newa); myprefs.parentNode.insertBefore(newpt, myprefs);

newpt = document.createElement('li'); newa = document.createElement('a'); newa.href='/wiki/User:Kipmaster/monobook.js' ; newa.appendChild(document.createTextNode('js')); newpt.appendChild(newa); myprefs.parentNode.insertBefore(newpt, myprefs);

newpt = document.createElement('li'); newa = document.createElement('a'); newa.href='/wiki/WT:SB' ; newa.appendChild(document.createTextNode('SB')); newpt.appendChild(newa); myprefs.parentNode.insertBefore(newpt, myprefs);

}

function reformatMyPage { addToNav ; addTools; } var hack = 'failed'; var hack_pagetitle =''; if (window.addEventListener) window.addEventListener("load",reformatMyPage,false); else if (window.attachEvent) window.attachEvent("onload",reformatMyPage);

// EDIT SECTION 0 function addEditSection0 { if (!document.getElementById) return; x = document.getElementById('ca-edit'); if(!x) return; y = document.createElement('LI'); y.id = 'ca-edit-0'; if (x.className == 'selected') { if (/&action=edit&section=0$/.test(window.location.href)) { x.className = 'istalk'; y.className = 'selected'; } else { x.className = 'selected istalk'; } } else if (x.className == 'selected istalk') { if (/&action=edit&section=0$/.test(window.location.href)) { x.className = 'istalk'; y.className = 'selected istalk'; } else { y.className = 'istalk'; } } else { y.className = x.className; x.className = 'istalk'; } z = document.createElement('A'); if (x.children) { z.href = x.children[0].href + '&section=0'; z.appendChild(document.createTextNode('0')); y.appendChild(z); document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling); } else { z.href = x.childNodes[0].href + '&section=0'; z.appendChild(document.createTextNode('0')); y.appendChild(z); document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling); } }

if (document.title.indexOf("Editing ") == -1) { addOnloadHook(addEditSection0); }

// EDITBAR EXPANSION - from Rei-artur@pt.wikipedia

window.AddMyOwnButton=function(tbar, caption, href, imgsrc) { var ba = document.createElement('a'); ba.href = href; var img = document.createElement('img'); img.src = imgsrc; img.alt = caption; ba.appendChild(img); tbar.appendChild(ba); }

window.myOwnEditButtons=function { var tbdiv=document.getElementById('toolbar'); if ( tbdiv ) { tbdiv.appendChild(document.createTextNode(' '));

//,   AddMyOwnButton(tbdiv, 'txt2predef', 'javascript:insertTags(\'{\{\',\'}\}\',\'\');', 'http://republico.estv.ipv.pt/~nmct/wikipedia/icons/button_topredef.png');

// , AddMyOwnButton(tbdiv, 'pedia', 'javascript:insertTags(\'\[\[\w\:\',\'\|\]\]\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/5/59/Button_template.png');

//    AddMyOwnButton(tbdiv, '  ', 'javascript:insertTags(\' \',\' \',\'\');', 'http://republico.estv.ipv.pt/~nmct/wikipedia/icons/button_small.png');

//    AddMyOwnButton(tbdiv, '  ', 'javascript:insertTags(\' \',\' \',\'\');', 'http://republico.estv.ipv.pt/~nmct/wikipedia/icons/button_strike.png');

//    AddMyOwnButton(tbdiv, '  ', 'javascript:insertTags(\' \',\' \',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/5/59/Button_template.png');

//    AddMyOwnButton(tbdiv, '  ', 'javascript:insertTags(\' \',\' \',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/5/59/Button_template.png');

//    AddMyOwnButton(tbdiv, '  ', 'javascript:insertTags(\' \',\' \',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/5/59/Button_template.png');

// [[Category:,]] AddMyOwnButton(tbdiv, 'category', 'javascript:document.editform.wpSummary.value=\'\+cat\';insertTags(\'[\[Category:\',\']]\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/1/11/Button_category.png');

// #redirect , AddMyOwnButton(tbdiv, 'redirect', 'javascript:document.editform.wpSummary.value=\'redirect\';insertTags(\'#\REDIRECT\[\[\',\']]\',\'\');', 'http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png');

//    AddMyOwnButton(tbdiv, 'pgnm', 'javascript:insertTags(\'\\\'\\\'\\\'{\{subst:PAGENAME}}\\\'\\\'\\\'\',\'\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/5/59/Button_template.png');

// translations AddMyOwnButton(tbdiv, 'transwikt', 'javascript:insertTags(\'====Translations====\\n\{\{top}}\\n*French:\\n\{\{mid}}\\n\{\{bottom}}\',\'\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/c/cf/GreekT-01.png');

//    AddMyOwnButton(tbdiv, 'nolang', 'javascript:document.editform.wpSummary.value=\'nolanguage\';insertTags(\'\{\{subst:nolanguage}}\',\'\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/5/59/Button_template.png');

//    AddMyOwnButton(tbdiv, 'noteng', 'javascript:document.editform.wpSummary.value=\'notenglish\';insertTags(\'\{\{subst:notenglish}}\',\'\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/5/59/Button_template.png');

// ~    AddMyOwnButton(tbdiv, 'Welcome', 'javascript:document.editform.wpSummary.value=\'\Welcome!\';document.editform.wpTextbox1.value=\'\';insertTags(\'\{\{subst:welcome}\}\ \~\~\~\~\',\'\',\'\');document.editform.submit;', 'http://upload.wikimedia.org/wikipedia/commons/5/59/Button_template.png');

// ~   AddMyOwnButton(tbdiv, 'Welcomeip', 'javascript:document.editform.wpSummary.value=\'\Welcome! Please consider creating an account!\';document.editform.wpTextbox1.value=\'\';insertTags(\'\{\{subst:welcomeip|\~\~\~\~\}\}\',\'\',\'\');document.editform.submit;', 'http://upload.wikimedia.org/wikipedia/commons/5/59/Button_template.png');

} }

window.myAddOnload=function(f) { if (window.addEventListener) window.addEventListener("load", f, false); else if (window.attachEvent) window.attachEvent("onload",f); }

myAddOnload(myOwnEditButtons);

//