User:Bryan/vector.js

/* Hide the nav bar for use on my tablet */

var barHandlers = { hide : function { var content = document.getElementById('content'); content.className = 'full-width'; this.onclick = barHandlers.show; },	show : function { var content = document.getElementById('content'); content.className = ''; this.onclick = barHandlers.hide; } };

addOnloadHook( function {	var bar = document.createElement('div');	bar.id = 'collapse-sidebar';	document.body.appendChild(bar);

if (window.is_safari) { bar.onclick = barHandlers.show; barHandlers.hide; } else { bar.onclick = barHandlers.hide; } } );

/* Add a random button to Special:Code */ addOnloadHook( function {	var script = document.createElement('script');	script.src = 'http://toolserver.org/~bryan/cgi-bin/random_code_rev';	document.body.appendChild(script); } );

function setRandomCodeRev(rev) { if (!document.forms[0].path) return;

var cell = document.forms[0].path.parentNode;

var offset = document.createElement('input'); offset.type = 'hidden'; offset.name = 'offset'; offset.value = rev;

var random = document.createElement('button'); random.appendChild(document.createTextNode('Random!')); cell.appendChild(random);

random.onclick = function { cell.appendChild(offset); document.forms[0].title.value = 'Special:Code/MediaWiki/status/new'; document.forms[0].submit; } }

/* Get rid of the support desk header */ function collapseSupportDeskHeader { var header = document.getElementById( 'supportdesk-header' ); if ( header ) { header.style.height = '2.5em'; header.style.paddingBottom = '8px'; header.style.overflow = 'hidden'; header.style.borderBottom = '1px solid #AAAAAA';

header.onclick = uncollapseSupportDeskHeader; } } function uncollapseSupportDeskHeader { var header = document.getElementById( 'supportdesk-header' ); if ( header ) { header.style.cssText = '';

header.onclick = collapseSupportDeskHeader; } }

addOnloadHook( collapseSupportDeskHeader );

/* My commits */ addOnloadHook( function { var c = document.getElementById( 'pt-logout' ); var li = document.createElement( 'li' ); var a = document.createElement( 'a' ); a.href = '/wiki/Special:Code/MediaWiki/author/btongminh'; a.appendChild( document.createTextNode( 'My commits' ) ); li.appendChild( a ); c.parentNode.insertBefore( li, c ); } );