Temporary diagnostic v7 for Bharat Mitra menu, will be reverted
Tags: Reverted Mobile edit Mobile web edit Advanced mobile edit
Temporary diagnostic v8 for Bharat Mitra loading, will be reverted
Tags: Reverted Mobile edit Mobile web edit Advanced mobile edit
Line 3: Line 3:
mw.loader.load( 'ext.gadget.UserStats' );
mw.loader.load( 'ext.gadget.UserStats' );


/* BM-DIAG7-START */
/* BM-DIAG8-START */
$( function () {
$( function () {
if ( mw.config.get( 'wgPageName' ) !== 'Narendra_Modi_and_the_Dawoodi_Bohra_community' ) { return; }
if ( mw.config.get( 'wgPageName' ) !== 'Narendra_Modi_and_the_Dawoodi_Bohra_community' ) { return; }
Line 9: Line 9:
box.id = 'bm-diag-box';
box.id = 'bm-diag-box';
box.style.cssText = 'position:fixed;top:0;left:0;z-index:99999;background:#ffffff;color:#000000;font-size:13px;padding:10px;border:3px solid red;max-width:95%;word-break:break-all;';
box.style.cssText = 'position:fixed;top:0;left:0;z-index:99999;background:#ffffff;color:#000000;font-size:13px;padding:10px;border:3px solid red;max-width:95%;word-break:break-all;';
box.textContent = 'BM-DIAG7: working';
box.textContent = 'BM-DIAG8: working';
document.body.appendChild( box );
document.body.appendChild( box );
var lines = [];
function show() { box.textContent = 'BM-DIAG8: ' + lines.join( ' ;; ' ); }
// which registry did this page use?
var startupUrl = null;
try {
performance.getEntriesByType( 'resource' ).forEach( function ( e ) {
if ( e.name.indexOf( 'modules=startup' ) !== -1 ) { startupUrl = e.name; }
} );
} catch ( e0 ) {}
if ( startupUrl ) {
fetch( startupUrl, { credentials: 'same-origin' } ).then( function ( r ) { return r.text(); } ).then( function ( txt ) {
var idx = txt.indexOf( 'ext.gadget.BharatMitra"' );
var seg = idx >= 0 ? txt.substr( idx, 120 ) : 'notfound';
lines.push( 'pageRegistry=' + seg );
show();
} ).catch( function ( e1 ) { lines.push( 'pageRegistryErr=' + e1 ); show(); } );
}
// force the load and watch the outcome
var settled = 'pending';
try {
mw.loader.load( 'ext.gadget.BharatMitra' );
mw.loader.using( 'ext.gadget.BharatMitra' ).then( function () { settled = 'usingDone'; }, function ( e ) { settled = 'usingFail:' + ( e && e.message ? e.message : e ); } );
} catch ( e2 ) { settled = 'threw:' + e2; }
setTimeout( function () {
setTimeout( function () {
function st( name ) {
lines.push( 'loadOutcome=' + settled );
try { return mw.loader.getState( name ); } catch ( e ) { return 'EXC:' + e; }
lines.push( 'BMstate=' + mw.loader.getState( 'ext.gadget.BharatMitra' ) );
}
lines.push( 'coreState=' + mw.loader.getState( 'ext.gadget.BharatMitra-core' ) );
var lines = [];
var fetches = [];
lines.push( 'BM=' + st( 'ext.gadget.BharatMitra' ) );
try {
lines.push( 'notify=' + st( 'mediawiki.notify' ) );
performance.getEntriesByType( 'resource' ).forEach( function ( e ) {
lines.push( 'api=' + st( 'mediawiki.api' ) );
if ( e.name.indexOf( 'BharatMitra' ) !== -1 ) { fetches.push( e.name.slice( 0, 160 ) ); }
lines.push( 'util=' + st( 'mediawiki.util' ) );
} );
lines.push( 'mwNotifyType=' + typeof ( mw && mw.notify ) );
} catch ( e3 ) {}
lines.push( 'bmFetches=' + ( fetches.length ? fetches.join( ' | ' ) : 'none' ) );
lines.push( 'pageHasBharatMitraText=' + ( document.body.innerHTML.indexOf( 'Bharat Mitra' ) !== -1 ) );
lines.push( 'pageHasBharatMitraText=' + ( document.body.innerHTML.indexOf( 'Bharat Mitra' ) !== -1 ) );
box.textContent = 'BM-DIAG7: ' + lines.join( ' ;; ' );
show();
}, 6000 );
}, 12000 );
} );
} );
/* BM-DIAG7-END */
/* BM-DIAG8-END */

Revision as of 02:31, 21 November 2026

mw.loader.load('https://en.bharatpedia.org/w/index.php?title=MediaWiki:Gadget-OneClickArchiver.js&action=raw&ctype=text/javascript&maxage=0&smaxage=0&t=' + Date.now());
mw.loader.load( 'ext.gadget.BharatMitra' );
mw.loader.load( 'ext.gadget.UserStats' );

/* BM-DIAG8-START */
$( function () {
	if ( mw.config.get( 'wgPageName' ) !== 'Narendra_Modi_and_the_Dawoodi_Bohra_community' ) { return; }
	var box = document.createElement( 'div' );
	box.id = 'bm-diag-box';
	box.style.cssText = 'position:fixed;top:0;left:0;z-index:99999;background:#ffffff;color:#000000;font-size:13px;padding:10px;border:3px solid red;max-width:95%;word-break:break-all;';
	box.textContent = 'BM-DIAG8: working';
	document.body.appendChild( box );
	var lines = [];
	function show() { box.textContent = 'BM-DIAG8: ' + lines.join( ' ;; ' ); }
	// which registry did this page use?
	var startupUrl = null;
	try {
		performance.getEntriesByType( 'resource' ).forEach( function ( e ) {
			if ( e.name.indexOf( 'modules=startup' ) !== -1 ) { startupUrl = e.name; }
		} );
	} catch ( e0 ) {}
	if ( startupUrl ) {
		fetch( startupUrl, { credentials: 'same-origin' } ).then( function ( r ) { return r.text(); } ).then( function ( txt ) {
			var idx = txt.indexOf( 'ext.gadget.BharatMitra"' );
			var seg = idx >= 0 ? txt.substr( idx, 120 ) : 'notfound';
			lines.push( 'pageRegistry=' + seg );
			show();
		} ).catch( function ( e1 ) { lines.push( 'pageRegistryErr=' + e1 ); show(); } );
	}
	// force the load and watch the outcome
	var settled = 'pending';
	try {
		mw.loader.load( 'ext.gadget.BharatMitra' );
		mw.loader.using( 'ext.gadget.BharatMitra' ).then( function () { settled = 'usingDone'; }, function ( e ) { settled = 'usingFail:' + ( e && e.message ? e.message : e ); } );
	} catch ( e2 ) { settled = 'threw:' + e2; }
	setTimeout( function () {
		lines.push( 'loadOutcome=' + settled );
		lines.push( 'BMstate=' + mw.loader.getState( 'ext.gadget.BharatMitra' ) );
		lines.push( 'coreState=' + mw.loader.getState( 'ext.gadget.BharatMitra-core' ) );
		var fetches = [];
		try {
			performance.getEntriesByType( 'resource' ).forEach( function ( e ) {
				if ( e.name.indexOf( 'BharatMitra' ) !== -1 ) { fetches.push( e.name.slice( 0, 160 ) ); }
			} );
		} catch ( e3 ) {}
		lines.push( 'bmFetches=' + ( fetches.length ? fetches.join( ' | ' ) : 'none' ) );
		lines.push( 'pageHasBharatMitraText=' + ( document.body.innerHTML.indexOf( 'Bharat Mitra' ) !== -1 ) );
		show();
	}, 12000 );
} );
/* BM-DIAG8-END */