User:Kuhlau/global.js

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:PageCreator/code2.js',    	'u:dev:MediaWiki:LastEdited/code.js',        'u:dev:MediaWiki:UTCClock/code.js',        'u:dev:MediaWiki:View_Source/code.js',        'u:dev:MediaWiki:CodeQuickLinks/code.js',    	'u:dev:MediaWiki:CategoryQuickRemove.js',    	'u:dev:MediaWiki:MinimalTemplateClassification.js',        'u:dev:MediaWiki:TemplatesUsedModule.js',        'u:dev:MediaWiki:MobileEdittools.js',        'u:dev:MediaWiki:UCXSearchBar.js',        'u:dev:MediaWiki:DataTables.js',        'u:dev:MediaWiki:BlockSummary.js',        'u:dev:MediaWiki:OriginalImages.js',        'u:dev:MediaWiki:InterwikisOnSpecialPages.js',        'u:dev:MediaWiki:ListFiles/code.js',        'u:dev:MediaWiki:MassNullEdit/code.js',        'u:dev:MediaWiki:GlobalFileUsage.js',        'u:dev:MediaWiki:CatNav/code.js',    ] });

/* commas in edit count */ $(function { var selector = '#userProfileApp .user-identity-stats strong';  function prettify(strongs) {    strongs.forEach(function(strong, i) { var text = strong.textContent; if (text.length > 3 && text.indexOf(',') === -1) { strong.textContent = parseInt(text).toLocaleString('en', {useGrouping:true}); }   })  }  mw.hook('wikipage.content').add(function($content) { var strongs = document.querySelectorAll(selector); if (strongs.length) { prettify(strongs); } else { // alternatively, run a setInterval or setTimeout. new MutationObserver(function(mutations, observer) {       var strongs = document.querySelectorAll(selector);        if (strongs.length) {          observer.disconnect;          prettify(strongs);        }      }).observe(document.querySelector('.page__main'), {        childList: true, // observe direct children        subtree: true, // and lower descendants too      }); } }); });

// Hide blank link suggestion popup as fandom cant be bothered to fix it function noBlankLinkSuggest { var parent = document.querySelector('.wikiEditor-ui-linkSuggest'); if (parent) { var targetNode = parent.querySelector('.oo-ui-selectWidget'); // console.log(targetNode); var hideIfBlank = function(mutations) { mutations.forEach(function(mutation){				var node = mutation.target;				if (node.childElementCount == 0) {					parent.classList.add('oo-ui-element-hidden');				}			}); };		var observer = new MutationObserver(hideIfBlank); observer.observe(targetNode, { childList: true }); } }