User:HighInBC/monobook.js: Difference between revisions
Appearance
Content deleted Content added
see if this old code still works |
ffs that is annoying, I hope this gets rid of it |
||
Line 51: | Line 51: | ||
} |
} |
||
addOnloadHook(diff_only_buttons) |
addOnloadHook(diff_only_buttons) |
||
// Suppress that annoying media viewer |
|||
mw.config.set("wgMediaViewerOnClick", false); |
Revision as of 17:40, 14 July 2014
// This code does an asynchronous check to see if there are any pages or files in
// "Category:Candidates for speedy deletion as attack pages" and if there are will
// place a big red button in the navigation window to take me there. It is my hopes
// that this can reduce the time that attack pages are present.
addOnloadHook(function () {
mw.loader.using( 'mediawiki.api', function () {
( new mw.Api() ).get( {
action: 'query',
prop: 'categoryinfo',
titles: 'Category:Candidates for speedy deletion as attack pages'
} ).done( function ( data ) {
var attackExists = data.query.pages[38838529].categoryinfo.files ||
data.query.pages[38838529].categoryinfo.pages;
if( attackExists ) {
mw.util.addPortletLink(
'p-navigation',
wgServer+wgScriptPath+'/index.php?title=Category:Candidates for speedy deletion as attack pages',
'Attack page!',
'attackNotification'
);
attackNotification.children[0].style = 'background-color:red;color:white;font-weight:bold;';
}
} );
} );
});
// Adds "Diff only" buttons to diff pages so you can see the changes without viewing the whole text(great for ANI)
// To comply with GFDL license when you copy this, copy the url in the "Permanent link" button and use it as your
// edit summary when you add it to your monobook.js
function diff_only_buttons()
{
handle_diff('differences-prevlink');
handle_diff('differences-nextlink');
function handle_diff(diff_id)
{
var link = document.getElementById(diff_id);
if (link == null)
{
return false;
}
var diff_only = document.createElement('a');
diff_only.id = diff_id;
diff_only.href = link.href + '&diffonly=1';
diff_only.appendChild(document.createTextNode(' - (Diff only)'));
link.parentNode.appendChild(diff_only);
return true;
}
}
addOnloadHook(diff_only_buttons)
// Suppress that annoying media viewer
mw.config.set("wgMediaViewerOnClick", false);