MediaWiki:Common.js: Difference between revisions

Created page with "/** * Keep code in MediaWiki:Common.js to a minimum as it is unconditionally * loaded for all users on every wiki page. If possible create a gadget that is * enabled by default instead of adding it here (since gadgets are fully * optimized ResourceLoader modules with possibility to add dependencies etc.) * * Since Common.js isn't a gadget, there is no place to declare its * dependencies, so we have to lazy load them with mw.loader.using on demand and * then execu..."
 
No edit summary
Line 120: Line 120:
/* End of mw.loader.using callback */
/* End of mw.loader.using callback */
} );
} );
document.addEventListener("DOMContentLoaded", function () {
  const params = new URLSearchParams(window.location.search);
  const point = params.get("point");
  const iframe = document.getElementById("self-esteem-frame");
  if (iframe && point) {
    iframe.addEventListener("load", () => {
      iframe.contentWindow.postMessage(
        { point: parseInt(point) },
        "https://test.magazine-d.com"
      );
    });
  }
});
/* DO NOT ADD CODE BELOW THIS LINE */
/* DO NOT ADD CODE BELOW THIS LINE */