User:DannyS712/hide.js
Note: After publishing, 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: Press Ctrl-F5.
$(function (){
// Version 1.22
mw.loader.using( 'mediawiki.util', function () {
$(document).ready( function () {
mw.util.addPortletLink ( 'p-cactions', '', 'Hide', 'ca-hideStuff', 'hide', "'");
$('#ca-hideStuff').on('click', function ( e ) {
e.preventDefault();
hideStuff();
} );
if ( mw.util.getParamValue( 'autohide' ) !== null ) {
hideStuff();
}
} );
} );
function hideStuff() {
const specialPage = mw.config.get('wgCanonicalSpecialPageName');
if ( specialPage !== false ) {
hideOnSpecialPage( specialPage );
return;
}
const action = mw.config.get('wgAction');
switch ( action ) {
case 'history':
// Revisions not waiting to be patrolled
$('.mw-contributions-list > li:not(".row-unpatrolled")').hide();
break;
}
}
function hideOnSpecialPage( page ) {
switch (page) {
case "Allpages":
// Redirects
$('.allpagesredirect').hide();
break;
case "CentralAuth":
// Wikis with 0 edits
$('#mw-content-text tbody > tr').filter( function(){ return (this.children[4].innerText === '0') } ).hide();
break;
case "Contributions":
// Edits that are not awaiting flagged revisions review or unpatrolled using recent changes patrolling
$('ul.mw-contributions-list > li:not(.flaggedrevs-pending):not(:has(abbr.unpatrolled))').hide();
break;
case "PageTranslation":
// Page entries other than those with pending changes to mark for translation
$('h2:has(span#Pages_proposed_for_translation, span#Broken_pages, span#Pages_in_translation)').hide();
$('h2:has(span#Pages_proposed_for_translation, span#Broken_pages, span#Pages_in_translation) + p').hide();
$('h2:has(span#Pages_proposed_for_translation, span#Broken_pages, span#Pages_in_translation) + p + ol').hide();
$('.mw-tpt-sp-section-type-old').hide();
break;
case "Protectedpages":
// Hide redirects
$('table.mw-protectedpages tr:has(.TablePager_col_pr_page a.mw-redirect)').hide();
// Hide indefinitely blocked user's pages
$('table.mw-protectedpages tr:has(.TablePager_col_pr_page a.user-blocked-indef)').hide();
break;
case "LintErrors":
// Lint errors through a template
$('tr:has(td.TablePager_col_template:has(a))').hide();
break;
case "Log":
// New users with 0 edits
$('li.mw-logline-newusers:has(a.mw-usertoollinks-contribs-no-edits)').hide();
if ( mw.config.get('wgDBname') === 'enwiki' ) {
// ST47ProxyBot places too many blocks to make the log usable
$('li.mw-logline-block:has(a.mw-userlink[title="User:ST47ProxyBot"])').hide();
}
break;
case "Newpages":
// 2017 wikitext editor tags
$('.mw-tag-marker-visualeditor-wikitext').hide();
break;
case "Unusedcategories":
// Unused categories that have since been deleted
$('div.mw-spcontent > ol.special > li:has(a.new)').hide();
break;
case "AbuseFilter":
if ( mw.config.get( 'wgDBname' ) === 'enwiki'
&& mw.config.get( 'wgPageName' ) === 'Special:AbuseFilter/history'
) {
// Ignore changes by `ProcBot II`
$('#mw-content-text .mw-datatable tr:has(a[title="User:ProcBot II"])').hide();
}
break;
case "AbuseLog":
if ( mw.config.get( 'wgDBname' ) === 'metawiki' ) {
// The "details" and "examine" links
$('#mw-content-text a:contains("details"), #mw-content-text a:contains("examine")').hide();
}
// Entries without a linked diff
$('#mw-content-text li:not(:has(a:contains("diff")))').hide();
break;
case "SiteMatrix":
// Deleted or non-existent projects, and then any empty rows
$('del, a.new').remove();
$('tr:not(:has(td:not(:empty, :first-child), th))').remove();
break;
case "DisambiguationPageLinks":
// Links from `{Foo}` to `{Foo} (disambiguation)`
$('ol.special > li').filter(function () { return( this.childNodes[0].innerText + ' (disambiguation)' === this.childNodes[4].innerText ); }).hide();
break;
case "Prefixindex":
if ( mw.config.get('wgTitle').indexOf( 'Translations:' ) > -1 ){
// Non-English and non-qqq translation subpages
$('.mw-prefixindex-list > li').filter( function () { return (/\/(?:en|qqq)$/.test( this.innerText ) ); } ).hide();
}
break;
default:
break;
}
}
});