Skip to content

Commit

Permalink
Super_preloaderPlus_one 6.3.1
Browse files Browse the repository at this point in the history
- 修正论坛下一页头像问题(采用新的解析 doc 的方式)
- 修正 Google 搜索 chrome 原生安装的重定向失效的问题和可能出现的排版不正确的情况
- 增加了一个站点:5652在线漫画
  • Loading branch information
ywzhaiqi committed Jul 29, 2014
1 parent dd39cfb commit d1ed611
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 6 deletions.
8 changes: 8 additions & 0 deletions Super_preloaderPlus/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Super_preloaderPlus/src/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 41 additions & 2 deletions Super_preloaderPlus/src/rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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',
Expand Down
53 changes: 50 additions & 3 deletions Super_preloaderPlus/super_preloaderplus_one.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit d1ed611

Please sign in to comment.