User:RhinosF1/global.js

mw.loader.load('//meta.miraheze.org/w/index.php?title=MediaWiki:UserInfo.js&action=raw&ctype=text/javascript'); function parseHttpHeaders( httpHeaders ) { return httpHeaders.split( "\n" ).map( function ( x ) {         return x.split(/: */, 2);   } ).filter( function ( x ) {          return x[0];   } ).reduce( function ( ac, x ) {          ac[x[0]] = x[1];          return ac;   }, {} ); }

var req = new XMLHttpRequest; req.open( 'GET', document.location, false ); req.send( null );

var headers = parseHttpHeaders(req.getAllResponseHeaders);

function showBackendPerformance { var respTime = mw.config.get( 'wgBackendResponseTime' ), backend = 'PHP7', server = mw.config.get( 'wgHostname' ), cp = headers['x-served-by'].replace( /.miraheze.org|^mw[0-9]+|\s|,/g, '' ), dbname = mw.config.get( 'wgDBname' ), caption = respTime.toString + 'ms ( ' + backend + ' via ' + dbname + '@' + server + ' / ' + cp + ')';

if ( mw.config.get( 'skin' ) === 'cosmos' ){ $( '' ).html( caption ).appendTo( '#p-tb ul' ); } else { $( '' ).html( caption ).prependTo( '#p-personal ul' ); } } $( document ).ready( showBackendPerformance );

$.when(mw.loader.using( [ "mediawiki.api" ] )).then( function {    return new mw.Api      .get( { action: "query", meta: "siteinfo", siprop: "statistics", format: "json", } )     .then( function ( data ) { var jobs = data.query.statistics.jobs, caption = 'Queued Jobs: ' + jobs; if ( mw.config.get( 'skin' ) === 'cosmos' ) { $( '').html(caption).appendTo( '#p-tb ul' ); } else { $( '' ).html(caption).prependTo( '#p-personal ul' ); }		} ); } );