MediaWiki:Monobook.js: Difference between revisions

From JP1 Remotes Wiki
Jump to navigationJump to search
No edit summary
Tag: Replaced
 
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the MonoBook skin */
/* 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']
  });
});

Latest revision as of 18:53, 18 November 2025

/* All JavaScript here will be loaded for users of the MonoBook skin */