🏠 

Greasy Fork is available in English.

v2ex 自动签到

try to take over the world!


安装此脚本?
// ==UserScript==
// @name         v2ex 自动签到
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description  try to take over the world!
// @author       imzhi
// @match        https://v2ex.com
// @match        https://v2ex.com/mission/daily
// @require      https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.5.1/jquery.min.js
// @grant        none
// ==/UserScript==
'use strict';
(function() {
// 对cloudflare拦截时直接返回
if (!$('#Logo').length) {
console.warn('no #Logo');
return;
}
if (!$('#member-activity').length) {
console.warn('未登录');
return;
}
var date = new Date();
var currdate = date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate();
var store = localStorage.getItem('tampermonkey-v2ex-sign');
// 判断今天是否已经执行过
if (store && store === currdate) {
console.warn('已执行', store, currdate);
return;
}
var url = 'https://v2ex.com/mission/daily';
var href = location.href;
if (href === 'https://v2ex.com/') {
var $link = $('#Rightbar .inner a');
if ($link.length) {
location.href = url;
} else {
localStorage.setItem('tampermonkey-v2ex-sign', currdate);
console.warn('已签到');
}
}
if (href === url) {
var $button = $('#Main .cell .super.normal.button');
console.warn('签到按钮不存在aaa', $button);
if ($button.length) {
$button.click();
localStorage.setItem('tampermonkey-v2ex-sign', currdate);
} else {
console.warn('签到按钮不存在');
}
}
})();