User:Mikevoir/global.js

window.dev = window.dev || {};

/**** * * Standalone dev scripts * importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:AjaxBatchDelete.js',        'u:dev:MediaWiki:Bang.js',        'u:dev:MediaWiki:FileUsageAuto-update/code.js',        'u:dev:MediaWiki:LastEdited/code.js',        'u:dev:MediaWiki:MassRename/code.js',        'u:dev:MediaWiki:MassNullEdit/code.js',        'u:dev:MediaWiki:PurgeButton.js',        'u:dev:MediaWiki:Wikimarks/code.js',    ] });

/**** * * Standalone user scripts * // Not necessary for rest of scripts but just if I wanna use it here importScriptPage('User:Mikevoir/betterLinkSuggest.js', 'community'); importScriptPage('User:Mikevoir/betterDiff.js', 'community'); importScriptPage('User:Mikevoir/betterCodeMirror.js', 'community'); importScriptPage('User:Mikevoir/SourceTemplateData.js', 'community'); // importScriptPage('User:Mikevoir/sandbox.js', 'community'); // Script for testing

/**** * * Snippets * // Dependencies var config = mw.config.get(['wgDiffNewId', 'wgAction', 'wgCanonicalSpecialPageName']); importScriptPage('User:Mikevoir/lib.js', 'community');

// Attempt to run $.when(window.dev._LIB).then(function{	lib = window.dev._LIB;	if	( config.wgCanonicalSpecialPageName == 'Recentchanges' || config.wgDiffNewId || config.wgAction == 'history' ) {		lib.waitFor('.mw-thanks-thank-link', noThank);		// start observing for RC reloads		if (config.wgCanonicalSpecialPageName == 'Recentchanges') {			var observer = new MutationObserver(function (mutations, me) { if (					mutations[0] &&					mutations[0].target &&					mutations[0].target.classList.contains('mw-rcfilters-ui-changesListWrapperWidget')				) {noThank;} });			observer.observe(document.querySelector('.mw-changeslist'), { childList: true, subtree: true });		}	} });

// No thanks function noThank { document.querySelectorAll('.mw-thanks-thank-link').forEach(function(el) {		if (el.parentNode.nodeName === 'SPAN'){			el.parentNode.remove;		}else{			if ( el.previousSibling.data === '( ' && el.nextSibling.data === ' )' ) {				el.nextSibling.remove;				el.previousSibling.remove;			}			el.remove;		}	}); }