MediaWiki
Gadget-RecentNonAudio.js
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* ************************************************************************** */
/* Edit toolbox ************************************************************ */
/* Sources: [[:mw:Manual:Interface/Sidebar#Add_or_remove_toolbox_sections_(JavaScript)]] */
function ModifySidebar( action, section, name, link ) {
//console.log("1:", action,section, name, link);
try {
var target='';
switch ( section ) {
case 'languages':
target = 'p-lang';
break;
case 'toolbox':
target = 'toolbox'; // mediawiki: "p-tb" ; wikibase: "toolbox" and then remove lines selecting children div and ul
break;
case 'navigation':
target = 'p-navigation';
break;
default:
target = 'p-' + section;
break;
}
if ( action == 'add' ) {
//console.log(action,section, name, link);
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() {
ModifySidebar( "add", "toolbox", "Recent (non-audio)", mw.util.getUrl( 'Special:RecentChanges', { limit: 2500, namespace: 0, invert: 1 } ) );
}
$( CustomizeModificationsOfSidebar );