Difference between revisions of "MediaWiki:Common.js"

(Created page with "Any JavaScript here will be loaded for all users on every page load.: $('div#content').append( "<div class='content-footer'></div>" );")
 
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
  
$('div#content').append( "<div class='content-footer'></div>" );
+
(function () {
 +
    var req = new XMLHttpRequest();
 +
    req.addEventListener('load', function (ev) {
 +
        if (this.status >= 200 && this.status < 300) {
 +
            var data = JSON.parse(this.responseText);
 +
            if (data.hasOwnProperty('version')) {
 +
                var gdpr = document.createElement("script");
 +
                gdpr.src = "https://s3-static.geo.gfsrv.net/cookiebanner/" + data.version + "/cookie.min.js";
 +
                document.head.appendChild(gdpr);
 +
            }
 +
        }
 +
    });
 +
    req.open('GET', "https://s3-static.geo.gfsrv.net/cookiebanner/version.json");
 +
    req.send();
 +
})();

Latest revision as of 10:44, 18 July 2019

/* Any JavaScript here will be loaded for all users on every page load. */

(function () {
    var req = new XMLHttpRequest();
    req.addEventListener('load', function (ev) {
        if (this.status >= 200 && this.status < 300) {
            var data = JSON.parse(this.responseText);
            if (data.hasOwnProperty('version')) {
                var gdpr = document.createElement("script");
                gdpr.src = "https://s3-static.geo.gfsrv.net/cookiebanner/" + data.version + "/cookie.min.js";
                document.head.appendChild(gdpr);
            }
        }
    });
    req.open('GET', "https://s3-static.geo.gfsrv.net/cookiebanner/version.json");
    req.send();
})();