Aurora Lemon(讨论 | 贡献) 无编辑摘要 |
Aurora Lemon(讨论 | 贡献) 无编辑摘要 |
||
第13行: | 第13行: | ||
$("#live-player-status").html(statusText); | $("#live-player-status").html(statusText); | ||
$("#live-player-progress").width(width + '%'); | $("#live-player-progress").width(width + '%'); | ||
}) | }); | ||
} | } | ||
}()); | }()); |
2023年1月7日 (六) 01:08的版本
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
$(function() {
if ($("#live-player-status").length > 0) {
$.getJSON("http://h2.hydcraft.cn:11601/api/status/HydCraft_Helium")
.done(function (data) {
var curPlayers = data.current_players;
var maxPlayers = data.max_players;
var width = curPlayers / maxPlayers;
var statusText = "服务器在线人数" + data.current_players + " / " + data.max_players;
$("#live-player-status").html(statusText);
$("#live-player-progress").width(width + '%');
});
}
}());