The District of Joban Difference between revisions of "MediaWiki:Common.js"

Difference between revisions of "MediaWiki:Common.js"

MediaWiki interface page
Line 3: Line 3:
     if(rtElement) {
     if(rtElement) {
         var routeCount = 0;
         var routeCount = 0;
         fetch("http://78.46.73.156:25674/data").then(e => e.json())
         fetch("http://78.46.73.156:25674/data").then(function (e) {
        .then(data => data.forEach(dimension => routeCount += dimension.routes.length));
            var data = e.json();
        rtElement.innerHTML = routeCount;
            data.forEach(dimension => routeCount += dimension.routes.length);
            rtElement.innerHTML = routeCount;
        }
     }
     }
}());
}());

Revision as of 03:04, 10 April 2022

$(function () {
	var rtElement = document.getElementById('rt-stats');
    if(rtElement) {
        var routeCount = 0;
        fetch("http://78.46.73.156:25674/data").then(function (e) {
            var data = e.json();
            data.forEach(dimension => routeCount += dimension.routes.length);
            rtElement.innerHTML = routeCount;
        }
    }
}());