小无编辑摘要 |
小无编辑摘要 |
||
| 第3行: | 第3行: | ||
if ($("#live-delay-info").length > 0) { | if ($("#live-delay-info").length > 0) { | ||
$.getJSON("/ | $.getJSON("http://zk01.mcstory.net:27223/mc/sysmap/data") | ||
.done(function (data) { | .done(function (data) { | ||
var delayedNames = []; | var delayedNames = []; | ||
2022年11月28日 (一) 22:58的版本
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
$(function() {
if ($("#live-delay-info").length > 0) {
$.getJSON("http://zk01.mcstory.net:27223/mc/sysmap/data")
.done(function (data) {
var delayedNames = [];
data[0].routes.forEach(function(route) {
if (route.maxWaitTime > 2400) {
var routeName = route.name.split("|")[0];
if (delayedNames.indexOf(routeName) < 0) {
delayedNames.push(routeName);
}
}
});
if (delayedNames.length > 0) {
$("#live-delay-info").html("服务器运行中。<b style='color:red'>有线路发生阻塞:" + delayedNames.join("、") + "。</b>");
} else {
$("#live-delay-info").html("服务器运行中。所有线路运行正常。");
}
})
.fail(function (xhr, textStatus) {
if (xhr.status == 502) {
$("#live-delay-info").html("服务器当前未启动,或处于休眠状态。");
} else {
$("#live-delay-info").html("<b style='color:red'>获取信息失败: " + xhr.status + " " + textStatus + "。</b>");
}
});
}
}());