From 08aa7821708bcd85fbdf8de775469e9d2c9c5867 Mon Sep 17 00:00:00 2001 From: ywzhaiqi Date: Thu, 18 Sep 2014 00:08:14 +0800 Subject: [PATCH] =?UTF-8?q?6.4.4=20=E5=A2=9E=E5=8A=A0=E9=BB=91=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Super_preloaderPlus/package.json | 2 +- Super_preloaderPlus/src/main.js | 24 ++++++---- Super_preloaderPlus/src/rule.js | 18 +++---- .../super_preloaderplus_one.user.js | 48 +++++++++++-------- 4 files changed, 56 insertions(+), 36 deletions(-) diff --git a/Super_preloaderPlus/package.json b/Super_preloaderPlus/package.json index a93dafdb..410c741b 100644 --- a/Super_preloaderPlus/package.json +++ b/Super_preloaderPlus/package.json @@ -1,6 +1,6 @@ { "name": "super_preloaderplus_one", - "version": "6.4.4", + "version": "6.4.5", "devDependencies": { "grunt": "~0.4.5", "grunt-contrib-clean": "~0.5.0", diff --git a/Super_preloaderPlus/src/main.js b/Super_preloaderPlus/src/main.js index 96a12a3f..721cf55c 100644 --- a/Super_preloaderPlus/src/main.js +++ b/Super_preloaderPlus/src/main.js @@ -94,7 +94,8 @@ var setup = function(){ #sp-prefs-setup input, #sp-prefs-setup select { border:1px solid gray;padding:2px;background:white; }\ #sp-prefs-setup li { margin:0;padding:6px 0;vertical-align:middle;background:#eee;border:0 }\ #sp-prefs-setup button { width:150px;margin:0 10px;text-align:center; }\ - #sp-prefs-custom_siteinfo { width:98%;height:100px;margin:3px 0; }\ + #sp-prefs-setup textarea { width:98%; height:60px; margin:3px 0; }\ + #sp-prefs-setup b { font-weight: bold; font-family: "微软雅黑", sans-serif; }\ '); var div = d.createElement('div'); @@ -113,6 +114,9 @@ var setup = function(){
  • 在预读模式下,默认启用 iframe 方式
  • \
  • 默认启用自动翻页
  • \
  • 自动翻页默认启用强制拼接
  • \ +
  • 自定义排除列表:\ +
    \ +
  • \
  • 自定义站点规则:\
    \
  • \ @@ -138,8 +142,9 @@ var setup = function(){ debug = xbug ? console.log.bind(console) : function() {}; GM_setValue('dblclick_pause', $('dblclick_pause').checked); - + GM_setValue('excludes', prefs.excludes = $('excludes').value); GM_setValue('custom_siteinfo', prefs.custom_siteinfo = $('custom_siteinfo').value); + SP.loadSetting(); close(); @@ -147,14 +152,18 @@ var setup = function(){ on($('cancel'), 'click', close); - $('checkUpdate').onclick = checkUpdate(); + $('checkUpdate').onclick = checkUpdate; $('debug').checked = xbug; $('enableHistory').checked = prefs.enableHistory; $('dblclick_pause').checked = GM_getValue('dblclick_pause') || false; $('SITEINFO_D-useiframe').checked = SITEINFO_D.useiframe; $('SITEINFO_D-a_enable').checked = SITEINFO_D.autopager.enable; $('SITEINFO_D-a_force_enable').checked = SITEINFO_D.autopager.force_enable; + $('excludes').value = prefs.excludes; $('custom_siteinfo').value = prefs.custom_siteinfo; + + // 打开设置自动检查更新 + checkUpdate(); }; function checkUpdate() { @@ -1663,11 +1672,10 @@ function init(window, document) { //执行开始../////////////////// - //分析黑名单 - var item = _.find(blackList, function(x){ return x[1] && toRE(x[2]).test(url); }); - if(item){ - debug('匹配黑名单', item, 'js执行终止'); - debug('全部过程耗时', new Date() - startTime, '毫秒'); + // 分析黑名单 + var blackList_re = new RegExp(blackList.map(wildcardToRegExpStr).join("|")); + if(blackList_re.test(url)){ + debug('匹配黑名单,js执行终止'); return; } diff --git a/Super_preloaderPlus/src/rule.js b/Super_preloaderPlus/src/rule.js index 42c3a73b..2173f212 100644 --- a/Super_preloaderPlus/src/rule.js +++ b/Super_preloaderPlus/src/rule.js @@ -61,20 +61,22 @@ var prefs={ debug: GM_getValue('debug', false), enableHistory: GM_getValue('enableHistory', false), // 把下一页链接添加到历史记录 autoGetPreLink: false, // 一开始不自动查找上一页链接,改为调用时再查找 - custom_siteinfo: GM_getValue('custom_siteinfo') || '[]', + excludes: GM_getValue('excludes', ''), + custom_siteinfo: GM_getValue('custom_siteinfo', '[]'), lazyImgSrc: 'zoomfile|file|original|load-src|_src|imgsrc|real_src|src2|data-lazyload-src|data-ks-lazyload|data-lazyload|data-src|data-original|data-thumb|data-imageurl|data-defer-src|data-placeholder', }; -//黑名单,网站正则.. +// 黑名单,网站正则.. var blackList=[ - // ['中关村首页',false,/^http:\/\/www\.zol\.com\.cn\/(?:#.*)?$/i], - // ['Gmail', true, /mail\.google\.com/i], - // ['Google reader',true,/google\.com\/reader\//i], - // ['优酷视频播放页面',true,/http:\/\/v\.youku\.com\//i], - - // ['underscorejs', true, /^http:\/\/underscorejs\.org\//i], + // 例子 + // 'http://*.douban.com/*', ]; +blackList = blackList.concat(prefs.excludes.split(/[\n\r]+/).map(function(line) { + return line.trim(); +})); + + //在以下网站上允许在非顶层窗口上加载JS..比如猫扑之类的框架集网页. var DIExclude = [ ['猫扑帖子', true, /http:\/\/dzh\.mop\.com\/[a-z]{3,6}\/\d{8}\/.*\.shtml$/i], diff --git a/Super_preloaderPlus/super_preloaderplus_one.user.js b/Super_preloaderPlus/super_preloaderplus_one.user.js index cc2d493b..f5691695 100644 --- a/Super_preloaderPlus/super_preloaderplus_one.user.js +++ b/Super_preloaderPlus/super_preloaderplus_one.user.js @@ -4,7 +4,7 @@ // @namespace https://github.com/ywzhaiqi // @description 预读+翻页..全加速你的浏览体验... // @author ywzhaiqi && NLF(原作者) -// @version 6.4.4 +// @version 6.4.5 // @homepageURL https://greasyfork.org/scripts/293-super-preloaderplus-one // @grant GM_addStyle @@ -40,8 +40,8 @@ // 主要用于 chrome 原生下检查更新,也可用于手动检查更新 var scriptInfo = { - version: '6.4.4', - updateTime: '2014/9/17', + version: '6.4.5', + updateTime: '2014/9/18', homepageURL: 'https://greasyfork.org/scripts/293-super-preloaderplus-one', downloadUrl: 'https://greasyfork.org/scripts/293-super-preloaderplus-one/code/Super_preloaderPlus_one.user.js', metaUrl: 'https://greasyfork.org/scripts/293-super-preloaderplus-one/code/Super_preloaderPlus_one.meta.js', @@ -111,20 +111,22 @@ var prefs={ debug: GM_getValue('debug', false), enableHistory: GM_getValue('enableHistory', false), // 把下一页链接添加到历史记录 autoGetPreLink: false, // 一开始不自动查找上一页链接,改为调用时再查找 - custom_siteinfo: GM_getValue('custom_siteinfo') || '[]', + excludes: GM_getValue('excludes', ''), + custom_siteinfo: GM_getValue('custom_siteinfo', '[]'), lazyImgSrc: 'zoomfile|file|original|load-src|_src|imgsrc|real_src|src2|data-lazyload-src|data-ks-lazyload|data-lazyload|data-src|data-original|data-thumb|data-imageurl|data-defer-src|data-placeholder', }; -//黑名单,网站正则.. +// 黑名单,网站正则.. var blackList=[ - // ['中关村首页',false,/^http:\/\/www\.zol\.com\.cn\/(?:#.*)?$/i], - // ['Gmail', true, /mail\.google\.com/i], - // ['Google reader',true,/google\.com\/reader\//i], - // ['优酷视频播放页面',true,/http:\/\/v\.youku\.com\//i], - - // ['underscorejs', true, /^http:\/\/underscorejs\.org\//i], + // 例子 + // 'http://*.douban.com/*', ]; +blackList = blackList.concat(prefs.excludes.split(/[\n\r]+/).map(function(line) { + return line.trim(); +})); + + //在以下网站上允许在非顶层窗口上加载JS..比如猫扑之类的框架集网页. var DIExclude = [ ['猫扑帖子', true, /http:\/\/dzh\.mop\.com\/[a-z]{3,6}\/\d{8}\/.*\.shtml$/i], @@ -3919,7 +3921,8 @@ var setup = function(){ #sp-prefs-setup input, #sp-prefs-setup select { border:1px solid gray;padding:2px;background:white; }\ #sp-prefs-setup li { margin:0;padding:6px 0;vertical-align:middle;background:#eee;border:0 }\ #sp-prefs-setup button { width:150px;margin:0 10px;text-align:center; }\ - #sp-prefs-custom_siteinfo { width:98%;height:100px;margin:3px 0; }\ + #sp-prefs-setup textarea { width:98%; height:60px; margin:3px 0; }\ + #sp-prefs-setup b { font-weight: bold; font-family: "微软雅黑", sans-serif; }\ '); var div = d.createElement('div'); @@ -3938,6 +3941,9 @@ var setup = function(){
  • 在预读模式下,默认启用 iframe 方式
  • \
  • 默认启用自动翻页
  • \
  • 自动翻页默认启用强制拼接
  • \ +
  • 自定义排除列表:\ +
    \ +
  • \
  • 自定义站点规则:\
    \
  • \ @@ -3963,8 +3969,9 @@ var setup = function(){ debug = xbug ? console.log.bind(console) : function() {}; GM_setValue('dblclick_pause', $('dblclick_pause').checked); - + GM_setValue('excludes', prefs.excludes = $('excludes').value); GM_setValue('custom_siteinfo', prefs.custom_siteinfo = $('custom_siteinfo').value); + SP.loadSetting(); close(); @@ -3972,14 +3979,18 @@ var setup = function(){ on($('cancel'), 'click', close); - $('checkUpdate').onclick = checkUpdate(); + $('checkUpdate').onclick = checkUpdate; $('debug').checked = xbug; $('enableHistory').checked = prefs.enableHistory; $('dblclick_pause').checked = GM_getValue('dblclick_pause') || false; $('SITEINFO_D-useiframe').checked = SITEINFO_D.useiframe; $('SITEINFO_D-a_enable').checked = SITEINFO_D.autopager.enable; $('SITEINFO_D-a_force_enable').checked = SITEINFO_D.autopager.force_enable; + $('excludes').value = prefs.excludes; $('custom_siteinfo').value = prefs.custom_siteinfo; + + // 打开设置自动检查更新 + checkUpdate(); }; function checkUpdate() { @@ -5488,11 +5499,10 @@ function init(window, document) { //执行开始../////////////////// - //分析黑名单 - var item = _.find(blackList, function(x){ return x[1] && toRE(x[2]).test(url); }); - if(item){ - debug('匹配黑名单', item, 'js执行终止'); - debug('全部过程耗时', new Date() - startTime, '毫秒'); + // 分析黑名单 + var blackList_re = new RegExp(blackList.map(wildcardToRegExpStr).join("|")); + if(blackList_re.test(url)){ + debug('匹配黑名单,js执行终止'); return; }