打开主菜单

Ballance Wiki β

更改

Widget:BMMOLatestUpdate

添加115字节2023年9月3日 (日) 11:10
无编辑摘要
<span class="bmmo-latest-update"></span>
<script>
fetch("https://dl.bmmo.bcrc.site/download/latest?version-only=true")
.then(res => res.json())
.then(data => {
const lang = "<!--{$lang|default:'en'param1|escape:'html'}-->";
const dateLatest = new Date(data["time"] * 1e3);
document.write(let text = data["version"]); document.write(text += '<span style="font-size: 0.88em">');
if (lang == "zh") {
document.writetext += (`(${dateLatest.toLocaleDateString("zh-SG")},`
+ `${((new Date() - dateLatest) / 1e3 / 86400).toFixed(0)}日前)`);
} else {
document.writetext += (` (${dateLatest.toLocaleDateString("en-UK", {year: "numeric", month: "long", day: "numeric"})}, `
+ `${((new Date() - dateLatest) / 1e3 / 86400).toFixed(0)} day(s) ago)`);
}
document.write(text += '</span>'; document.querySelectorAll(".bmmo-latest-update").forEach(el => { el.innerHTML = text; });
});
</script>
3,425
个编辑