Greasy Fork

Greasy Fork is available in English.

Discuz BUX广告点击赚积分

Discuz论坛插件 BUX广告点击赚积分 自动

当前为 2021-05-15 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Discuz BUX广告点击赚积分
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description Discuz论坛插件 BUX广告点击赚积分 自动
// @author       lvweicheng
// @match       *://*/plugin.php?id=jnbux
// @icon         https://www.google.com/s2/favicons?domain=discuz.test
// @require     https://cdn.bootcdn.net/ajax/libs/jquery/3.1.0/jquery.min.js
// @require     https://cdn.bootcdn.net/ajax/libs/layer/3.3.0/layer.min.js
// @grant       GM.openInTab
// ==/UserScript==

(function() {

    'use strict';
    $(document.body).append(`<link href="https://cdn.bootcdn.net/ajax/libs/layer/3.3.0/theme/default/layer.min.css" rel="stylesheet">`);

    run();
    function getUserId() {
        let url = $(".vwmy a").attr('href');
        let pattern = /(\d){1,}/;
        return url.match(pattern) | url.match(pattern)[0];
    }
    function getTasks() {
        let html = $("html").html();
        let pattern = /window.open(.){1,}/g;
        let tasks = [];
        if (html.match(pattern)){
            tasks = html.match(pattern);
        }
        let returns = [];
        let features = "height=500, width=500, top=100, left=100";
        for (const tasksKey in tasks) {
            pattern = /plugin.php(.){1,}(\d)/;
            let url = tasks[tasksKey].match(pattern)[0];
            let jsStr = "window.open('"+ url +"', '', '"+ features +"')"
            returns.push(jsStr);
            // returns.push(tasks[tasksKey].replace('newwindow', '').replace('""', "'" + features + "'"));
        }
        return returns;
    }

    function msg(msg, icon = 1, taskId = 999) {
        layer.msg(msg, {
            offset: 'rt' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
            ,id: taskId //防止重复弹出
            ,shade: 0 //不显示遮罩
            ,icon: icon
        });
    }
    function checkJoin() {
        let flag = document.evaluate("//ul[@class='xl xl2 cl']/li[1]/a/font/b/text()").iterateNext();
        return !(flag == null);
    }

    function run(res) {
        console.log(parent)
        let id = getUserId();
        if (!id){
            msg('还没有登录', 5);
            return;
        }
        if (!checkJoin()){
            msg('还没有加入', 5);
            return;
        }
        let tasks = getTasks();
        if (tasks.length == 0){
            msg('今日任务已完成');
            return;
        }
        let promise = Promise.resolve();
        let runCount = 0;
        tasks.forEach((task, index) => {
            let pattern = /clickid=\d{1,}/;
            let taskId = task.match(pattern)[0].split('=')[1];
            promise =  promise.then(() => {
                return new Promise((resolve => {
                    let newWindow = eval(task);
                    if (newWindow){
                        setTimeout(()=>{
                            let timer = setInterval(() => {
                                if (!newWindow.document.getElementById('timer')){
                                    msg('任务id:' + taskId + '执行成功', 1, taskId);
                                    clearInterval(timer);
                                    resolve(newWindow);
                                }
                            }, 1000);
                        },5000);
                    }
                }));
            });
            promise.then((res) => {
                res.close();
                runCount += 1;
                if (runCount >= tasks.length){
                    window.location.href = '/';
                }
            });
        });
    }
})();