forked from ywzhaiqi/userscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
5.1.3 增加 replace 中的简写 \P,修正部分用户起点新版下一页失效问题
- Loading branch information
Showing
4 changed files
with
62 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// @id mynovelreader@[email protected] | ||
// @name My Novel Reader | ||
// @name:zh-CN 小说阅读脚本 | ||
// @version 5.1.2 | ||
// @version 5.1.3 | ||
// @namespace https://github.com/ywzhaiqi | ||
// @author ywzhaiqi | ||
// @contributor Roger Au, shyangs, JixunMoe | ||
|
@@ -295,6 +295,10 @@ var READER_AJAX = "reader-ajax"; // 内容需要 ajax 的 className | |
|
||
// Unicode/2000-2FFF:http://zh.wikibooks.org/wiki/Unicode/2000-2FFF | ||
|
||
// replace 中的简写 | ||
var CHAR_ALIAS = { | ||
'\\P': '[\\u2000-\\u2FFF\\u3004-\\u303F\\uFE00-\\uFF60]', // 小说中添加的特殊符号 | ||
} | ||
|
||
// ===== 自动尝试的规则 ===== | ||
var Rule = { | ||
|
@@ -400,8 +404,7 @@ Rule.specialSite = [ | |
}, | ||
contentRemove: "span[id^='ad_'], .read_ma", | ||
contentPatch: function(fakeStub){ | ||
// if (fakeStub.find('#content > p').size() > 0) return; | ||
fakeStub.find('#maincontent script[src$=".txt"]').addClass('reader-ajax'); | ||
fakeStub.find('script[src$=".txt"]').addClass('reader-ajax'); | ||
}, | ||
}, | ||
{siteName: '起点新版', | ||
|
@@ -423,7 +426,7 @@ Rule.specialSite = [ | |
'手机用户请到m.qidian.com阅读。' | ||
], | ||
contentPatch: function(fakeStub){ | ||
fakeStub.find('#chaptercontent script[src$=".txt').addClass('reader-ajax'); | ||
fakeStub.find('script[src$=".txt"]').addClass('reader-ajax'); | ||
}, | ||
}, | ||
{siteName: "起点中文网免费频道", | ||
|
@@ -940,6 +943,7 @@ Rule.specialSite = [ | |
'\\(.*?平南文学网\\)', | ||
'{首发}|【首发】', | ||
'=长=风', | ||
'-优-优-小-说-更-新-最-快-\\.', | ||
{ "。\\.": "。" }, | ||
] | ||
}, | ||
|
@@ -1216,7 +1220,7 @@ Rule.specialSite = [ | |
mutationChildCount: 0, | ||
}, | ||
{siteName: "读零零", | ||
url: "http://www\\.du00\\.com/read/\\d+/\\d+/[\\d_]+\\.html", | ||
url: "http://www\\.du00\\.(?:com|cc)/read/\\d+/\\d+/[\\d_]+\\.html", | ||
titleReg: "(.*?)(?:第\\d+段)?,(.*) - 读零零小说网", | ||
titlePos: 1, | ||
prevSelector: "#footlink a:first", | ||
|
@@ -1234,7 +1238,6 @@ Rule.specialSite = [ | |
"\\*文學馆\\*", | ||
"\\(未完待续请搜索,小说更好更新更快!", | ||
"www\\.DU00\\.com", | ||
'记住我们的网址.*', | ||
], | ||
checkSection: true | ||
}, | ||
|
@@ -1519,8 +1522,7 @@ Rule.specialSite = [ | |
titleSelector: '.title', | ||
bookTitleSelector: '.linkleft > a:last', | ||
contentReplace: [ | ||
'[《(\\+[]长.{1,2}风.{1,2}文学 www.*?net', | ||
'[…~≡△∧√]长.风.文.学.*?t', | ||
'\\P{1,2}长.{1,2}风.{1,2}文.{1,2}学.*?t', | ||
] | ||
}, | ||
{siteName: "云来阁", | ||
|
@@ -1533,6 +1535,7 @@ Rule.specialSite = [ | |
'[☆★◆〓『【◎◇].*?(?:yunlaige|云 来 阁|yunlaige).*?[☆◆★〓』】◎◇]', | ||
'《更新最快小说网站:雲来阁http://WWW.YunLaiGe.COM》', | ||
'◢百度搜索雲来阁,最新最快的小说更新◣', | ||
'【當你閱讀到此章節,請您移步到雲來閣閱讀最新章節,或者,雲來閣】', | ||
'【最新更新】', | ||
'值得您收藏。。', | ||
'小说“小说章节', | ||
|
@@ -1677,9 +1680,11 @@ Rule.specialSite = [ | |
{siteName: "小说巴士", | ||
url: "http://www\\.xsbashi\\.com/\\d+_\\d+/", | ||
contentReplace: [ | ||
'==如您已閱讀到此章节,请移步到“/”阅读最新章节,也可在百度直接搜索“ ”或者“”,敬请记住我们新的网址 。/', | ||
'==如您已閱讀到此章节.*?敬请记住我们新的网址 。/', | ||
'看小说首发推荐去眼快看书', | ||
'最快更新,阅读请。___小/说/巴/士 Www.XSBASHI.coM___', | ||
'___小/说/巴/士 www.XSBASHI.com___', | ||
'lala如您已阅读到此章節,請移步到.*?速记方法:,\\]', | ||
] | ||
}, | ||
|
||
|
@@ -1927,11 +1932,13 @@ Rule.replaceAll = [ | |
'(?天上掉馅饼的好活动.*?微信公众号!)?', | ||
// '(天上掉馅饼.*中文网公众号', | ||
'(微信添加.*qdread微信公众号!)', | ||
'jiemei如您已阅读到此章节,请移步到.*?\\[ads:本站换新网址啦,速记方法:,.\\]', | ||
|
||
'[\\u2000-\\u2FFF\\u3004-\\u303F\\uFE00-\\uFF60]{1,2}[顶頂].{1,3}[点小].*?o?[mw,]', | ||
'\\P{1,2}[顶頂].{1,3}[点小].*?o?[mw,]', | ||
|
||
'》长>风》', | ||
'《无〈错《', '》无>错》', '\\+无\\+错\\+', '|无|错|', '~无~错~', '`无`错`小说`www.``com', | ||
'《无〈错《', '》无>错》', '\\+无\\+错\\+', '|无|错|', '~无~错~', | ||
'`无`错`小说`www.``com', '+无+错+小说+3w++', | ||
'\\|优\\|优\\|小\\|说\\|更\\|新\\|最\\|快X', | ||
]; | ||
|
||
|
@@ -3332,10 +3339,6 @@ Parser.prototype = { | |
// 移除文字广告等 | ||
text = this.replaceText(text, Rule.replaceAll); | ||
|
||
if (info.contentReplace) { | ||
text = this.replaceText(text, info.contentReplace); | ||
} | ||
|
||
// 去除内容中的标题 | ||
if(this.chapterTitle && Rule.titleRegExp.test(this.chapterTitle)){ | ||
try { | ||
|
@@ -3355,6 +3358,10 @@ Parser.prototype = { | |
|
||
text = text.replace(Rule.contentReplace, ''); | ||
|
||
if (info.contentReplace) { | ||
text = this.replaceText(text, info.contentReplace); | ||
} | ||
|
||
if (Config.cn2tw) { | ||
text = this.convert2tw(text); | ||
} | ||
|
@@ -3482,6 +3489,10 @@ Parser.prototype = { | |
text = text.replace(rule, ''); | ||
break; | ||
case _.isString(rule): | ||
// 还原简写 | ||
_.each(CHAR_ALIAS, function(value, key) { | ||
rule = rule.replace(key, value); | ||
}); | ||
var regexp = new RegExp(rule, 'ig'); | ||
text = text.replace(regexp, ''); | ||
break; | ||
|
@@ -3589,11 +3600,9 @@ Parser.prototype = { | |
|
||
if (this.info.indexSelector && _.isFunction(this.info.indexSelector)) { | ||
url = this.info.indexSelector(this.$doc); | ||
} | ||
|
||
if(this.info.indexSelector){ | ||
} else if(this.info.indexSelector){ | ||
link = this.$doc.find(this.info.indexSelector); | ||
}else{ | ||
} else { | ||
var selectors = Rule.indexSelectors; | ||
var _indexLink; | ||
// 按照顺序选取目录链接 | ||
|
@@ -3609,7 +3618,9 @@ Parser.prototype = { | |
if(link && link.length){ | ||
url = this.checkLinks(link); | ||
C.log("找到目录链接: " + url); | ||
}else{ | ||
} | ||
|
||
if (!url) { | ||
C.log("无法找到目录链接."); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters