◆少前百科是非盈利性、非官方的少女前线维基百科。 ◆如果您发现某些内容错误/空缺,请勇于修正/添加!参与进来其实很容易!点这里 加入少前百科。 ◆有任何意见、建议、纠错,欢迎在 GFwiki:反馈与建议 提出和讨论。编辑事务讨论QQ群:597764980,微博@GFwiki少前百科 ◆To foreigners,You can use twitter to contact us. |
“Widget:Mp-dailyquest”的版本间的差异
Mikumikuer(讨论 | 贡献) |
Mikumikuer(讨论 | 贡献) |
||
(未显示同一用户的10个中间版本) | |||
第1行: | 第1行: | ||
<script> | <script> | ||
var weekday_list = ['日', '一', '二', '三', '四', '五', '六']; | var weekday_list = ['日', '一', '二', '三', '四', '五', '六']; | ||
− | + | var initialRun = function () { | |
− | |||
DailyQuestDisplay(true); | DailyQuestDisplay(true); | ||
var i = window.setInterval( | var i = window.setInterval( | ||
第13行: | 第12行: | ||
}, 1000) | }, 1000) | ||
} | } | ||
− | ) | + | if (document.readyState === "complete"||(document.readyState !== "loading" && !document.documentElement.doScroll)) {initialRun()} else {document.addEventListener("DOMContentLoaded", initialRun)} |
function DailyQuestDisplay(firstRun) { | function DailyQuestDisplay(firstRun) { | ||
var mpoffset = new Date().getTimezoneOffset() + 480; | var mpoffset = new Date().getTimezoneOffset() + 480; | ||
var mpdate = new Date(Date.now() + mpoffset * 60 * 1000); | var mpdate = new Date(Date.now() + mpoffset * 60 * 1000); | ||
− | + | if(firstRun || window.curDate != mpdate.getDay()){var a = document.querySelectorAll("span[class*='mp-dailyquest']");for(var i=0;i<a.length;i++){a[i].style.display = "none"}} | |
− | if(firstRun || window.curDate != mpdate.getDay()){ | + | var b = document.querySelectorAll(".mp-dailyquest-" + mpdate.getDay());for(var i=0;i<b.length;i++){b[i].style.display = "inline"}; |
− | + | document.querySelector("#mp-dailyquest-month").textContent=mpdate.getMonth() + 1; | |
− | + | document.querySelector("#mp-dailyquest-date").textContent=mpdate.getDate(); | |
− | + | document.querySelector("#mp-dailyquest-day").textContent=weekday_list[mpdate.getDay()]; | |
− | |||
window.curDate = mpdate.getDay(); | window.curDate = mpdate.getDay(); | ||
} | } | ||
</script> | </script> |
2020年3月31日 (二) 18:02的最新版本
<script>
var weekday_list = ['日', '一', '二', '三', '四', '五', '六']; var initialRun = function () { DailyQuestDisplay(true); var i = window.setInterval( function () { if (new Date().getSeconds() == 0) { window.clearInterval(i); DailyQuestDisplay(); window.setInterval(DailyQuestDisplay, 30000); } }, 1000) } if (document.readyState === "complete"||(document.readyState !== "loading" && !document.documentElement.doScroll)) {initialRun()} else {document.addEventListener("DOMContentLoaded", initialRun)} function DailyQuestDisplay(firstRun) { var mpoffset = new Date().getTimezoneOffset() + 480; var mpdate = new Date(Date.now() + mpoffset * 60 * 1000); if(firstRun || window.curDate != mpdate.getDay()){var a = document.querySelectorAll("span[class*='mp-dailyquest']");for(var i=0;i<a.length;i++){a[i].style.display = "none"}} var b = document.querySelectorAll(".mp-dailyquest-" + mpdate.getDay());for(var i=0;i<b.length;i++){b[i].style.display = "inline"}; document.querySelector("#mp-dailyquest-month").textContent=mpdate.getMonth() + 1; document.querySelector("#mp-dailyquest-date").textContent=mpdate.getDate(); document.querySelector("#mp-dailyquest-day").textContent=weekday_list[mpdate.getDay()]; window.curDate = mpdate.getDay(); }
</script>