// ==UserScript== // @name 下载卫士 // @namespace http://www.newday.me/ // @version 0.1.1 // @icon http://www.onlinedown.net/favicon.ico // @author 哩呵 // @description 拒绝高(捆)速(绑)下载 // @match *://*.onlinedown.net/* // @match *://*.cr173.com/* // @match *://*.xiazaiba.com/* // @match *://*.mydown.com/* // @match *://*.pc6.com/* // @match *://*.zol.com.cn/* // @match *://*.pconline.com.cn/* // @match *://*.jb51.net/* // @match *://*.cncrk.com/* // @match *://pc.qq.com/* // @match *://*.crsky.com/* // @match *://*.duote.com/* // @match *://*.downza.cn/* // @match *://*.yesky.com/* // @match *://*.ddooo.com/* // @match *://*.pchome.net/* // @match *://*.xpgod.com/* // @match *://*.52z.com/* // @match *://*.opdown.com/* // @match *://*.newday.me/* // @connect newday.me // @require https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js // @require https://cdn.staticfile.org/vue/2.6.6/vue.min.js // @run-at document-end // @grant GM_getValue // @grant GM_setValue // @grant GM_listValues // @grant GM_xmlhttpRequest // @downloadURL none // ==/UserScript== (function () { 'use strict'; var container = (function () { var obj = { module_defines: {}, module_objects: {} }; obj.define = function (name, requires, callback) { name = obj.processName(name); obj.module_defines[name] = { requires: requires, callback: callback }; }; obj.require = function (name, cache) { if (typeof cache == "undefined") { cache = true; } name = obj.processName(name); if (cache && obj.module_objects.hasOwnProperty(name)) { return obj.module_objects[name]; } else if (obj.module_defines.hasOwnProperty(name)) { var requires = obj.module_defines[name].requires; var callback = obj.module_defines[name].callback; var module = obj.use(requires, callback); cache && obj.register(name, module); return module; } }; obj.use = function (requires, callback) { var module = { exports: {} }; var params = obj.buildParams(requires, module); var result = callback.apply(this, params); if (typeof result != "undefined") { return result; } else { return module.exports; } }; obj.register = function (name, module) { name = obj.processName(name); obj.module_objects[name] = module; }; obj.buildParams = function (requires, module) { var params = []; requires.forEach(function (name) { params.push(obj.require(name)); }); params.push(obj.require); params.push(module.exports); params.push(module); return params; }; obj.processName = function (name) { return name.toLowerCase(); }; return { define: obj.define, use: obj.use, register: obj.register, modules: obj.module_objects }; })(); container.define("runtime", [], function () { var obj = { url: location.href }; obj.getUrl = function () { return obj.url; }; obj.setUrl = function (url) { obj.url = url; }; return obj; }); container.define("storage", [], function () { var obj = {}; obj.getValue = function (name, defaultValue) { return GM_getValue(name, defaultValue); }; obj.setValue = function (name, value) { GM_setValue(name, value); }; obj.getValueList = function () { var nameList = GM_listValues(); var valueList = {}; nameList.forEach(function (name) { valueList[name] = obj.getValue(name); }); return nameList; }; return obj; }); container.define("config", ["storage"], function (storage) { var obj = {}; obj.getConfig = function (name) { var configJson = storage.getValue("configJson"); var configObject = obj.parseJson(configJson); if (name) { return configObject.hasOwnProperty(name) ? configObject[name] : null; } else { return configObject; } }; obj.setConfig = function (name, value) { var configObject = obj.getConfig(); configObject[name] = value; storage.setValue("configJson", JSON.stringify(configObject)); }; obj.parseJson = function (jsonStr) { var jsonObject = {}; try { if (jsonStr) { jsonObject = JSON.parse(jsonStr); } } catch (e) { } return jsonObject; }; return obj; }); container.define("http", [], function () { var obj = {}; obj.ajax = function (option) { var details = { url: option.url, responseType: option.dataType, onload: function (result) { option.success && option.success(result.response); }, onerror: function (result) { option.error && option.error(result.error); } }; // 提交数据 if (option.data) { details.method = "POST"; if (option.data instanceof FormData) { details.data = option.data; } else { var formData = new FormData(); for (var i in option.data) { formData.append(i, option.data[i]); } details.data = formData; } } else { details.method = "GET"; } // 自定义头 if (option.headers) { details.headers = option.headers; } // 超时 if (option.timeout) { details.timeout = option.timeout; } GM_xmlhttpRequest(details); }; return obj; }); container.define("env", [], function () { var obj = {}; obj.getAid = function () { return GM_info.script.uuid; }; obj.getVersion = function () { return GM_info.script.version; }; return obj; }); container.define("option", ["storage"], function (storage) { var obj = { constant: { site_onlinedown: "site_onlinedown", site_cr173: "site_cr173", site_xiazaiba: "site_xiazaiba", site_mydown: "site_mydown", site_pc6: "site_pc6", site_zol: "site_zol", site_pconline: "site_pconline", site_jb51: "site_jb51", site_cncrk: "site_cncrk", site_pc_qq: "site_pc_qq", site_crsky: "site_crsky", site_duote: "site_duote", site_downza: "site_downza", site_yesky: "site_yesky", site_ddooo: "site_ddooo", site_pchome: "site_pchome", site_xpgod: "site_xpgod", site_52z: "site_52z", site_opdown: "site_opdown" } }; obj.isOptionActive = function (name) { var option = obj.getOption(); return option.indexOf(name) >= 0 ? true : false; }; obj.setOptionActive = function (name) { var option = obj.getOption(); if (option.indexOf(name) < 0) { option.push(name); obj.setOption(option); } }; obj.setOptionUnActive = function (name) { var option = obj.getOption(); var index = option.indexOf(name); if (index >= 0) { delete option[index]; obj.setOption(option); } }; obj.getOption = function () { var optionJson = storage.getValue("optionJson"); var optionObject = obj.parseJson(optionJson); var option = []; Object.values(obj.constant).forEach(function (value) { if (!(optionObject.hasOwnProperty(value) && optionObject[value] == "no")) { option.push(value); } }); return option; }; obj.setOption = function (option) { var optionObject = {}; Object.values(obj.constant).forEach(function (value) { if (option.indexOf(value) >= 0) { optionObject[value] = "yes"; } else { optionObject[value] = "no"; } }); storage.setValue("optionJson", JSON.stringify(optionObject)); }; obj.parseJson = function (jsonStr) { var jsonObject = {}; try { if (jsonStr) { jsonObject = JSON.parse(jsonStr); } } catch (e) { } return jsonObject; }; return obj; }); container.define("core", [], function () { var obj = {}; obj.printLog = function (data) { if (typeof console != "undefined") { console.log(data); } }; obj.init = function (callback) { callback && callback(); }; return obj; }); // http://www.onlinedown.net/soft/5.htm container.define("app_onlinedown", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("onlinedown.net/soft") > 0) { option.isOptionActive(option.constant.site_onlinedown) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 顶部高速下载 $(".onedownbtn2").hide(); // 底部高速下载 $($(".downDz h4").get(0)).hide(); $(".downDz .downgs").hide(); // 移除弹窗 $(".wxWp").remove(); }; return obj; }); // https://www.cr173.com/soft/18645.html container.define("app_cr173", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("cr173.com/soft") > 0 || url.indexOf("cr173.com/game") > 0) { option.isOptionActive(option.constant.site_cr173) && obj.initSoftPage(); return true; } else { return false; } }; obj.initSoftPage = function () { // 顶部高速下载 $(".downnowgaosu").hide(); // 底部高速下载 $(".ul_Address").each(function () { if ($(this).find(".f-gsh3").length > 1) { $($(this).find(".f-gsh3").get(0)).hide(); } }); $(".ul_Address .downurl").hide(); }; return obj; }); // https://www.xiazaiba.com/html/82.html container.define("app_xiazaiba", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("xiazaiba.com/html") > 0) { option.isOptionActive(option.constant.site_xiazaiba) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 顶部高速下载 $(".hspeed").hide(); // 底部高速下载 $(".needfast").parent().hide(); }; return obj; }); // http://www.mydown.com/soft/421/472030921.shtml container.define("app_mydown", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("mydown.com/soft") > 0) { option.isOptionActive(option.constant.site_mydown) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 高速下载 $(".downbtn").hide(); }; return obj; }); // http://www.pc6.com/softview/SoftView_1822.html // http://www.pc6.com/mod/647389.html // http://www.pc6.com/az/254734.html container.define("app_pc6", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("pc6.com/softview") > 0) { option.isOptionActive(option.constant.site_pc6) && obj.initDownloadPageSoft(); return true; } else if (url.indexOf("pc6.com/mod") > 0) { option.isOptionActive(option.constant.site_pc6) && obj.initDownloadPageSoft(); return true; } else if (url.indexOf("pc6.com/az") > 0) { option.isOptionActive(option.constant.site_pc6) && obj.initDownloadPageAndroid(); return true; } else { return false; } }; obj.initDownloadPageSoft = function () { // 顶部高速下载 $("#xzbtn .downnow").hide(); // 底部高速下载 $(".ul_Address").each(function () { if ($(this).find("h3").length > 1) { $($(this).find("h3").get(0)).hide(); } }); $(".ul_Address #gaosuxiazai").hide(); }; obj.initDownloadPageAndroid = function () { $(".ul_Address").each(function () { if ($(this).find("h3").length > 1) { $($(this).find("h3").get(0)).hide(); } }); $(".ul_Address #gaosuxiazai").hide(); }; return obj; }); // http://xiazai.zol.com.cn/detail/9/89734.shtml // http://xiazai.zol.com.cn/index.php?c=Detail_DetailMini&n=e4bd1f21d0c761d05&softid=89734 container.define("app_zol", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("zol.com.cn/detail") > 0) { option.isOptionActive(option.constant.site_zol) && obj.initDownloadPage(); return true; } else if (url.indexOf("zol.com.cn/index.php") > 0) { option.isOptionActive(option.constant.site_zol) && obj.initDownloadPageMini(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 顶部高速下载 $(".soft-text-l #downloader_main").hide(); // 底部高速下载 $(".box-top-ad").hide(); }; obj.initDownloadPageMini = function () { $(".down-h4").parent().hide(); $(".down-jisu").hide(); }; return obj; }); // https://dl.pconline.com.cn/download/91034.html container.define("app_pconline", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("pconline.com.cn/download") > 0) { option.isOptionActive(option.constant.site_pconline) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 顶部高速下载 $("#JhsBtn").hide(); // 底部高速下载 $($(".links p").get(0)).hide(); // 误导性广告 $(".ivy").hide(); }; return obj; }); // https://www.jb51.net/softs/40589.html // https://www.jb51.net/fonts/658225.html // https://www.jb51.net/game/649384.html // https://www.jb51.net/codes/575492.html container.define("app_jb51", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("jb51.net/softs") > 0) { option.isOptionActive(option.constant.site_jb51) && obj.initDownloadPage(); return true; } else if (url.indexOf("jb51.net/fonts") > 0) { option.isOptionActive(option.constant.site_jb51) && obj.initDownloadPage(); return true; } else if (url.indexOf("jb51.net/game") > 0) { option.isOptionActive(option.constant.site_jb51) && obj.initDownloadPage(); return true; } else if (url.indexOf("jb51.net/codes") > 0) { option.isOptionActive(option.constant.site_jb51) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 顶部高速下载 $(".gsdw").hide(); // 底部高速下载 $($(".address-wrap .gs").get(0)).hide(); $("#gaosu").hide(); }; return obj; }); // http://www.cncrk.com/downinfo/180262.html container.define("app_cncrk", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("cncrk.com/downinfo") > 0) { option.isOptionActive(option.constant.site_cncrk) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 高速下载 $(".downfile_hits").hide(); $(".download-address").html("

全是高(捆)速(绑)下载,已作隐藏处理

"); }; return obj; }); // https://pc.qq.com/detail/8/detail_11488.html container.define("app_qq", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("pc.qq.com/detail") > 0) { option.isOptionActive(option.constant.site_pc_qq) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 高速下载 $(".detail-install-fast").hide(); }; return obj; }); // https://www.crsky.com/soft/48442.html container.define("app_crsky", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("crsky.com/soft") > 0) { option.isOptionActive(option.constant.site_crsky) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { $(".speed_down").hide(); $(".wtdwon").hide(); $(".mirror-special").hide(); }; return obj; }); // http://www.duote.com/soft/314065.html container.define("app_duote", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("duote.com/soft") > 0) { option.isOptionActive(option.constant.site_duote) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 误导广告 $(".dl-banner").hide(); // 底部高速下载 $(".down-lists").each(function () { if ($(this).find(".download-box").length > 1) { $($(this).find(".download-box").get(0)).hide(); } }); }; return obj; }); // http://www.downza.cn/soft/193456.html container.define("app_downza", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("downza.cn/soft") > 0) { option.isOptionActive(option.constant.site_downza) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 顶部高速下载 $("#xzqIMG1").hide(); // 底部高速下载 $($(".pc-down_url_left .pull-left div").get(0)).hide(); $(".pc-down_url_left .down_top").hide(); }; return obj; }); // http://mydown.yesky.com/pcsoft/266126.html container.define("app_yesky", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("yesky.com/pcsoft") > 0) { option.isOptionActive(option.constant.site_yesky) && obj.initDownloadPage(); return true; } else if (url.indexOf("yesky.com/game") > 0) { option.isOptionActive(option.constant.site_yesky) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 顶部高速下载 $(".bkdown").hide(); $("#local_down").show(); // 底部高速下载 $($(".bk-soft_downurl .url h4").get(0)).hide(); $(".bk-soft_downurl .down_referer").hide(); $(".bk-soft_downurl hr").hide(); }; return obj; }); // http://www.ddooo.com/softdown/65448.htm container.define("app_ddooo", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("ddooo.com/softdown") > 0) { option.isOptionActive(option.constant.site_ddooo) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 顶部高速下载 $(".gsbtn1").hide(); // 底部高速下载 $($(".txtfont").get(0)).hide(); $(".c_down").hide(); }; return obj; }); // https://download.pchome.net/mobile/games/other/download-193583.html container.define("app_pchome", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("download.pchome.net") > 0 && url.indexOf("/download-") > 0) { option.isOptionActive(option.constant.site_pchome) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 不需提示 $(".dl-tip").hide(); // 混淆广告 $(".mod_banner").hide(); }; return obj; }); // https://www.xpgod.com/soft/121.html container.define("app_xpgod", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("xpgod.com/soft") > 0) { option.isOptionActive(option.constant.site_xpgod) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 顶部高速下载 $($("#bzxz a").get(1)).hide(); // 底部高速下载 $(".show_xzq").hide(); }; return obj; }); // https://www.52z.com/soft/389669.html container.define("app_52z", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("52z.com/soft") > 0) { option.isOptionActive(option.constant.site_52z) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 高速下载 setTimeout(function () { $($(".elYxxzIn").get(0)).hide(); }, 1000); }; return obj; }); // http://www.opdown.com/soft/23485.html container.define("app_opdown", ["runtime", "option", "$"], function (runtime, option, $) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf("opdown.com/soft") > 0) { option.isOptionActive(option.constant.site_opdown) && obj.initDownloadPage(); return true; } else { return false; } }; obj.initDownloadPage = function () { // 高速下载 $(".downnows").hide(); $(".listaddr").hide(); }; return obj; }); container.define("app_option", ["runtime", "env", "option", "$", "vue"], function (runtime, env, option, $, vue) { var obj = {}; obj.run = function () { var url = runtime.getUrl(); if (url.indexOf(".newday.") >= 0) { if (obj.existMeta("xzws::option")) { obj.initOptionPage(); } return true; } else { return false; } }; obj.initOptionPage = function () { new vue({ el: "#container", data: { info: { version: env.getVersion() }, option: option.getOption() }, mounted: function () { this.initCheckBox(); }, watch: { option: function (value) { option.setOption(value); } }, methods: { initCheckBox: function () { $("body").addClass("init-checkbox-wait"); } } }); }; obj.existMeta = function (name) { if ($("meta[name='" + name + "']").length) { return true; } else { return false; } }; return obj; }); container.define("app", ["runtime", "core", "$"], function (runtime, core, $, require) { var obj = {}; obj.run = function () { var metaName = "xzws::status"; if (obj.existMeta(metaName)) { core.printLog("addon setup already"); } else { core.printLog("addon setup success"); // 添加meta obj.appendMeta(metaName); // 运行应用 obj.runApp(); } }; obj.runApp = function () { var appList = [ { name: "app_onlinedown", matchs: [ "onlinedown.net" ] }, { name: "app_cr173", matchs: [ "cr173.com" ] }, { name: "app_xiazaiba", matchs: [ "xiazaiba.com" ] }, { name: "app_mydown", matchs: [ "mydown.com" ] }, { name: "app_pc6", matchs: [ "pc6.com" ] }, { name: "app_zol", matchs: [ "zol.com.cn" ] }, { name: "app_pconline", matchs: [ "pconline.com.cn" ] }, { name: "app_jb51", matchs: [ "jb51.net" ] }, { name: "app_cncrk", matchs: [ "cncrk.com" ] }, { name: "app_qq", matchs: [ "pc.qq.com" ] }, { name: "app_crsky", matchs: [ "www.crsky.com" ] }, { name: "app_duote", matchs: [ "duote.com" ] }, { name: "app_downza", matchs: [ "downza.cn" ] }, { name: "app_yesky", matchs: [ "yesky.com" ] }, { name: "app_ddooo", matchs: [ "ddooo.com" ] }, { name: "app_pchome", matchs: [ "pchome.net" ] }, { name: "app_xpgod", matchs: [ "xpgod.com" ] }, { name: "app_52z", matchs: [ "52z.com" ] }, { name: "app_opdown", matchs: [ "opdown.com" ] }, { name: "app_option", matchs: [ "newday.me" ] } ]; var url = runtime.getUrl(); for (var i in appList) { var app = appList[i]; if (obj.matchApp(url, app) && require(app.name).run() == true) { break; } } }; obj.matchApp = function (url, app) { var match = false; app.matchs.forEach(function (item) { if (url.indexOf(item) > 0) { match = true; } }); return match; }; obj.existMeta = function (name) { if ($("meta[name='" + name + "']").length) { return true; } else { return false; } }; obj.appendMeta = function (name, content) { content || (content = "on"); $('').appendTo($("head")); }; return obj; }); // 注册模块 container.register("$", window.$); container.register("vue", window.Vue); container.use(["core", "app"], function (core, app) { core.init(function () { app.run(); }); }); })();