MediaWiki:Common.js:修订间差异

MediaWiki界面页面
无编辑摘要
无编辑摘要
第6行: 第6行:
     .done(function (data) {
     .done(function (data) {
      var curPlayers = data.current_players;
      var curPlayers = data.current_players;
      var maxPlayers = date.max_players;
      var maxPlayers = data.max_players;
      var width = curPlayers / maxPlayers;
      var width = curPlayers / maxPlayers;


      var statusText = "服务器在线人数" + data.current_players + " / " + date.max_players;
      var statusText = "服务器在线人数" + data.current_players + " / " + data.max_players;


      $("#live-player-status").html(statusText);
      $("#live-player-status").html(statusText);

2023年1月7日 (六) 01:00的版本

/* 这里的任何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 + '%'); 
      })
      
    }
    
    }());
为了让您的浏览体验更加高效、方便和个性化,遵照《中华人民共和国网络安全法》和《信息安全技术个人信息安全规范》,我们需要您允许本站使用Cookies。在某些情况下,Cookies是使网站正常运行的必要条件。