Acfun_checkin

automatically checkin for acfun

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name Acfun_checkin
// @name:zh-CN   Acfun自动领蕉
// @namespace https://github.com/machsix/acfun_checkin
// @description  automatically checkin for acfun
// @description:zh-cn  acfun自动领蕉脚本
// @author       Mach6
// @version      1.0
// @license      GNU GPL v3
// @include      http*://www.acfun.cn/*
// @grant 		unsafeWindow
// @run-at 		document-end
// ==/UserScript==
(function() {
        var acfun_main = /^https?:\/\/www.acfun.cn\/?$/;
    var acfun_member = /^https?:\/\/www.acfun.cn\/member(?:\/#.*)?/;
    var islogin = function (doc){
        return JSON.parse(localStorage.user).name != "游客";
    };
    if (acfun_main.test(window.location.href)){
        console.log("成功进入acfun世界");
        window.addEventListener('load', function(){
            if (!islogin(document)){
                console.log('脑波没对接');
            } else {
                var i = document.createElement('iframe');
                i.name = 'autologin-iframe';
                i.width = '100%';
                i.height = '0';
                i.frameBorder = "0";
                i.style.cssText = '\
                    margin:0!important;\
                    padding:0!important;\
                    visibility:hidden!important;\
                ';
                i.src = 'http://www.acfun.cn/member/';
                document.body.appendChild(i);
            }
        }, false);
    } else if (acfun_member.test(window.location.href)) {
        console.log('进入acfun会员');
        setTimeout(function(){
            var ischecked = function (doc){
                return doc.evaluate('//*[@id="btn-sign-user"]/text()', 
                doc, null, XPathResult.FIRST_ORDERED_NODE_TYPE,
                null).singleNodeValue.data == "已签到";
            };
            if (!ischecked(document)){
                document.getElementById("btn-sign-user").click();
                console.log('Acfun 签到完成');
            }else {
                console.log('Acfun 已签到');
            }
        },3000);
    }
    return;
})();