From d1ed611b0402f29f54384cabb550d6ecdf50e8f8 Mon Sep 17 00:00:00 2001 From: ywzhaiqi Date: Tue, 29 Jul 2014 14:03:26 +0800 Subject: [PATCH] Super_preloaderPlus_one 6.3.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修正论坛下一页头像问题(采用新的解析 doc 的方式) - 修正 Google 搜索 chrome 原生安装的重定向失效的问题和可能出现的排版不正确的情况 - 增加了一个站点:5652在线漫画 --- Super_preloaderPlus/src/main.js | 8 +++ Super_preloaderPlus/src/meta.js | 2 +- Super_preloaderPlus/src/rule.js | 43 ++++++++++++++- .../super_preloaderplus_one.user.js | 53 +++++++++++++++++-- 4 files changed, 100 insertions(+), 6 deletions(-) diff --git a/Super_preloaderPlus/src/main.js b/Super_preloaderPlus/src/main.js index 8d12c06e..b82b568b 100644 --- a/Super_preloaderPlus/src/main.js +++ b/Super_preloaderPlus/src/main.js @@ -2847,7 +2847,15 @@ function createDocumentByString(str) { // string转为DOM if (document.documentElement.nodeName != 'HTML') { return new DOMParser().parseFromString(str, 'application/xhtml+xml'); } + var doc; + try { + // firefox and chrome 30+,Opera 12 会报错 + doc = new DOMParser().parseFromString(str, 'text/html'); + } catch (ex) {} + + if (doc) return doc; + if (document.implementation.createHTMLDocument) { doc = document.implementation.createHTMLDocument('superPreloader'); } else { diff --git a/Super_preloaderPlus/src/meta.js b/Super_preloaderPlus/src/meta.js index f4fd36cf..0dcc01dd 100644 --- a/Super_preloaderPlus/src/meta.js +++ b/Super_preloaderPlus/src/meta.js @@ -4,7 +4,7 @@ // @namespace https://github.com/ywzhaiqi // @description 预读+翻页..全加速你的浏览体验... // @author ywzhaiqi && NLF(原作者) -// @version 6.3.0 +// @version 6.3.1 // @homepageURL https://greasyfork.org/scripts/293-super-preloaderplus-one // @updateURL https://greasyfork.org/scripts/293-super-preloaderplus-one/code/Super_preloaderPlus_one.meta.js // @downloadURL https://greasyfork.org/scripts/293-super-preloaderplus-one/code/Super_preloaderPlus_one.user.js diff --git a/Super_preloaderPlus/src/rule.js b/Super_preloaderPlus/src/rule.js index ee4e7542..b26cec90 100644 --- a/Super_preloaderPlus/src/rule.js +++ b/Super_preloaderPlus/src/rule.js @@ -166,15 +166,33 @@ var SITEINFO=[ // 修正下一页的图片 var x = doc.evaluate('//script/text()[contains(self::text(), "data:image/")]', doc, null, 9, null).singleNodeValue; if (x) { - new Function('document, window, google', x.nodeValue)(doc, unsafeWindow, unsafeWindow.google); + try { + new Function('document, window, google', x.nodeValue)(doc, unsafeWindow, unsafeWindow.google); + } catch (e) {} } + + // 修正可能出现的 小箭头更多按钮 排版不正确的情况(2014-7-29) + var oClassName = document.querySelector('.ab_button').className; + [].forEach.call(doc.querySelectorAll('.ab_button'), function(elem){ + if (elem.className != oClassName) + elem.className = oClassName; + }); }, startFilter: function(win, doc) { // 只作用一次 // 移除 Google 重定向 var script = doc.createElement('script'); script.type = 'text/javascript'; - script.textContent = 'window.rwt = function(){}'; + script.textContent = '\ + Object.defineProperty(window, "rwt", {\ + configurable: false,\ + enumerable: true,\ + get: function () {\ + return function() {};\ + },\ + });\ + '; doc.documentElement.appendChild(script); + doc.documentElement.removeChild(script); // 移动相关搜索到第一页 var brs = doc.getElementById('brs'), @@ -2757,6 +2775,27 @@ var SITEINFO=[ useiframe: true, } }, + {name: '5652在线漫画', + url: /^http:\/\/mh\.5652\.com\/mh\/.*\.shtml/i, + exampleUrl: 'http://mh.5652.com/mh/20130124/5484/125907.shtml?p=2', + nextLink: { + startAfter: '?p=', + mFails: [/^http:\/\/mh\.5652\.com\/mh\/.*\.shtml/i, '?p=1'], + inc: 1, + isLast: function(doc, win, lhref) { + var select = doc.querySelector('.Directory_bar select'); + if (select) { + var s2os = select.options; + var s2osl = s2os.length; + if (select.selectedIndex == s2osl - 1) return true; + } + }, + }, + autopager: { + pageElement: 'id("show_img")', + useiframe: true, + } + }, {name: '汗汗漫画', url: /^http:\/\/\w+\.(?:vs20|3gmanhua|hhcomic)\.(?:com|net)\/\w+\/\w+\.htm/i, siteExample: 'http://page.vs20.com/1815454/115321.htm?v=2*s=6', diff --git a/Super_preloaderPlus/super_preloaderplus_one.user.js b/Super_preloaderPlus/super_preloaderplus_one.user.js index daa21198..bbcae13b 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.3.0 +// @version 6.3.1 // @homepageURL https://greasyfork.org/scripts/293-super-preloaderplus-one // @updateURL https://greasyfork.org/scripts/293-super-preloaderplus-one/code/Super_preloaderPlus_one.meta.js // @downloadURL https://greasyfork.org/scripts/293-super-preloaderplus-one/code/Super_preloaderPlus_one.user.js @@ -211,15 +211,33 @@ var SITEINFO=[ // 修正下一页的图片 var x = doc.evaluate('//script/text()[contains(self::text(), "data:image/")]', doc, null, 9, null).singleNodeValue; if (x) { - new Function('document, window, google', x.nodeValue)(doc, unsafeWindow, unsafeWindow.google); + try { + new Function('document, window, google', x.nodeValue)(doc, unsafeWindow, unsafeWindow.google); + } catch (e) {} } + + // 修正可能出现的 小箭头更多按钮 排版不正确的情况(2014-7-29) + var oClassName = document.querySelector('.ab_button').className; + [].forEach.call(doc.querySelectorAll('.ab_button'), function(elem){ + if (elem.className != oClassName) + elem.className = oClassName; + }); }, startFilter: function(win, doc) { // 只作用一次 // 移除 Google 重定向 var script = doc.createElement('script'); script.type = 'text/javascript'; - script.textContent = 'window.rwt = function(){}'; + script.textContent = '\ + Object.defineProperty(window, "rwt", {\ + configurable: false,\ + enumerable: true,\ + get: function () {\ + return function() {};\ + },\ + });\ + '; doc.documentElement.appendChild(script); + doc.documentElement.removeChild(script); // 移动相关搜索到第一页 var brs = doc.getElementById('brs'), @@ -2802,6 +2820,27 @@ var SITEINFO=[ useiframe: true, } }, + {name: '5652在线漫画', + url: /^http:\/\/mh\.5652\.com\/mh\/.*\.shtml/i, + exampleUrl: 'http://mh.5652.com/mh/20130124/5484/125907.shtml?p=2', + nextLink: { + startAfter: '?p=', + mFails: [/^http:\/\/mh\.5652\.com\/mh\/.*\.shtml/i, '?p=1'], + inc: 1, + isLast: function(doc, win, lhref) { + var select = doc.querySelector('.Directory_bar select'); + if (select) { + var s2os = select.options; + var s2osl = s2os.length; + if (select.selectedIndex == s2osl - 1) return true; + } + }, + }, + autopager: { + pageElement: 'id("show_img")', + useiframe: true, + } + }, {name: '汗汗漫画', url: /^http:\/\/\w+\.(?:vs20|3gmanhua|hhcomic)\.(?:com|net)\/\w+\/\w+\.htm/i, siteExample: 'http://page.vs20.com/1815454/115321.htm?v=2*s=6', @@ -6461,7 +6500,15 @@ function createDocumentByString(str) { // string转为DOM if (document.documentElement.nodeName != 'HTML') { return new DOMParser().parseFromString(str, 'application/xhtml+xml'); } + var doc; + try { + // firefox and chrome 30+,Opera 12 会报错 + doc = new DOMParser().parseFromString(str, 'text/html'); + } catch (ex) {} + + if (doc) return doc; + if (document.implementation.createHTMLDocument) { doc = document.implementation.createHTMLDocument('superPreloader'); } else {