Jump to content

User:Czar/hideClosedFFD.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Czar (talk | contribs) at 19:32, 23 July 2016 (Based on User:Mr.Z-man/hideClosedAFD). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Based on [[User:Mr.Z-man/hideClosedAFD]]

mw.loader.using( ['mediawiki.util'], function() {
	
	if ((mw.config.get('wgPageName').indexOf('Wikipedia:Files_for_deletion/Log/') != -1) && (mw.config.get('wgAction') == 'view')) {
		$(document).ready( function () {
			mw.util.addPortletLink( 'p-cactions', '#', 'Hide closed', 'ca-hideClosed', "Hide closed discussions" );
			mw.util.addPortletLink( 'p-cactions', '#', 'Show closed', 'ca-showClosed', "Show closed discussions" );
			$('#ca-showClosed').hide();
			
			$('#ca-hideClosed').on('click', function() {
				$(".boilerplate.ffd.vfd.xfd-closed").hide();
				$('#ca-showClosed').show();
				$('#ca-hideClosed').hide();
				return false;
			});
			
			$('#ca-showClosed').on('click', function() {
				$(".boilerplate.ffd.vfd.xfd-closed").show();
				$('#ca-showClosed').hide();
				$('#ca-hideClosed').show();
				return false;
			});
			
		} );
	}	
});