User:JJMC89/common.js

/*** Import Local Scripts ***/ importScript('MediaWiki:Gadget-protectionNotices.js'); importScript('MediaWiki:Gadget-SysopTools.js'); importScript('MediaWiki:Gadget-codeBacklinks.js'); importScript('User:JJMC89/AjaxPatrolLinks.js'); importScript('User:JJMC89/ajaxRollback.js'); //importScript('MediaWiki:Gadget-listStyles.js'); //Doesn't seem to work. /*** /Import Local Scripts ***/

/** * Make [rollback] and "blocklink" disappear on Watchlist, RecentChanges, and Contributions. * From User:Technical 13 */ if (wgPageName == "Special:Watchlist" || wgPageName == "Special:RecentChanges" || wgCanonicalSpecialPageName == "Contributions") { $('span.mw-rollback-link').remove; $('span.mw-usertoollinks').each(function {		$(this).children('a:last').replaceWith("-");		$(this).html($(this).html.replace(" | -", ""));	}); }

/* * Add custom delete reasons * Author: Krinkle * File:Krinkle_addDeleteReasons.js * http://meta.wikimedia.org/wiki/User:Krinkle/Scripts/addDeleteReasons * http://meta.wikimedia.org/wiki/User:Krinkle/Scripts/addDeleteReasons.js */ $.getScript( 'http://meta.wikimedia.org/w/index.php?title=User:Krinkle/Scripts/addDeleteReasons.js&action=raw&ctype=text/javascript', function{ krAddDeleteReasons.File( 'Image of an item that never existed' );  krAddDeleteReasons.File( 'Invalid file extension per Naming policy' );

});

/* * Real-Time Recent Changes (RTRC) * Author: Krinkle * File:Krinkle_RTRC.js * http://meta.wikimedia.org/wiki/User:Krinkle/Tools/Real-Time_Recent_Changes * http://meta.wikimedia.org/wiki/User:Krinkle/RTRC.js */ // Disabled for testing. // mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Krinkle/RTRC.js&action=raw&ctype=text/javascript');

/** * What Leaves Here * Author: Krinkle * File:Krinkle_WhatLeavesHere.js * http://meta.wikimedia.org/wiki/User:Krinkle/Tools/WhatLeavesHere * http://meta.wikimedia.org/wiki/User:Krinkle/Tools/WhatLeavesHere.js */ // Disabled for testing. // mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Krinkle/Tools/WhatLeavesHere.js&action=raw&ctype=text/javascript');

/** * Extra buttons in toolbar * Author: Krinkle * File:Krinkle_InsertWikiEditorButton.js * http://meta.wikimedia.org/wiki/User:Krinkle/Scripts/insertVectorButtons * http://meta.wikimedia.org/wiki/User:Krinkle/insertVectorButtons.js */ // Disabled until needed. /*jQuery.getScript('//meta.wikimedia.org/w/index.php?title=User:Krinkle/Scripts/InsertWikiEditorButton.js&action=raw&ctype=text/javascript', function {	// Happy face	krInsertWikiEditorButton({ id: "mw-customeditbutton-myspecialbutton", icon: "//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png", label: 'Insert happy face', insertBefore: '', sampleText: 'Happy face' });	// Monkey	krInsertWikiEditorButton({ id: 'mw-customeditbutton-anotherspecialbutton', icon: '//upload.wikimedia.org/wikipedia/commons/thumb/1/1b/Gnome-face-monkey.svg/22px-Gnome-face-monkey.svg.png', label: 'Insert monkey', insertBefore: '', sampleText: 'Happy face' }); });*/

/** * Modify Sidebar * https://www.mediawiki.org/wiki/Manual:Interface/Sidebar#Add_or_remove_toolbox_sections_.28JavaScript.29 */ function ModifySidebar( action, section, name, link ) { try { switch ( section ) { //			case 'languages': //				var target = 'p-lang'; //				break; case 'toolbox': var target = 'p-tb'; break; //			case 'navigation': //				var target = 'p-navigation'; //				break; case 'navigation': var target = 'p-Site_navigation'; break; case 'forums': var target = 'p-Forums'; break; default: var target = 'p-' + section; break; }		if ( action == 'add' ) { var node = document.getElementById( target ) .getElementsByTagName( 'div' )[0] .getElementsByTagName( 'ul' )[0]; var aNode = document.createElement( 'a' ); var liNode = document.createElement( 'li' ); aNode.appendChild( document.createTextNode( name ) ); aNode.setAttribute( 'href', link ); liNode.appendChild( aNode ); liNode.className = 'plainlinks'; node.appendChild( liNode ); }		if ( action == 'remove' ) { var list = document.getElementById( target ) .getElementsByTagName( 'div' )[0] .getElementsByTagName( 'ul' )[0]; var listelements = list.getElementsByTagName( 'li' ); for ( var i = 0; i < listelements.length; i++ ) { if (					listelements[i].getElementsByTagName( 'a' )[0].innerHTML == name ||					listelements[i].getElementsByTagName( 'a' )[0].href == link				) {					list.removeChild( listelements[i] ); }			}		}	} catch( e ) { // let's just ignore what's happened return; } } function CustomizeModificationsOfSidebar { // adds Special:CategoryTree to toolbox // ModifySidebar( 'add', 'toolbox', 'CategoryTree', 'http://ddowiki.com/page/Special:CategoryTree' ); // removes Special:Upload from toolbox // ModifySidebar( 'remove', 'toolbox', 'Upload file', 'http://ddowiki.com/page/Special:Upload' ); // adds [Special:DoubleRedirects]] to toolbox ModifySidebar( 'add', 'navigation', 'My links', 'http://ddowiki.com/page/User:JJMC89/Links' ); // removes Related changes from toolbox ModifySidebar( 'remove', 'toolbox', 'Related changes' ); // removes Related changes from toolbox ModifySidebar( 'remove', 'toolbox', 'Printable version' ); } addOnloadHook( CustomizeModificationsOfSidebar );