Restore personal JS (4 lines) Tags: Replaced Manual revert |
Temporary Main Page DOM diagnostic Tag: Reverted |
||
| Line 3: | Line 3: | ||
mw.loader.load( 'ext.gadget.UserStats' ); | mw.loader.load( 'ext.gadget.UserStats' ); | ||
mw.loader.load( 'https://en.bharatpedia.org/w/index.php?title=MediaWiki:Gadget-DoubleCatFixer.js&action=raw&ctype=text/javascript&maxage=0&smaxage=0&t=' + Date.now() ); | mw.loader.load( 'https://en.bharatpedia.org/w/index.php?title=MediaWiki:Gadget-DoubleCatFixer.js&action=raw&ctype=text/javascript&maxage=0&smaxage=0&t=' + Date.now() ); | ||
(function () { | |||
'use strict'; | |||
function shortEl( el ) { | |||
if ( !el || el.nodeType !== 1 ) { return 'none'; } | |||
var t = el.tagName || ''; | |||
var i = el.id || ''; | |||
var c = ( el.className && typeof el.className === 'string' ) ? el.className : ''; | |||
return t + ' id=' + ( i || '-' ) + ' class=' + ( c || '-' ); | |||
} | |||
function diag() { | |||
if ( !document.body ) { return; } | |||
var lines = []; | |||
var bar = document.getElementById( 'dcf-mini' ); | |||
lines.push( 'DIAG page: ' + ( document.title || '' ) ); | |||
lines.push( 'DIAG elapsedSec: ' + Math.round( ( Date.now() - window.__dcfDiagStart ) / 1000 ) ); | |||
lines.push( 'DIAG scrollY: ' + ( window.scrollY || window.pageYOffset || 0 ) ); | |||
lines.push( 'DIAG dcfMiniExists: ' + ( bar ? 'true' : 'false' ) ); | |||
if ( bar ) { | |||
var cs = window.getComputedStyle( bar ); | |||
lines.push( 'DIAG barDisplay: ' + cs.display ); | |||
lines.push( 'DIAG barVisibility: ' + cs.visibility ); | |||
var r = bar.getBoundingClientRect(); | |||
lines.push( 'DIAG barTop: ' + Math.round( r.top ) ); | |||
lines.push( 'DIAG barLeft: ' + Math.round( r.left ) ); | |||
lines.push( 'DIAG barWidth: ' + Math.round( r.width ) ); | |||
lines.push( 'DIAG barHeight: ' + Math.round( r.height ) ); | |||
lines.push( 'DIAG barText: ' + ( bar.textContent || '' ).replace( /\s+/g, ' ' ).substring( 0, 120 ) ); | |||
var node = bar.parentNode; | |||
for ( var k = 1; k <= 4 && node; k++ ) { | |||
lines.push( 'DIAG parent' + k + ': ' + shortEl( node ) ); | |||
if ( node.nodeType === 1 ) { | |||
lines.push( 'DIAG parent' + k + 'Display: ' + window.getComputedStyle( node ).display ); | |||
} else { | |||
lines.push( 'DIAG parent' + k + 'Display: (not-an-element)' ); | |||
} | |||
node = node.parentNode; | |||
} | |||
} | |||
var sn = document.getElementById( 'siteNotice' ); | |||
lines.push( 'DIAG siteNoticeExists: ' + ( sn ? 'true' : 'false' ) ); | |||
if ( sn ) { | |||
lines.push( 'DIAG siteNoticeDisplay: ' + window.getComputedStyle( sn ).display ); | |||
lines.push( 'DIAG siteNoticeParent: ' + shortEl( sn.parentNode ) ); | |||
} | |||
var fh = document.getElementById( 'firstHeading' ); | |||
lines.push( 'DIAG firstHeadingExists: ' + ( fh ? 'true' : 'false' ) ); | |||
if ( fh ) { | |||
lines.push( 'DIAG firstHeadingDisplay: ' + window.getComputedStyle( fh ).display ); | |||
lines.push( 'DIAG firstHeadingParent: ' + shortEl( fh.parentNode ) ); | |||
} | |||
lines.push( 'DIAG mwContentTextExists: ' + ( document.getElementById( 'mw-content-text' ) ? 'true' : 'false' ) ); | |||
lines.push( 'DIAG contentExists: ' + ( document.getElementById( 'content' ) ? 'true' : 'false' ) ); | |||
var mbc = document.querySelector( '.mw-body-content' ); | |||
lines.push( 'DIAG mwBodyContentExists: ' + ( mbc ? 'true' : 'false' ) ); | |||
var kids = document.body ? document.body.children : []; | |||
for ( var j = 0; j < 5 && j < kids.length; j++ ) { | |||
lines.push( 'DIAG bodyChild' + ( j + 1 ) + ': ' + shortEl( kids[ j ] ) ); | |||
} | |||
var runRaw = null; | |||
var lockRaw = null; | |||
try { runRaw = window.localStorage.getItem( 'dcf-run-v1' ); } catch ( e ) { runRaw = '(error)'; } | |||
try { lockRaw = window.localStorage.getItem( 'dcf-lock-v1' ); } catch ( e ) { lockRaw = '(error)'; } | |||
lines.push( 'DIAG runState: ' + ( runRaw === null ? 'null' : String( runRaw ).substring( 0, 200 ) ) ); | |||
lines.push( 'DIAG lockState: ' + ( lockRaw === null ? 'null' : String( lockRaw ).substring( 0, 200 ) ) ); | |||
var d = document.getElementById( 'dcf-diag' ); | |||
if ( !d ) { | |||
d = document.createElement( 'div' ); | |||
d.id = 'dcf-diag'; | |||
d.style.cssText = 'border:2px solid #080;background:#fff;padding:10px;margin:10px 0;white-space:pre-wrap;font-family:monospace;'; | |||
document.body.appendChild( d ); | |||
} | |||
d.textContent = lines.join( '\n' ); | |||
} | |||
function start() { | |||
if ( window.__dcfDiagStarted ) { return; } | |||
window.__dcfDiagStarted = true; | |||
window.__dcfDiagStart = Date.now(); | |||
setInterval( diag, 5000 ); | |||
diag(); | |||
} | |||
if ( document.readyState === 'loading' ) { | |||
document.addEventListener( 'DOMContentLoaded', start ); | |||
} else { | |||
start(); | |||
} | |||
}() ); | |||
Revision as of 06:48, 13 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' );
mw.loader.load( 'https://en.bharatpedia.org/w/index.php?title=MediaWiki:Gadget-DoubleCatFixer.js&action=raw&ctype=text/javascript&maxage=0&smaxage=0&t=' + Date.now() );
(function () {
'use strict';
function shortEl( el ) {
if ( !el || el.nodeType !== 1 ) { return 'none'; }
var t = el.tagName || '';
var i = el.id || '';
var c = ( el.className && typeof el.className === 'string' ) ? el.className : '';
return t + ' id=' + ( i || '-' ) + ' class=' + ( c || '-' );
}
function diag() {
if ( !document.body ) { return; }
var lines = [];
var bar = document.getElementById( 'dcf-mini' );
lines.push( 'DIAG page: ' + ( document.title || '' ) );
lines.push( 'DIAG elapsedSec: ' + Math.round( ( Date.now() - window.__dcfDiagStart ) / 1000 ) );
lines.push( 'DIAG scrollY: ' + ( window.scrollY || window.pageYOffset || 0 ) );
lines.push( 'DIAG dcfMiniExists: ' + ( bar ? 'true' : 'false' ) );
if ( bar ) {
var cs = window.getComputedStyle( bar );
lines.push( 'DIAG barDisplay: ' + cs.display );
lines.push( 'DIAG barVisibility: ' + cs.visibility );
var r = bar.getBoundingClientRect();
lines.push( 'DIAG barTop: ' + Math.round( r.top ) );
lines.push( 'DIAG barLeft: ' + Math.round( r.left ) );
lines.push( 'DIAG barWidth: ' + Math.round( r.width ) );
lines.push( 'DIAG barHeight: ' + Math.round( r.height ) );
lines.push( 'DIAG barText: ' + ( bar.textContent || '' ).replace( /\s+/g, ' ' ).substring( 0, 120 ) );
var node = bar.parentNode;
for ( var k = 1; k <= 4 && node; k++ ) {
lines.push( 'DIAG parent' + k + ': ' + shortEl( node ) );
if ( node.nodeType === 1 ) {
lines.push( 'DIAG parent' + k + 'Display: ' + window.getComputedStyle( node ).display );
} else {
lines.push( 'DIAG parent' + k + 'Display: (not-an-element)' );
}
node = node.parentNode;
}
}
var sn = document.getElementById( 'siteNotice' );
lines.push( 'DIAG siteNoticeExists: ' + ( sn ? 'true' : 'false' ) );
if ( sn ) {
lines.push( 'DIAG siteNoticeDisplay: ' + window.getComputedStyle( sn ).display );
lines.push( 'DIAG siteNoticeParent: ' + shortEl( sn.parentNode ) );
}
var fh = document.getElementById( 'firstHeading' );
lines.push( 'DIAG firstHeadingExists: ' + ( fh ? 'true' : 'false' ) );
if ( fh ) {
lines.push( 'DIAG firstHeadingDisplay: ' + window.getComputedStyle( fh ).display );
lines.push( 'DIAG firstHeadingParent: ' + shortEl( fh.parentNode ) );
}
lines.push( 'DIAG mwContentTextExists: ' + ( document.getElementById( 'mw-content-text' ) ? 'true' : 'false' ) );
lines.push( 'DIAG contentExists: ' + ( document.getElementById( 'content' ) ? 'true' : 'false' ) );
var mbc = document.querySelector( '.mw-body-content' );
lines.push( 'DIAG mwBodyContentExists: ' + ( mbc ? 'true' : 'false' ) );
var kids = document.body ? document.body.children : [];
for ( var j = 0; j < 5 && j < kids.length; j++ ) {
lines.push( 'DIAG bodyChild' + ( j + 1 ) + ': ' + shortEl( kids[ j ] ) );
}
var runRaw = null;
var lockRaw = null;
try { runRaw = window.localStorage.getItem( 'dcf-run-v1' ); } catch ( e ) { runRaw = '(error)'; }
try { lockRaw = window.localStorage.getItem( 'dcf-lock-v1' ); } catch ( e ) { lockRaw = '(error)'; }
lines.push( 'DIAG runState: ' + ( runRaw === null ? 'null' : String( runRaw ).substring( 0, 200 ) ) );
lines.push( 'DIAG lockState: ' + ( lockRaw === null ? 'null' : String( lockRaw ).substring( 0, 200 ) ) );
var d = document.getElementById( 'dcf-diag' );
if ( !d ) {
d = document.createElement( 'div' );
d.id = 'dcf-diag';
d.style.cssText = 'border:2px solid #080;background:#fff;padding:10px;margin:10px 0;white-space:pre-wrap;font-family:monospace;';
document.body.appendChild( d );
}
d.textContent = lines.join( '\n' );
}
function start() {
if ( window.__dcfDiagStarted ) { return; }
window.__dcfDiagStarted = true;
window.__dcfDiagStart = Date.now();
setInterval( diag, 5000 );
diag();
}
if ( document.readyState === 'loading' ) {
document.addEventListener( 'DOMContentLoaded', start );
} else {
start();
}
}() );