早上8点后打开任意网页即可自动当日签到
目前為
// ==UserScript==
// @name 掌上书苑自动签到
// @description 早上8点后打开任意网页即可自动当日签到
// @include *
// @version 1.0
// @author yechenyin
// @namespace https://greasyfork.org/users/3586-yechenyin
// @require https://code.jquery.com/jquery-1.11.2.min.js
// @grant GM_openInTab
// ==/UserScript==
if (location.href === 'http://www.cnepub.com/discuz/plugin.php?id=dsu_paulsign:sign') {
setTimeout(function () {
$('.tac li')[0].click();
$('input[name="qdmode"]')[1].click();
$('.tac a')[0].click();
var date = new Date();
var utc = date.getTime() + date.getTimezoneOffset() * 60000;
var china_time = utc + 8 * 3600 * 1000;
var china_hour = (new Date(china_time)).getHours();
var china_date = (new Date(china_time)).getDate();
localStorage.signed_date = china_date;
console.log(localStorage.signed_date + '日掌上书苑已签到');
}, 0);
}
else if (location.href === 'http://www.cnepub.com/discuz/member.php?mod=logging&action=login') {
if (window.self !== window.top) {
GM_openInTab('http://www.cnepub.com/discuz/member.php?mod=logging&action=login', false);
}
}
else {
var date = new Date();
var utc = date.getTime() + date.getTimezoneOffset() * 60000;
var china_time = utc + 8 * 3600 * 1000;
var china_hour = (new Date(china_time)).getHours();
var china_date = (new Date(china_time)).getDate();
//console.log('hour='+china_hour);
if (china_hour >= 8 && china_date != localStorage.signed_date) {
$('body').append($('<iframe>', {src:'http://www.cnepub.com/discuz/plugin.php?id=dsu_paulsign:sign', css:{display:'none'}}));
}
}