Skillnad mellan versioner av "MediaWiki:Common.js"
Från Mittköping
Isrjo (Diskussion | bidrag) |
Isrjo (Diskussion | bidrag) |
||
Rad 1: | Rad 1: | ||
/* JavaScript som skrivs här körs varje gång en användare laddar en sida. */ | /* JavaScript som skrivs här körs varje gång en användare laddar en sida. */ | ||
− | function | + | // The enclosed code runs only after the page has been loaded and parsed. |
− | + | window.addEventListener('DOMContentLoaded', function() { | |
− | + | try { | |
− | + | // Detect whether the page's TOC is being displayed. | |
− | } | + | if (document.getElementById('toc').getElementsByTagName('ul')[0].style.display != 'none') { |
− | + | // Use MW's toggleToc() to hide TOC, change "hide/show" link text, and set cookie. | |
+ | toggleToc(); | ||
+ | } | ||
+ | } catch (exception) { | ||
+ | // Probably this page doesn't have a TOC, ignore the exception to prevent console clutter. | ||
+ | } | ||
+ | }, false); |
Versionen från 16 oktober 2017 kl. 16.12
/* JavaScript som skrivs här körs varje gång en användare laddar en sida. */
// The enclosed code runs only after the page has been loaded and parsed.
window.addEventListener('DOMContentLoaded', function() {
try {
// Detect whether the page's TOC is being displayed.
if (document.getElementById('toc').getElementsByTagName('ul')[0].style.display != 'none') {
// Use MW's toggleToc() to hide TOC, change "hide/show" link text, and set cookie.
toggleToc();
}
} catch (exception) {
// Probably this page doesn't have a TOC, ignore the exception to prevent console clutter.
}
}, false);