Greasy Fork

Greasy Fork is available in English.

🔥🔥🔥防沉迷减点料🔥🔥🔥

(已支持qq空间部分游戏,07073,7k7k,4399) ⚡️减点料最快0.99秒 ❤️ 尽情享受游戏时光 ⭕ 持续更新更靠谱 💪去除一堆花里胡哨的玩意,大大加快减料速度,紧急修复7k7k失效问题

目前为 2022-01-17 提交的版本,查看 最新版本

// ==UserScript==
// @name         🔥🔥🔥防沉迷减点料🔥🔥🔥
// @name:en      07073, 7k7k and 4399 No Anti Indulgence

// @description  (已支持qq空间部分游戏,07073,7k7k,4399) ⚡️减点料最快0.99秒 ❤️ 尽情享受游戏时光 ⭕ 持续更新更靠谱 💪去除一堆花里胡哨的玩意,大大加快减料速度,紧急修复7k7k失效问题
// @description:en Say no to 07073, 7k7k and 4399's anti indulgence.

// @namespace    https://fcmsb250.github.io/
// @version      4.4
// @icon         https://gitee.com/dsy4567/sofast/raw/master/game.png
// @author       dsy

// @include      *://*.07073.*/*
// --------
// @include      *://*.4399.*/*
// @include      *://*.*4399.*/*
// @include      *://*.4399*.*/*
// @include      *://*.iwan4399.*/*
// @include      *://*.aiwan4399.*/*
// @include      *://*.zxwyouxi.*/*
// --------
// @include      *://*.7k7k.*/*
// @include      *://*.*7k7k.*/*
// @include      *://*.7k7k*.*/*
// --------
// @include      *://gameapp.qq.com/*
// --------
// @include      *://wj.qq.com/*

// @grant        unsafeWindow
// @grant        GM_unregisterMenuCommand
// @grant        GM_registerMenuCommand
// @grant        GM_openInTab
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_deleteValue
// @grant        GM_notification
// @grant        GM_info
// @grant        GM_setClipboard


// @license      MIT
// @run-at       document-body

// ==/UserScript==

// NO CTRL+C OR CTRL+V
// NO CTRL+C OR CTRL+V
// NO CTRL+C OR CTRL+V

if (self == top) {
    if (GM_getValue("版本") != GM_info.script.version) {
        GM_notification(
            "快看看有什么新功能吧",
            "🔥🔥🔥防沉迷减点料🔥🔥🔥 更新完毕",
            "",
            function () {
                open(
                    "http://greasyfork.icu/zh-CN/scripts/437233-%E9%98%B2%E6%B2%89%E8%BF%B7%E5%8A%A0%E7%82%B9%E6%96%99",
                    "_blank"
                );
            }
        );
    }
}

function 改变值(值, 默认值, 回调) {
    if (GM_getValue(值, 默认值) == "1") {
        GM_setValue(值, "0");
    } else if (GM_getValue(值, 默认值) == "0") {
        GM_setValue(值, "1");
    } else {
        GM_setValue(值, 默认值);
    }
    if (回调) {
        回调();
    }
}
function 初始化值(值, 默认值, 回调) {
    if (GM_getValue(值, "天知道是啥") == "天知道是啥") {
        GM_setValue(值, 默认值);
    }
    if (回调) {
        回调();
    }
}
var D = new Date();

// 照顾旧版本
if (
    GM_getValue("安装日期", "天知道是啥") == "天知道是啥" &&
    GM_getValue("insday", "天知道是啥") != "天知道是啥"
) {
    GM_setValue("安装日期", GM_getValue("insday"));
}
if (
    GM_getValue("7k7k_h5游戏没有防沉迷", "天知道是啥") == "天知道是啥" &&
    GM_getValue("7k7k_h5_nofcm", "天知道是啥") != "天知道是啥"
) {
    GM_setValue("7k7k_h5游戏没有防沉迷", GM_getValue("7k7k_h5_nofcm"));
}
if (
    GM_getValue("已参与调查", "天知道是啥") == "天知道是啥" &&
    GM_getValue("investigation", "天知道是啥") != "天知道是啥"
) {
    GM_setValue("已参与调查", 0);
}
GM_deleteValue("7k7k_h5_nofcm");
GM_deleteValue("howToFxxk");
GM_deleteValue("insday");
GM_deleteValue("investigation");

GM_setValue("版本", GM_info.script.version);
初始化值("安装日期", String(Math.floor(D.getTime() / 1000 / 60 / 60 / 24)));
初始化值("7k7k_h5游戏没有防沉迷", "0");
初始化值("已参与调查", "0");
// 初始化值("web_game_no_fcm", "0");

var 最后一个菜单id = 0;
var 玩了几分钟 = 0;
var 用了多少天 =
    Math.ceil(D.getTime() / 1000 / 60 / 60 / 24) -
    Number(GM_getValue("安装日期"));
// var web_game_no_fcm = GM_getValue("web_game_no_fcm", "1");
var _7k7k_h5游戏没有防沉迷 = GM_getValue("7k7k_h5游戏没有防沉迷", "0");

const 脚本信息 = JSON.stringify({
    脚本能更新: GM_info.scriptWillUpdate,
    脚本版本: GM_info.script.version,
    脚本更新地址: GM_info.script.updateURL,
    脚本管理器: GM_info.scriptHandler,
    脚本管理器版本: GM_info.version,
    用多久: 用了多少天,
    存储__7k7k_h5游戏没有防沉迷: _7k7k_h5游戏没有防沉迷,
    存储_已参与调查: GM_getValue("已参与调查"),
});
console.log(脚本信息);

var 一堆伞兵玩意 = [
    "f**k#fcmIframe",
    "f**k.sdkDialog",
    "f**#anti-indulge",
    "f**k#pusher",
    "f**k#anti-indulge-prompt",
    "f**k#messageBox",
    "f**k#Guide",
    "f**k.popup-c",
    "f**k#tc100",
    "f**k#div_dialog",
    "f**k#addiv",
    "f**k#Anti_open",
    "f**k#Anti_mask",
    "f**k#swfdiv > div.box",
    "f**k#page_wallpaper > div.xiaowei.xiaowei-orange > div.xw-left > div.xw-game > div.xw-top > div > div",
    "f**k.fixedModal",
    "f**k.play_load",
    "f**k#cover",
    "f**k.realName",
    "f**k.mask",
    "f**k.ui-forbidden",
];

function 更新菜单() {
    const 一堆菜单 = [
        ["♥减料需要一些时间,请耐心等待", undefined, undefined],
        ["♥您已尽情欢乐" + String(用了多少天) + "天", undefined, undefined],
        ["♥如果游戏显示不完整,请调整浏览器窗口大小", undefined, undefined],
        [
            "游戏时间: " + 玩了几分钟 + "分钟,请合理安排游戏时间才怪",
            undefined,
            undefined,
        ],
        // [
        //     "🟡开启/关闭4399页游减料(似乎屁用没得)",
        //     function () {
        //         改变值("web_game_no_fcm", "0", function () {
        //             alert("设置成功,请刷新网页,该功能似乎屁用没得");
        //         });
        //     },
        //     undefined,
        // ],
        [
            "🟡再次减料",
            function () {
                多减料几次();
            },
            undefined,
        ],
        [
            "🟡开启/关闭7k7k h5游戏强力减料",
            function () {
                改变值("7k7k_h5游戏没有防沉迷", "0", function () {
                    alert("设置成功,请刷新网页");
                });
            },
            undefined,
        ],
        [
            "🟡参与调查",
            function () {
                open("https://wj.qq.com/s2/9509463/7fcb/", "_blank");
            },
            undefined,
        ],
        [
            "🟡复制脚本信息",
            function () {
                GM_setClipboard(脚本信息);
            },
        ],
    ];
    for (
        let 索引 = 最后一个菜单id - 一堆菜单.length;
        索引 < 最后一个菜单id + 一堆菜单.length;
        索引++
    ) {
        GM_unregisterMenuCommand(索引);
    }
    for (let 索引 = 0; 索引 < 一堆菜单.length; 索引++) {
        const 菜单名 = 一堆菜单[索引][0];
        const 函数 = 一堆菜单[索引][1];
        const 快捷键 = 一堆菜单[索引][2];

        var 最后一个菜单id = GM_registerMenuCommand(菜单名, 函数, 快捷键);
    }
}

function 游戏中() {
    let 有没有玩游戏 = false;
    if (
        location.href.indexOf("sda.4399.com") >= 0 ||
        location.href.indexOf("sbai.4399.com") >= 0 ||
        location.href.indexOf("sxiao.4399.com") >= 0 ||
        location.href.indexOf("zxwyouxi.com") >= 0 ||
        location.href.indexOf("flash.7k7k.com") >= 0 ||
        location.href.indexOf("7k7k.com/swf/") >= 0 ||
        location.href.indexOf("h5.07073.com/gameplay") >= 0
    ) {
        有没有玩游戏 = true;
    }
    return 有没有玩游戏;
}

function 减料() {
    if (
        document.querySelector("fuck#flash22".substring(4)) &&
        location.href.indexOf("4399.com")
    ) {
        // 4399全屏游戏
        if (unsafeWindow.webServer && unsafeWindow._strGamePath) {
            location.href = unsafeWindow.webServer + unsafeWindow._strGamePath;
        } else {
            try {
                location.href = String(
                    document.querySelector("fuck#flash22".substring(4)).src
                );
            } catch (err) {
                console.error(err);
            }
        }
    } else if (document.querySelector("iframe#game")) {
        // 4399全屏游戏2
        try {
            location.href = String(document.querySelector("iframe#game").src);
        } catch (err) {
            console.error(err);
        }
    } else if (
        document.querySelector("#gameobj") &&
        document.title.indexOf("合成") == -1
    ) {
        // 7k7k全屏游戏 (不支持合成大西瓜和小芝麻)
        location.href = document.querySelector("#gameobj").src;
    } else if (unsafeWindow.Play24 && location.href.indexOf("7k7k.com") >= 0) {
        // 7k7k获取游戏真实地址,顺便说一句,7k7k跟4399一样狗
        try {
            unsafeWindow.Play24.prototype.playLoading();
            unsafeWindow.Play24.prototype.playLoading = function () {}; // 防止重复调用
        } catch (err) {
            console.error(err);
        }
    }
    try {
        // 简单暴力的减料方式
        for (let 索引 = 0; 索引 < 一堆伞兵玩意.length; 索引++) {
            const element = 一堆伞兵玩意[索引].substring(4);
            if (document.querySelector(element) != null) {
                document.querySelector(element).remove();
                console.log("[防沉迷减点料] -减料成功- " + element);
            }
        }
    } catch (err) {
        console.error(err);
    }
}

function 多减料几次() {
    var interval1 = setInterval(减料, 3000);
    减料();

    setTimeout(() => {
        try {
            clearInterval(interval1);
            clearInterval(interval2);
        } catch (e) {}
    }, 10000);
}

if (
    location.href.indexOf("h5.7k7k.com/game/") >= 0 &&
    _7k7k_h5游戏没有防沉迷 == "1"
) {
    var interval2 = setInterval(() => {
        if (document.querySelector("#gameframe")) {
            var frame1 = document.querySelector("#gameframe");
            frame1.onload = function () {
                if (frame1.src) {
                    location.href = frame1.src;
                }
            };
        }
    }, 500);
}

//判断是否在iframe中
if (self == top) {
    if (用了多少天 >= 5 && GM_getValue("已参与调查") == "0") {
        GM_setValue("已参与调查", "1");
        GM_notification(
            "请点击参与脚本使用情况调查(第二期),帮助这个脚本变得更好",
            "🔥🔥🔥防沉迷减点料🔥🔥🔥 用的怎样?",
            "",
            function () {
                open("https://wj.qq.com/s2/9618279/815b/", "_blank");
            }
        );
    }
    if (游戏中()) {
        for (let i = 0.5; i < 5; i = i + 0.5) {
            setTimeout(() => {
                GM_notification(
                    "你已经玩了" +
                        i +
                        "个小时,防沉迷那个啥虽好,但也要适度游戏,休息一下吧",
                    "健康游戏提示"
                );
            }, i * 60 * 60 * 1000);
            console.log("[防沉迷减点料] 已设置健康游戏提醒 " + i + " 小时");
        }
        setInterval(function () {
            玩了几分钟 += 1;
            更新菜单();
        }, 60 * 1000);
    } else {
        玩了几分钟 = "未在游戏";
    }
    更新菜单();
}

function 减点料() {
    setTimeout(() => {
        // 不健康游戏忠告
        if (document.querySelector("#skinbody > div.copy > div.copy_t")) {
            document.querySelector(
                "#skinbody > div.copy > div.copy_t"
            ).innerHTML =
                '作品版权归作者所有,如果侵犯了您的版权,请<a href="//my.4399.com/joinus/contact.html">联系我们</a>,本站将在3个工作日内删除。<br><span>不温馨提示:</span>不要抵制不良游戏,不要拒绝盗版游戏,不要注意自我保护,不要谨防受骗上当,沉迷游戏益脑,适度游戏伤身,不要合理安排时间,享受快乐游戏生活';
        }
        if (
            document.querySelector(
                "#theme-blue > div.footer > div > div.f_con_fl2 > p.f_p5"
            )
        ) {
            document.querySelector(
                "#theme-blue > div.footer > div > div.f_con_fl2 > p.f_p5"
            ).innerHTML =
                "7k7k小游戏不温馨提示:不要适度游戏娱乐,沉迷游戏益脑,不要合理安排时间,享受快乐游戏生活……";
        }

        多减料几次();

        // 4399页游减料(似乎屁用没得,已弃用)
        // if (web_game_no_fcm == "1") {
        //     if (document.querySelector("#game_box") && location.href.indexOf("web.4399.com") > -1) {
        //         if (
        //             document.querySelector("#game_box").src != location.href &&
        //             GM_getValue(String(document.title), "天知道是啥") == "天知道是啥"
        //         ) {
        //             GM_setValue(
        //                 String(document.title),
        //                 String(document.querySelector("#game_box").src)
        //             );
        //         } else if (
        //             GM_getValue(String(document.title), "天知道是啥") != "天知道是啥" &&
        //             document.querySelector("#game_box").src == location.href
        //         ) {
        //             location.href = GM_getValue(String(document.title), "天知道是啥");
        //         }
        //     }
        // }
    }, 3000);
}

window.onload = function () {
    if (location.href.indexOf("s2/9618279/815b") >= 0) {
        var interval3 = setInterval(function () {
            try {
                document.querySelector(
                    "#question_q-26-Zd7K > div.question-body > textarea"
                ).value = 脚本信息;
                clearInterval(interval3);
            } catch (err) {}
        }, 3000);
    }
    减点料();
};
减点料();