Difference between revisions of "MediaWiki:Common.js"

From COPTR
Jump to navigation Jump to search
Line 2: Line 2:
 
/* ANJ Adding anonymous analytics support 2025-09-09 */
 
/* ANJ Adding anonymous analytics support 2025-09-09 */
 
var templateLiteral = '<script defer src="https://cloud.umami.is/script.js" data-website-id="ecc13e7c-09d2-4236-a597-c3c570bfc411"></script>'
 
var templateLiteral = '<script defer src="https://cloud.umami.is/script.js" data-website-id="ecc13e7c-09d2-4236-a597-c3c570bfc411"></script>'
 +
 +
function htmlToNodes(html) {
 +
    const template = document.createElement('template');
 +
    template.innerHTML = html;
 +
    return template.content.childNodes;
 +
}
  
 
var head = document.querySelector("head");
 
var head = document.querySelector("head");
head.appendChild(templateLiteral);
+
head.appendChild(htmlToNodes(templateLiteral));

Revision as of 13:22, 5 September 2025

/* Any JavaScript here will be loaded for all users on every page load. */
/* ANJ Adding anonymous analytics support 2025-09-09 */
var templateLiteral = '<script defer src="https://cloud.umami.is/script.js" data-website-id="ecc13e7c-09d2-4236-a597-c3c570bfc411"></script>'

function htmlToNodes(html) {
    const template = document.createElement('template');
    template.innerHTML = html;
    return template.content.childNodes;
}

var head = document.querySelector("head");
head.appendChild(htmlToNodes(templateLiteral));