User:Fetofs/scripts/tabs.js

//

///////////////////////////////////////////////////////////////////////////////////////////////////////// // Tabs by Korath - (http://en.wikipedia.org/wiki/User:Korath) /////////////////////////////////////////////////////////////////////////////////////////////////////////

function addlilink(url, name) { var na = document.createElement('a'); na.setAttribute('href', url); var txt = document.createTextNode(name); na.appendChild(txt); var li = document.createElement('li'); li.appendChild(na); return li; }

// appends msg to the currently-edited page, sets the summary to summ, // and marks or unmarks the Watch this page checkbox according to watch. function edit_summary_watch(msg, summ, watch) { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += msg; f.wpSummary.value = summ; // f.wpWatchthis.checked = watch; }

// appends msg to the currently-editted page, sets the summary to summ, // and marks or unmarks the Watch this page checkbox according to watch. function add_del_tag(msg, summ, watch) { var f = document.editform, t = f.wpTextbox1; msg += '\n'; msg += t.value; t.value = msg; f.wpSummary.value = summ; // f.wpWatchthis.checked = watch; } // adds various tabs to call the above function add_tabs { var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

// Only add for pages with "Editing User talk:" somewhere in the title if (document.title.indexOf("Editing User talk:") != -1) { tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"Wel")); tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"We-IP")); //*******************************************************************     tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"S-tst")); tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"T1")); tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"T2")); tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"T3")); tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"T4")); //*******************************************************************     tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"T1a")); tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"T2a")); //*******************************************************************     tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"Bl2")); tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"Bl3")); tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"Bl4")); //*******************************************************************      tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"Obsc")); //*******************************************************************     tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"Usr2")); tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"Usr4")); //*******************************************************************     tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"Npa")); tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"Npa3")); //*******************************************************************     tabs.appendChild(addlilink('javascript:edit_summary_watch(" -- ~" + "~" + "~" + "~", "", true, 1)',"cpvio")); }

if (document.title.indexOf("Editing User talk:") == -1 && document.title.indexOf("Editing User:") == -1 && document.title.indexOf("Editing ") == 0) { tabs.appendChild(addlilink('javascript:add_del_tag("", "", true, 1)',"d")); tabs.appendChild(addlilink('javascript:add_del_tag("", "", true, 1)',"db")); tabs.appendChild(addlilink('javascript:add_del_tag("", "", true, 1)',"dv")); tabs.appendChild(addlilink('javascript:add_del_tag("", "", true, 1)',"nc")); tabs.appendChild(addlilink('javascript:add_del_tag("", "", true, 1)',"attack")); tabs.appendChild(addlilink('javascript:add_del_tag("", "", true, 1)',"nonsense")); tabs.appendChild(addlilink('javascript:add_del_tag("", "", true, 1)',"pv")); tabs.appendChild(addlilink('javascript:edit_summary_watch("", "stubify", false, 1)',"stub")); }

if (document.title.indexOf("Editing") != 0) {        } }

if (window.addEventListener) window.addEventListener("load", add_tabs, false); else if (window.attachEvent) window.attachEvent("onload", add_tabs);

//