“Widget:BMMOLatestUpdate”的版本间的差异

来自Ballance Wiki
跳转至: 导航搜索
(创建页面,内容为“<script> fetch("https://dl.bmmo.bcrc.site/download/latest?version-only=true") .then(res => res.json()) .then(data => { const lang = "<!--{$param1|esc…”)
 
第3行: 第3行:
 
     .then(res => res.json())
 
     .then(res => res.json())
 
     .then(data => {
 
     .then(data => {
         const lang = "<!--{$param1|escape:'html'}-->";
+
         const lang = "<!--{$lang|default:'en'|escape:'html'}-->";
 
         const dateLatest = new Date(data["time"] * 1e3);
 
         const dateLatest = new Date(data["time"] * 1e3);
 
         document.write(data["version"]);
 
         document.write(data["version"]);

2023年9月3日 (日) 11:02的版本

<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);
       document.write(data["version"]);
       document.write('');
       if (lang == "zh") {
           document.write(`(${dateLatest.toLocaleDateString("zh-SG")},`
               + `${((new Date() - dateLatest) / 1e3 / 86400).toFixed(0)}日前)`);
       } else {
           document.write(` (${dateLatest.toLocaleDateString("en-UK", {year: "numeric", month: "long", day: "numeric"})}, `
               + `${((new Date() - dateLatest) / 1e3 / 86400).toFixed(0)} day(s) ago)`);
       }
       document.write('');
   });

</script>