User:Josette/monobook.js

// // -- tab manipulation functions -- // **** Add tab to tab structure with name 'tabname' with function 'url' and label 'name'**** function addlilinkExisting(tabname, url, name, id) { tabs = document.getElementById(tabname).getElementsByTagName('ul')[0]; addlilink(tabs, url, name, id); } // **** Add tab to tab structure 'tabs' with function 'url' and label 'name'**** function addlilink(tabs, url, name, id){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.appendChild(na); tabs.appendChild(li); return li; } function addlimenu(tabset, name, id) {   var na = document.createElement('a'); na.href = '#'; var mn = document.createElement('ul'); na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.className = 'tabmenu'; li.appendChild(na); li.appendChild(mn); tabset.appendChild(li); return li; } //First loads

// new tab functions

//--- /* like submitting the URL http://en.wikisource.org/w/index.php?title=&action=purge */ function addpurge { ta['ca-purge'] = ['g', 'Purge the internal cache for this page']; if(!document.getElementById) return; var x = document.getElementById('ca-history'); var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(!x) return; if(x.children) x = x.children[0]; else x = x.childNodes[0]; addlilink(tabs, x.href.replace(/=history/, "=purge"), 'purge', 'ca-purge'); } function dyk_talkNo { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += ""; f.wpSummary.value = "This article was selected for DYK!" }

function sdelete_redirect { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += "\n"; t.value += ""; f.wpSummary.value = "add sdelete for unneeded redirect" }

// adds various tabs and menu tabs function add_tabs { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; var username=document.getElementById("pt-userpage").textContent; // Only add for pages with "Editing " somewhere in the title if (document.title.indexOf("Editing ") != -1) {    // addlimenu(tabs, 'add tags', 'tagsMM'); // var tagsMM = document.getElementById('tagsMM').getElementsByTagName('ul')[0]; addlilink(tabs,'javascript:sdelete_redirect','sdelete','sd-11'); // addlilink(tagsMM,'javascript:dyk_talkNo','dyk'); } }

$(Mainfast) function Mainfast {   add_tabs; addpurge; } //