Temporary diagnostic for Bharat Mitra menu, will be reverted
Tags: Reverted Mobile edit Mobile web edit Advanced mobile edit
Temporary diagnostic v2 for Bharat Mitra menu, 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-DIAG-START */
/* BM-DIAG2-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; }
var out = [];
out.push( 'ns=' + mw.config.get( 'wgNamespaceNumber' ) );
out.push( 'isRedirect=' + mw.config.get( 'wgIsRedirect' ) );
out.push( 'gadgetState=' + mw.loader.getState( 'ext.gadget.BharatMitra' ) );
var urls = [];
try {
performance.getEntriesByType( 'resource' ).forEach( function ( e ) {
if ( e.name.indexOf( 'load.php' ) !== -1 && e.name.indexOf( 'BharatMitra' ) !== -1 ) { urls.push( e.name ); }
} );
} catch ( err ) {}
out.push( 'moduleUrls=' + ( urls.join( ' | ' ) || 'none' ) );
var box = document.createElement( 'div' );
var box = document.createElement( 'div' );
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:14px;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-DIAG: ' + out.join( ' ;; ' );
box.textContent = 'BM-DIAG2: working';
document.body.appendChild( box );
document.body.appendChild( box );
var target = null;
var skin = mw.config.get( 'skin' );
urls.forEach( function ( u ) { if ( u.indexOf( 'only=scripts' ) !== -1 ) { target = u; } } );
var lines = [];
if ( !target && urls.length ) { target = urls[ 0 ]; }
try {
if ( target ) {
var foundStore = false;
fetch( target, { credentials: 'same-origin' } ).then( function ( r ) { return r.text(); } ).then( function ( txt ) {
for ( var i = 0; i < localStorage.length; i++ ) {
box.textContent += ' ;; FETCHED len=' + txt.length + ' hasArchivebot=' + ( txt.indexOf( 'archivebot' ) !== -1 ) + ' hasLabel=' + ( txt.indexOf( 'Request archive links' ) !== -1 );
var k = localStorage.key( i );
} ).catch( function ( e ) { box.textContent += ' ;; FETCH FAILED ' + e; } );
if ( k && k.indexOf( 'ModuleStore' ) !== -1 ) {
}
foundStore = true;
var v = localStorage.getItem( k ) || '';
lines.push( 'storeKey=' + k + ' len=' + v.length + ' storeHasArchivebot=' + ( v.indexOf( 'archivebot' ) !== -1 ) );
}
}
if ( !foundStore ) { lines.push( 'storeKey=none' ); }
} catch ( e ) { lines.push( 'storeErr=' + e ); }
box.textContent = 'BM-DIAG2: ' + lines.join( ' ;; ' );
fetch( '/w/load.php?lang=en&modules=startup&only=scripts&skin=' + skin, { cache: 'no-store', 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, 320 ) : 'notfound';
box.textContent += ' ;; STARTUP seg=' + seg.replace( /\s+/g, ' ' );
return fetch( '/w/load.php?lang=en&modules=ext.gadget.BharatMitra&only=scripts&skin=' + skin, { cache: 'no-store', credentials: 'same-origin' } );
} )
.then( function ( r ) { return r.text(); } )
.then( function ( txt ) {
box.textContent += ' ;; MODULE len=' + txt.length + ' hasArchivebot=' + ( txt.indexOf( 'archivebot' ) !== -1 ) + ' hasLabel=' + ( txt.indexOf( 'Request archive links' ) !== -1 );
} )
.catch( function ( e ) { box.textContent += ' ;; ERR ' + e; } );
} );
} );
/* BM-DIAG-END */
/* BM-DIAG2-END */

Revision as of 19:46, 20 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-DIAG2-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-DIAG2: working';
	document.body.appendChild( box );
	var skin = mw.config.get( 'skin' );
	var lines = [];
	try {
		var foundStore = false;
		for ( var i = 0; i < localStorage.length; i++ ) {
			var k = localStorage.key( i );
			if ( k && k.indexOf( 'ModuleStore' ) !== -1 ) {
				foundStore = true;
				var v = localStorage.getItem( k ) || '';
				lines.push( 'storeKey=' + k + ' len=' + v.length + ' storeHasArchivebot=' + ( v.indexOf( 'archivebot' ) !== -1 ) );
			}
		}
		if ( !foundStore ) { lines.push( 'storeKey=none' ); }
	} catch ( e ) { lines.push( 'storeErr=' + e ); }
	box.textContent = 'BM-DIAG2: ' + lines.join( ' ;; ' );
	fetch( '/w/load.php?lang=en&modules=startup&only=scripts&skin=' + skin, { cache: 'no-store', 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, 320 ) : 'notfound';
			box.textContent += ' ;; STARTUP seg=' + seg.replace( /\s+/g, ' ' );
			return fetch( '/w/load.php?lang=en&modules=ext.gadget.BharatMitra&only=scripts&skin=' + skin, { cache: 'no-store', credentials: 'same-origin' } );
		} )
		.then( function ( r ) { return r.text(); } )
		.then( function ( txt ) {
			box.textContent += ' ;; MODULE len=' + txt.length + ' hasArchivebot=' + ( txt.indexOf( 'archivebot' ) !== -1 ) + ' hasLabel=' + ( txt.indexOf( 'Request archive links' ) !== -1 );
		} )
		.catch( function ( e ) { box.textContent += ' ;; ERR ' + e; } );
} );
/* BM-DIAG2-END */