// ==UserScript==
// @name 下载卫士
// @namespace http://www.newday.me/
// @version 0.1.4
// @icon http://www.newday.me/xia/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-start
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_listValues
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function () {
'use strict';
var injectInfo = {
enable: false,
name: "xzws",
version: "0.1.4"
};
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("gm", [], function () {
var obj = {};
obj.ready = function (callback) {
if (typeof GM_getValue != "undefined") {
callback && callback();
}
else {
setTimeout(function () {
obj.ready(callback);
}, 100);
}
};
return obj;
});
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("object", [], function () {
var obj = {};
obj.keys = function (data) {
var list = [];
for (var key in data) {
list.push(key);
}
return list;
};
obj.values = function (data) {
var list = [];
for (var key in data) {
list.push(data[key]);
}
return list;
};
return obj;
});
container.define("storage", [], function () {
var obj = {};
obj.getValue = function (name, defaultValue) {
name = obj.processName(name);
return GM_getValue(name, defaultValue);
};
obj.setValue = function (name, value) {
name = obj.processName(name);
GM_setValue(name, value);
};
obj.getValueList = function () {
var nameList = GM_listValues();
var valueList = {};
nameList.forEach(function (name) {
if (injectInfo.enable) {
if (name.indexOf(injectInfo.name + "_") >= 0) {
name = name.replace(injectInfo.name + "_", "");
valueList[name] = obj.getValue(name);
}
}
else {
valueList[name] = obj.getValue(name);
}
});
return valueList;
};
obj.processName = function (name) {
if (injectInfo.enable) {
return injectInfo.name + "_" + name;
}
else {
return name;
}
};
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("mode", [], function () {
var obj = {
constant: {
addon: "addon",
script: "script"
}
};
obj.getMode = function () {
if (typeof GM_info == "undefined") {
return obj.constant.addon;
}
else if (GM_info.scriptHandler) {
return obj.constant.script;
}
else {
return obj.constant.addon;
}
};
return obj;
});
container.define("env", ["mode"], function (mode) {
var obj = {};
obj.getMode = function () {
return mode.getMode();
};
obj.getAid = function () {
if (GM_info.addon && GM_info.addon.id) {
return GM_info.addon.id;
}
else if (GM_info.scriptHandler) {
return GM_info.scriptHandler.toLowerCase();
}
else {
return "unknown";
}
};
obj.getVersion = function () {
if (injectInfo.enable) {
return injectInfo.version;
}
else {
return GM_info.script.version;
}
};
obj.getInfo = function () {
return {
mode: obj.getMode(),
aid: obj.getAid(),
version: obj.getVersion()
};
};
return obj;
});
container.define("option", ["storage", "constant", "object"], function (storage, constant, object) {
var obj = {
constant: constant.option
};
obj.isOptionActive = function (item) {
var name = item.name;
var option = obj.getOption();
return option.indexOf(name) >= 0 ? true : false;
};
obj.setOptionActive = function (item) {
var name = item.name;
var option = obj.getOption();
if (option.indexOf(name) < 0) {
option.push(name);
obj.setOption(option);
}
};
obj.setOptionUnActive = function (item) {
var name = item.name;
var option = obj.getOption();
var index = option.indexOf(name);
if (index >= 0) {
delete option[index];
obj.setOption(option);
}
};
obj.getOption = function () {
var option = [];
var optionJson = storage.getValue("optionJson");
var optionObject = obj.parseJson(optionJson);
object.values(obj.constant).forEach(function (item) {
var name = item.name;
if (optionObject.hasOwnProperty(name)) {
if (optionObject[name] != "no") {
option.push(name);
}
}
else if (item.value != "no") {
option.push(name);
}
});
return option;
};
obj.setOption = function (option) {
var optionObject = {};
object.values(obj.constant).forEach(function (item) {
var name = item.name;
if (option.indexOf(name) >= 0) {
optionObject[name] = "yes";
} else {
optionObject[name] = "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("logger", ["env", "constant"], function (env, constant) {
var obj = {
level: 3,
constant: {
debug: 0,
info: 1,
warn: 2,
error: 3
}
};
obj.debug = function (message) {
obj.log(message, obj.constant.debug);
};
obj.info = function (message) {
obj.log(message, obj.constant.info);
};
obj.warn = function (message) {
obj.log(message, obj.constant.warn);
};
obj.error = function (message) {
obj.log(message, obj.constant.error);
};
obj.log = function (message, level) {
if (level < obj.level) {
return false;
}
console.group("[" + constant.name + "]" + env.getMode());
console.log(message);
console.groupEnd();
};
obj.setLevel = function (level) {
obj.level = level;
};
return obj;
});
container.define("meta", ["constant", "$"], function (constant, $) {
var obj = {};
obj.existMeta = function (name) {
name = obj.processName(name);
if ($("meta[name='" + name + "']").length) {
return true;
}
else {
return false;
}
};
obj.appendMeta = function (name, content) {
name = obj.processName(name);
content || (content = "on");
$('<meta name="' + name + '" content="on">').appendTo($("head"));
};
obj.processName = function (name) {
return constant.name + "::" + name;
};
return obj;
});
/** custom start **/
container.define("constant", [], function () {
return {
name: "xzws",
option: {
site_onlinedown: {
name: "site_onlinedown",
value: "yes"
},
site_cr173: {
name: "site_cr173",
value: "yes"
},
site_xiazaiba: {
name: "site_xiazaiba",
value: "yes"
},
site_mydown: {
name: "site_mydown",
value: "yes"
},
site_pc6: {
name: "site_pc6",
value: "yes"
},
site_zol: {
name: "site_zol",
value: "yes"
},
site_pconline: {
name: "site_pconline",
value: "yes"
},
site_jb51: {
name: "site_jb51",
value: "yes"
},
site_cncrk: {
name: "site_cncrk",
value: "yes"
},
site_pc_qq: {
name: "site_pc_qq",
value: "yes"
},
site_crsky: {
name: "site_crsky",
value: "yes"
},
site_duote: {
name: "site_duote",
value: "yes"
},
site_downza: {
name: "site_downza",
value: "yes"
},
site_yesky: {
name: "site_yesky",
value: "yes"
},
site_ddooo: {
name: "site_ddooo",
value: "yes"
},
site_pchome: {
name: "site_pchome",
value: "yes"
},
site_xpgod: {
name: "site_xpgod",
value: "yes"
},
site_52z: {
name: "site_52z",
value: "yes"
},
site_opdown: {
name: "site_opdown",
value: "yes"
}
}
};
});
container.define("core", [], function () {
var obj = {};
obj.ready = 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 .gaosu").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").hide();
$(".soft-text-r").addClass("soft-text-l").removeClass("soft-text-r");
// 底部高速下载
$(".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("<p>全是高(捆)速(绑)下载,已作隐藏处理</p>");
};
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 () {
$($(".i_dwon a").get(1)).hide();
$(".Adown_dli").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 || url.indexOf("downza.cn/android") > 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_newday", ["runtime", "env", "option", "meta", "vue"], function (runtime, env, option, meta, vue) {
var obj = {};
obj.run = function () {
if (meta.existMeta("info")) {
obj.initInfoPage();
return true;
} else if (meta.existMeta("option")) {
obj.initOptionPage();
return true;
}
else {
return false;
}
};
obj.initInfoPage = function () {
new vue({
el: "#container",
data: {
info: env.getInfo()
},
created: function () {
obj.initAddonReady();
}
});
};
obj.initOptionPage = function () {
new vue({
el: "#container",
data: {
info: env.getInfo(),
option: option.getOption()
},
created: function () {
obj.initAddonReady();
},
watch: {
option: function (value) {
option.setOption(value);
}
}
});
};
obj.initAddonReady = function () {
$("body").addClass("nd-addon-ready");
};
return obj;
});
container.define("app", ["runtime", "logger", "meta", "$"], function (runtime, logger, meta, $, require) {
var obj = {};
obj.run = function () {
var metaName = "status";
if (meta.existMeta(metaName)) {
logger.info("addon setup already");
}
else {
logger.info("addon setup success");
// 添加meta
meta.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_newday",
matchs: [
"*"
]
}
];
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 || item == "*") {
match = true;
}
});
return match;
};
return obj;
});
// 注册模块
container.define("$", [], function () {
return window.$;
});
container.define("vue", [], function () {
return window.Vue;
});
container.use(["gm", "core", "app", "logger"], function (gm, core, app, logger) {
gm.ready(function () {
// 日志级别
logger.setLevel(logger.constant.info);
core.ready(app.run);
});
});
})();