User:Nakon/monobook.js

// Variables Begin Here popupAdminLinks=true; // Variables End Here

// Include here mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Mr.Z-man/closeAFD.js&action=raw&ctype=text/javascript'); mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Timotheus Canens/spihelper.js&action=raw&ctype=text/javascript'); mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:MusikAnimal/userRightsManager.js&action=raw&ctype=text/javascript'); // End include

// JS Functions Begin Here

function tnaddlilink(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; }

function testn(number) { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value += " ~" + "~" + "~" + "~"; f.wpSummary.value = "adding template: " + number; document.forms[0].wpSave.click; }

function testb(blockType) { if ( blockType == 1 ) { document.forms[0].wpBlockReason.value = "Vandalism"; document.forms[0].wpBlockOther.value = "31 hours"; } else if ( blockType == 2 ) { document.forms[0].wpBlockReason.value = "Vandalism-only account"; document.forms[0].wpBlockOther.value = "indefinite"; }  else if ( blockType == 3 ) { document.forms[0].wpBlockReason.value = "user..."; document.forms[0].wpBlockOther.value = "indefinite"; } else if ( blockType == 4 ) { document.forms[0].wpBlockReason.value = "user..."; document.forms[0].wpBlockOther.value = "indefinite"; document.forms[0].wpAllowUsertalk.value = ""; document.forms[0].wpEmailBan.value = "1"; document.forms[0].wpEmailBan.checked = true; } else if ( blockType == 5 ) { document.forms[0].wpBlockReason.value = ""; document.forms[0].wpBlockOther.value = "indefinite"; document.forms[0].wpEnableAutoblock.value = "0"; document.forms[0].wpEnableAutoblock.checked = false; document.forms[0].wpCreateAccount.value = "0"; document.forms[0].wpCreateAccount.checked = false; } else if ( blockType == 6 ) { document.forms[0].wpBlockReason.value = ""; document.forms[0].wpBlockOther.value = "indefinite"; } else if ( blockType == 7 ) { document.forms[0].wpBlockReason.value = ""; document.forms[0].wpBlockOther.value = "indefinite"; } document.forms[0].wpBlock.click; }

function addBlockTabs { var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0]; if ( document.title.indexOf("Block user") != -1 ) { tabs.appendChild(tnaddlilink('javascript:testb(2)',"voa-indef")); tabs.appendChild(tnaddlilink('javascript:testb(1)',"v-31")); tabs.appendChild(tnaddlilink('javascript:testb(3)',"user...")); tabs.appendChild(tnaddlilink('javascript:testb(4)',"user... (no email/talk)")); tabs.appendChild(tnaddlilink('javascript:testb(5)',"unb")); tabs.appendChild(tnaddlilink('javascript:testb(6)',"unhb")); tabs.appendChild(tnaddlilink('javascript:testb(7)',"unsb")); } }

function addTestnTabs { 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) { var tabContentArray = [ 'test1', 'test2', 'test2a', 'test3', 'test4', 'test5', 'bv', 'uw-create1', 'uw-create2', 'uw-create3', 'uw-create4', 'uw-vaublock', 'uw-ublock', 'uw-uhblock', 'uw-spamublock', 'uw-voablock' ]; var tabTitleArray = [ 't1', 't2', 't2a', 't3', 't4', 't5', 'bv', 'c1', 'c2', 'c3', 'c4', 'vau', 'unsb', 'unhb', 'spam', 'voa' ]; for ( i = 0; i < tabContentArray.length; i++ ) { tabs.appendChild( tnaddlilink( 'javascript:testn("' + tabContentArray[i] + '")', tabTitleArray[i] ) ); }	} }

function addDelTabs { var hist; var url; if (!(hist = document.getElementById('ca-history') )) return; // Only on pages with a history tab url = hist.getElementsByTagName('a')[0]; url = url.href; var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0]; var delContentArray = [ 'G11: Unambiguous advertising or promotion', 'A7: No indication that the article may meet guidelines for inclusion', 'G6: Housekeeping, technical maintenance', 'G1: Patent Nonsense', 'G3: Blatant hoax', 'G3: Blatant Vandalism', 'G8: Page dependent on a deleted or nonexistent page', 'G13: Abandoned Article for creation – to retrieve it, see WP:REFUND/G13', 'Expired PROD', 'Expired BLPPROD' ]; var delTitleArray = [ 'g11', 'a7', 'g6', 'g1', 'g3h', 'g3v', 'g8', 'g13', 'xp', 'xpb' ]; for ( i = 0; i < delContentArray.length; i++ ) { tabs.appendChild( tnaddlilink( url.replace(/([?&]action=)history([&#]|$)/, '$1delete&submitdelete=true&wpReason=' ) + delContentArray[i], delTitleArray[i] ) ); } }

function duplicateTabs { var tabs = document.getElementById('p-cactions').cloneNode(true); tabs.id = 'mytabs'; var listitems = tabs.getElementsByTagName('LI'); for (i=0;i<listitems.length;i++) { if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id; }   content = document.getElementById("content");    // Find the content div content.parentNode.insertBefore(tabs, content.nextSibling);   // Place tab list right after content div };

// Remove pre-filled deletion reason if (queryString("submitdelete") != "true" ) { addOnloadHook(function{ var x; if (x=document.getElementById('wpReason')) {x.value='';} }); }

// Jude's Automagic Deletion function automagicDel{ if(queryString("submitdelete")=="true") document.forms[0].wpConfirmB.click; }; function queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) {} }	return null; }; // End Jude's Automagic Deletion

function automagicUb { if(queryString("autounblock")=="true") document.forms[0].wpBlock.click; }

// Onload Hooks $(addTestnTabs); $(addBlockTabs); $(addDelTabs); $(duplicateTabs); $(automagicDel); $(automagicUb);