User:Pcj/common.js

// LookupUser fixes $(function {	if (mw.config.get('wgCanonicalSpecialPageName') !== 'LookupUser') return;	var prom = [];	$('div.lookup-user__table-wrapper > table > tbody > tr > td:nth-child(2) > a:first-child').each(function{ var baseUrl = $(this).text.trim; prom.push($.getJSON(baseUrl+'api.php?action=query&meta=siteinfo&sipropr=variables&format=json&callback=?')); });	Promise.allSettled(prom).then(function(res) { for (var i in res) { if (res[i].status !== 'rejected') continue; // just assume if we have an error the wiki is closed. // does not consider further in the event the wiki is *otherwise* unreachable, // possible exceptions: behind the VPN, some error state in the API, server error, etc.			$('div.lookup-user__table-wrapper > table > tbody > tr:eq('+i+') > td:nth-child(1)').wrapInner(' ').append(' Closed '); }	}); });

// WikiConfig fixes mw.loader.using('jquery.makeCollapsible').then(function{	if (mw.config.get('wgCanonicalSpecialPageName') !== 'WikiConfig') return;	console.log('test');	$('.wikiconfig-changelog-table tr').each(function { if ($(this).find('.TablePager_col_cl_text .v1').text.length < 500 	   	&& $(this).find('.TablePager_col_cl_text .v2').text.length < 500	    	&& $(this).find('.TablePager_col_cl_text > pre').text.length < 500) return; $(this).find('.v1,.v2,pre').wrapAll(' '); });	$('.mw-collapsible').makeCollapsible; });