MCPcopy Create free account
hub / github.com/XIU2/UserScript / qianDao

Function qianDao

V2ex-Enhanced.user.js:209–230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

207
208 // 自动签到(后台)
209 function qianDao() {
210 let timeNow = new Date().getUTCFullYear() + '/' + (new Date().getUTCMonth() + 1) + '/' + new Date().getUTCDate() // 当前 UTC-0 时间(V2EX 按这个时间的)
211 if (location.pathname == '/') { // 在首页
212 let qiandao = document.querySelector('.box .inner a[href="/mission/daily"]');
213 if (qiandao) { // 如果找到了签到提示
214 qianDao_(qiandao, timeNow); // 后台签到
215 } else if (document.getElementById('gift_v2excellent')) { // 兼容 [V2ex Plus] 扩展
216 document.getElementById('gift_v2excellent').click();
217 GM_setValue('menu_clockInTime', timeNow); // 写入签到时间以供后续比较
218 console.info('[V2EX 增强] 自动签到完成!')
219 } else { // 都没有找到,说明已经签过到了
220 console.info('[V2EX 增强] 已经签过到了。')
221 }
222 } else { // 不在首页
223 let timeOld = GM_getValue('menu_clockInTime')
224 if (!timeOld || timeOld != timeNow) {
225 qianDaoStatus_(timeNow) // 后台获取签到状态(并判断是否需要签到)
226 }/* else { // 新旧签到时间一致
227 console.info('[V2EX 增强] 已经签过到了。')
228 }*/
229 }
230 }
231
232
233 // 后台签到

Callers

nothing calls this directly

Calls 2

qianDao_Function · 0.85
qianDaoStatus_Function · 0.85

Tested by

no test coverage detected