MediaWiki:Monobook.js

From JP1 Remotes Wiki
Revision as of 18:05, 18 November 2025 by The Robman (talk | contribs)
Jump to navigationJump to search

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.
/* All JavaScript here will be loaded for users of the MonoBook skin */
document.addEventListener('DOMContentLoaded', function () {
  const el = document.querySelector('#n-mainpage-description a');
  if (el && el.style.border.includes('red')) {
    el.style.border = 'none';
  }

  // MutationObserver to catch re-injections
  new MutationObserver(muts => {
    muts.forEach(m => {
      if (m.type === 'attributes' && m.attributeName === 'style') {
        const el = m.target;
        if (el.id === 'n-mainpage-description' || el.closest('#n-mainpage-description')) {
          if (el.style.border.includes('red')) {
            el.style.border = 'none';
          }
        }
      }
    });
  }).observe(document.getElementById('n-mainpage-description'), {
    attributes: true,
    subtree: true,
    attributeFilter: ['style']
  });
});