MediaWiki:Common.js: Difference between revisions
No edit summary |
No edit summary |
||
| Line 180: | Line 180: | ||
// ── TOC: rename "Contents" → "विषयसूची" ──────────────────────── | // ── TOC: rename "Contents" → "विषयसूची" ──────────────────────── | ||
function renameTocTitle() { | function renameTocTitle() { | ||
if ( _isNoTocPage() ) return; | |||
var toc = document.querySelector('.vector-toc'); | |||
if ( !toc ) return; | |||
var titleEl = | |||
toc.querySelector('.vector-toc-title') || | |||
toc.querySelector('.vector-pinnable-header-label'); | |||
if ( !titleEl ) return; | |||
var LABEL = 'विषयसूची'; | |||
/* If already inserted, just refresh text */ | |||
var span = titleEl.querySelector('.gr-toc-title'); | |||
if ( !span ) { | |||
titleEl.innerHTML = ''; | |||
span = document.createElement('span'); | |||
span.className = 'gr-toc-title'; | |||
span.setAttribute('data-deva', LABEL); | span.setAttribute('data-deva', LABEL); | ||
titleEl.appendChild(span); | |||
translatableSpans.push(span); // uses your internal array | |||
} | |||
span.textContent = | |||
currentScript === 'deva' | |||
? LABEL | |||
: transliterateText(LABEL, currentScript); | |||
} | } | ||
// ── TOC: Remove the "Beginning" / top-of-page link ───────────── | // ── TOC: Remove the "Beginning" / top-of-page link ───────────── | ||
function removeTocBeginning() { | function removeTocBeginning() { | ||