打开主菜单

Ballance Wiki β

Widget:BMMOLatestUpdate

BallanceBug讨论 | 贡献2023年12月15日 (五) 16:30的版本

<script> fetch("https://dl-bmmo.bcrc.site/download/latest?version-only=true")

   .then(res => res.json())
   .then(data => {
       const lang = "";
       const dateLatest = new Date(data["time"] * 1e3);
       let text = data["version"];
       text += '';
       if (lang == "zh") {
           text += (`(${dateLatest.toLocaleDateString("zh-SG")},`
               + `${((new Date() - dateLatest) / 1e3 / 86400).toFixed(0)}日前)`);
       } else {
           text += (` (${dateLatest.toLocaleDateString("en-UK", {year: "numeric", month: "long", day: "numeric"})}, `
               + `${((new Date() - dateLatest) / 1e3 / 86400).toFixed(0)} day(s) ago)`);
       }
       text += '';
       document.querySelectorAll(".bmmo-latest-update").forEach(el => {
           el.innerHTML = text;
       });
   });

</script>