实用脚本大集合 was reported 2021-07-19 as an unauthorized copy of TimerHooker.

TimerHooker uses the GPL-3.0-or-later license. Visit tldrlegal.com for help understanding what this license means.

Script License Created Updated
Reported 实用脚本大集合 N/A 2020-05-01 03:19:02 UTC 2020-05-01 03:19:01 UTC
Original TimerHooker GPL-3.0-or-later 2018-09-29 02:18:11 UTC 2021-04-17 12:14:02 UTC
  • // ==UserScript==
  • -// @name 计时器掌控者|视频广告跳过|视频广告加速器
  • -// @name:en TimerHooker
  • -// @namespace https://gitee.com/HGJing/everthing-hook/
  • -// @updateURL https://gitee.com/HGJing/everthing-hook/raw/master/src/plugins/timeHooker.js
  • -// @version 1.0.62
  • -// @description 控制网页计时器速度|加速跳过页面计时广告|视频快进(慢放)|跳过广告|支持几乎所有网页.
  • -// @description:en it can hook the timer speed to change.
  • -// @include *
  • -// @require https://greasyfork.org/scripts/372672-everything-hook/code/Everything-Hook.js?version=881251
  • -// @author Cangshi
  • -// @match http://*/*
  • -// @run-at document-start
  • -// @grant none
  • -// @license GPL-3.0-or-later
  • +// @name 实用脚本大集合
  • +// @namespace https://github.com/ziyuanxiaozhan
  • +// @version v C 0.0.0.1
  • +// @description 脚本大集合
  • +// @author ziyuanxiaozhan
  • +// @connect *://*
  • +// @include *://*
  • // ==/UserScript==
  • +var version = "2.2.1";
  • +var currentURL = window.location.href;
  • +var list;
  • +
  • +(function () {
  • + 'use strict';
  • +
  • + l("CSDNGreener V" + version);
  • + var blockURL = currentURL.split("/").length;
  • + var main = /(www\.csdn\.net\/)$/;
  • + var article = /article/;
  • + var bbs = /bbs\.csdn\.net/;
  • + var blog = /blog\.csdn\.net/;
  • + var blog2 = /\/article\/list\//;
  • + var download = /download\.csdn\.net/;
  • + var login = /passport\.csdn\.net/;
  • + var zone = /me\.csdn\.net/;
  • +
  • + // 数组初始化
  • + list = [];
  • + // 头部分
  • + // APP
  • + put(".app-app");
  • + // VIP
  • + put(".vip-caise");
  • + // 记录你的成长历程(记个毛)
  • + put("#writeGuide");
  • + // 新通知小圆点(未登录才消掉)
  • + if ($(".userinfo a").text() === '登录/注册') {
  • + put("#msg-circle");
  • + }
  • + // Cookie
  • + common(6, 1);
  • +
  • + if (main.test(currentURL)) {
  • + l("正在优化主页体验...");
  • + // 常规
  • + // 头部广告
  • + put(".banner-ad-box");
  • + // 右侧广告
  • + put(".slide-outer");
  • + // 右侧浮窗
  • + put(".csdn-side-toolbar");
  • + // 右侧详情
  • + put(".persion_article");
  • + clean(10);
  • + common(5, 10);
  • + loop(1);
  • + } else if ((blog.test(currentURL) && blockURL === 4) || blog2.test(currentURL)) {
  • + l("正在优化个人博客主页体验...");
  • + // 常规
  • + // 左侧广告
  • + put(".mb8");
  • + put("#kp_box_503");
  • + clean(10);
  • + common(5, 10);
  • + } else if (article.test(currentURL)) {
  • + l("正在优化阅读体验...");
  • + // 常规
  • + // 右侧广告,放到第一个清除
  • + // put(".recommend-right");
  • + put("#addAdBox");
  • + put(".aside-box.kind_person.d-flex.flex-column");
  • + put(".recommend-top-adbox");
  • + put(".recommend-list-box.d-flex.flex-column.aside-box");
  • + // 左侧广告
  • + put("#container");
  • + // 快来写博客吧
  • + put(".blog_tip_box");
  • + // 推荐关注用户
  • + put(".blog-expert-recommend-box");
  • + // 右下角VIP
  • + put(".meau-gotop-box");
  • + // 广告
  • + put(".mediav_ad");
  • + put(".pulllog-box");
  • + put(".recommend-ad-box");
  • + put(".box-shadow");
  • + put(".type_hot_word");
  • + put(".fourth_column");
  • + // 高分辨率时右侧文章推荐
  • + put(".right-item");
  • + // 广告
  • + put("#asideFooter");
  • + put("#ad-div");
  • + put("#479");
  • + put("#480");
  • + // 打赏
  • + put(".postTime");
  • + // 课程推荐
  • + put(".t0");
  • + // 分享海报
  • + put(".shareSuggest");
  • + // 底部主题
  • + put(".template-box");
  • + // 评论区广告
  • + put("div#dmp_ad_58");
  • + // 打赏
  • + put(".reward-user-box");
  • + // 右侧打赏按钮
  • + put(".to-reward");
  • + // 推荐内容广告
  • + put(".recommend-recommend-box");
  • + // 右侧广告
  • + put(".indexSuperise");
  • + clean(10);
  • + // 填充
  • + common(4, 5);
  • + // 评论
  • + common(1, 30);
  • + // 其它
  • + common(2, 20);
  • + // 顶部显示作者信息
  • + common(8, 1);
  • + // 循环线程开始
  • + loop(2);
  • + } else if (bbs.test(currentURL)) {
  • + l("正在优化论坛体验...");
  • + // 常规
  • + // 评论嵌入小广告
  • + put(".post_recommend");
  • + // 底部推荐
  • + put("#post_feed_wrap");
  • + // 底部相关文章里面的广告
  • + put(".bbs_feed_ad_box");
  • + put(".recommend-ad-box");
  • + // 底部相关文字里面的热词提示
  • + put(".type_hot_word");
  • + // 底部蓝色flex属性的广告栏+登录注册框
  • + put(".pulllog-box");
  • + // 猜你喜欢
  • + put(".personalized-recommend-box");
  • + // 发帖减半提示
  • + put(".totast-box");
  • + // 顶部广告
  • + put(".recommend-right");
  • + // 顶部广告
  • + put(".ad_top");
  • + clean(10);
  • + // 展开
  • + common(3, 50);
  • + common(5, 10);
  • + } else if (download.test(currentURL)) {
  • + l("正在优化下载页体验...");
  • + // 常规
  • + put(".fixed_dl");
  • + put("indexSuperise");
  • + clean(10);
  • + common(5, 10);
  • + } else if (login.test(currentURL)) {
  • + l("正在优化登录页体验...");
  • + // 常规
  • + // 登录界面大图广告
  • + put(".main-tu");
  • + clean(10);
  • + common(5, 10);
  • + } else if (zone.test(currentURL)) {
  • + l("正在优化个人空间体验...");
  • + // 常规
  • + clean(10);
  • + common(7, 10);
  • + common(5, 10);
  • + } else {
  • + e("不受支持的页面!");
  • + }
  • + l("超级优化完毕。");
  • + l("如果觉得好用,来 https://greasyfork.org/zh-CN/scripts/378351 收藏脚本来支持我吧!");
  • +})();
  • +
  • +function l(log) {
  • + console.log("[CSDNGreener] " + log);
  • +}
  • +
  • +function e(error) {
  • + console.error("[CSDNGreener] " + error);
  • +}
  • +
  • +function clear() {
  • + list = [];
  • +}
  • +
  • +function put(tag) {
  • + list.push(tag);
  • +}
  • +
  • +function clean(times) {
  • + var loop = setInterval(function () {
  • + --times;
  • + if (times <= 0) {
  • + clearInterval(loop);
  • + }
  • + /* for (var j = 0; j < list.length; j++) {
  • + $(list[j]).hide(1000);
  • + }
  • + setInterval(function () {
  • + for (var k = 0; k < list.length; k++) {
  • + $(list[k]).remove();
  • + }
  • + }, 1000); */
  • + for (var k = 0; k < list.length; k++) {
  • + $(list[k]).remove();
  • + }
  • + }, 100);
  • +}
  • +
  • +function loop(num) {
  • + var did = false;
  • + setInterval(function () {
  • + if (num === 1) {
  • + // 主页中间的广告
  • + $(".J_adv").remove();
  • + // 主页有新的内容横条
  • + $(".feed-fix-box").remove();
  • + // 主页广告 iframe
  • + if (currentURL == "https://www.csdn.net/") {
  • + $("iframe").remove();
  • + }
  • + // 删除 CSDN 官方在主页的文章(大多是广告)
  • + $("li.clearfix").each(function(index, ele) {
  • + var banned = /csdn<\/a>/;
  • + var aMark = $(ele).find(".name").html();
  • + if (banned.test(aMark)) {
  • + $(ele).remove();
  • + }
  • + });
  • + } else if (num === 2) {
  • + // 评论查看更多展开监听
  • + $("div.comment-list-box").css("max-height", "none");
  • + // 文章宽度自适应
  • + if (window.innerWidth < 1100) {
  • + $("article").width(window.innerWidth - 150);
  • + did = true;
  • + } else {
  • + if (did === true) {
  • + $("article").removeAttr("style");
  • + did = false;
  • + }
  • + }
  • + }
  • + }, 500);
  • +}
  • +
  • +function common(num, times) {
  • + var loop = setInterval(function () {
  • + --times;
  • + if (times <= 0) {
  • + clearInterval(loop);
  • + }
  • + if (num === 1) {
  • + // 查看更多
  • + $(".btn-readmore").removeClass("no-login");
  • + $(".btn-readmore").addClass("fans-read-more");
  • + $(".btn-readmore").removeAttr("href");
  • + $(".btn-readmore").removeAttr("target");
  • + $(".btn-readmore").removeAttr("rel");
  • + $(".btn-readmore").click();
  • + // 已登录用户展开评论
  • + try {
  • + document.getElementById("btnMoreComment").click();
  • + } catch (e) {}
  • + // 删除查看更多按钮
  • + $("#btnMoreComment").parent("div.opt-box").remove();
  • + // 展开内容
  • + $("div.comment-list-box").css("max-height", "none");
  • + // 改回背景颜色
  • + $(".login-mark").remove();
  • + // 删除登录框
  • + $(".login-box").remove();
  • + } else if (num === 2) {
  • + // 挡住评论的“出头推荐”
  • + if ($(".recommend-box").length > 1) {
  • + $(".recommend-box")[0].remove();
  • + }
  • + // 去外链
  • + $("#content_views").off();
  • + // 去除推广广告
  • + $("li[data-type='ad']").remove();
  • + // 免登录复制
  • + $(".hljs-button").removeClass("signin");
  • + $(".hljs-button").addClass("{2}");
  • + $(".hljs-button").attr("data-title", "免登录复制");
  • + // 去除剪贴板劫持
  • + $("code").attr("onclick", "mdcp.copyCode(event)");
  • + try {
  • + // 复制时保留原文格式,参考 https://greasyfork.org/en/scripts/390502-csdnremovecopyright/code
  • + Object.defineProperty(window, "articleType", {
  • + value: 0,
  • + writable: false,
  • + configurable: false
  • + });
  • + } catch (err) {
  • + }
  • + csdn.copyright.init("", "", "");
  • + // 页头广告
  • + try {
  • + document.getElementsByClassName("column-advert-box")[0].style.display="none";
  • + } catch (e) {}
  • + // 自动检测是否有目录,如果没有则删除右边栏,文章居中
  • + if ($(".recommend-right_aside").html().replace(/[\r\n]/g, "").replace(/(\s)/g, "") === "") {
  • + $("#rightAside").remove();
  • + } else if ($("#recommend-right").html().replace(/[\r\n]/g, "").replace(/(\s)/g, "") === "") {
  • + $("#rightAside").remove();
  • + }
  • + } else if (num == 3) {
  • + //论坛自动展开
  • + $(".js_show_topic").click();
  • + } else if (num == 4) {
  • + // 左侧栏填充屏幕
  • + $(".blog_container_aside").hide();
  • + var screenWidth = document.body.clientWidth;
  • + if (screenWidth <= 1500) {
  • + $("main").css("cssText", "width:96% !important;");
  • + } else {
  • + $("main").css("cssText", "width:100% !important;");
  • + }
  • + // 右侧栏靠右
  • + $(".tool-box").css("right", "0px");
  • + $(".csdn-side-toolbar").css("right", "0px");
  • + } else if (num == 5) {
  • + // 改回背景颜色
  • + $(".login-mark").remove();
  • + // 删除登录框
  • + $(".login-box").remove();
  • + } else if (num == 6) {
  • + // 推荐内容开关 cookie
  • + var removeCookie = $.cookie("remove");
  • + var remove;
  • + if (removeCookie == undefined) {
  • + $.cookie('remove', true, {
  • + path: '/'
  • + });
  • + remove = true;
  • + }
  • + if (removeCookie == "true") {
  • + remove = true;
  • + } else {
  • + remove = false;
  • + }
  • + // 删除推荐内容(自定义)
  • + if (remove) {
  • + $(".recommend-box").hide();
  • + }
  • + // 推荐内容开关
  • + $(".blog-content-box").append("<br><div class='blog-content-box' id='switch'></div>");
  • + //$(".comment-edit-box").after("<center><font size='1px'><a href='https://greasyfork.org/zh-CN/scripts/378351'>CSDN Greener V" + version + "</a><br><a href='https://github.com/AdlerED'>By GitHub :: AdlerED</a></font></center>");
  • + if (remove) {
  • + $("#switch").append("<button class='hide-recommend-button'>显示推荐内容</button>");
  • + } else {
  • + $("#switch").append("<button class='hide-recommend-button'>隐藏推荐内容</button>");
  • + }
  • + renderHideButton();
  • + // 开关监听
  • + $(".hide-recommend-button").click(function () {
  • + if ($.cookie('remove') == "true") {
  • + $.cookie('remove', false, {
  • + path: '/'
  • + });
  • + $(".recommend-box").slideDown(2000);
  • + $(".hide-recommend-button").html("隐藏推荐内容");
  • + } else {
  • + $.cookie('remove', true, {
  • + path: '/'
  • + });
  • + $(".recommend-box").slideUp(1000);
  • + $(".hide-recommend-button").html("显示推荐内容");
  • + }
  • + renderHideButton();
  • + });
  • + } else if (num === 7) {
  • + $(".me_r")[1].remove();
  • + } else if (num === 8) {
  • + $(".article-bar-top").append("<br>");
  • + $(".article-bar-top").append($(".aside-box-footerClassify").children("dd").html());
  • + $("dl").each(function (index, element) {
  • + var key = $(this).children("dt");
  • + var value = $(this).children("dd").children("span");
  • + if (key.html().indexOf("原创") != -1) {
  • + key = $(this).children("dt").children("a")
  • + value = $(this).children("dd").children("a").children("span");
  • + addInfo(key, value);
  • + } else
  • + if (value.html() != undefined) {
  • + addInfo(key, value);
  • + }
  • + } );
  • + function addInfo(key, value) {
  • + var bind = key.html() + "&nbsp;" + value.html() + "&nbsp;&nbsp;";
  • + $(".article-bar-top").append(bind + " ");
  • + }
  • + $(".blog_container_aside").remove();
  • + }
  • + }, 100);
  • +}
  • +
  • +function renderHideButton() {
  • + $(".hide-recommend-button").css({
  • + "width": "270px",
  • + "height": "40px",
  • + "border-width": "0px",
  • + "border-radius": "3px",
  • + "background": "#F7F7F7",
  • + "cursor": "pointer",
  • + "outline": "none",
  • + "font-family": "Microsoft YaHei",
  • + "color": "rgba(15,15,15,0.6)",
  • + "font-size": "17px",
  • + "display": "block",
  • + "margin": "0 auto"
  • + });
  • + $(".hide-recommend-button").hover(
  • + function () {
  • + $(".hide-recommend-button").css("background", "#EEEEEE");
  • + }, function () {
  • + $(".hide-recommend-button").css("background", "#F7F7F7");
  • + }
  • + );
  • +}
  • +"use strict";
  • +
  • +//Get the file hash from html
  • +function parse_file_value() {
  • + var file_value = ''
  • + $( 'script' ).each(function(){
  • + var sc = $(this)[0].outerHTML
  • + if (sc.indexOf('down_r') != -1) {
  • + file_value = sc.substring( sc.indexOf('file') + 7, sc.indexOf('bm') - 3 )
  • + return;
  • + }
  • + })
  • + return file_value;
  • +}
  • +
  • +//Store new token to GM database
  • +async function setGM( code, code_hash ) {
  • + await GM.setValue('code', code);
  • + await GM.setValue('code_hash', code_hash);
  • +};
  • +
  • +//Post the cookie and validate
  • +function down_r_bypass( auto, code, code_hash ) {
  • + var file = parse_file_value();
  • + //Set code and hash
  • + if (!auto) {
  • + code = $('#code')[0].value;
  • + code_hash = Cookies.get('down_code');
  • + };
  • + Cookies.remove('down_code', { 'domain': '.vip.d0.baidupan.com' });
  • + Cookies.set('down_code', code_hash, { 'domain': '.vip.d0.baidupan.com' });
  • + //Ajax XHR
  • + $.ajax({
  • + async : false,
  • + type : 'post',
  • + url : 'ajax.php',
  • + data : { 'file': file, 'bm': code },
  • + dataType : 'json',
  • + success:function(msg) {
  • + if (msg.zt == '1') {
  • + //Success
  • + if (!auto) {
  • + setGM( code, code_hash );
  • + }
  • + document.location.href = msg.url;
  • + } else {
  • + //Failure
  • + changeCode();
  • + }
  • + }
  • + });
  • +}
  • +
  • +//Main function
  • +(async() => {
  • + //Load values from GM's database
  • + var code = await GM.getValue('code', '');
  • + var code_hash = await GM.getValue('code_hash', '');
  • + //Replace event bind on the download button
  • + $('#sub')[0].onclick = () => {down_r_bypass( false, code, code_hash )};
  • + //Try to auto download
  • + if (window.performance) {
  • + var IDMBack = (performance.navigation.type == performance.navigation.TYPE_BACK_FORWARD) || (performance.getEntriesByType("navigation")[0].type == "back_forward")
  • + //Prevent IDM bug causing repeat download
  • + if (!IDMBack) {
  • + down_r_bypass( true, code, code_hash );
  • + } else {
  • + changeCode();
  • + };
  • + }
  • +})();
  • +
  • +-function(doc, bd) {
  • + "use strict";
  • + let isEmbed, swfAddr;
  • + const onlyUseGpu = false,//仅使用脚本的GPU加速功能
  • + regYk = /VideoIDS=(\w+)/,
  • + noAdPlayerPath = 'http://code.taobao.org/svn/NoAdSwf/swf/',//可填写有效播放器地址路径(不包括文件名)http://halflife.coding.me/swf/
  • + swfWhiteList = [
  • + '.pdim.gs/static/', //熊猫直播
  • + 'http://v.6.cn/apple/player/',
  • + 'http://www.gaoxiaovod.com/ck/player.swf',
  • + ],
  • + Youku = {
  • + matchPlayer: url => /^http:\/\/static\.youku\.com\/v.*?\/v\/swf\/upsplayer\//.test(url),
  • + setPlayer(p, v) {
  • + if (location.hostname.endsWith('.youku.com')) {
  • + unsafeWindow.sessionStorage.P_l_h5 = true;
  • + unsafeWindow.reload();
  • + }
  • + else {
  • + let m = v.match(regYk)[1],
  • + s = getPlayerUrl('youku.swf');
  • + if (typeof(s) ==='string')
  • + setYkPlayer(p, s, m);
  • + else s.then(url => {
  • + setYkPlayer(p, url, m);
  • + setTimeout(() => URL.revokeObjectURL(url), 3e3);
  • + })
  • + .then(console.log)
  • + .catch(console.error);
  • + }
  • + }
  • + },
  • + YkOutsite = {
  • + matchPlayer: url => /^http:\/\/player\.youku\.com\/player\.php\/sid\/(\w+)/.test(url),
  • + setPlayer(p, v) {
  • + let m = RegExp.$1;
  • + if (!m) {
  • + m = swfAddr.match(regYk) || v.match(regYk);
  • + m = m[1];
  • + }
  • +
  • + let s = getPlayerUrl('youku.swf');
  • + if (typeof(s) === 'string')
  • + setYkPlayer(p, s, m);
  • + else if (window.chrome) {
  • + s.then(url => {
  • + setYkPlayer(p, url, m);
  • + setTimeout(() => URL.revokeObjectURL(url), 3e3);
  • + });
  • + } else {
  • + setYkPlayer(p, 'http://static.youku.com/v1.0.0658/v/swf/player.swf', m);
  • + }
  • + }
  • + },
  • + AcfunYk = {
  • + matchPlayer: url => url.toLowerCase().startsWith('http://cdn.aixifan.com/player/cooperation/acfunxyouku.swf'),
  • + setPlayer(p, v) {
  • + let m = v.match(/vid=(\w+)/)[1];
  • +
  • + let s = getPlayerUrl('youku.swf');
  • + if (typeof(s) === 'string')
  • + setYkPlayer(p, s, m);
  • + else if (window.chrome) {
  • + s.then(url => {
  • + setYkPlayer(p, url, m);
  • + //if (s.startsWith('blob:'))
  • + setTimeout(() => URL.revokeObjectURL(url), 3e3);
  • + });
  • + } else {
  • + setYkPlayer(p, 'http://static.youku.com/v1.0.0658/v/swf/youku.swf', m);
  • + }
  • + }
  • + },
  • + Tudou = {
  • + matchPlayer: url => location.hostname.endsWith('tudou.com') && url.startsWith('http://static.youku.com/v'),
  • + setPlayer(p, v) {
  • + console.log(doc.domain);
  • + p.data = noAdPlayerPath + 'tudou.swf';
  • + openFlashGPU(p);
  • + }
  • + },
  • + Iqiyi = {
  • + matchPlayer: url => url.startsWith('http://www.iqiyi.com/common/flashplayer/201'),
  • + setPlayer(p, v) {
  • + p.data = noAdPlayerPath + 'iqiyi.swf';
  • + openFlashGPU(p);
  • + }
  • + },
  • + Sohu = {
  • + matchPlayer: url => location.hostname === 'tv.sohu.com' && url.startsWith('http://tv.sohu.com/upload/swf/'),
  • + setPlayer(p, v) {
  • + p.src = noAdPlayerPath + 'sohu.swf';
  • + openFlashGPU(p);
  • + }
  • + };
  • +
  • + function setYkPlayer(p, url, vid) {
  • + p.outerHTML = `<embed id="${p.id}" wmode="gpu" allowfullscreen="true" src="${url}" allowscriptaccess="always" type="application/x-shockwave-flash" width="${p.width}" height="${p.height}" flashvars="isShowRelatedVideo=false&showAd=0&show_ce=0&showsearch=0&VideoIDS=${vid}&isAutoPlay=true&winType=BDskin&Type=PlayList">`;
  • + }
  • + function getPlayerUrl(fileName) {
  • + if (noAdPlayerPath)
  • + return noAdPlayerPath + fileName;
  • + let a, url = GM_getResourceURL(fileName.replace('.','_'));
  • + //console.log(url);
  • +/*
  • + if (window.chrome) {
  • + // a = url.slice(url.indexOf(',')+1);
  • + // a = new TextEncoder().encode(a);
  • + // console.log(a);
  • + // a = new Blob(a, {'type': 'application/x-shockwave-flash'});
  • + // return URL.createObjectURL(a);
  • + //url = url.replace(':application','$&/x-shockwave-flash;charset=utf-8');//"data:application/x-shockwave-flash;charset=utf-8;base64,"
  • + console.log(url.slice(0,56));
  • + //return URL.createObjectURL(dataURL2Blob(a));
  • + } else {//firefox
  • + let a = {
  • + url: url,
  • + method: "GET",
  • + responseType: 'blob',
  • + synchronous: true
  • + };
  • + a = GM_xmlhttpRequest(a);
  • + if (a.status !== 200) {
  • + alert("Unexpected status code " + a.status + " for " + fileName);
  • + return false;
  • + }
  • + return URL.createObjectURL(new Blob(a.response));
  • + } */
  • + return fetch(url)
  • + //any more type: res.arrayBuffer() .text() .json()
  • + .then(res => res.blob())
  • + .then(data => URL.createObjectURL(data));
  • + }
  • +/*
  • + function dataURL2File(src, fileName, mimeType){
  • + return fetch(src).then(res => res.blob())
  • + //.then(res => res.arrayBuffer())
  • + //.then(function(buf){return new File([buf], fileName, {type:mimeType});});
  • + }
  • + function dataURL2Blob(dataurl) {
  • + let arr = dataurl.split(','),
  • + mime = arr[0].match(/:(.*?);/)[1],
  • + bstr = atob(arr[1]),
  • + n = bstr.length,
  • + a = new Uint8Array(n);
  • + while(n--){
  • + a[n] = bstr.charCodeAt(n);
  • + }
  • + return new Blob(a, {'type': mime});
  • + }
  • + function injectDOM(replaceCss) {
  • + // if (!confirm('请选择下载的swf播放器文件。准备好了吗?'))
  • + // return;
  • + let s, c;
  • + if (replaceCss) {
  • + c = document.querySelector(replaceCss);
  • + if (!c) return;
  • + } else {
  • + c = $C('div');
  • + document.body.appendChild(c);
  • + }
  • + s = $C('script', {type:"text/javascript", 'class':"gmTemp"});
  • + s.textContent = `window.URL = window.URL || window.webkitURL;
  • + function handleSwf(file) {
  • + if (!/\.swf$/i.test(file.name) ) return false;
  • +
  • + //save data to localStorage
  • + blob2DataURL(file, r => {localStorage.swfPlayer = r});
  • + setTimeout(function() {
  • + alert('缓存完毕!刷新页面...');
  • + location.reload();
  • + }, 1000);
  • + }
  • +
  • + function blob2DataURL(blob, callback) {
  • + let fr = new FileReader();
  • + fr.onload = function (ev) {
  • + callback(ev.target.result);
  • + };
  • + fr.readAsDataURL(blob);
  • + }`;
  • + document.head.appendChild(s);
  • + c.outerHTML = `<div><input type="file" id="fileElem" onchange="handleSwf(this.files[0])" hidden>
  • + <a href="javascript:;" id="fileSelect" style="font-size:20px;" onclick="document.querySelector('input#fileElem').click();">设置去广告swf文件</a></div>`;
  • + }
  • +//https://github.com/beatgammit/base64-js
  • +let lookup=[];let revLookup=[];let code='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';for(let i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i;}
  • +function placeHoldersCount(b64){let len=b64.length;if(len%4>0){throw new Error('Invalid string. Length must be a multiple of 4');}
  • +return b64[len-2]==='='?2:b64[len-1]==='='?1:0;}
  • +function toByteArray(b64){let i,j,l,tmp,placeHolders,arr;let len=b64.length;placeHolders=placeHoldersCount(b64);arr=new Uint8Array(len*3/4-placeHolders);l=placeHolders>0?len-4:len;let L=0;for(i=0,j=0;i<l;i+=4,j+=3){tmp=(revLookup[b64.charCodeAt(i)]<<18)|(revLookup[b64.charCodeAt(i+1)]<<12)|(revLookup[b64.charCodeAt(i+2)]<<6)|revLookup[b64.charCodeAt(i+3)];arr[L++]=(tmp>>16)&0xFF;arr[L++]=(tmp>>8)&0xFF;arr[L++]=tmp&0xFF;}
  • +if(placeHolders===2){tmp=(revLookup[b64.charCodeAt(i)]<<2)|(revLookup[b64.charCodeAt(i+1)]>>4);arr[L++]=tmp&0xFF;}else if(placeHolders===1){tmp=(revLookup[b64.charCodeAt(i)]<<10)|(revLookup[b64.charCodeAt(i+1)]<<4)|(revLookup[b64.charCodeAt(i+2)]>>2);arr[L++]=(tmp>>8)&0xFF;arr[L++]=tmp&0xFF;}
  • +return arr;}
  • +
  • + function qyOutsiteFormat(p, v) {
  • + let tvid = v.match(/\btvId=(\w+)/i)[1],
  • + definitionID = v.match(/\b(?:definitionID|sourceId|vid)=(\w+)/)[1],
  • + s = `<embed width="100%" height="100%" allowscriptaccess="always" wmode="gpu" allowfullscreen="true" type="application/x-shockwave-flash" id="${p.id}" src="${noAdPlayerPath}iqiyi_out.swf" flashvars="vid=${definitionID}&tvid=${tvid}&autoPlay=1&showSearch=0&showSearchBox=0&autoHideControl=1&cid=qc_100001_300089&showDock=0">`;
  • + setPlayer(p, s);
  • + } */
  • + function openFlashGPU(p) {
  • + isEmbed ? p.setAttribute('wmode', 'gpu') :
  • + setFlashParam(p, {wmode: 'gpu'});
  • + //p.parentNode.replaceChild(p.cloneNode(true), p);
  • + refreshElem(p);
  • + }
  • + function refreshElem(o) {
  • + let s = o.style.display;
  • + o.style.display = 'none';
  • + setTimeout(() => {
  • + s ? o.style.display = s : o.style.removeProperty('display');
  • + if ('' === o.getAttribute('style'))
  • + o.removeAttribute('style');
  • + }, 9);
  • + }
  • + function isPlayer(p) {
  • + if (swfWhiteList.some(x => swfAddr.toLowerCase().includes(x)))
  • + return !0;
  • + if (!p.width) return !1;
  • + if (p.width.endsWith('%')) return !0;
  • + if (parseInt(p.width) < 233 || parseInt(p.height) < 53) return !1;
  • + return isEmbed ? p.matches('[allowFullScreen]') : /"allowfullscreen"/i.test(p.innerHTML);
  • + }
  • + function setFlashParam(p, values) {
  • + let i, o,
  • + e = p.querySelector('embed');
  • + for (i in values) {
  • + if (e) e.setAttribute(i, values[i]);
  • + if (p.hasAttribute(i)) p.setAttribute(i, values[i]);
  • + }
  • + for (o of p.childNodes) if (o.name) {
  • + i = o.name.toLowerCase();
  • + if (i in values) {
  • + o.value = values[i];
  • + delete values[i];
  • + }
  • + }
  • + for (i in values) {
  • + e = doc.createElement('param');
  • + e.name = i;
  • + e.value = values[i];
  • + p.appendChild(e);
  • + }
  • + }
  • + function getFlashvars(p) {
  • + let s = 'flashvars';
  • + if (isEmbed)
  • + return p.getAttribute(s);
  • + if (!p.children[s])
  • + s = 'flashVars';
  • + return p.children[s].value;
  • + }
  • + let player_pr = [Youku,YkOutsite,AcfunYk,Sohu];//处理队列
  • + function doPlayer(e) {
  • + if (!onlyUseGpu) {
  • + for (let t of player_pr) {
  • + if (t.matchPlayer(swfAddr)) {
  • + t.setPlayer(e, getFlashvars(e));
  • + return;
  • + }
  • + }
  • + }
  • + openFlashGPU(e);
  • + }
  • + function $C(name, attr) {
  • + let el = document.createElement(name);
  • + if (attr) {
  • + for (var i in attr) {//用var修正TM的for-in循环BUG
  • + attr.hasOwnProperty(i) && el.setAttribute(i, attr[i]);
  • + }
  • + }
  • + return el;
  • + }
  • +
  • + if (window.chrome)
  • + NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
  • + if ($C('a').click === undefined) {
  • + Element.prototype.click = function () {
  • + // var e = document.createEvent('MouseEvents');
  • + // e.initEvent('click', true, true);
  • + var e = new MouseEvent("click");
  • + this.dispatchEvent(e);
  • + };
  • + }
  • + window.URL = window.URL || window.webkitURL;
  • + let parents = new WeakSet();
  • +
  • + new MutationObserver(function () {
  • + for (let k of doc.querySelectorAll('object,embed')) {
  • + isEmbed = k.matches('embed');
  • + if (isEmbed && k.parentNode.matches('object'))
  • + continue;
  • + swfAddr = isEmbed ? k.src : k.data || k.children.movie.value;
  • + console.log(swfAddr);
  • + let p = k.parentNode;
  • + if (parents.has(p) || !/\.swf(?:$|\?)/.test(swfAddr))
  • + continue;
  • + parents.add(p);
  • + if (isPlayer(k)) {
  • + console.log(k, swfAddr, ' is player!');
  • + doPlayer(k);
  • + }
  • + }
  • + }).observe(bd, {
  • + childList : true,
  • + subtree : true
  • + });
  • + let div = $C('div');
  • + bd.appendChild(div);
  • + bd.removeChild(div);
  • +}(document, document.body);
  • +function activelink(re, nre) {
  • + $('.t_f').each(function () {
  • + //console.log('info:'+ $(this).html());
  • + // var link = re.exec($(this).html());
  • + if (($(this).html()).match(nre)) return;
  • + var link = ($(this).html()).match(re);
  • + console.log(link);
  • + if (link) {
  • + var ss = $(this).html();
  • + ss = ss.replace(re, '<a target="_blank" href="$1" style="color: rgb(63, 211, 68); text-decoration:none;">$1</a>');
  • + $(this).html(ss);
  • + }
  • + });
  • +}
  • +var re_baidu = /((?:https?:\/\/)?(?:yun|pan|eyun).baidu.com\/(?:s\/[0-9a-zA-Z_\-]*|share\/\S*\d))/g;
  • +var re_ex_baidu = /(href="https?:\/\/(yun|pan|eyun).baidu.com\/(?:s\/[0-9a-zA-Z_\-]*|share\/\S*\d))/g;
  • +activelink(re_baidu, re_ex_baidu);
  • +var re_360 = /(https?:\/\/yunpan.360.cn\/surl_\w*)/g;
  • +var re_ex_360 = /href="https?:\/\/yunpan.360.cn\/surl_\w*/g;
  • +activelink(re_360, re_ex_360);
  • +var re_weiyun = /(https?:\/\/(share.weiyun.com|url.cn)\/\w*)/g;
  • +var re_ex_weiyun = /href="https?:\/\/(share.weiyun.com|url.cn)\/\w*/g;
  • +activelink(re_weiyun, re_ex_weiyun);
  • +var re_lanzou = /(https?:\/\/www.lanzous.com\/\w*)/g;
  • +var re_ex_lanzou = /href="https?:\/\/www.lanzous.com\/\w*/g;
  • +activelink(re_lanzou, re_ex_lanzou);
  • +
  • +var temp = /(<\/font><font color="#\w*">h<\/font><font color="#\w*">t<\/font>.*font>)/g;
  • + $('.t_f').each(function () {
  • + var link = ($(this).html()).match(temp);
  • + if (link){
  • + link = link[0].replace(/<font color="#\w*">|<\/font>/g,"").match(/htt.*?(?=\s)/)[0];
  • + console.log(link);
  • + }
  • + var ss = $(this).html();
  • + var m = '<a target="_blank" href=' + link +' style="color: rgb(63, 211, 68); text-decoration:none;">$1</a>';
  • + ss = ss.replace(temp,m);
  • + $(this).html(ss);
  • +
  • + });
  • +
  • +(function() {
  • + 'use strict';
  • + if(document.querySelector('span.sign-in-link')){
  • + var otherSite=/greasyfork\.org/.test(location.hostname)?"sleazyfork":"greasyfork";
  • + if(/scripts\/\d+/.test(location.href)){
  • + if(!document.querySelector("#script-info") && (otherSite == "greasyfork" || document.querySelector("div.width-constraint>section>p>a"))){
  • + location.href=location.href.replace(/\/\/([^\.]+\.)?(greasyfork|sleazyfork)\.org/,"//$1"+otherSite+"\.org");
  • + }
  • + }else if(/\/(scripts|users)(\/|.*(\?|&)q=|.*\?set=)/.test(location.href)){
  • + GM_xmlhttpRequest({
  • + method: 'GET',
  • + url: location.href.replace(/\/\/([^\.]+\.)?(greasyfork|sleazyfork)\.org/,"//$1"+otherSite+"\.org"),
  • + onload: function(result) {
  • + var doc = null;
  • + try {
  • + doc = document.implementation.createHTMLDocument('');
  • + doc.documentElement.innerHTML = result.responseText;
  • + }
  • + catch (e) {
  • + console.log('parse error');
  • + }
  • + if (!doc) {
  • + return;
  • + }
  • + var l = doc.querySelector('ol.script-list');
  • + if (l) {
  • + var ml = document.querySelector('ol.script-list');
  • + if(!ml){
  • + ml=document.createElement("ol");
  • + ml.setAttribute("class","script-list");
  • + var list=document.querySelector('.sidebarred-main-content');
  • + var ps=list.querySelectorAll("p");
  • + for(let i=0;i<ps.length;i++){
  • + let p=ps[i];
  • + list.removeChild(p);
  • + }
  • + list.appendChild(ml);
  • + }
  • + var scs=l.querySelectorAll("li");
  • + if(scs){
  • + for(let i=0;i<scs.length;i++){
  • + let sc=scs[i];
  • + if(!ml.querySelector("li[data-script-id='"+sc.getAttribute("data-script-id")+"']")){
  • + addScore(sc);
  • + ml.appendChild(sc);
  • + }
  • + }
  • + }
  • + }
  • + },
  • + onerror: function(e) {
  • + console.log(e);
  • + }
  • + });
  • + }
  • + }
  • + function addScore(script){
  • + var separator=script.querySelector('h2>span.name-description-separator');
  • + var description=script.querySelector('h2>span.description');
  • + if(separator){
  • + var score=document.createElement("strong");
  • + score.style.color="#e09015";
  • + score.innerHTML=script.getAttribute("data-script-rating-score");
  • + separator.parentNode.insertBefore(score,separator);
  • + }
  • + if(description)description.innerHTML+="<strong>Ver."+script.getAttribute("data-script-version")+"</strong>"+'<div id="install-area" style="display:none;float: right;position: relative;"><a class="install-link" href="'+script.querySelector('h2>a').href.replace(/(\d)-.*/,"$1")+'/code/script.user.js">Install</a></div>';
  • + var installArea=script.querySelector("#install-area");
  • + if(installArea){
  • + script.onmouseover=function(e){
  • + installArea.style.display="block";
  • + };
  • + script.onmouseout=function(e){
  • + installArea.style.display="none";
  • + };
  • + }
  • + }
  • + var sortDiv=document.querySelector("#script-list-sort");
  • + if(sortDiv){
  • + var switchFilter=document.createElement("div"),enableFilter=!GM_getValue("disableFilter");
  • + var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  • + var observer = new MutationObserver(function(records){
  • + records.map(function(record) {
  • + for(var i=0;i<record.addedNodes.length;i++){
  • + var curNode=record.addedNodes[i];
  • + if(curNode.className=="script-list"){
  • + var scripts=curNode.querySelectorAll('li');
  • + for(let i=0;i<scripts.length;i++){
  • + let script=scripts[i];
  • + addScore(script);
  • + }
  • + if(enableFilter)filter(curNode);
  • + }
  • + }
  • + });
  • + });
  • + var option = {
  • + 'childList': true
  • + };
  • + observer.observe(document.querySelector("body>.width-constraint .sidebarred-main-content"), option);
  • + var scripts=document.querySelectorAll('ol.script-list>li');
  • + for(let i=0;i<scripts.length;i++){
  • + let script=scripts[i];
  • + addScore(script);
  • + }
  • + //Modify from GreasyFork Bullshit Filter,Thanks to darkred
  • + var style = document.createElement('style');
  • + style.textContent = 'li.filtered { display:none !important; }';
  • + style.type = 'text/css';
  • + document.querySelector('head').appendChild(style);
  • + var bullshit="vip.*视频|百度(云|网盘)|AntiGame|split|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(ö|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|NeoQuest|MyFreeFarm|narwhale\.io|Neopets|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium";
  • + var filterName="Enable Filter",filteredNum=0;
  • + var filter=function(t){
  • + [].forEach.call(t.querySelectorAll('article>h2'), function(item) {
  • + if(new RegExp(bullshit,"i").test(item.innerText)){
  • + item.parentNode.parentNode.classList.add('filtered');
  • + filteredNum++;
  • + }
  • + });
  • + };
  • + if(enableFilter)filter(document);
  • + switchFilter.innerHTML='<input type="checkBox" name="switchFilter" id="switchFilter"/><label for="switchFilter">'+filterName+(filteredNum?' ('+filteredNum+' filtered)':'')+'</label>';
  • + var switchFilterCheckbox=switchFilter.querySelector('#switchFilter');
  • + var switchFilterLabel=switchFilterCheckbox.nextSibling;
  • + switchFilterCheckbox.checked=enableFilter;
  • + switchFilterCheckbox.onclick=function(){
  • + if(enableFilter){
  • + [].forEach.call(document.querySelectorAll('li.filtered'), function(item) {
  • + item.classList.remove('filtered');
  • + });
  • + switchFilterLabel.innerHTML=filterName;
  • + }else{
  • + filteredNum=0;
  • + filter(document);
  • + switchFilterLabel.innerHTML=filterName+' ('+filteredNum+' filtered)';
  • + }
  • + GM_setValue("disableFilter",enableFilter);
  • + enableFilter=!enableFilter;
  • + };
  • + sortDiv.insertBefore(switchFilter,sortDiv.firstChild);
  • + }
  • +})();
  • +
  • +(function() {
  • + 'use strict';
  • + if(document.querySelector('span.sign-in-link')){
  • + var otherSite=/greasyfork\.org/.test(location.hostname)?"sleazyfork":"greasyfork";
  • + if(/scripts\/\d+/.test(location.href)){
  • + if(!document.querySelector("#script-info") && (otherSite == "greasyfork" || document.querySelector("div.width-constraint>section>p>a"))){
  • + location.href=location.href.replace(/\/\/([^\.]+\.)?(greasyfork|sleazyfork)\.org/,"//$1"+otherSite+"\.org");
  • + }
  • + }else if(/\/(scripts|users)(\/|.*(\?|&)q=|.*\?set=)/.test(location.href)){
  • + GM_xmlhttpRequest({
  • + method: 'GET',
  • + url: location.href.replace(/\/\/([^\.]+\.)?(greasyfork|sleazyfork)\.org/,"//$1"+otherSite+"\.org"),
  • + onload: function(result) {
  • + var doc = null;
  • + try {
  • + doc = document.implementation.createHTMLDocument('');
  • + doc.documentElement.innerHTML = result.responseText;
  • + }
  • + catch (e) {
  • + console.log('parse error');
  • + }
  • + if (!doc) {
  • + return;
  • + }
  • + var l = doc.querySelector('ol.script-list');
  • + if (l) {
  • + var ml = document.querySelector('ol.script-list');
  • + if(!ml){
  • + ml=document.createElement("ol");
  • + ml.setAttribute("class","script-list");
  • + var list=document.querySelector('.sidebarred-main-content');
  • + var ps=list.querySelectorAll("p");
  • + for(let i=0;i<ps.length;i++){
  • + let p=ps[i];
  • + list.removeChild(p);
  • + }
  • + list.appendChild(ml);
  • + }
  • + var scs=l.querySelectorAll("li");
  • + if(scs){
  • + for(let i=0;i<scs.length;i++){
  • + let sc=scs[i];
  • + if(!ml.querySelector("li[data-script-id='"+sc.getAttribute("data-script-id")+"']")){
  • + addScore(sc);
  • + ml.appendChild(sc);
  • + }
  • + }
  • + }
  • + }
  • + },
  • + onerror: function(e) {
  • + console.log(e);
  • + }
  • + });
  • + }
  • + }
  • + function addScore(script){
  • + var separator=script.querySelector('h2>span.name-description-separator');
  • + var description=script.querySelector('h2>span.description');
  • + if(separator){
  • + var score=document.createElement("strong");
  • + score.style.color="#e09015";
  • + score.innerHTML=script.getAttribute("data-script-rating-score");
  • + separator.parentNode.insertBefore(score,separator);
  • + }
  • + if(description)description.innerHTML+="<strong>Ver."+script.getAttribute("data-script-version")+"</strong>"+'<div id="install-area" style="display:none;float: right;position: relative;"><a class="install-link" href="'+script.querySelector('h2>a').href.replace(/(\d)-.*/,"$1")+'/code/script.user.js">Install</a></div>';
  • + var installArea=script.querySelector("#install-area");
  • + if(installArea){
  • + script.onmouseover=function(e){
  • + installArea.style.display="block";
  • + };
  • + script.onmouseout=function(e){
  • + installArea.style.display="none";
  • + };
  • + }
  • + }
  • + var sortDiv=document.querySelector("#script-list-sort");
  • + if(sortDiv){
  • + var switchFilter=document.createElement("div"),enableFilter=!GM_getValue("disableFilter");
  • + var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  • + var observer = new MutationObserver(function(records){
  • + records.map(function(record) {
  • + for(var i=0;i<record.addedNodes.length;i++){
  • + var curNode=record.addedNodes[i];
  • + if(curNode.className=="script-list"){
  • + var scripts=curNode.querySelectorAll('li');
  • + for(let i=0;i<scripts.length;i++){
  • + let script=scripts[i];
  • + addScore(script);
  • + }
  • + if(enableFilter)filter(curNode);
  • + }
  • + }
  • + });
  • + });
  • + var option = {
  • + 'childList': true
  • + };
  • + observer.observe(document.querySelector("body>.width-constraint .sidebarred-main-content"), option);
  • + var scripts=document.querySelectorAll('ol.script-list>li');
  • + for(let i=0;i<scripts.length;i++){
  • + let script=scripts[i];
  • + addScore(script);
  • + }
  • + //Modify from GreasyFork Bullshit Filter,Thanks to darkred
  • + var style = document.createElement('style');
  • + style.textContent = 'li.filtered { display:none !important; }';
  • + style.type = 'text/css';
  • + document.querySelector('head').appendChild(style);
  • + var bullshit="vip.*视频|百度(云|网盘)|AntiGame|split|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(ö|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|NeoQuest|MyFreeFarm|narwhale\.io|Neopets|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium";
  • + var filterName="Enable Filter",filteredNum=0;
  • + var filter=function(t){
  • + [].forEach.call(t.querySelectorAll('article>h2'), function(item) {
  • + if(new RegExp(bullshit,"i").test(item.innerText)){
  • + item.parentNode.parentNode.classList.add('filtered');
  • + filteredNum++;
  • + }
  • + });
  • + };
  • + if(enableFilter)filter(document);
  • + switchFilter.innerHTML='<input type="checkBox" name="switchFilter" id="switchFilter"/><label for="switchFilter">'+filterName+(filteredNum?' ('+filteredNum+' filtered)':'')+'</label>';
  • + var switchFilterCheckbox=switchFilter.querySelector('#switchFilter');
  • + var switchFilterLabel=switchFilterCheckbox.nextSibling;
  • + switchFilterCheckbox.checked=enableFilter;
  • + switchFilterCheckbox.onclick=function(){
  • + if(enableFilter){
  • + [].forEach.call(document.querySelectorAll('li.filtered'), function(item) {
  • + item.classList.remove('filtered');
  • + });
  • + switchFilterLabel.innerHTML=filterName;
  • + }else{
  • + filteredNum=0;
  • + filter(document);
  • + switchFilterLabel.innerHTML=filterName+' ('+filteredNum+' filtered)';
  • + }
  • + GM_setValue("disableFilter",enableFilter);
  • + enableFilter=!enableFilter;
  • + };
  • + sortDiv.insertBefore(switchFilter,sortDiv.firstChild);
  • + }
  • +})();
  • +
  • +(function() {
  • + 'use strict';
  • + var killBaijiaType=1;//1:添加-baijiahao ;2:嗅探真实url
  • + var MO = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  • + if(MO){
  • + var observer = new MO(function(records){
  • + records.map(function(record) {
  • + if(record.addedNodes.length){
  • + [].forEach.call(record.addedNodes,function(addedNode) {
  • + clearOneAD(addedNode);
  • + });
  • + }
  • + });
  • + });
  • + var option = {
  • + 'childList': true,
  • + 'subtree': true
  • + };
  • + observer.observe(document, option);
  • + }
  • +
  • + function checkBaijia(item){
  • + var itemHref=item.querySelector("a").href;
  • + item.style.display="none";
  • + if(itemHref.indexOf("baidu.com")==-1)return;
  • + var gmxhr=GM_xmlhttpRequest({
  • + url: itemHref,
  • + headers: {
  • + "Accept": "text/html"
  • + },
  • + method: "head",
  • + onreadystatechange:function(response) {
  • + if(response.readyState==4){
  • + if(response.finalUrl.indexOf("baijiahao.baidu.com")!=-1){
  • + item.remove();
  • + }else{
  • + item.style.display="";
  • + }
  • + gmxhr.abort();
  • + }
  • + }
  • + });
  • + }
  • +
  • + function clearAD(){
  • + if(!document.querySelectorAll || !document.parentNode)return;
  • + var mAds=document.querySelectorAll(".ec_wise_ad,.ec_youxuan_card,.page-banner"),i;
  • + for(i=0;i<mAds.length;i++){
  • + var mAd=mAds[i];
  • + mAd.remove();
  • + }
  • + var list=document.querySelectorAll("#content_left>div,#content_left>table");
  • + for(i=0;i<list.length;i++){
  • + let item = list[i];
  • + let s = item.getAttribute("style");
  • + if (s && /display:(table|block)\s!important/.test(s)) {
  • + item.remove();
  • + }else{
  • + var span=item.querySelector("div>span");
  • + if(span && span.innerHTML=="广告"){
  • + item.remove();
  • + }
  • + [].forEach.call(item.querySelectorAll("a>span"),function(span){
  • + if(span && (span.innerHTML=="广告" || span.getAttribute("data-tuiguang"))){
  • + item.remove();
  • + }
  • + });
  • + if(killBaijiaType==2){
  • + [].forEach.call(item.querySelectorAll("a>span>img"),function(img){
  • + if(img && img.classList.contains("source-icon") && !item.querySelector("span.c-pingjia")){
  • + checkBaijia(item);
  • + }
  • + });
  • + }
  • + }
  • + }
  • +
  • + var eb = document.querySelectorAll("#content_right>table>tbody>tr>td>div");
  • + for(i=0;i<eb.length;i++){
  • + let d = eb[i];
  • + if (d.id!="con-ar") {
  • + d.remove();
  • + }
  • + }
  • +
  • + var nr = document.querySelector("#content_right>div>div>div");
  • + if(nr){
  • + var nra=nr.querySelectorAll("a");
  • + for(i=0;i<nra.length;i++){
  • + let d = nra[i];
  • + if (d.innerHTML=="广告") {
  • + nr.remove();
  • + break;
  • + }
  • + }
  • + }
  • + }
  • +
  • + function clearOneAD(ele){
  • + if(ele.nodeType!=1)return;
  • + if(ele.classList.contains("ec_wise_ad") || ele.classList.contains("ec_youxuan_card") || ele.classList.contains("page-banner")){
  • + ele.remove();
  • + return;
  • + }
  • + if(ele.parentNode && ele.parentNode.id=="content_left" && (ele.nodeName=="DIV" || ele.nodeName=="TABLE")){
  • + let s = ele.getAttribute("style");
  • + if (s && /display:(table|block)\s!important/.test(s)) {
  • + ele.remove();
  • + }else{
  • + var span=ele.querySelector("div>span");
  • + if(span && span.innerHTML=="广告"){
  • + ele.remove();
  • + }
  • + [].forEach.call(ele.querySelectorAll("a>span"),function(span){
  • + if(span && (span.innerHTML=="广告" || span.getAttribute("data-tuiguang"))){
  • + ele.remove();
  • + }
  • + });
  • + if(killBaijiaType==2){
  • + [].forEach.call(ele.querySelectorAll("a>span>img"),function(img){
  • + if(img && img.classList.contains("source-icon") && !ele.querySelector("span.c-pingjia")){
  • + checkBaijia(ele);
  • + }
  • + });
  • + }
  • + }
  • + }
  • +
  • + if(ele.parentNode && ele.parentNode.id=="content_right"){
  • + if(ele.nodeName=="TABLE"){
  • + var eb = ele.querySelectorAll("tbody>tr>td>div");
  • + for(var i=0;i<eb.length;i++){
  • + let d = eb[i];
  • + if (d.id!="con-ar") {
  • + d.remove();
  • + }
  • + }
  • + }
  • + if(ele.nodeName=="DIV"){
  • + var nr = ele.querySelector("div>div");
  • + if(nr){
  • + var nra=nr.querySelectorAll("a");
  • + for(i=0;i<nra.length;i++){
  • + let d = nra[i];
  • + if (d.innerHTML=="广告") {
  • + nr.remove();
  • + break;
  • + }
  • + }
  • + }
  • + }
  • + }
  • + }
  • + setTimeout(()=>{clearAD();},2000);
  • +})();
  • +
  • +(function() {
  • + 'use strict';
  • +
  • + if(!$){
  • + var s = document.createElement ("script");
  • + s.src = "http://cdn.bootcss.com/jquery/1.8.3/jquery.min.js";
  • + s.async = false;
  • + document.documentElement.appendChild (s);
  • + }
  • +
  • + let timeoutId = -1;
  • + let downloadBtn = '<div id="reader-copy-div" style="float:left;padding:10px 20px;background:green;z-index:999;position:relative;top:60px;left:0px;"><a id="reader-copy-text" href="###" style="color:white;font-size:15px;"><b class="ui-btn-btc">复制此页</b></a></div>';
  • + let toastDiv = '<div id="page-toast-div" style="margin: 0px auto;background: black;opacity: 0.8;padding: 15px 30px;position: fixed;z-index: 10001;display: block;top: 85%;left: 44%;"><span id="page-toast-span" style="color:white;font-size:15px;"></span></div>';
  • + let opacity = '0.95';
  • + let ua = navigator.userAgent;
  • + if(ua.indexOf("Edge") >= 0){
  • + opacity = '0.6';
  • + }
  • + else if(ua.indexOf("Chrome")){
  • + opacity = '0.95';
  • + }
  • + let textBlockDiv = '<div id="page-textblock-div" style="width:100%;height:100%;position: fixed;z-index: 9999;display: block;top: 0px;left: 0px;background:rgba(255,255,255,' + opacity + ');-webkit-backdrop-filter: blur(20px);display: flex;justify-content:center;align-items:center;"><div id="page-textblock-cancel-layer" style="width:100%;height:100%;position:fixed;top:0px;left:0px;"></div><pre id="page-textblock" style="width:60%;font-size:16px;line-height:22px;z-index:10000;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;word-break:break-all;max-height:70%;overflow:auto;"></pre></div>"';
  • + function Copy(str){
  • + let result = false;
  • + let save = function(e){
  • + e.clipboardData.setData('text/plain', str);
  • + e.preventDefault();
  • + }
  • + document.addEventListener('copy', save);
  • + result = document.execCommand('copy');
  • + document.removeEventListener('copy',save);
  • + return result;
  • + }
  • +
  • + function ShowToast(str){
  • + if(timeoutId >= 0){
  • + clearTimeout(timeoutId);
  • + }
  • + $('#page-toast-div').remove();
  • + $('body').append(toastDiv);
  • + $('#page-toast-span').text(str);
  • + timeoutId=setTimeout("$('#page-toast-div').remove();",1500);
  • + }
  • +
  • + function ShowTextBlock(str){
  • + $('#page-textblock-div').remove();
  • + $('body').append(textBlockDiv);
  • + $('#page-textblock').text(str);
  • + $('#page-textblock-cancel-layer').click(function(){
  • + $('#page-textblock-div').remove();
  • + });
  • + }
  • +
  • + function PrependButtonTo(ele){
  • + ele.prepend(downloadBtn);
  • + ele.find('#reader-copy-text').click(function(){
  • + let str = "";
  • + let parent = $(this).parent().parent();
  • + parent.find('.reader-word-layer').each(function(){
  • + str += this.innerText.replace(/\u2002/g,' ');
  • + });
  • + str = str.replace(/。\s/g,'。\r\n');
  • + let result= (str.length > 0);
  • + if(result){
  • + ShowToast("解析成功");
  • + ShowTextBlock(str);
  • + }else{
  • + ShowToast("解析失败,请等待网页加载");
  • + }
  • + });
  • + }
  • +
  • + $(document).ready(function(){
  • + $('.mod.reader-page.complex').each(function(){
  • + PrependButtonTo($(this));
  • + });
  • + });
  • +})();
  • +
  • +(function() {
  • + 'use strict';
  • +
  • + addBtn();
  • + addDownloadBtnEvent(getDownloadURL());
  • +
  • + function addBtn(){
  • + var download = "<div id='wenkudownload' style='cursor:pointer;z-index:98;display:block;width:30px;height:30px;line-height:30px;position:fixed;left:0;top:300px;text-align:center;overflow:visible'><p style='font-size:25px;color:red'>免费下载</p></div>";
  • + $("body").append(download);
  • + }
  • +
  • + function getDownloadURL(){
  • + var url = window.location.href;
  • + url = url.replace(/baidu.com/g,"baiduvvv.com");
  • + return url;
  • + }
  • +
  • + function addDownloadBtnEvent(url){
  • + $("#wenkudownload").click(function(){
  • + window.open(url);
  • + });
  • + }
  • +})();
  • +
  • +(function() {
  • + 'use strict';
  • +
  • + // Your code here...
  • + function addLink(e) {
  • + e.preventDefault();
  • + var pagelink = '\nRead more: ' + document.location.href,
  • + copytext = window.getSelection();
  • + var clipdata = e.clipboardData || window.clipboardData;
  • + if (clipdata) {
  • + clipdata.setData('Text', copytext);
  • + }
  • +}
  • +document.addEventListener('copy', addLink);
  • +})();
  • +
  • +
  • +(function() {
  • + 'use strict';
  • +
  • + document.querySelector('body').addEventListener('DOMNodeInserted',function(e){
  • + if(e.target.getElementsByClassName('signFlowModal').length!==0){
  • + e.target.getElementsByClassName('Modal-backdrop')[0].click();
  • + }
  • + });
  • +})();
  • +
  • +
  • +if(location.host==='link.zhihu.com') {
  • + let regRet = location.search.match(/target=(.+?)(&|$)/);
  • + if(regRet && regRet.length==3)
  • + location.href = decodeURIComponent(regRet[1]);
  • +}
  • +else
  • + window.addEventListener('click', function(e){
  • + let dom = e.target,
  • + max_times = 5;
  • + while(dom && max_times--) {
  • + if(dom.nodeName.toUpperCase()==='A') {
  • + let regRet = dom.search.match(/target=(.+?)(&|$)/);
  • + if(regRet && regRet.length==3)
  • + dom.href = decodeURIComponent(regRet[1]);
  • + return;
  • + }
  • + else
  • + dom = dom.parentNode;
  • + }
  • + });
  • +
  • +
  • +(function(window, self, unsafeWindow) {
  • + 'use strict';
  • + let timeStart = new Date().getTime();
  • + let location = self.location;
  • + let host = location.host;
  • + let path = location.pathname;
  • + let code, input;
  • + let getCode = function(rule) {
  • + code = location.hash.slice(1, 5);
  • + if ((rule || /([a-z\d]{4})/i.exec(code))) {
  • + code = RegExp.$1;
  • + } else code = null;
  • + return code;
  • + };
  • + if (/(pan|e?yun)\.baidu\.com/.test(host)) {
  • + //百度云盘
  • + if (path.indexOf("/share/") !== -1 && document.querySelector('form[name="accessForm"]') && getCode()) {
  • + let target = document.querySelector('.pickpw input');
  • + if (!target)
  • + return;
  • +
  • + target.value = code;
  • + unsafeWindow.document.querySelector('form[name="accessForm"]').onsubmit();
  • + }
  • + } else if (/(pan|d|www)\.lanzous?\.com/.test(host) && getCode()) {
  • + let target = document.querySelector('#pwd');
  • + if (!target)
  • + return;
  • +
  • + target.value = code;
  • + unsafeWindow.document.querySelector('#sub').dispatchEvent(new UIEvent('click'));
  • + } else if (/cloud.189.cn/.test(host) && getCode()) {
  • + let target = document.getElementById('code_txt');
  • + if (!target)
  • + return;
  • +
  • + target.value = code;
  • +
  • + let nameLabel = document.querySelector('.shareDate');
  • + let delayFunc = () => {
  • + if (!nameLabel.innerText) {
  • + console.log('delay 500ms due to page load not complete.');
  • + setTimeout(delayFunc, 500);
  • + } else {
  • + unsafeWindow.$(target.nextElementSibling).click();
  • + }
  • + };
  • + setTimeout(delayFunc, 500);
  • + } else {
  • + //其它网站,检测链接
  • + Array.prototype.slice.call(document.querySelectorAll("a[href*='pan.baidu.com'], a[href*='lanzou.com'], a[href*='lanzous.com']")).forEach(function(link) {
  • + let txt = link.nextSibling && link.nextSibling.nodeValue;
  • + let linkcode = /码.*?([a-z\d]{4})/i.exec(txt) && RegExp.$1;
  • + if (!linkcode) {
  • + txt = link.parentNode.innerText;
  • + linkcode = /码.*?([a-z\d]{4})/i.exec(txt) && RegExp.$1;
  • + }
  • + if (linkcode) {
  • + let href = link.getAttribute("href");
  • + link.setAttribute("href", href + "#" + linkcode);
  • + }
  • + });
  • + }
  • + let timeEnd = new Date().getTime();
  • + console.log("[网盘提取工具] 链接处理完成,耗时:" + (timeEnd - timeStart) + "毫秒. 处理模式:DOM处理");
  • +})(window, window.self, unsafeWindow);
  • +(function() {
  • + 'use strict';
  • + //consts...
  • + let CODE_RULE_COMMON = /^([a-z\d]{4})$/i;
  • + let MAX_SEARCH_CODE_RANGE = 5;
  • + //functions...
  • + let textNodesUnder = function(el) {
  • + let n, a = [],
  • + walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false);
  • + while ((n = walk.nextNode())) {
  • + if (n.nodeName === '#text')
  • + a.push(n);
  • + }
  • + return a;
  • + };
  • + let generalLinkifyText = function(source, eles, index, testReg, validateRule) {
  • + let count = 0,
  • + text = source,
  • + match;
  • + while ((match = testReg.exec(source))) {
  • + count++;
  • +
  • + let url = (match[1] || "http://") + match[2];
  • + let originalText = (match[1] || "") + match[2];
  • + let code = match[3] || findCodeFromElements(eles, index, validateRule) || "";
  • + if (!code)
  • + continue;
  • + console.log("[网盘提取工具] 已处理网盘地址,URL=" + url + ",提取码=" + code + "模式:TEXTNODE");
  • + //fix double #
  • + url = url.split('#')[0];
  • + text = text.replace(originalText, "<a href='" + url + "#" + code + "' target='_blank'>" + url + '</a>');
  • + }
  • + return {
  • + count,
  • + text
  • + };
  • + };
  • + let linkifyTextBlockBaidu = function(...args) {
  • + return generalLinkifyText(...[
  • + ...args,
  • + /(https?:\/\/)?((?:pan|e?yun)\.baidu\.com\/s\/(?:[a-z\d\-_]+)(?:#[a-z\d-_]*)?)(?:.*?码.*?([a-z\d]+))?/gi,
  • + CODE_RULE_COMMON
  • + ]);
  • + };
  • + let linkifyTextBlockLanZou = function(...args) {
  • + return generalLinkifyText(...[
  • + ...args,
  • + /(https?:\/\/)?((?:pan|d|www)\.lanzous?\.com\/(?:[a-z\d]+))(?:.*?码.*?([a-z\d]+))?/gi,
  • + CODE_RULE_COMMON
  • + ]);
  • + };
  • + let linkifyTextBlock189cn = function(...args) {
  • + return generalLinkifyText(...[
  • + ...args,
  • + /(https?:\/\/)?(cloud\.189?\.cn\/t\/(?:[a-z\d]+))(?:.*?码.*?([a-z\d]+))?/gi,
  • + CODE_RULE_COMMON
  • + ]);
  • + }
  • + let findCodeFromElements = function(eles, index, rule) {
  • + for (let i = 0; i < MAX_SEARCH_CODE_RANGE && i < eles.length; i++) {
  • + let txt = eles[i + index].textContent;
  • + let codeReg = /码.*?([a-z\d]+)/gi;
  • + let codeMatch = codeReg.exec(txt) && RegExp.$1;
  • + if (!codeMatch) continue;
  • + let linkTestReg = /(https?:|\.(net|cn|com|gov|cc|me))/gi;
  • + if (linkTestReg.exec(txt) && linkTestReg.lastIndex <= codeReg.lastIndex) {
  • + break;
  • + }
  • + if (rule.test(codeMatch)) return codeMatch;
  • + }
  • + return null;
  • + };
  • + let linkify = function() {
  • + let eles = textNodesUnder(document.body);
  • + let processor = [
  • + linkifyTextBlockBaidu,
  • + linkifyTextBlockLanZou,
  • + linkifyTextBlock189cn
  • + ];
  • + for (let i = 0; i < eles.length; i++) {
  • + let ele = eles[i];
  • + if (ele.parentNode.tagName == 'a' || !ele.textContent) continue;
  • +
  • + let txt = ele.textContent;
  • + let loopCount = 0;
  • +
  • + for (var action of processor) {
  • + let {
  • + count,
  • + text
  • + } = action(txt, eles, i + 1);
  • + loopCount += count;
  • + txt = text;
  • + }
  • + if (loopCount > 0) {
  • + var span = document.createElement("span");
  • + span.innerHTML = txt;
  • + ele.parentNode.replaceChild(span, ele);
  • + }
  • + }
  • + };
  • + let timeStart = new Date().getTime();
  • + linkify();
  • + let timeEnd = new Date().getTime();
  • + console.log("[网盘提取工具] 链接处理完成,耗时:" + (timeEnd - timeStart) + "毫秒. 处理模式:TEXTNODE处理");
  • +})();
  • +
  • +var urls=location.href,
  • + hash=location.hash,
  • + host=location.hostname.replace(/^www\./i,'').toLowerCase(),
  • + search=location.search,
  • + paths=location.pathname.toLowerCase(),
  • + Control_newTag=true, // 网盘链接添加以新页面打开属性
  • + u=unsafeWindow;
  • +
  • +//console.log('GM_ValueInfo: ',GM_listValues(), GM_getValue('CatPW_Manage'), GM_getValue('CatPW'));
  • +//管理功能开关 & 设置
  • +var CatPW_Manage_Config, // 管理功能配置,采用 GM_setValue API进行保存,非 localStorage
  • + StorageSave, // 信息记录功能,localStorage 记录密码开关
  • + StorageExp, // localStorage 记录密码的有效期(天数)
  • + UpdataConfig={
  • + UpdataSave:true, // 再次访问该网盘地址时,更新信息
  • + UpdataNotify:true, // 更新该网盘地址时,发出桌面通知
  • + UpdataPlugin:true, // 脚本更新后,发出桌面通知
  • + UpdataVersion:GM_info.script.version //记录脚本的版本号
  • + };
  • +
  • +if(GM_getValue('CatPW_Manage')==='undefined'||GM_getValue('CatPW_Manage')===undefined) {
  • + CatPW_Manage_Config={'StorageSave':true,'UpdataConfig':UpdataConfig,'StorageExp':365};
  • + GM_setValue('CatPW_Manage', CatPW_Manage_Config);
  • +} else {
  • + CatPW_Manage_Config=GM_getValue('CatPW_Manage');
  • + if(!CatPW_Manage_Config.UpdataConfig) {
  • + CatPW_Manage_Config.UpdataConfig=UpdataConfig;
  • + GM_setValue('CatPW_Manage', CatPW_Manage_Config);
  • + }
  • + if(!CatPW_Manage_Config.UpdataConfig.UpdataVersion) {
  • + CatPW_Manage_Config.UpdataConfig.UpdataVersion=GM_info.script.version;
  • + GM_setValue('CatPW_Manage', CatPW_Manage_Config);
  • + }
  • +}
  • +
  • +StorageSave=CatPW_Manage_Config.StorageSave;
  • +StorageExp=CatPW_Manage_Config.StorageExp;
  • +UpdataConfig=CatPW_Manage_Config.UpdataConfig;
  • +
  • +var Cat = {
  • + changelog : {
  • + "3.12.7" : {
  • + "date" : "2020.03.01",
  • + "info" : "【特殊支持】agefans.tv",
  • + "detail" : "【特殊支持】agefans.tv,网盘地址免跳转"
  • + }
  • + },
  • + UpdataPlugin : function(e){
  • + //插件更新提示
  • + var v1=CatPW_Manage_Config.UpdataConfig.UpdataVersion, v1arr=v1.split('.');
  • + var v2=GM_info.script.version, v2arr=v2.split('.');
  • + if(this.changelog[v2]) {
  • + for(i=0;i<v2.length;i++){
  • + if(this.changelog[v2]&&Number(v2arr[i])>Number(v1arr[i])) {
  • + GM_notification({
  • + 'title' : GM_info.script.name + ' 更新日志',
  • + 'text' : '本次更新内容(该消息仅提醒一次)'+'\n当期版本:'+v2+'\n更新日期:'+this.changelog[v2]['date']+'\n'+this.changelog[v2]['info'],
  • + 'image' : 'https://eyun.baidu.com/box-static/page-common/images/favicon.ico',
  • + 'timeout' : 60,
  • + 'onclick' : function(e){
  • + alert('更新日志详细\r\n'+Cat.changelog[v2]['detail']||Cat.changelog[v2]['info']);
  • + }
  • + });
  • + CatPW_Manage_Config.UpdataConfig.UpdataVersion=v2;
  • + GM_setValue('CatPW_Manage', CatPW_Manage_Config);
  • + break;
  • + }
  • + }
  • + } else {
  • + console.error('网盘自动填写密码【威力加强版】版本号信息与当前更新日志不符,无法显示更新提示。');
  • + }
  • + },
  • + init : function(){
  • + this.UpdataPlugin();//更新提示
  • + }
  • +};
  • +Cat.init();
  • +
  • +var site = {
  • + 'pwdRule' : /(?:提取|访问)[码碼]?\s*[:: ]?\s*([a-z\d]{4})/, //常规密码
  • + 'codeRule' : /(?:(?:提取|访问|密[码碼]|艾|Extracted-code)[码碼]?)\s*[:: ]?\s*([a-z\d]{4})/i, //其它类型的密码
  • + 'YunDisk':{
  • + 'pan.baidu.com':{
  • + surl : getQueryString('surl')||location.pathname.replace('/s/1',''),
  • + chk : /^[a-z0-9]{4}$/,
  • + code : '.pickpw input, #accessCode',
  • + btn : '.g-button, #submitBtn, #getfileBtn',
  • + PreProcess: function() { //已处理
  • +
  • + console.group('===== 百度网盘自动填写密码 Begin =====');
  • + var CatPW_BaiduPan={
  • + CatPW_Manage : function(){
  • + var CatPW_Manage_Menu_Fn = {
  • + infoFn : function(e){ //信息记录功能
  • + StorageSave=CatPW_Manage_Config.StorageSave=StorageSave?!confirm('你已开启“信息记录功能”,是否需要关闭?'):confirm('你已关闭“信息记录功能”,是否需要开启?');
  • + $(this).text(StorageSave?'已开启信息记录功能':'已关闭信息记录功能');
  • + CatPW_Manage_Menu_Fn.save();
  • + CatPW_BaiduPan.ShowInfo();
  • + },
  • + UpdataConfigFn : {
  • + UpdataSave : function(e){
  • + UpdataConfig.UpdataSave=CatPW_Manage_Config.UpdataConfig.UpdataSave=UpdataConfig.UpdataSave?!confirm('你已开启“信息记录更新功能”,是否需要关闭?'):confirm('你已关闭“信息记录更新功能”,是否需要开启?');
  • + $(this).text(UpdataConfig.UpdataSave?'已开启记录更新功能':'已关闭记录更新功能');
  • + CatPW_Manage_Menu_Fn.save();
  • + },
  • + UpdataNotify : function(e){
  • + UpdataConfig.UpdataNotify=CatPW_Manage_Config.UpdataConfig.UpdataNotify=UpdataConfig.UpdataNotify?!confirm('你已开启“信息记录更新桌面通知功能”,是否需要关闭?'):confirm('你已关闭“信息记录更新桌面通知功能”,是否需要开启?');
  • + $(this).text(UpdataConfig.UpdataNotify?'已开启更新桌面通知':'已关闭更新桌面通知');
  • + CatPW_Manage_Menu_Fn.save();
  • + },
  • + UpdataPlugin : function(e){
  • + UpdataConfig.UpdataPlugin=CatPW_Manage_Config.UpdataConfig.UpdataPlugin=UpdataConfig.UpdataPlugin?!confirm('你已开启“脚本更新桌面通知功能”,是否需要关闭?'):confirm('你已关闭“脚本更新桌面通知功能”,是否需要开启?');
  • + $(this).text(UpdataConfig.UpdataPlugin?'脚本更新桌面通知':'脚本更新不通知');
  • + CatPW_Manage_Menu_Fn.save();
  • + },
  • + MessageUI : function(e){
  • + UpdataConfig.MessageUI=CatPW_Manage_Config.UpdataConfig.MessageUI=UpdataConfig.MessageUI?!confirm('你已开启“浮动窗式的网盘信息”,是否切换为“网页嵌入式的网盘信息”?'):confirm('你已开启“网页嵌入式的网盘信息”,是否切换为“浮动窗式的网盘信息”?');
  • + $(this).text(UpdataConfig.MessageUI?'使用嵌入式的网盘信息':'使用浮动窗的网盘信息');
  • + CatPW_Manage_Menu_Fn.save();
  • + location.reload();
  • + }
  • + },
  • + Exp : function(e){
  • + var _StorageExpTemp;
  • + do{
  • + _StorageExpTemp=prompt("设置信息保存时间(天数):", _StorageExpTemp||StorageExp)||_StorageExpTemp||StorageExp;
  • + if(!/^\d+$/.test(_StorageExpTemp)) {
  • + alert('所设置的天数不是数字,请重新设置');
  • + }
  • + else break;
  • + } while(!/^\d+$/.test(_StorageExpTemp));
  • + StorageExp=CatPW_Manage_Config.StorageExp=_StorageExpTemp;
  • + $(this).text('信息保存时间:'+_StorageExpTemp+'天');
  • + CatPW_Manage_Menu_Fn.save();
  • + },
  • + CleanInfo : function(e){
  • + var _CleanInfo=confirm("如果所记录的信息并没有及时更新,可通过该功能清除记录。");
  • + if(_CleanInfo) GM_setValue('CatPW', {});
  • + },
  • + save : function(){
  • + GM_setValue('CatPW_Manage', CatPW_Manage_Config);
  • + }
  • + };
  • + var CatPW_Manage_Main=$('<span>').attr({'class':'g-dropdown-button'}).css({'width':'135px'});
  • + var CatPW_Manage_A=$('<a>').attr({'class':'g-button','data-button-id':'b300','data-button-index':'300','href':'javascript:void(0);'});
  • + var CatPW_Manage_A_span=$('<span class="g-button-right">');
  • + var CatPW_Manage_A_span_span=$('<span class="text">').text('密码填写管理');
  • + var CatPW_Manage_Menu=$('<span class="menu" style="width:auto;z-index:41;">');
  • + var CatPW_Manage_Menu_infoFn=$('<A class="g-button-menu" href="javascript:void(0);">').text(StorageSave?'已开启信息记录功能':'已关闭信息记录功能').attr({'data-menu-id':'b-menu307'}).click(CatPW_Manage_Menu_Fn.infoFn);
  • + var CatPW_Manage_Menu_Exp=$('<A class="g-button-menu" href="javascript:void(0);">').text('信息保存时间:'+StorageExp+'天').attr({'data-menu-id':'b-menu308'}).click(CatPW_Manage_Menu_Fn.Exp);
  • + var CatPW_Manage_Menu_CleanInfo=$('<A class="g-button-menu" href="javascript:void(0);">').text('清除缓存记录信息').attr({'data-menu-id':'b-menu309'}).click(CatPW_Manage_Menu_Fn.CleanInfo);
  • + var CatPW_Manage_Menu_UpdataSave=$('<A class="g-button-menu" href="javascript:void(0);">').text(UpdataConfig.UpdataSave?'已开启记录更新功能':'已关闭记录更新功能').attr({'data-menu-id':'b-menu310'}).click(CatPW_Manage_Menu_Fn.UpdataConfigFn.UpdataSave);
  • + var CatPW_Manage_Menu_UpdataNotify=$('<A class="g-button-menu" href="javascript:void(0);">').text(UpdataConfig.UpdataNotify?'已开启更新桌面通知':'已关闭更新桌面通知').attr({'data-menu-id':'b-menu311'}).click(CatPW_Manage_Menu_Fn.UpdataConfigFn.UpdataNotify);
  • + var CatPW_Manage_Menu_UpdataPlugin=$('<A class="g-button-menu" href="javascript:void(0);">').text(UpdataConfig.UpdataPlugin?'脚本更新桌面通知':'脚本更新不通知').attr({'data-menu-id':'b-menu313'}).click(CatPW_Manage_Menu_Fn.UpdataConfigFn.UpdataPlugin);
  • + var CatPW_Manage_Menu_MessageUI=$('<A class="g-button-menu" href="javascript:void(0);">').text(UpdataConfig.MessageUI?'使用嵌入式的网盘信息':'使用浮动窗的网盘信息').attr({'data-menu-id':'b-menu314'}).click(CatPW_Manage_Menu_Fn.UpdataConfigFn.MessageUI);
  • +
  • +
  • + CatPW_Manage_A.append(CatPW_Manage_A_span);
  • + CatPW_Manage_A_span.append(CatPW_Manage_A_span_span);
  • + CatPW_Manage_Menu.append(CatPW_Manage_Menu_infoFn, CatPW_Manage_Menu_Exp, CatPW_Manage_Menu_CleanInfo, '<hr>', CatPW_Manage_Menu_UpdataSave, CatPW_Manage_Menu_UpdataNotify, CatPW_Manage_Menu_UpdataPlugin, CatPW_Manage_Menu_MessageUI);
  • + CatPW_Manage_Main.insertBefore('.x-button-box>.g-button.g-button-blue');
  • +
  • + CatPW_Manage_Main.append(CatPW_Manage_A).append(CatPW_Manage_Menu).hover(function(){
  • + CatPW_Manage_Main.toggleClass('button-open');
  • + });
  • + GM_addStyle('.slide-show-right{width:650px!important;}');
  • + },
  • + ShowInfo : function(){
  • + //显示信息记录
  • + var CatPW_Info_Display=$('#CatPW_Info').css('display');
  • + if(CatPW_Info_Display) {
  • + if(CatPW_Info_Display=='none') $('#CatPW_Info').css('display','block');
  • + else $('#CatPW_Info').css('display','none');
  • + } else if(StorageSave){
  • + //插入信息记录
  • + var yunData=unsafeWindow.yunData, //取得 yunData 数据
  • + CatPW,
  • + CatPW_Format={'date':Dates(),'sCode':'', unPW:'', 'Src':'', 'surl':'', 'Hash':'', "webSrc":'', "webTitle":''}; //初始化信息记录变量
  • + yunData.surl=getQueryString('surl')||location.pathname.replace('/s/1',''); //获取当前的分享ID
  • + yunData.Src=getQueryString('surl')||location.href.replace(location.search,'');
  • + //初始化 getValue 数据
  • + if(GM_getValue('CatPW')=='undefined'||GM_getValue('CatPW')===undefined) {
  • + if(StorageDB('Share_'+yunData.surl).read()) GM_setValue('CatPW', StorageDB('Share_'+yunData.surl).read());
  • + else GM_setValue('CatPW', CatPW_Format); //初始化
  • + }
  • + var isCatPW=GM_getValue('CatPW').Src.search(yunData.surl)>0;
  • + var isCatPW_DB=StorageDB('Share_'+yunData.surl).read();
  • + CatPW=isCatPW?GM_getValue('CatPW'):isCatPW_DB?isCatPW_DB:CatPW_Format;//取得信息记录
  • + CatPW.Src=urls.replace(hash,'');
  • + CatPW.surl='Share_'+yunData.surl; //获取 分享文件surl
  • + CatPW.unPW=decodeURIComponent(CatPW.unPW);
  • + CatPW.webSrc=decodeURIComponent(CatPW.webSrc);
  • + CatPW.webTitle=decodeURIComponent(CatPW.webTitle);
  • + CatPW.sCode=CatPW.sCode||(CatPW.Hash?CatPW.Hash.replace('#',''):/^#/.test(hash)&&!/^#list\/path=/i.test(hash)?hash.match(/^#([^&]+)&?/)[1]:''); //获取 提取码
  • + if(!localStorage[CatPW.surl]) { //当不存在记录时,收集信息
  • + console.log('不存在记录,插入信息', 'Src:'+CatPW.Src, 'surl:'+yunData.surl, CatPW);
  • + if(CatPW.Src.search(yunData.surl)<0) {//新记录中的网盘地址与当前的分享ID不一致时,更新信息记录变量
  • + CatPW.Src=urls.replace(hash,'');
  • + CatPW.Hash=hash;
  • + CatPW.sCode=CatPW.sCode;
  • + CatPW.unPW=CatPW.webTitle=CatPW.webSrc=''; //当前网址与记录的信息不符时,只保留密码信息
  • + }
  • +
  • + CatPW.ShareUK=yunData.SHARE_UK; //获取 分享用户ID
  • + CatPW.ShareID=yunData.SHARE_ID; //获取 分享文件ID
  • + StorageDB(CatPW.surl).insert(CatPW);
  • + }
  • +
  • + else if(UpdataConfig.UpdataSave && localStorage[CatPW.surl] &&//是否已开启网盘信息记录更新,是否存在缓存
  • + CatPW.Src.search(StorageDB(CatPW.surl).read().surl.replace('Share_',''))>0)//从检测缓存中的分享ID是否与记录中的分享ID匹配
  • + {
  • + var CatPW_StorageDB=StorageDB(CatPW.surl).read();
  • + if(decodeURIComponent(CatPW.webSrc)!==decodeURIComponent(CatPW_StorageDB.webSrc)) {
  • + CatPW_StorageDB.webSrc=decodeURIComponent(CatPW.webSrc);
  • + CatPW_StorageDB.webTitle=decodeURIComponent(CatPW.webTitle);
  • + StorageDB(CatPW.surl).insert(CatPW_StorageDB);
  • + if(UpdataConfig.UpdataNotify) GM_notification({
  • + 'text':'网盘地址来源与上一次记录不同,记录已更新',
  • + 'title':'网盘信息记录更新通知',
  • + 'image':'https://eyun.baidu.com/box-static/page-common/images/favicon.ico',
  • + 'timeout': 5
  • + });
  • + }
  • + } else {//直接载入记录
  • + console.log('载入 locatStorage 记录');
  • + CatPW=StorageDB(CatPW.surl||yunData.SHARE_ID||getQueryString('shareid')).read();
  • + }
  • +
  • + console.log('分享文件ID:', CatPW.surl, '提取码:', StorageDB(CatPW.surl).find('sCode'));
  • + console.log('已收集的信息:', 'conf:', conf, 'CatPW:', CatPW, 'GM: ', GM_getValue('CatPW'));
  • +
  • + $(conf.btn).click(function(){ //提交密码时
  • + var $code=$(conf.code).val().trim();
  • + CatPW.sCode=CatPW.sCode&&$code==StorageDB(CatPW.surl).find('sCode')?CatPW.sCode:$code!==''?$code:CatPW.sCode;
  • +
  • + var tips=$('form[name="accessForm"]~div[style*="display: block"]');
  • + tips.text('')
  • + //提取码提交click事件
  • + if(!localStorage[CatPW.surl]) {
  • + //不存在记录时,添加新纪录
  • + StorageDB(CatPW.surl).insert(CatPW);//插入记录
  • + StorageDB('ShareIDexp').add(CatPW.surl,{'date':Dates(),'id':CatPW.surl,'exp':$.now()+StorageExp*24*60*60*1000}); //记录超时时间
  • + } else if(!StorageDB(CatPW.surl).find('sCode')) {
  • + //不存在提取码信息时,重新获取提取码
  • + StorageDB(CatPW.surl).insert(CatPW);//插入记录
  • + StorageDB('ShareIDexp').add(CatPW.surl,{'date':Dates(),'id':CatPW.surl,'exp':$.now()+StorageExp*24*60*60*1000}); //记录超时时间
  • + } else if($code!==StorageDB(CatPW.surl).find('sCode')&&(tips.text()==='')){
  • + //已记录的提取码与填写的提取码不一致时,更新提取码记录
  • + StorageDB(CatPW.surl).add('sCode', CatPW.sCode);//更新提取码记录
  • + StorageDB('ShareIDexp').add(CatPW.surl,{'date':Dates(),'id':CatPW.surl,'exp':$.now()+StorageExp*24*60*60*1000}); //记录超时时间
  • + }
  • + });
  • +
  • + //当存在解压密码时,插入新纪录
  • + if(CatPW.unPW&&!localStorage[CatPW.surl]){
  • + StorageDB(CatPW.surl).insert(CatPW);
  • + StorageDB('ShareIDexp').add(CatPW.surl,{'date':Dates(),'id':CatPW.surl,'exp':$.now()+StorageExp*24*60*60*1000}); //记录超时时间
  • + }
  • +
  • + //显示记录的信息
  • + if('Share_'+yunData.surl==CatPW.surl && localStorage[CatPW.surl]){
  • + var CatPW_Info=$('<DIV>').attr('id','CatPW_Info').text('提取码:'+CatPW.sCode+'  '+'解压密码:')/*.insertBefore($('.module-share-header'))*/;
  • + //解压密码
  • + var CatPW_Info_unPW=$('<input>').attr({'id':'unPW','title':'点击复制密码,修改内容将被保存'}).css({'margin':'0 10px','width':'150px','text-align':'center'}).val(CatPW.unPW).change(function(){
  • + StorageDB(CatPW.surl).add('unPW',encodeURIComponent(this.value));
  • + CatPW.unPW=encodeURIComponent(this.value);
  • + GM_setValue('CatPW', CatPW);
  • + }).click(function(){
  • + document.execCommand("SelectAll");document.execCommand("copy");
  • + });
  • +
  • + //来源页面:
  • + var CatPW_Info_delBtn=$('<button>').text('删除记录').val('删除记录').click(function(){
  • + delete localStorage[CatPW.surl];
  • + StorageDB('ShareIDexp').del(CatPW.surl);
  • + GM_setValue('CatPW', CatPW_Format);
  • + this.disabled=true;
  • + });
  • +
  • + var CatPW_Info_WebTitle=$('<span>').attr({'id':'CatPW_webTitle'}).text('网页标题:'+CatPW.webTitle);
  • + var CatPW_Info_WebSrc=$('<A>').attr({'id':'CatPW_webSrc','href':CatPW.webSrc,'target':'blank'}).text('网盘来源:'+CatPW.webSrc);
  • + GM_addStyle('#CatPW_Info{font-size:14px;border:1px solid #06c;padding:5px;display:block;}');
  • +
  • + CatPW_Info.append(CatPW_Info_unPW, CatPW_Info_delBtn, '<br>', CatPW_Info_WebTitle, '<br>', CatPW_Info_WebSrc);
  • + UpdataConfig.MessageUI?CatPW_Info.insertBefore('.module-share-header'):Fn_MessageUI(CatPW_Info);
  • + }
  • +
  • + StorageDB('ShareIDexp').deleteExpires();
  • + }
  • + },
  • + init : function(){
  • + this.CatPW_Manage();
  • + this.ShowInfo();
  • + }
  • + };
  • + CatPW_BaiduPan.init();
  • + console.groupEnd();
  • + }
  • + },
  • + 'eyun.baidu.com': {
  • + chk: /^[a-z0-9]{4}$/,
  • + code: '.share-access-code',
  • + btn: '.g-button-right',
  • + pwdRule : /(?:提取|访问)[码碼]?\s*[:: ]?\s*([a-z\d]{4,14})/,
  • + codeRule : /(?:(?:提取|访问|密[码碼]|Extracted-code)[码碼]?)\s*[:: ]?\s*([a-z\d]{4,14})/i,
  • + PreProcess: function() {
  • + if((hash&&!/sharelink|path/i.test(hash))&&!/enterprise/.test(paths)) {
  • + location.href=location.href.replace(location.hash,'');
  • + }
  • + conf.ShareUK=yunData.SHARE_UK||getQueryString('uk'); //获取 分享用户ID
  • + conf.ShareID=yunData.SHARE_ID||getQueryString('cid'); //获取 分享文件ID
  • + conf.sCode=/^#/.test(hash)?hash.match(/^#(\w+)&?/)[1]:StorageDB(conf.ShareID).find('sCode'); //获取 提取码
  • + $(conf.btn).click(function(){
  • + if(!localStorage[conf.ShareID]&&conf.sCode) {
  • + StorageDB(conf.ShareID).insert({'sCode':conf.sCode});
  • + StorageDB('ShareIDexp').add(conf.ShareID,{'id':conf.ShareID,'exp':$.now()+StorageExp*24*60*60*1000}); //记录超时时间
  • + }
  • + });
  • + StorageDB('ShareIDexp').deleteExpires();
  • + }
  • + },
  • + 'yunpan.360.cn':{
  • + chk : /^[a-z0-9]{4,8}$/,
  • + code : '.pwd-input',
  • + btn : '.submit-btn'
  • + },
  • + 'pan.lanzou.com':{
  • + chk : /^[a-z0-9]{4,8}$/,
  • + code : '#pwd',
  • + btn : '#sub'
  • + },
  • + 'lanzous.com':{
  • + chk : /^[a-z0-9]{4,8}$/,
  • + code : '#pwd',
  • + btn : '#sub',
  • + preSubmit : function(codebox, cdoebtn, sCode){
  • + $('.ifr2').contents().find(codebox).val(sCode);
  • + $('.ifr2').contents().find(cdoebtn).click();
  • + }
  • + },
  • + 'share.weiyun.com': {
  • + chk: /^[a-z0-9]{6}$/i,
  • + code: '.input-txt',
  • + btn: '.btn.btn-l.btn-main',
  • + pwdRule : /(?:提取|访问)[码碼]?\s*[:: ]?\s*([a-z\d]{4,6})/,
  • + codeRule : /(?:(?:提取|访问|密[码碼]|Extracted-code)[码碼]?)\s*[:: ]?\s*([a-z\d]{4,6})/i,
  • + preSubmit: function(codebox, cdoebtn, sCode) {
  • + console.log('微云特殊提交方法');
  • + $(codebox).val(sCode);
  • + console.log($(codebox).get(0));
  • + if(typeof(InputEvent)!=='undefined') {
  • + //使用 InputEvent 方法,主流浏览器兼容
  • + $(codebox).get(0).dispatchEvent(new InputEvent("input")); //模拟事件
  • + } else if(KeyboardEvent) {
  • + //使用 KeyboardEvent 方法,ES6以下的浏览器方法
  • + $(codebox).get(0).dispatchEvent(new KeyboardEvent("input"));
  • + }
  • + $(cdoebtn).click();
  • + }
  • + },
  • + 'dufile.com':{
  • + PreProcess: function(){
  • + if(/\/down\//.test(location.pathname)) {
  • + var hiddenProperty = 'hidden' in document ? 'hidden' :
  • + 'webkitHidden' in document ? 'webkitHidden' :
  • + 'mozHidden' in document ? 'mozHidden' :
  • + null;
  • + var visibilityChangeEvent = hiddenProperty.replace(/hidden/i, 'visibilitychange');
  • + var onVisibilityChange = function(){
  • + if (!document[hiddenProperty]) {
  • + document.title='被发现啦(*´∇`*) 快来输验证码!';
  • + } else {
  • + alert('DuFile 快来输验证码!');
  • + }
  • + }
  • + document.addEventListener(visibilityChangeEvent, onVisibilityChange);
  • + }
  • + }
  • + },
  • + 'fxpan.com':{
  • + PreProcess:function(){
  • + var Key=$('#key').val(); //文件分享ID
  • +
  • + var CatPW={'date':Dates(),'sCode':'', unPW:'', 'Src':'', 'Hash':'', "webSrc":'', "webTitle":''};
  • + var CatPW_Data=(GM_getValue('CatPW')!=('undefined')||GM_getValue('CatPW')!==undefined)?GM_getValue('CatPW'):GM_setValue('CatPW',CatPW);
  • +
  • + if(CatPW_Data['webSrc'].search(Key)>-1) {
  • + var $CatPW_Info=$('<DIV>').attr('id','CatPW_Info');
  • + var $CatPW_Info_unPW=$('<div>').text('解压密码:').append($('<input>').attr({'id':'unPW','title':'点击复制密码'}).css({'margin':'0 10px','width':'150px','text-align':'center'}).val(decodeURIComponent(CatPW_Data.unPW)).click(function(){document.execCommand("SelectAll");document.execCommand("copy");}));
  • + var $CatPW_Info_title=$('<span>').attr({'id':'CatPW_webTitle'}).text('网页标题:'+decodeURIComponent(CatPW_Data.webTitle));
  • + var $CatPW_Info_webSrc=$('<A>').attr({'id':'CatPW_webSrc','href':decodeURIComponent(CatPW_Data.webSrc),'target':'blank'}).text('网盘来源:'+decodeURIComponent(CatPW_Data.webSrc));
  • + $CatPW_Info.append($CatPW_Info_unPW, '<br>', $CatPW_Info_title,'<br>', $CatPW_Info_webSrc).insertBefore('.file_item.file_desc');
  • + $('.ysbtn').click(function(){
  • + StorageDB(Key).insert(CatPW_Data);
  • + StorageDB().insert(CatPW_Data);
  • + });
  • + }
  • + GM_addStyle('#CatPW_Info{font-size:14px;border:1px solid #06c;padding:5px;display:block;}');
  • + }
  • + },
  • + 'cloud.189.cn':{
  • + chk: /^[a-z0-9]{4}$/i,
  • + code: '#code_txt',
  • + btn: '.btn.btn-primary',
  • + PreProcess: function(code, btn){
  • + document.querySelector('.btn-primary').click();
  • + }
  • + },
  • + 'yunfile.com':{//YunFile
  • + PreProcess:function(){
  • + var FileID=getQueryString('fileId',$('#counter_js').attr('src'));
  • + DiskInfo(FileID, '.file_message', function(CatPW_Data, Key){
  • + CatPW_Data.FileID=FileID;
  • + });
  • + //Banner
  • + $('img[src="http://www.yunfile.com/images/premium-zh_cn.png"]').hide();
  • + //隐藏与下载链无关Table TR
  • + $('table.intro_text>tbody>tr:not(:nth-child(1)):not([style="height: 60px;"])').hide();
  • + //隐藏开通VIP
  • + $('#MemberPayfor').hide();
  • + //隐藏购买高级套餐
  • + $('#right_prem').parent().hide();
  • + }
  • + },
  • + 'ccchoo.com':{//彩虹云
  • + PreProcess:function(){
  • + String.prototype.isSearch=function(key){
  • + return this.search(key)>-1;
  • + }
  • + if(paths.isSearch('file-')) $('div[class="lo_box box_shadow"], div.down_two>.clearfix:nth-of-type(1), div.down_two>.down_tl, ul.down_three, div.down_five, div.down_six_main_b_img').remove();
  • + $('img[src="http://www.ccchoo.com/images/ad2.gif"], .lo_box.box_shadow').remove();
  • + DiskInfo(paths.replace(/\/(?:down2?|file)-(\d+).html/i,'$1'),'.down_one, .ksk');
  • + GM_addStyle('.b-box{height:auto!important;display:block!important;}');
  • +
  • + if(paths.isSearch('down2-')) {
  • + location.href=location.href.replace('down2','down');
  • + } else if(paths.isSearch('down-')) {
  • + $('#down_box, #down_boxc').insertBefore('.ksk').show();
  • + $('#code_box, .ksk').hide();
  • + }
  • + }
  • + },
  • + 'own-cloud.cn':{
  • + chk: /^[a-z0-9]{4,6}$/i,
  • + pwdRule : /(?:提取|访问)[码碼]?\s*[:: ]?\s*([a-z\d]{4,6})/,
  • + codeRule : /(?:(?:提取|访问|密[码碼]|Extracted-code)[码碼]?)\s*[:: ]?\s*([a-z\d]{4,6})/i,
  • + code:'#inputPassword',
  • + btn:'#submit_pwd'
  • + }
  • + },
  • + //跳转链预处理
  • + 'JumpUrl' : {
  • + 'zhihu.com' : {
  • + href: $('A[href*="//link.zhihu.com/?target="]'),
  • + url:/.*\/\/link\.zhihu\.com\/\?target=/
  • + },
  • + 'sijihuisuo.club': {
  • + href: $('.down-tip A[href^="https://www.sijihuisuo.club/go/?url="]'),
  • + url: 'https://www.sijihuisuo.club/go/?url='
  • + },
  • + 'nyavo.com':{
  • + href: $('.content a'),
  • + url: 'https://www.nyavo.com/go?url='
  • + }
  • + },
  • + //密码融合需要特殊支持的网站
  • + 'Support' : {
  • + 'agefans.tv':{
  • + path: /detail/i,
  • + callback: function(){
  • + $('.res_links_a').each(function(){
  • + var res_links_a = this;
  • + GM_xmlhttpRequest({
  • + method: "get",
  • + url: res_links_a.href,
  • + onload: function (result) {
  • + console.log('load:', res_links_a.href, result.finalUrl, result);
  • + console.log(res_links_a);
  • + $(res_links_a).attr({'href': result.finalUrl});
  • + }
  • + });
  • + });
  • + }
  • + },
  • + 'yunpanjingling.com':{
  • + path : /search/i,
  • + callback:function(){
  • + $('.item').each(function(){
  • + var name=$(this).find('.name').text().trim();
  • + var code=$(this).find('.code').text()||'';
  • + var href=$(this).find('.name').find('a');
  • + var referrer=$(this).find('.referrer').find('a');
  • + referrer.attr('href',decodeURIComponent(getQueryString('url',referrer.attr('href'))));
  • + href.attr('href',decodeURIComponent(getQueryString('url',href.attr('href'))));
  • + if(code) href.attr('href',href.attr('href')+'#'+code);
  • + href.click(function(){
  • + var CatPW_Data={'date':Dates(),'sCode':code, unPW:'', 'Src':href.attr('href'), 'Hash':'#'+code, "webSrc":referrer.attr('href'), "webTitle":encodeURIComponent(name)};
  • + sessionStorage['CatPW_Data']=JSON.stringify(CatPW_Data);
  • + })
  • + });
  • + }
  • + },
  • + 'jiluhome.cn' : {
  • + path:/./i,
  • + callback:function(){
  • + var PostID=$.getUrlParam('p', $('link[rel="shortlink"]').attr('href'));
  • + //获取网盘地址
  • + DownAjax('http://www.jiluhome.cn/wp-content/plugins/erphpdown/download.php?postid='+PostID, '#erphpdown-download', function(e){
  • + $(e).find('a[href*="download.php"]').each(function(){
  • + var target=this;
  • + $.ajax({
  • + "url":'http://www.jiluhome.cn/wp-content/plugins/erphpdown/download.php?postid='+PostID+"&url=&key=1",
  • + success:function(d){
  • + target.href=d.match(/window.location=\'([^']+?)\'/i)[1];
  • + }
  • + });
  • + });
  • + $('#erphpdown>center').append(e);//.replaceWith(e);
  • + });
  • + }
  • + },
  • + 'dakashangche.com':{
  • + path:/\/sj\/\d/,
  • + callback:function(){
  • + console.log('特殊支持');
  • + $('.down-tip>a[href*="du.acgget.com"]').each(function(){
  • + DownAjax(this.href,'.panel-body',function(e){
  • + $(e).appendTo($('#paydown'));
  • + });
  • + });
  • + }
  • + },
  • + 'appinn.com':{
  • + path:/\/[^\/]+\//i,
  • + callback:function(){
  • + console.log('特殊支持');
  • + new PreHandle.VM();
  • + }
  • + },
  • + 'meta.appinn.com':{
  • + path:/\/t\/[^/]+\//i,
  • + callback:function(){
  • + new PreHandle.VM();
  • + $('A[href*="pan.baidu.com"],A[href*="eyun.baidu.com"]').each(function(){
  • + $(this).data({'url':this.href}).click(function(e){
  • + location.href=$(this).data('url');
  • + });
  • + });
  • + }
  • + },
  • + 'madsck.com':{
  • + path: /\/resource\/\d+/,
  • + callback:function(){
  • + var ID=$('.btn-download').data('id');
  • + $.ajax({
  • + "url":"http://www.madsck.com/ajax/login/download-link?id="+ID,
  • + method: "GET",
  • + dataType: "json",
  • + success:function(e){
  • + var res=e.resource;
  • + $('.btn-download').css('display','none');
  • + $('<a>').attr({'href':res.resource_link+'#'+res.fetch_code,'target':'blank','class':'btn-download'}).css({'line-height':'60px','text-align':'center','font-size':'24px'}).text('下载').insertBefore('.btn-download');
  • + }
  • + });
  • + }
  • + },
  • + 'idanmu.com': {
  • + path : /storage\-download/i,
  • + callback : function(){
  • + $('.input-group').each(function(){
  • + $(this).text($(this).text()+$(this).find('input').val());
  • + });
  • + }
  • + },
  • + 'qiuquan.cc':{
  • + path:/./,
  • + callback : function(){
  • + $('#down>a[href*="pan.baidu.com"]').each(function(){
  • + if(!this.hash) {
  • + this.hash=$(this).text().match(/[\((](\w+)[)\)]/i)[1];
  • + }
  • + });
  • + }
  • + },
  • + 'acg44.com':{
  • + //search:['page_id','p'],
  • + path:/download/i,
  • + callback : function(){
  • + site['codeRule']=/(?:(?:提取|访问|密[码碼])[码碼]?)\s*[:: ]?\s*([a-z\d]{4}|[^$]+)/i;
  • + addMutationObserver('#download-container',function(e){
  • + e.some(function(a){
  • + for(var i in a.addedNodes){
  • + var b=a.addedNodes[i];
  • + if(b.className=='animated fadeIn') {
  • + var VerCode=$('[id^="downloadPwd"]').val();
  • + var unZipPW=encodeURIComponent($('[id^="extractPwd"]').val());
  • + var DownUrl=$('#download-container a.btn').attr('href');
  • + if(/pan.baidu.com\/share/i.test(DownUrl)){
  • + $('#download-container a.btn').attr('href',DownUrl+'&unPW='+unZipPW+'&Src='+encodeURIComponent(urls));
  • + } else {
  • + $('#download-container a.btn').attr('href',DownUrl+'#'+VerCode+'&unPW='+unZipPW+'&Src='+encodeURIComponent(urls));
  • + }
  • + }
  • + }
  • + });
  • + });
  • + }
  • + },
  • + 'reimu.net': {
  • + path: /archives/i,
  • + callback: function(){
  • + site['codeRule']=/(?:(?:提取|访问|密[码碼])[码碼]?)\s*[:: ]?\s*([a-z\d]{4}|8酱)/i;
  • + }
  • + },
  • + 'ccava.net': {
  • + path: /post/i,
  • + callback: function(){
  • + site['codeRule']=/(?:(?:提取|访问|密[码碼])[码碼]?)\s*[:: ]?\s*([a-z\d]{4,8}|ccava)/i;
  • + }
  • + },
  • + //189天翼云盘支持
  • + 'mebook.cc':{
  • + path: /download.php/i,
  • + callback:function(){
  • + $('a').click(function(){
  • + if(this.hostname=='cloud.189.cn') site['codeRule']=/天翼云盘密码\s*[:: ]?\s*([a-z\d]{4,8})/i;
  • + else site['codeRule']=/百度网盘密码\s*[:: ]?\s*([a-z\d]{4,8})/i;
  • + });
  • + }
  • + },
  • + 's-dm.com':{ //天使动漫
  • + path:/./,
  • + callback:function(){
  • + $('body').on('click','a',function(){
  • + if(this.hostname=='pan.baidu.com') this.hash=$(this).text().replace(/.+(?:[集版]|无修)(\w{4,8})$/,'$1');
  • + });
  • + }
  • + },
  • + 'mikuclub.org':{
  • + path:/\d+/,
  • + callback:function(){
  • + $('.passw').each(function(){
  • + var dl=$(this).parent().next().find('.dl');
  • + dl[0].hash=this.value;
  • + });
  • + }
  • + }
  • + }
  • +};
  • +
  • +
  • +
  • +/***** 镜像域名映射 Begin *****/
  • +var HostToList={}, HostToListArr={
  • + YunDisk : {
  • + 'yunfile.com':['5xpan.com','putpan.com','pwpan.com','skpan.com','5xpan.com','yfdisk.com','filemarkets.com','tadown.com','page2.dfpan.com'],
  • + 'ccchoo.com':['chooyun.com','wodech.com','caihop.com','caihoo.me','caihoo.info','caihoo.co','caihoo.club'],
  • + },
  • + Support : {
  • + 's-dm.com':['fodm.net'],
  • + 'reimu.net':['blog.reimu.net'],
  • + 'idanmu.com':['idanmu.co','idanmu.ch','idanmu.at']
  • + }
  • +}
  • +
  • +for(var key in HostToListArr){
  • + HostToList[key]={};
  • + for(var key_i in HostToListArr[key]) {
  • + var key_host=HostToListArr[key][key_i];
  • + for(var key_j=0;key_j<key_host.length;key_j++){
  • + HostToList[key][key_host[key_j]]=key_i;
  • + }
  • + }
  • +}
  • +
  • +//站点存在则加入到Site中
  • +if(HostToList['YunDisk'][host]) site['YunDisk'][host]=site['YunDisk'][HostToList['YunDisk'][host]];
  • +else if(HostToList['Support'][host]) site['Support'][host]=site['Support'][HostToList['Support'][host]];
  • +else if(/yunpan.360.cn/.test(host)) host='yunpan.360.cn'; //如果是360云盘,重设主域名Host
  • +//console.warn('CheckHostToList: ', host, HostToList['Support'][host], site['Support'][HostToList['Support'][host]]);
  • +/***** 镜像域名映射 End *****/
  • +
  • +var conf = site['YunDisk'][host]; //设置主域名
  • +
  • +/* -----===== 生成正则,校验匹配的网盘 Start =====----- */
  • +var HostArr = []; //生成域名数组
  • +for(var i in site['YunDisk']) HostArr.push(i); //插入域名对象数组
  • +for(var i in HostToList['YunDisk']) HostArr.push(i); //插入域名对象数组
  • +var HostExp = new RegExp(HostArr.join("|"),'i'); //生成支持网盘的校验正则,进行密码融合
  • +/* -----===== 生成正则,校验匹配的网盘 End =====----- */
  • +
  • +/* -----===== 检查是否需要处理跳转链 Start =====----- */
  • +//console.log(site.JumpUrl[host]);
  • +if(site['JumpUrl'][host]){
  • + //console.log('跳转链处理:',site['JumpUrl'][host]['href']);
  • + site['JumpUrl'][host]['href'].each(function(){
  • + //console.log(site['JumpUrl'][host]['rep']);
  • + $(this).attr({'href':decodeURIComponent($(this).attr('href').replace(site['JumpUrl'][host]['url'],'')),'target':'blank'});
  • + });
  • +}
  • +/* -----===== 检查是否需要处理跳转链 End =====----- */
  • +//console.warn('checkSite: ', site, 'YunDisk:', site['YunDisk'], site['YunDisk'][host], 'Support: ', site['Support'], site['YunDisk'][host]);
  • +//console.warn('checkHost: ', host, conf, 'HostToList: ', HostToList);
  • +if(conf&&!/zhidao.baidu.com/i.test(host)){ //网盘页面填密码登录
  • + // 抓取提取码
  • + if(conf.PreProcess) conf.PreProcess(); //内容预处理
  • + var StorageCode = StorageDB('Share_'+conf.surl).find('sCode'), //从缓存中读取提取码
  • + HashCode = /^#/.test(hash)&&!/^#list\/path=/i.test(hash)?hash.match(/^#([^&]+)&?/)[1]:''; //从Hash中读取提取码
  • + var sCode = (StorageCode&&StorageCode==HashCode)||!HashCode ? StorageCode : HashCode; //Hash不存在提取码时,或缓存与Hash一致时,使用缓存提取码
  • + // 调试用,检查是否为合法格式
  • +
  • + if (!sCode) {
  • + console.log('没有 Key 或格式不对');
  • + } else {
  • + console.log ('抓取到的提取码: %s', sCode);
  • + }
  • + // 加个小延时
  • + setTimeout (function () {
  • + // 键入提取码并单击「提交」按钮,报错不用理。
  • + var codeBox = $(conf.code),
  • + btnOk = $(conf.btn);
  • + //console.log('提交访问:',codeBox, btnOk);
  • + if (conf.preSubmit) { //特殊提交方式
  • + codeBox.val(sCode); //填写验证码
  • + btnOk.click(); //先尝试常规提交
  • + $(document).ready(function(){
  • + conf.preSubmit (conf.code, conf.btn, sCode); //最后尝试预处理方案
  • + });
  • + } else if(codeBox.length>0) { //存在密码框时才进行密码提交操作
  • + codeBox.val(sCode); //填写验证码
  • + btnOk.click();
  • + }
  • + }, 10);
  • +
  • +} else {
  • + var PreHandle={ //内容预处理
  • + Text : function(text){ //预处理含解码密码的文本
  • + text=text?typeof(text)=="string"?text.trim():text.textContent.trim():null;
  • + text=text?text.replace('本帖隐藏的内容',''):null; //文本内容预处理,提高DZ论坛的匹配率
  • + text=text?text.replace(/([\[【]?解[压壓]|[压壓][缩縮])密[码碼][\]】]?\s*[:: ]?(?:&nbsp;?)\s*([a-z\d]{4}|[^\n]+)/ig,''):null;
  • + return text;
  • + },
  • + Code : function(obj){ //
  • + var text=this.Text(obj);
  • + if(!text) return;
  • + //首先尝试使用 提取码|访问码 作为密码匹配的关键字,无效时则使用模糊匹配规则
  • + var pw=site['pwdRule'].test(text)?text.match(site['pwdRule'])[1]:site['codeRule'].test(text)?text.match(site['codeRule'])[1]:null;
  • + //console.log(text,pw);
  • + return pw;
  • + },
  • + Fusion : function(target, obj){ //融合密码
  • + if(!target.hash) {
  • + target.href+='#'+this.Code(obj);
  • + }
  • + },
  • + VM : function(){ //暴力匹配
  • + var Link=$('A[href*="pan.baidu.com"],A[href*="eyun.baidu.com"]');
  • + for(i=0;i<Link.length;i++){
  • + var LinkParent=$(Link[i]).parent();
  • + var LinkParentHtml=LinkParent.html();
  • + if(PreHandle.Code(LinkParentHtml)) Link[i].href+='#'+PreHandle.Code(LinkParentHtml);
  • + }
  • + },
  • + PassWord : function(CatPW_Data){
  • + if(StorageSave) {
  • + var unPWArr=[
  • + /[^\w]password[:: ]?([^\n]+)/igm,
  • + /解压[:: ]?(\w+)/gm,
  • + /【解[压壓]密[码碼]】\s*[:: ]?\s*(\w+)/igm,
  • + /【解[压壓]密[码碼]】\s*[:: ]?\s*([^\r\n]+)/igm,
  • + /\[解[压壓]密[码碼]\]\s*[:: ]?\s*([a-z\d\.:/@]+)/igm, //http://www.itokoo.com/
  • + /(?:解[压壓]密?[码碼])\s*[:: ]?\s*([a-z\d\.:/@]+)(?!-)\b/igm,
  • + /(?:解[压壓]密?[码碼])(?:都?是|为)\s*[:: ]?\s*([\w\.:/@]+)[^$\r\n]/igm,
  • + /(?:解[压壓]密?[码碼])(?:都?是|为)\s*[:: ]?\s*([^\w]+)[^$\r\n]/igm, //中文类
  • + /【?压缩密码】?\s*[:: ]?\s*([^\n]+)/igm,
  • + /【?[資资]源密[码碼]】?:(\w+)/ //http://www.abcmm.co
  • + ];
  • + for(i=0;i<unPWArr.length;i++) {
  • + var unPWTemp=unPWArr[i].exec(document.body.innerText)||unPWArr[i].exec(document.body.outerHTML.replace(/\b\w+=['"]?[^'"]+['"]?/ig,''))||unPWArr[i].exec(document.body.textContent);
  • + if(unPWTemp) {
  • + console.log(i, '规则:'+unPWArr[i], '解压密码提取:'+encodeURIComponent(unPWTemp[1]), '所有结果:'+unPWTemp);
  • + CatPW_Data.unPW=encodeURIComponent(unPWTemp[1]);
  • + break;
  • + }
  • + }
  • + if(sessionStorage['CatPW_Data']) GM_setValue('CatPW', JSON.parse(sessionStorage['CatPW_Data']));
  • + else GM_setValue('CatPW', CatPW_Data);
  • + console.log('GM_getValue', GM_getValue('CatPW'));
  • + }
  • + },
  • + EachSibling : function($parent, $target, pi, $sibling, $i, $max){
  • + console.group('=== 同级元素遍历模式 第 '+pi+' 次 ===');
  • + var dz_i=$i||1, dz_maxParent = $max||5, dz_sibling=5||$sibling, dz_parent=$parent;
  • + while(dz_i<=dz_maxParent){
  • + //console.group('=== 同级元素遍历模式 第 '+dz_i+' 个父元素 ===');
  • + //console.log('=== 同级元素遍历模式 向上遍历 '+dz_maxParent+' 次 同级元素 '+dz_sibling+' 个 第 '+dz_i+' 个父元素 ===');
  • + //console.log('目标:', dz_parent);
  • + dz_i++;
  • + var dz_si=1, dz_s=dz_parent.nextSibling;//获得节点的兄弟节点
  • + while(dz_si<=dz_sibling){
  • + //console.log(' 第 '+dz_si+' 个同级元素', dz_s);
  • + if(dz_s) {
  • + if(PreHandle.Code(dz_s)) {
  • + //console.groupEnd('=== 同级元素遍历模式 ===');
  • + //console.groupEnd('--- 普通父级遍历模式 ----');
  • + PreHandle.Fusion($target, dz_s);
  • + return;
  • + }
  • + } else {
  • + //console.log(' 在目标元素查找 ', PreHandle.Code(dz_parent));
  • + if(PreHandle.Code(dz_parent)) {
  • + //console.groupEnd('=== 同级元素遍历模式 End ===');
  • + //console.groupEnd('--- 普通父级遍历模式 End ----');
  • + PreHandle.Fusion($target, dz_parent);
  • + return true;
  • + }
  • + break;
  • + }
  • + dz_si++;
  • + dz_s=dz_s.nextSibling;
  • + }
  • +
  • + dz_parent=dz_parent.parentNode;
  • + //console.log(dz_parent);
  • + console.groupEnd('--- 普通父级遍历模式 ----');
  • + }
  • + console.groupEnd('=== 同级元素遍历模式 ===');
  • + }
  • + };
  • +
  • + //密码融合 特别支持的网站
  • + var SupportHost=site['Support'][host];
  • + if(SupportHost&&(SupportHost['path']?SupportHost['path'].test(paths):getQueryString(SupportHost['search']))) {
  • + SupportHost.callback();
  • + }
  • + //监听 A 标签点击事件
  • + $('body').on('click', 'a', function (e) {
  • + var target=this, CatPW_Data;
  • + //提升密码匹配范围,以兼容部分网盘
  • + if(site['YunDisk'][this.host.toLowerCase()]&&site['YunDisk'][this.host.toLowerCase()]['pwdRule']) site['pwdRule']=site['YunDisk'][this.host.toLowerCase()]['pwdRule'], site['codeRule']=site['YunDisk'][this.host.toLowerCase()]['codeRule'];
  • +
  • + if(HostExp.test(this.href)){
  • + if(Control_newTag) this.target='blank'; //新页面打开网盘
  • + //初始化信息记录变量
  • + CatPW_Data={'date':Dates(),'sCode':'', unPW:'', 'Src':this.href, 'surl':'', 'Hash':this.hash, "webSrc":encodeURIComponent(urls), "webTitle":encodeURIComponent(document.title)};
  • +
  • + if(this.hash) { //如果超链接已有 hash 则跳过
  • + console.log('密码已融合,跳过密码融合步骤');
  • + if(sessionStorage['CatPW_Data']) GM_setValue('CatPW', JSON.parse(sessionStorage['CatPW_Data']));
  • + else GM_setValue('CatPW', CatPW_Data);
  • + PreHandle.PassWord(CatPW_Data); //融合解压密码
  • + return;
  • + }
  • + console.group(' ===== 网盘自动填写密码 密码融合 =====');
  • +
  • + //论坛兼容模式
  • + if($.getUrlParam('mod')=='viewthread'&&$.getUrlParam('tid')&&$('.showhide').length>0||u.discuz_uid){
  • + if($(target).next().hasClass("showhide")&&PreHandle.Code(target.nextElementSibling)) {
  • + console.log('论坛特殊兼容模式 - 从链接后隐藏内容中查找密码');
  • + PreHandle.Fusion(target, target.nextElementSibling);
  • + }
  • + }
  • + //常规匹配模式
  • + if(PreHandle.Code(target)) {
  • + console.log('在当前超链接的对象中查找密码');
  • + PreHandle.Fusion(target, target);
  • + } else if(PreHandle.Code(target.nextSibling)){
  • + console.log('密码在超链接后面的兄弟元素中');
  • + PreHandle.Fusion(target, target.nextSibling);
  • + } else if(PreHandle.Code(target.parentNode)){
  • + console.log('从父对象中查找密码');
  • + PreHandle.Fusion(target, target.parentNode);
  • + } else {
  • + console.group('--- 普通父级遍历模式 ----');
  • + var i = 0,
  • + maxParent = 5, //向上遍历的层级
  • + parent = target,
  • + $parent = parent;
  • + while(i<maxParent) {
  • + i++; //遍历计数
  • + parent = parent.parentNode; //取得父对象
  • + console.log('遍历上级目录查找密码:'+ i, parent);
  • + if(parent.tagName=="TR") { //如果父对象是表格,则从表格中提取密码
  • + if(PreHandle.Code(parent.nextElementSibling)) {
  • + parent=parent.nextElementSibling;
  • + console.log('表格中查找密码成功!',parent);
  • + PreHandle.Fusion(target, parent);
  • + break;
  • + }
  • + } else {
  • + var EachSiblingResult=PreHandle.EachSibling($parent, target, i); //同级遍历函数
  • + if(EachSiblingResult) break; //遍历取得结果,停止遍历
  • +
  • + $parent=parent.parentNode; //取得上一级父对象
  • + if(maxParent>5) {
  • + console.log('已超出遍历范围');
  • + }
  • + }
  • + if(parent==document.body) break; //如果已经遍历到最顶部
  • + }
  • + console.groupEnd('--- 普通父级遍历模式 ----');
  • + }
  • +
  • + CatPW_Data.Hash=this.hash;
  • + PreHandle.PassWord(CatPW_Data); //融合解压密码
  • + }
  • + console.groupEnd();
  • + });
  • +}
  • +
  • +function addMutationObserver(selector, callback, Kill) {
  • + var watch = document.querySelector(selector);
  • + //console.log(watch);
  • +
  • + if (!watch) {
  • + return;
  • + }
  • + var observer = new MutationObserver(function(mutations){
  • + //console.log(mutations);
  • + var nodeAdded = mutations.some(function(x){ return x.addedNodes.length > 0; });
  • + if (nodeAdded) {
  • + callback(mutations);
  • + if(Kill) {
  • + console.log('停止'+selector+'的监控');
  • + observer.disconnect();
  • + }
  • + }
  • + });
  • + observer.observe(watch, {childList: true, subtree: true});
  • +}
  • +
  • +function getQueryString(name,url) {//筛选参数
  • + var reg, str;
  • + url=url?url.match(/[?#].*/).toString():location.search; //网址传递的参数提取,如果传入了url参数则使用传入的参数,否则使用当前页面的网址参数
  • +
  • + if(Array.isArray(name)){
  • + for(var i in name){
  • + reg = new RegExp("(?:^|&)(" + name[i] + ")=([^&]*)(?:&|$)", "i"); //正则筛选参数
  • + str = url.substr(1).match(reg);
  • + if (str !== null) return unescape(str[2]);
  • + }
  • + } else {
  • + reg = new RegExp("(?:^|&)(" + name + ")=([^&]*)(?:&|$)", "i"); //正则筛选参数
  • + str = url.substr(1).match(reg);
  • + if (str !== null) return unescape(str[2]);
  • + }
  • + return null;
  • +}
  • +
  • +function StorageDB(collectionName) {
  • + //如果没有 集合名,则使用默认 default
  • + collectionName = collectionName ? collectionName : 'default';
  • + //创建JSON缓存,如果缓存存在,则转为JSON,否则新建
  • + var cache = localStorage[collectionName] ? JSON.parse(localStorage[collectionName]) : {};
  • +
  • + return {
  • + add : function(name, value) {
  • + cache[name]=value;
  • + localStorage.setItem(collectionName, JSON.stringify(cache)); //回写 localStorage
  • + },
  • + del:function(name) {
  • + if(name) {
  • + console.log(cache,cache[name]);
  • + delete cache[name];
  • + localStorage.setItem(collectionName, JSON.stringify(cache)); //回写 localStorage
  • + } else {
  • + //删除整个 localStorage 数据
  • + localStorage.removeItem(name);
  • + }
  • + },
  • + insert: function(obj){
  • + localStorage.setItem(collectionName, JSON.stringify(obj));
  • + },
  • + Updata : function(name,obj,value){
  • + cache[obj]=cache[obj]||{};
  • + cache[obj][name]=value;
  • + localStorage.setItem(collectionName, JSON.stringify(cache)); //回写 localStorage
  • + },
  • + Query : function(obj,name){
  • + return cache[obj]?name?(cache[obj][name]?cache[obj][name]:null):cache[obj]:null;
  • + },
  • + find : function(name) {
  • + if(!collectionName) return false;
  • + return cache[name];
  • + },
  • + read : function(){
  • + return $.isEmptyObject(cache)?null:cache;//如果为空,则返回 null
  • + },
  • + deleteExpires : function(now){
  • + now=now||$.now();
  • + for(var i in cache) {
  • + //console.log(i, collectionName, now, cache[i]['exp'], now>cache[i]['exp']); //删除记录显示
  • + //console.log(cache[i], localStorage[i]);
  • + if(now>cache[i]['exp']) {
  • + delete localStorage[i]; //删除对应分享 ID 的记录
  • + this.del(i); //删除时间表中的记录
  • + }
  • + }
  • + }
  • + };
  • +}
  • +
  • +function DiskInfo(Key, target, Prepocess){
  • + //Key文件分享ID
  • + var insertTarget=target, //信息插入的目标位置
  • + CatPW_Data,
  • + CatPW_Format={'date':Dates(),'sCode':'', unPW:'', 'Src':'', 'Hash':'', "webSrc":'', "webTitle":''};
  • +
  • + //初始化 getValue 数据
  • +
  • + if(StorageDB(Key).read()) {
  • + GM_setValue('CatPW', StorageDB(Key).read());
  • + CatPW_Data=StorageDB(Key).read();
  • + } else if(GM_getValue('CatPW')=='undefined'||GM_getValue('CatPW')===undefined) {
  • + GM_setValue('CatPW', CatPW_Format); //初始化
  • + } else {
  • + CatPW_Data=GM_getValue('CatPW');
  • + }
  • + if(Prepocess) Prepocess(CatPW_Data, Key);
  • +
  • + if((CatPW_Data['Src'].search(Key)>-1||CatPW_Data['FileID']==Key)&&$('#CatPW_Info').length<1) {
  • + var $CatPW_Info=$('<DIV>').attr('id','CatPW_Info');
  • + var $CatPW_Info_unPW=$('<div>').text('解压密码:').append($('<input>').attr({'id':'unPW','title':'点击复制密码'}).css({'margin':'0 10px','width':'150px','text-align':'center'}).val(decodeURIComponent(CatPW_Data.unPW)).click(function(){document.execCommand("SelectAll");document.execCommand("copy");}).change(function(){
  • + StorageDB(Key).add('unPW',encodeURIComponent(this.value));
  • + CatPW_Data.unPW=encodeURIComponent(this.value);
  • + GM_setValue('CatPW', CatPW_Data);
  • + }));
  • + var $CatPW_Info_title=$('<span>').text('网页标题:').append($('<input>').attr({'id':'CatPW_webTitle','title':'内容修改自动保存'}).val(decodeURIComponent(CatPW_Data.webTitle)).css({'margin':'0 10px','padding':'0 2px','min-width':'450px'}).show(function(){
  • + $(this).css({'width':this.value.length*15});
  • + }).change(function(){
  • + StorageDB(Key).add('webTitle',encodeURIComponent(this.value));
  • + }));
  • + var $CatPW_Info_webSrc=$('<A>').attr({'id':'CatPW_webSrc','href':decodeURIComponent(CatPW_Data.webSrc),'target':'blank'}).text('网盘来源:'+decodeURIComponent(decodeURIComponent(CatPW_Data.webSrc)));
  • + var $CatPW_Info_DeleteBtn=$('<button>').text('删除记录').val('删除记录').css({'display':'inline-block'}).click(function(){
  • + delete localStorage[Key];
  • + GM_setValue('CatPW', CatPW_Format);
  • + this.disabled=true;
  • + });
  • + $CatPW_Info.append($CatPW_Info_unPW.append($CatPW_Info_DeleteBtn), '<br>', $CatPW_Info_title,'<br>', $CatPW_Info_webSrc).insertBefore(insertTarget);
  • + StorageDB(Key).insert(CatPW_Data);
  • + } else {
  • + $('<div>').append('当前记录网盘地址为:',$('<A>').attr({'href':CatPW_Data.Src,'target':'blank'}).text(CatPW_Data.Src),' 与当前网盘不符').insertBefore(insertTarget);
  • + }
  • + GM_addStyle('#CatPW_Info{font-size:14px;border:1px solid #06c;padding:5px;display:block;}');
  • +}
  • +
  • +function DownAjax(urls, selection,callback){
  • + GM_xmlhttpRequest({
  • + method: "GET",
  • + url: urls,
  • + onload: function (result) {
  • + var parsetext = function(text){
  • + var doc = null;
  • + try {
  • + doc = document.implementation.createHTMLDocument("");
  • + doc.documentElement.innerHTML = text;
  • + return doc;
  • + }
  • + catch (e) {
  • + alert("parse error");
  • + }
  • + };
  • + var Down;
  • + var doc = parsetext(result.responseText);
  • + console.log(doc,$(doc));
  • + var t = $(doc).find(selection);
  • + callback(t);
  • + }
  • + });
  • +}
  • +
  • +function Dates(){
  • + var sDate=new Date();
  • + return sDate.getFullYear()+'/'+(sDate.getMonth()+1)+'/'+sDate.getDate();
  • +}
  • +
  • +
  • +function Fn_MessageUI(content){
  • + GM_addStyle(`
  • +#MessageUI {
  • +width: 100%;
  • +position: fixed;
  • +left: 0;
  • +top: 0;
  • +z-index: 99999999;
  • +pointer-events: none;
  • +}
  • +#MessageUI * {
  • +pointer-events: auto;
  • +}
  • +#MessageUI_Btn {
  • +position: relative;
  • +margin: 0 auto;
  • +padding: 1px 0;
  • +width: 100px;
  • +height: 16px;
  • +color: #000;
  • +font-size: 12px;
  • +line-height: 10px;
  • +cursor: pointer;
  • +text-align: center;
  • +border: 1px solid #AAA;
  • +border-radius: 0 0 12px 12px;
  • +background-color: #fff;
  • +box-shadow: 0 0 5px rgba(0, 0, 0, .1);
  • +}
  • +#MessageUI_Btn:hover {
  • +color: rgba(0, 0, 0, .8);
  • +background-color: rgba(255, 255, 255, 0.8);
  • +}
  • +#MessageUI_Panel {
  • +display: none;
  • +border-top: 5px solid #65adff;
  • +background-color: #FFF;
  • +box-shadow: 0 0 5px rgba(0, 0, 0, .1);
  • +}
  • +#MessageUI_Panel > #MessageUI_Panel_Content {
  • +display: flex;
  • +flex: 1 1 none;
  • +flex-wrap: wrap;
  • +width: 100%;
  • +max-width: 1400px;
  • +margin: 0 auto;
  • +padding: 16px 20px;
  • +position: relative;
  • +}
  • +`);
  • + /** 添加界面 **/
  • + var MessageUI=$('<div>').attr({'id':'MessageUI'}),
  • + MessageUI_Btn=$('<div>').attr({'id':'MessageUI_Btn'}).text('展开网盘信息'),
  • + MessageUI_Panel=$('<div>').attr({'id':'MessageUI_Panel'}),
  • + MessageUI_Panel_Content=$('<div>').attr({'id':'MessageUI_Panel_Content'});
  • +
  • + MessageUI.click(function(ele){
  • + var eleStyle = MessageUI_Panel.css('display');
  • + if(MessageUI_Panel.css('display') === 'none'){
  • + MessageUI_Panel.css('display','block');
  • + } else {
  • + MessageUI_Panel.css('display','');
  • + }
  • + });
  • +
  • + MessageUI_Panel_Content.html(content);
  • +
  • + $('body').after(MessageUI.append(MessageUI_Btn, MessageUI_Panel.append(MessageUI_Panel_Content)));
  • +}
  • +
  • +"use strict";
  • +// 域名规则列表
  • +const rules = {
  • + plus: {
  • + hook_eventNames: "contextmenu|select|selectstart|copy|cut|dragstart",
  • + unhook_eventNames: "mousedown|mouseup|keydown|keyup",
  • + dom0: true,
  • + hook_addEventListener: true,
  • + hook_preventDefault: true,
  • + add_css: true
  • + }
  • +};
  • +
  • +const returnTrue = e => true;
  • +// 获取目标域名应该使用的规则
  • +const getRule = (host) => rules[host] || rules.plus;
  • +const dontHook = e => !!e.closest('form');
  • +// 储存被 Hook 的函数
  • +const EventTarget_addEventListener = EventTarget.prototype.addEventListener;
  • +const document_addEventListener = document.addEventListener;
  • +const Event_preventDefault = Event.prototype.preventDefault;
  • +// 要处理的 event 列表
  • +let hook_eventNames, unhook_eventNames, eventNames;
  • +
  • +// Hook addEventListener proc
  • +function addEventListener(type, func, useCapture) {
  • + const _addEventListener = this === document ? document_addEventListener : EventTarget_addEventListener;
  • + const a = hook_eventNames.includes(type) ? [type, returnTrue, useCapture] : arguments;
  • + _addEventListener.apply(this, a);
  • +}
  • +
  • +// 清理或还原DOM节点的onxxx属性
  • +function clearLoop() {
  • + let type, prop,
  • + c = [document,document.body, ...document.getElementsByTagName('div')],
  • + // https://life.tw/?app=view&no=746862
  • + e = document.querySelector('iframe[src="about:blank"]');
  • + if (e && e.clientWidth>99 && e.clientHeight>11) {
  • + e = e.contentWindow.document;
  • + c.push(e, e.body);
  • + }
  • +
  • + for (e of c) {
  • + if (!e) continue;
  • + e = e.wrappedJSObject || e;
  • + for (type of eventNames) {
  • + prop = 'on' + type;
  • + e[prop] = null;
  • + }
  • + }
  • +}
  • +
  • +function init() {
  • + // 获取当前域名的规则
  • + let rule = getRule(location.host);
  • + // 设置 event 列表
  • + hook_eventNames = rule.hook_eventNames.split("|");
  • + // Allowed to return value
  • + unhook_eventNames = rule.unhook_eventNames.split("|");
  • + eventNames = hook_eventNames.concat(unhook_eventNames);
  • +
  • + if (rule.dom0) {
  • + setInterval(clearLoop, 9e3);
  • + setTimeout(clearLoop, 1e3);
  • + window.addEventListener('load', clearLoop, true);
  • + }
  • +
  • + if (rule.hook_addEventListener) {
  • + EventTarget.prototype.addEventListener = addEventListener;
  • + document.addEventListener = addEventListener;
  • + }
  • +
  • + if (rule.hook_preventDefault) {
  • + Event.prototype.preventDefault = function () {
  • + if (dontHook(this.target) || !eventNames.includes(this.type)) {
  • + Event_preventDefault.apply(this, arguments);
  • + }
  • + };
  • + }
  • +
  • + if (rule.add_css) GM_addStyle(
  • + `html, * {
  • + -webkit-user-select:text !important;
  • + -moz-user-select:text !important;
  • + user-select:text !important;
  • + }
  • + ::-moz-selection {color:#111 !important; background:#05D3F9 !important;}
  • + ::selection {color:#111 !important; background:#05D3F9 !important;}`
  • + );
  • +}
  • +
  • +init();
  • /**
  • * ---------------------------
  • * Time: 2017/11/20 19:28.
  • * View: http://palerock.cn
  • * ---------------------------
  • */
  • -
  • -/**
  • - * 1. hook Object.defineProperty | Object.defineProperties
  • - * 2. set configurable: true
  • - * 3. delete property
  • - * 4. can set property for onxx event method
  • - */
  • -
  • -window.isDOMLoaded = false;
  • -window.isDOMRendered = false;
  • -
  • -document.addEventListener('readystatechange', function () {
  • - if (document.readyState === "interactive" || document.readyState === "complete") {
  • - window.isDOMLoaded = true;
  • - }
  • -});
  • -
  • ~function (global) {
  • var workerURLs = [];
  • var extraElements = [];
  • - var suppressEvents = {};
  • var helper = function (eHookContext, timerContext, util) {
  • return {
  • applyUI: function () {
  • - var style = '._th-container ._th-item{margin-bottom:3px;position:relative;width:0;height:0;cursor:pointer;opacity:.3;background-color:aquamarine;border-radius:100%;text-align:center;line-height:30px;-webkit-transition:all .35s;-o-transition:all .35s;transition:all .35s;right:30px}._th-container ._th-item,._th-container ._th-click-hover,._th_cover-all-show-times ._th_times{-webkit-box-shadow:-3px 4px 12px -5px black;box-shadow:-3px 4px 12px -5px black}._th-container:hover ._th-item._item-x2{margin-left:18px;width:40px;height:40px;line-height:40px}._th-container:hover ._th-item._item-x-2{margin-left:17px;width:38px;height:38px;line-height:38px}._th-container:hover ._th-item._item-xx2{width:36px;height:36px;margin-left:16px;line-height:36px}._th-container:hover ._th-item._item-xx-2{width:32px;height:32px;line-height:32px;margin-left:14px}._th-container:hover ._th-item._item-reset{width:30px;line-height:30px;height:30px;margin-left:10px}._th-click-hover{position:relative;-webkit-transition:all .5s;-o-transition:all .5s;transition:all .5s;height:45px;width:45px;cursor:pointer;opacity:.3;border-radius:100%;background-color:aquamarine;text-align:center;line-height:45px;right:0}._th-container:hover{left:-5px}._th-container{font-size:12px;-webkit-transition:all .5s;-o-transition:all .5s;transition:all .5s;left:-35px;top:20%;position:fixed;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:100000;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}._th-container ._th-item:hover{opacity:.8;background-color:#5fb492;color:aliceblue}._th-container ._th-item:active{opacity:.9;background-color:#1b3a26;color:aliceblue}._th-container:hover ._th-click-hover{opacity:.8}._th-container:hover ._th-item{opacity:.6;right:0}._th-container ._th-click-hover:hover{opacity:.8;background-color:#5fb492;color:aliceblue}._th_cover-all-show-times{position:fixed;top:0;right:0;width:100%;height:100%;z-index:99999;opacity:1;font-weight:900;font-size:30px;color:#4f4f4f;background-color:rgba(0,0,0,0.1)}._th_cover-all-show-times._th_hidden{z-index:-99999;opacity:0;-webkit-transition:1s all;-o-transition:1s all;transition:1s all}._th_cover-all-show-times ._th_times{width:300px;height:300px;border-radius:50%;background-color:rgba(127,255,212,0.51);text-align:center;line-height:300px;position:absolute;top:50%;right:50%;margin-top:-150px;margin-right:-150px}';
  • -
  • - var displayNum = (1 / timerContext._percentage).toFixed(2);
  • -
  • + var style = '._th-container ._th-item{margin-bottom:3px;position:relative;width:30px;height:30px;cursor:pointer;opacity:.3;background-color:aquamarine;border-radius:100%;text-align:center;line-height:30px;-webkit-transition:all .5s;-o-transition:all .5s;transition:all .5s;right:30px}._th-container ._th-item._item-x2{margin-left:18px;width:40px;height:40px;line-height:40px}._th-container ._th-item._item-x-2{margin-left:17px;width:38px;height:38px;line-height:38px}._th-container ._th-item._item-x4{width:36px;height:36px;margin-left:16px;line-height:36px}._th-container ._th-item._item-x-4{width:32px;height:32px;line-height:32px;margin-left:14px}._th-container ._th-item._item-reset{width:30px;line-height:30px;height:30px;margin-left:10px}._th-click-hover{position:relative;-webkit-transition:all .5s;-o-transition:all .5s;transition:all .5s;height:50px;width:50px;cursor:pointer;opacity:.3;border-radius:100%;background-color:aquamarine;text-align:center;line-height:50px;right:0}._th-container:hover{left:-10px}._th-container{font-size:12px;-webkit-transition:all .5s;-o-transition:all .5s;transition:all .5s;left:-40px;top:20%;position:fixed;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:100000}._th-container ._th-item:hover{opacity:.8;background-color:#5fb492;color:aliceblue}._th-container:hover ._th-click-hover{opacity:.8}._th-container:hover ._th-item{opacity:.6;right:0}._th-container ._th-click-hover:hover{opacity:.8;background-color:#5fb492;color:aliceblue}._th_cover-all-show-times{position:fixed;top:0;right:0;width:100%;height:100%;z-index:99999;opacity:1;font-weight:900;font-size:30px;color:#4f4f4f;background-color:rgba(0,0,0,0.1)}._th_cover-all-show-times._th_hidden{z-index:-99999;opacity:0;-webkit-transition:1s all;-o-transition:1s all;transition:1s all}._th_cover-all-show-times ._th_times{width:80px;height:80px;border-radius:80px;background-color:rgba(127,255,212,0.51);text-align:center;line-height:80px;position:absolute;top:50%;right:50%;margin-top:-40px;margin-right:-40px}';
  • // 在页面左边添加一个半圆便于修改
  • var html = '<div class="_th-container">\n' +
  • - ' <div class="_th-click-hover _item-input">
  • -' +
  • - ' x' + displayNum + '
  • -' +
  • + ' <div class="_th-click-hover" onclick="changTime()">
  • +' +
  • + ' x' + 1 / timerContext._percentage + '
  • +' +
  • ' </div>\n' +
  • - ' <div class="_th-item _item-x2">&gt;</div>
  • -' +
  • - ' <div class="_th-item _item-x-2">&lt;</div>
  • -' +
  • - ' <div class="_th-item _item-xx2">&gt;&gt;</div>
  • -' +
  • - ' <div class="_th-item _item-xx-2">&lt;&lt;</div>
  • -' +
  • - ' <div class="_th-item _item-reset">O</div>
  • -' +
  • + ' <div class="_th-item _item-x2" onclick="changTime(2,0,true)">&gt;</div>
  • +' +
  • + ' <div class="_th-item _item-x-2" onclick="changTime(-2,0,true)">&lt;</div>
  • +' +
  • + ' <div class="_th-item _item-x4" onclick="changTime(0,4)">&gt;&gt;</div>
  • +' +
  • + ' <div class="_th-item _item-x-4" onclick="changTime(0,-4)">&lt;&lt;</div>
  • +' +
  • + ' <div class="_th-item _item-reset" onclick="changTime(0,0,false,true)">O</div>
  • +' +
  • '</div>\n' +
  • '<div class="_th_cover-all-show-times _th_hidden">\n' +
  • - ' <div class="_th_times">x' + displayNum + '</div>
  • -' +
  • + ' <div class="_th_times">x' + 1 / timerContext._percentage + '</div>
  • +' +
  • '</div>' +
  • '';
  • var stylenode = document.createElement('style');
  • }
  • var node = document.createElement('div');
  • node.innerHTML = html;
  • -
  • - var clickMapper = {
  • - '_item-input': function () {
  • - changeTime();
  • - },
  • - '_item-x2': function () {
  • - changeTime(2, 0, true);
  • - },
  • - '_item-x-2': function () {
  • - changeTime(-2, 0, true);
  • - },
  • - '_item-xx2': function () {
  • - changeTime(0, 2);
  • - },
  • - '_item-xx-2': function () {
  • - changeTime(0, -2);
  • - },
  • - '_item-reset': function () {
  • - changeTime(0, 0, false, true);
  • - }
  • - };
  • -
  • - Object.keys(clickMapper).forEach(function (className) {
  • - var exec = clickMapper[className];
  • - var targetEle = node.getElementsByClassName(className)[0];
  • - if (targetEle) {
  • - targetEle.onclick = exec;
  • - }
  • - });
  • -
  • - if (!global.isDOMLoaded) {
  • - document.addEventListener('readystatechange', function () {
  • - if ((document.readyState === "interactive" || document.readyState === "complete") && !global.isDOMRendered) {
  • -
  • + window.addEventListener('load', function () {
  • document.head.appendChild(stylenode);
  • document.body.appendChild(node);
  • - global.isDOMRendered = true;
  • - console.log('Time Hooker Works!');
  • - }
  • });
  • - } else {
  • - document.head.appendChild(stylenode);
  • - document.body.appendChild(node);
  • - global.isDOMRendered = true;
  • - console.log('Time Hooker Works!');
  • - }
  • },
  • - applyGlobalAction: function (timer) {
  • + applyGlobalAction: function () {
  • // 界面半圆按钮点击的方法
  • - timer.changeTime = function (anum, cnum, isa, isr) {
  • + global.changTime = function (anum, cnum, isa, isr) {
  • if (isr) {
  • global.timer.change(1);
  • return;
  • }
  • if (isNaN(parseFloat(t))) {
  • alert("请输入正确的数字");
  • - timer.changeTime();
  • + changTime();
  • return;
  • }
  • if (parseFloat(t) <= 0) {
  • alert("倍率不能小于等于0");
  • - timer.changeTime();
  • + changTime();
  • return;
  • }
  • result = 1 / parseFloat(t);
  • }
  • result = 1 / (1 / timerContext._percentage + anum);
  • } else {
  • - if (cnum <= 0) {
  • + if (cnum < 0) {
  • cnum = 1 / -cnum
  • }
  • result = 1 / ((1 / timerContext._percentage) * cnum);
  • }
  • }
  • - timer.change(result);
  • + global.timer.change(result);
  • };
  • - global.changeTime = timer.changeTime;
  • },
  • applyHooking: function () {
  • - var _this = this;
  • // 劫持循环计时器
  • eHookContext.hookReplace(window, 'setInterval', function (setInterval) {
  • - return _this.getHookedTimerFunction('interval', setInterval);
  • - });
  • - // 劫持单次计时
  • - eHookContext.hookReplace(window, 'setTimeout', function (setTimeout) {
  • - return _this.getHookedTimerFunction('timeout', setTimeout)
  • + return function () {
  • + // 储存原始时间间隔
  • + arguments[2] = arguments[1];
  • + // 获取变速时间间隔
  • + arguments[1] *= timerContext._percentage;
  • + var resultId = setInterval.apply(window, arguments);
  • + // 保存每次使用计时器得到的id以及参数等
  • + timerContext._intervalIds[resultId] = {
  • + args: arguments,
  • + nowId: resultId
  • + };
  • + return resultId;
  • + };
  • });
  • // 劫持循环计时器的清除方法
  • eHookContext.hookBefore(window, 'clearInterval', function (method, args) {
  • - _this.redirectNewestId(args);
  • + var id = args[0];
  • + if (timerContext._intervalIds[id]) {
  • + args[0] = timerContext._intervalIds[id].nowId;
  • + }
  • + // 清除该记录id
  • + delete timerContext._intervalIds[id];
  • });
  • - // 劫持循环计时器的清除方法
  • - eHookContext.hookBefore(window, 'clearTimeout', function (method, args) {
  • - _this.redirectNewestId(args);
  • + // 劫持单次计时器setTimeout
  • + eHookContext.hookBefore(window, 'setTimeout', function (method, args) {
  • + args[1] *= timerContext._percentage;
  • });
  • var newFunc = this.getHookedDateConstructor();
  • eHookContext.hookClass(window, 'Date', newFunc, '_innerDate', ['now']);
  • };
  • eHookContext.hookedToString(timerContext._Date.now, Date.now);
  • var objToString = Object.prototype.toString;
  • -
  • - Object.prototype.toString = function toString() {
  • - 'use strict';
  • -
  • + Object.prototype.toString = function () {
  • if (this instanceof timerContext._mDate) {
  • return '[object Date]';
  • } else {
  • return objToString.call(this);
  • }
  • };
  • -
  • - eHookContext.hookedToString(objToString, Object.prototype.toString);
  • eHookContext.hookedToString(timerContext._setInterval, setInterval);
  • eHookContext.hookedToString(timerContext._setTimeout, setTimeout);
  • eHookContext.hookedToString(timerContext._clearInterval, clearInterval);
  • });
  • return;
  • } else if (arguments.length > 1) {
  • - var definedValue;
  • - switch (arguments.length) {
  • - case 2:
  • - definedValue = new timerContext._Date(
  • - arguments[0],
  • - arguments[1]
  • - );
  • - break;
  • - case 3:
  • - definedValue = new timerContext._Date(
  • - arguments[0],
  • - arguments[1],
  • - arguments[2],
  • - );
  • - break;
  • - case 4:
  • - definedValue = new timerContext._Date(
  • - arguments[0],
  • - arguments[1],
  • - arguments[2],
  • - arguments[3],
  • - );
  • - break;
  • - case 5:
  • - definedValue = new timerContext._Date(
  • - arguments[0],
  • - arguments[1],
  • - arguments[2],
  • - arguments[3],
  • - arguments[4]
  • - );
  • - break;
  • - case 6:
  • - definedValue = new timerContext._Date(
  • - arguments[0],
  • - arguments[1],
  • - arguments[2],
  • - arguments[3],
  • - arguments[4],
  • - arguments[5]
  • - );
  • - break;
  • - default:
  • - case 7:
  • - definedValue = new timerContext._Date(
  • - arguments[0],
  • - arguments[1],
  • - arguments[2],
  • - arguments[3],
  • - arguments[4],
  • - arguments[5],
  • - arguments[6]
  • - );
  • - break;
  • - }
  • -
  • Object.defineProperty(this, '_innerDate', {
  • configurable: false,
  • enumerable: false,
  • - value: definedValue,
  • + value: new timerContext._Date(
  • + arguments[0] || null,
  • + arguments[1] || null,
  • + arguments[2] || null,
  • + arguments[3] || null,
  • + arguments[4] || null,
  • + arguments[5] || null,
  • + arguments[6] || null
  • + ),
  • writable: false
  • });
  • return;
  • });
  • };
  • },
  • - getHookedTimerFunction: function (type, timer) {
  • - var property = '_' + type + 'Ids';
  • - return function () {
  • - var uniqueId = timerContext.genUniqueId();
  • - var callback = arguments[0];
  • - if (typeof callback === 'string') {
  • - callback += ';timer.notifyExec(' + uniqueId + ')';
  • - arguments[0] = callback;
  • - }
  • - if (typeof callback === 'function') {
  • - arguments[0] = function () {
  • - var returnValue = callback.apply(this, arguments);
  • - timerContext.notifyExec(uniqueId);
  • - return returnValue;
  • - }
  • - }
  • - // 储存原始时间间隔
  • - var originMS = arguments[1];
  • - // 获取变速时间间隔
  • - arguments[1] *= timerContext._percentage;
  • - var resultId = timer.apply(window, arguments);
  • - // 保存每次使用计时器得到的id以及参数等
  • - timerContext[property][resultId] = {
  • - args: arguments,
  • - originMS: originMS,
  • - originId: resultId,
  • - nowId: resultId,
  • - uniqueId: uniqueId,
  • - oldPercentage: timerContext._percentage,
  • - exceptNextFireTime: timerContext._Date.now() + originMS
  • - };
  • - return resultId;
  • - };
  • - },
  • - redirectNewestId: function (args) {
  • - var id = args[0];
  • - if (timerContext._intervalIds[id]) {
  • - args[0] = timerContext._intervalIds[id].nowId;
  • - // 清除该记录id
  • - delete timerContext._intervalIds[id];
  • - }
  • - if (timerContext._timeoutIds[id]) {
  • - args[0] = timerContext._timeoutIds[id].nowId;
  • - // 清除该记录id
  • - delete timerContext._timeoutIds[id];
  • - }
  • - },
  • - registerShortcutKeys: function (timer) {
  • + registerShortcutKeys: function () {
  • // 快捷键注册
  • addEventListener('keydown', function (e) {
  • switch (e.keyCode) {
  • - case 57:
  • - if (e.ctrlKey || e.altKey) {
  • - // custom
  • - timer.changeTime();
  • - }
  • - break;
  • // [=]
  • case 190:
  • case 187: {
  • if (e.ctrlKey) {
  • // console.log('+2');
  • - timer.changeTime(2, 0, true);
  • + changTime(2, 0, true);
  • } else if (e.altKey) {
  • - // console.log('xx2');
  • - timer.changeTime(0, 2);
  • + // console.log('x4');
  • + changTime(0, 4);
  • }
  • break;
  • }
  • case 189: {
  • if (e.ctrlKey) {
  • // console.log('-2');
  • - timer.changeTime(-2, 0, true);
  • + changTime(-2, 0, true);
  • } else if (e.altKey) {
  • - // console.log('xx-2');
  • - timer.changeTime(0, -2);
  • + // console.log('x-4');
  • + changTime(0, -4);
  • }
  • break;
  • }
  • case 48: {
  • if (e.ctrlKey || e.altKey) {
  • // console.log('reset');
  • - timer.changeTime(0, 0, false, true);
  • + changTime(0, 0, false, true);
  • }
  • break;
  • }
  • percentageChangeHandler: function (percentage) {
  • // 改变所有的循环计时
  • util.ergodicObject(timerContext, timerContext._intervalIds, function (idObj, id) {
  • - idObj.args[1] = Math.floor((idObj.originMS || 1) * percentage);
  • + idObj.args[1] = Math.floor(idObj.args[2] * percentage);
  • + // console.log(idObj.args[1]);
  • +
  • // 结束原来的计时器
  • this._clearInterval.call(window, idObj.nowId);
  • // 新开一个计时器
  • idObj.nowId = this._setInterval.apply(window, idObj.args);
  • });
  • - // 改变所有的延时计时
  • - util.ergodicObject(timerContext, timerContext._timeoutIds, function (idObj, id) {
  • - var now = this._Date.now();
  • - var exceptTime = idObj.exceptNextFireTime;
  • - var oldPercentage = idObj.oldPercentage;
  • - var time = exceptTime - now;
  • - if (time < 0) {
  • - time = 0;
  • - }
  • - var changedTime = Math.floor(percentage / oldPercentage * time);
  • - idObj.args[1] = changedTime;
  • - // 重定下次执行时间
  • - idObj.exceptNextFireTime = now + changedTime;
  • - idObj.oldPercentage = percentage;
  • - // 结束原来的计时器
  • - this._clearTimeout.call(window, idObj.nowId);
  • - // 新开一个计时器
  • - idObj.nowId = this._setTimeout.apply(window, idObj.args);
  • - });
  • },
  • hookShadowRoot: function () {
  • var origin = Element.prototype.attachShadow;
  • return result;
  • }, false);
  • eHookContext.hookedToString(origin, Element.prototype.attachShadow);
  • - },
  • - hookDefine: function () {
  • - const _this = this;
  • - eHookContext.hookBefore(Object, 'defineProperty', function (m, args) {
  • - var option = args[2];
  • - var ele = args[0];
  • - var key = args[1];
  • - var afterArgs = _this.hookDefineDetails(ele, key, option);
  • - afterArgs.forEach((arg, i) => {
  • - args[i] = arg;
  • - })
  • - });
  • - eHookContext.hookBefore(Object, 'defineProperties', function (m, args) {
  • - var option = args[1];
  • - var ele = args[0];
  • - if (ele && ele instanceof Element) {
  • - Object.keys(option).forEach(key => {
  • - var o = option[key];
  • - var afterArgs = _this.hookDefineDetails(ele, key, o);
  • - args[0] = afterArgs[0];
  • - delete option[key];
  • - option[afterArgs[1]] = afterArgs[2]
  • - })
  • - }
  • - })
  • - },
  • - hookDefineDetails: function (target, key, option) {
  • - if (option && target && target instanceof Element && typeof key === 'string' && key.indexOf('on') >= 0) {
  • - option.configurable = true;
  • - }
  • - if (target instanceof HTMLVideoElement && key === 'playbackRate') {
  • - option.configurable = true;
  • - console.warn('[Timer Hook]', '已阻止默认操作视频倍率');
  • - key = 'playbackRate_hooked'
  • - }
  • - return [target, key, option];
  • - },
  • - suppressEvent: function (ele, eventName) {
  • - if (ele) {
  • - delete ele['on' + eventName];
  • - delete ele['on' + eventName];
  • - delete ele['on' + eventName];
  • - ele['on' + eventName] = undefined;
  • - }
  • - if (!suppressEvents[eventName]) {
  • - eHookContext.hookBefore(EventTarget.prototype, 'addEventListener',
  • - function (m, args) {
  • - var eName = args[0];
  • - if (eventName === eName) {
  • - console.warn(eventName, 'event suppressed.')
  • - args[0] += 'suppressed';
  • - }
  • - }, false);
  • - suppressEvents[eventName] = true;
  • - }
  • - },
  • - changePlaybackRate: function (ele, rate) {
  • - delete ele.playbackRate;
  • - delete ele.playbackRate;
  • - delete ele.playbackRate;
  • - ele.playbackRate = rate
  • - if (rate !== 1) {
  • - timerContext.defineProperty.call(Object, ele, 'playbackRate', {
  • - configurable: true,
  • - get: function () {
  • - return 1;
  • - },
  • - set: function () {
  • - }
  • - });
  • - }
  • - }
  • - }
  • - };
  • -
  • - var normalUtil = {
  • - isInIframe: function () {
  • - let is = global.parent !== global;
  • - try {
  • - is = is && global.parent.document.body.tagName !== 'FRAMESET'
  • - } catch (e) {
  • - // ignore
  • - }
  • - return is;
  • - },
  • - listenParentEvent: function (handler) {
  • - global.addEventListener('message', function (e) {
  • - var data = e.data;
  • - var type = data.type || '';
  • - if (type === 'changePercentage') {
  • - handler(data.percentage || 0);
  • - }
  • - })
  • - },
  • - sentChangesToIframe: function (percentage) {
  • - var iframes = document.querySelectorAll('iframe') || [];
  • - var frames = document.querySelectorAll('frame');
  • - if (iframes.length) {
  • - for (var i = 0; i < iframes.length; i++) {
  • - iframes[i].contentWindow.postMessage(
  • - {type: 'changePercentage', percentage: percentage}, '*');
  • - }
  • - }
  • - if (frames.length) {
  • - for (var j = 0; j < frames.length; j++) {
  • - frames[j].contentWindow.postMessage(
  • - {type: 'changePercentage', percentage: percentage}, '*');
  • - }
  • }
  • }
  • };
  • var timerHooker = {
  • // 用于储存计时器的id和参数
  • _intervalIds: {},
  • - _timeoutIds: {},
  • - _auoUniqueId: 1,
  • // 计时器速率
  • __percentage: 1.0,
  • // 劫持前的原始的方法
  • _setInterval: window['setInterval'],
  • _clearInterval: window['clearInterval'],
  • - _clearTimeout: window['clearTimeout'],
  • _setTimeout: window['setTimeout'],
  • _Date: window['Date'],
  • __lastDatetime: new Date().getTime(),
  • __lastMDatetime: new Date().getTime(),
  • videoSpeedInterval: 1000,
  • - defineProperty: Object.defineProperty,
  • - defineProperties: Object.defineProperties,
  • - genUniqueId: function () {
  • - return this._auoUniqueId++;
  • - },
  • - notifyExec: function (uniqueId) {
  • - var _this = this;
  • - if (uniqueId) {
  • - // 清除 timeout 所储存的记录
  • - var timeoutInfos = Object.values(this._timeoutIds).filter(
  • - function (info) {
  • - return info.uniqueId === uniqueId;
  • - }
  • - );
  • - timeoutInfos.forEach(function (info) {
  • - _this._clearTimeout.call(window, info.nowId);
  • - delete _this._timeoutIds[info.originId]
  • - })
  • - }
  • - // console.log(uniqueId, 'called')
  • - },
  • /**
  • * 初始化方法
  • */
  • var timerContext = this;
  • var h = helper(eHookContext, timerContext, util);
  • - h.hookDefine();
  • h.applyHooking();
  • // 设定百分比属性被修改的回调
  • }
  • });
  • - if (!normalUtil.isInIframe()) {
  • - console.log('[TimeHooker]', 'loading outer window...');
  • h.applyUI();
  • - h.applyGlobalAction(timerContext);
  • - h.registerShortcutKeys(timerContext);
  • - } else {
  • - console.log('[TimeHooker]', 'loading inner window...');
  • - normalUtil.listenParentEvent((function (percentage) {
  • - console.log('[TimeHooker]', 'Inner Changed', percentage)
  • - this.change(percentage);
  • - }).bind(this))
  • - }
  • -
  • +
  • + h.applyGlobalAction();
  • +
  • + h.registerShortcutKeys();
  • +
  • },
  • /**
  • * 调用该方法改变计时器速率
  • * @param percentage
  • */
  • change: function (percentage) {
  • + var _this = this;
  • this.__lastMDatetime = this._mDate.now();
  • + // console.log(this._mDate.toString());
  • + // console.log(new this._mDate());
  • this.__lastDatetime = this._Date.now();
  • + // debugger;
  • + //---------------------------------//
  • this._percentage = percentage;
  • var oldNode = document.getElementsByClassName('_th-click-hover');
  • var oldNode1 = document.getElementsByClassName('_th_times');
  • - var displayNum = (1 / this._percentage).toFixed(2);
  • - (oldNode[0] || {}).innerHTML = 'x' + displayNum;
  • - (oldNode1[0] || {}).innerHTML = 'x' + displayNum;
  • + (oldNode[0] || {}).innerHTML = 'x' + 1 / this._percentage;
  • + (oldNode1[0] || {}).innerHTML = 'x' + 1 / this._percentage;
  • var a = document.getElementsByClassName('_th_cover-all-show-times')[0] || {};
  • + // console.log(a.className);
  • a.className = '_th_cover-all-show-times';
  • this._setTimeout.bind(window)(function () {
  • a.className = '_th_cover-all-show-times _th_hidden';
  • }, 100);
  • this.changeVideoSpeed();
  • - normalUtil.sentChangesToIframe(percentage);
  • + this._clearInterval.bind(window)(this.videoSpeedIntervalId);
  • + this.videoSpeedIntervalId = this._setInterval.bind(window)(function () {
  • + _this.changeVideoSpeed();
  • + var rate = 1 / _this._percentage;
  • + if (rate === 1) {
  • + _this._clearInterval.bind(window)(_this.videoSpeedIntervalId);
  • + }
  • + }, this.videoSpeedInterval);
  • },
  • changeVideoSpeed: function () {
  • - var timerContext = this;
  • - var h = helper(eHookContext, timerContext, util);
  • var rate = 1 / this._percentage;
  • rate > 16 && (rate = 16);
  • rate < 0.065 && (rate = 0.065);
  • + // console.log(rate);
  • var videos = querySelectorAll(document, 'video', true) || [];
  • if (videos.length) {
  • for (var i = 0; i < videos.length; i++) {
  • - h.changePlaybackRate(videos[i], rate);
  • + videos[i].playbackRate = rate;
  • }
  • }
  • }

ziyuanxiaozhan (the reported user) has made:

This report has been upheld by a moderator.

The concept of open source doesn't mean you can modify and publish code without proper attribution. The script should specify the URL, author, and license by using @original-script, @original-author, @original-license, and describe the major changes you've made. Alternatively you can specify those in the description page. Also, your script absolutely must include the same `@license GPL-3.0-or-later` because this license doesn't allow sub-licensing. After you fix and update this deleted script, ask a moderator to undelete it.