MediaWiki:Common.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 372: Line 372:


/* end Accordion button */
/* end Accordion button */
/* This is where the code for inserting the Location Map starts. */
(function() {
      if (document.querySelector('h1#firstHeading').innerHTML === "Guided Research for Online Records") {
        var polyfill = document.createElement('script');
        polyfill.type = 'text/javascript';
        polyfill.async = true;
        polyfill.src = 'https://polygit.org/components/webcomponentsjs/webcomponents-lite.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(polyfill, s);
        var locationMap = document.createElement('link');
        locationMap.rel = 'import';
        locationMap.href = 'https://gist.githubusercontent.com/ecollett1/6acc6d3d51f82f9b142e7f5274ae8592/raw/d30618173a3aedddd676613889f5e20fbce6720c/location-map.html';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(locationMap, s);
        document.querySelector('#mw-content-text p').innerHTML = "<div style='width: 1000px; height:500px;'><location-map></location-map></div>";
    }
})();