MediaWiki:Common.js

Revision as of 21:19, 10 November 2025 by CaptainChris (talk | contribs)

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. */

document.addEventListener('DOMContentLoaded', () => {
  document.querySelectorAll('.infobox').forEach(box => {
    box.querySelectorAll('hr').forEach(hr => {
      const section = hr.previousSibling;
      if (section && section.nodeType === Node.TEXT_NODE && !section.textContent.trim()) {
        hr.style.display = 'none';
      }
    });
  });
});

document.addEventListener("DOMContentLoaded", () => {
  const iframe = document.querySelector('iframe[key="wikiphone"]');
  if (!iframe) return;

  iframe.style.width = "100%";
  iframe.style.border = "none";
  iframe.style.overflow = "hidden";

  window.addEventListener("message", (event) => {
    if (typeof event.data === "object" && event.data.type === "resizeIframe") {
      iframe.style.height = event.data.height + "px";
    }
  });
});