User:Epicgenius/ShushChanges.js

//Derived from User:Alexis Jazz/ShushChanges. //ShushChanges (w:en:User:Alexis Jazz/ShushChanges) is a userscript that adds a text input to Special:RecentChanges and Special:Watchlist. Usernames can be entered (comma separated) and their changes will vanish from RecentChanges/Watchlist. //ShushChanges is public domain, irrevocably released as WTFPL Version 2[www.wtfpl.net/about/] by its author, Alexis Jazz. // /*globals $:false,mw:false,OO:false*/ if ( mw.config.get('wgCanonicalNamespace') == 'Special' && ['Watchlist','Recentchanges','Recentchangeslinked'].includes(mw.config.get('wgCanonicalSpecialPageName')) ) { window.ShushC = {}; var ShushC = window.ShushC; ShushC.userInput = new OO.ui.TextInputWidget( {	placeholder:'mute,users,example1,example2',	value:(mw.storage.get('ShushC') || '' ),	spellcheck:false,	id:'ShushCInput' }); ShushC.userInput.on('change',function{ShushC.filter;}); ShushC.uiClass = '.mw-rcfilters-ui-filterTagMultiselectWidget-wrapper-top-queryName'; ShushC.timeout = 0; var addInput = setInterval(function (int) {	if ( $(ShushC.uiClass)[0] || ShushC.timeout > 50 ) {		clearInterval(addInput);		$(ShushC.uiClass).append(ShushC.userInput.$element);						$('#ShushCInput input').on('mousedown',function(event){event.stopPropagation;});	}	ShushC.timeout++; },100); mw.util.addCSS('.ShushCHide{display:none !important}#ShushCInput input{width:25em}#ShushCInput{margin-left:auto;margin-right:auto}'); ShushC.filter = function(i) { "use strict"; if ( ShushC.userInput.getValue == '' ) { mw.storage.remove('ShushC'); return; }	mw.storage.set('ShushC',ShushC.userInput.getValue); ShushC.changesLines = $('.mw-changeslist:eq(0) ul.special:eq(0) li.mw-changeslist-line'); ShushC.muteUsers = ShushC.userInput.getValue.split(','); for(i=0;i<ShushC.changesLines.length;i++) { if ( ShushC.muteUsers.includes(ShushC.changesLines[i].querySelectorAll('.mw-userlink')[0].innerText) ) { ShushC.changesLines[i].classList.add('ShushCHide'); } else { ShushC.changesLines[i].classList.remove('ShushCHide'); }	} }; ShushC.filter; } //