()
| 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 | // 后台签到 |
nothing calls this directly
no test coverage detected