From 4ce3d3ce9625172134c4961bfc8c6043c33d3786 Mon Sep 17 00:00:00 2001 From: ywzhaiqi Date: Fri, 11 Jul 2014 15:13:08 +0800 Subject: [PATCH] Super_preloaderPlus_one 6.2.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 改善 Greasemonkey 2.0 的兼容性 --- Super_preloaderPlus/src/main.js | 6 ++--- Super_preloaderPlus/src/meta.js | 2 +- Super_preloaderPlus/src/rule.js | 17 ++++--------- .../super_preloaderplus_one.user.js | 25 +++++++------------ 4 files changed, 18 insertions(+), 32 deletions(-) diff --git a/Super_preloaderPlus/src/main.js b/Super_preloaderPlus/src/main.js index 368fb635..f6fe0624 100644 --- a/Super_preloaderPlus/src/main.js +++ b/Super_preloaderPlus/src/main.js @@ -1348,7 +1348,7 @@ function init(window, document) { if(prefs.enableHistory){ try { - unsafeWindow.history.pushState(null, docTitle, cplink); + window.history.pushState(null, docTitle, cplink); } catch(e) {} } @@ -1466,9 +1466,9 @@ function init(window, document) { clearTimeout(timeout); timeout = setTimeout(scroll, 100); } - unsafeWindow.addEventListener('scroll', timeoutfn, false); + window.addEventListener('scroll', timeoutfn, false); remove.push(function() { - unsafeWindow.removeEventListener('scroll', timeoutfn, false); + window.removeEventListener('scroll', timeoutfn, false); }); autoPO = { diff --git a/Super_preloaderPlus/src/meta.js b/Super_preloaderPlus/src/meta.js index b53205ee..f6bae289 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.2.6 +// @version 6.2.7 // @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 538b80df..19c7de62 100644 --- a/Super_preloaderPlus/src/rule.js +++ b/Super_preloaderPlus/src/rule.js @@ -163,6 +163,7 @@ var SITEINFO=[ stylish: 'hr.rgsep{display:none;}' + '.rg_meta{display:none}.bili{display:inline-block;margin:0 6px 6px 0;overflow:hidden;position:relative;vertical-align:top}._HG{margin-bottom:2px;margin-right:2px}', documentFilter: function(doc){ + // 修正下一页的图片 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); @@ -170,18 +171,10 @@ var SITEINFO=[ }, startFilter: function(win, doc) { // 只作用一次 // 移除 Google 重定向 - if (unsafeWindow.rwt) { - try { - Object.defineProperty(unsafeWindow, 'rwt', { - value: function() { return ''; }, - }); - } catch (e) {} - } else { // Chrome 原生的情况 - var script = doc.createElement('script'); - script.type = 'text/javascript'; - script.textContent = 'window.rwt = function(){}'; - doc.documentElement.appendChild(script); - } + var script = doc.createElement('script'); + script.type = 'text/javascript'; + script.textContent = 'window.rwt = function(){}'; + doc.documentElement.appendChild(script); // 移动相关搜索到第一页 var brs = doc.getElementById('brs'), diff --git a/Super_preloaderPlus/super_preloaderplus_one.user.js b/Super_preloaderPlus/super_preloaderplus_one.user.js index dbe9eb39..d95b5fac 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.2.6 +// @version 6.2.7 // @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 @@ -208,6 +208,7 @@ var SITEINFO=[ stylish: 'hr.rgsep{display:none;}' + '.rg_meta{display:none}.bili{display:inline-block;margin:0 6px 6px 0;overflow:hidden;position:relative;vertical-align:top}._HG{margin-bottom:2px;margin-right:2px}', documentFilter: function(doc){ + // 修正下一页的图片 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); @@ -215,18 +216,10 @@ var SITEINFO=[ }, startFilter: function(win, doc) { // 只作用一次 // 移除 Google 重定向 - if (unsafeWindow.rwt) { - try { - Object.defineProperty(unsafeWindow, 'rwt', { - value: function() { return ''; }, - }); - } catch (e) {} - } else { // Chrome 原生的情况 - var script = doc.createElement('script'); - script.type = 'text/javascript'; - script.textContent = 'window.rwt = function(){}'; - doc.documentElement.appendChild(script); - } + var script = doc.createElement('script'); + script.type = 'text/javascript'; + script.textContent = 'window.rwt = function(){}'; + doc.documentElement.appendChild(script); // 移动相关搜索到第一页 var brs = doc.getElementById('brs'), @@ -4924,7 +4917,7 @@ function init(window, document) { if(prefs.enableHistory){ try { - unsafeWindow.history.pushState(null, docTitle, cplink); + window.history.pushState(null, docTitle, cplink); } catch(e) {} } @@ -5042,9 +5035,9 @@ function init(window, document) { clearTimeout(timeout); timeout = setTimeout(scroll, 100); } - unsafeWindow.addEventListener('scroll', timeoutfn, false); + window.addEventListener('scroll', timeoutfn, false); remove.push(function() { - unsafeWindow.removeEventListener('scroll', timeoutfn, false); + window.removeEventListener('scroll', timeoutfn, false); }); autoPO = {