MediaWiki:Common.js
Appearance
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
// On page load, collapse TOC in Vector 2022 if expanded. This is only collapsing the first section
// (function () {
// const observer = new MutationObserver(() => {
// const toggle = document.querySelector('.vector-toc-toggle');
// const toc = document.querySelector('.vector-toc');
//
// if (!toggle || !toc) return;
//
// // Only act if expanded
// if (toggle.getAttribute('aria-expanded') === 'true') {
// toggle.click();
//
// try {
// localStorage.setItem('vector-toc-expanded', 'false');
// localStorage.setItem('vector-toc-pinned', 'false');
// } catch (e) {}
//
// observer.disconnect();
// }
// });
//
// observer.observe(document.body, {
// childList: true,
// subtree: true
// });
// })();