v2ex 自动签到

try to take over the world!

目前为 2020-10-14 提交的版本。查看 最新版本

// ==UserScript==
// @name         v2ex 自动签到
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  try to take over the world!
// @author       imzhi
// @match        https://v2ex.com/*
// @require      https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js
// @grant        none
// ==/UserScript==

'use strict';

(function() {
    // 对cloudflare拦截时直接返回
    if (!$('#Logo').length) {
        return;
    }
    if (!$('#member-activity').length) {
        console.warn('未登录(不可用)');
        return;
    }
    var date = new Date();
    var currdate = date.getFullYear() + '-' + date.getMonth() + '-' + date.getDate();
    var store = localStorage.getItem('tampermonkey-v2ex-sign');
    // 判断今天是否已经执行过
    if (store && store === currdate) {
        console.warn('已执行');
        return;
    }
    var url = 'https://v2ex.com/mission/daily';
    var href = location.href;
    if (href === 'https://v2ex.com/') {
        var $link = $('#Rightbar > div:nth-child(4) > div > a');
        if ($link.length) {
            location.href = url;
        } else {
            localStorage.setItem('tampermonkey-v2ex-sign', currdate);
            console.warn('已签到');
        }
    }
    if (href === url) {
        var $button = $('#Main > div.box > div:nth-child(2) > input');
        if ($button.length) {
            $button.click();
            localStorage.setItem('tampermonkey-v2ex-sign', currdate);
        } else {
            console.warn('签到按钮不存在');
        }
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址