My Novel Reader

小说阅读脚本,统一阅读样式,内容去广告、修正拼音字、段落整理,自动下一页

Versione datata 07/09/2015. Vedi la nuova versione l'ultima versione.

  1. // ==UserScript==
  2. // @id mynovelreader@ywzhaiqi@gmail.com
  3. // @name My Novel Reader
  4. // @name:zh-CN 小说阅读脚本
  5. // @name:zh-TW 小說閱讀腳本
  6. // @version 5.1.7
  7. // @namespace https://github.com/ywzhaiqi
  8. // @author ywzhaiqi
  9. // @contributor Roger Au, shyangs, JixunMoe、akiba9527 及其他网友
  10. // @description 小说阅读脚本,统一阅读样式,内容去广告、修正拼音字、段落整理,自动下一页
  11. // @description:zh-CN 小说阅读脚本,统一阅读样式,内容去广告、修正拼音字、段落整理,自动下一页
  12. // @description:zh-TW 小說閱讀腳本,統一閱讀樣式,內容去廣告、修正拼音字、段落整理,自動下一頁
  13. // @license GPL version 3
  14. // @grant GM_xmlhttpRequest
  15. // @grant GM_addStyle
  16. // @grant GM_getValue
  17. // @grant GM_setValue
  18. // @grant GM_getResourceURL
  19. // @grant GM_openInTab
  20. // @grant GM_setClipboard
  21. // @grant GM_registerMenuCommand
  22. // @grant unsafeWindow
  23. // @homepageURL https://greasyfork.org/scripts/292/
  24. // @require http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js
  25. // @require http://cdn.staticfile.org/underscore.js/1.7.0/underscore-min.js
  26. // @require http://cdn.staticfile.org/keymaster/1.6.1/keymaster.min.js
  27. // @require https://greasyfork.org/scripts/2672-meihua-cn2tw/code/Meihua_cn2tw.js?version=7375
  28. // @resource fontawesomeWoff http://libs.baidu.com/fontawesome/4.0.3/fonts/fontawesome-webfont.woff?v=4.0.3
  29.  
  30. // @include http://read.qidian.com/*,*.aspx
  31. // @include http://readbook.qidian.com/bookreader/*,*.html
  32. // @include http://read.qidian.com/BookReaderOld/*,*.aspx
  33. // @include http://read.qidian.com/BookReader/*,*.aspx
  34. // @include http://wwwploy.qidian.com/BookReader/*,*.aspx
  35. // @include http://free.qidian.com/Free/ReadChapter.aspx?*
  36. // @include http://www.qdmm.com/BookReader/*,*.aspx
  37. // @include http://www.qdwenxue.com/BookReader/*,*.aspx
  38. // @include http://chuangshi.qq.com/read/bookreader/*.html*
  39. // @include http://chuangshi.qq.com/*bk/*/*-r-*.html*
  40. // @include http://yunqi.qq.com/*bk/*/*.html
  41. // @include http://dushu.qq.com/read.html?bid=*
  42. // @include http://www.jjwxc.net/onebook.php?novelid=*
  43. // @include http://book.zongheng.com/chapter/*/*.html
  44. // @include http://www.xxsy.net/books/*/*.html
  45. // @include http://book.zhulang.com/*/*.html
  46. // @include http://www.17k.com/chapter/*/*.html
  47. // @include http://mm.17k.com/chapter/*/*.html
  48. // @include http://www.kanxia.net/k/*/*/*.html
  49. // @include http://www.qingdi.com/files/article/html/*/*/*.html
  50. // @include http://www.xkzw.org/*/*.html
  51. // @include http://shouda8.com/*/*.html
  52. // @include http://novel.hongxiu.com/*/*/*.shtml
  53. // @include http://www.readnovel.com/novel/*.html
  54. // http://www.tianyabook.com/*/*.htm
  55.  
  56. // @include http://tieba.baidu.com/p/*
  57. // @include http://booklink.me/*
  58.  
  59. // booklink.me
  60. // @include http://www.shumilou.com/*/*.html
  61. // @include http://www.wcxiaoshuo.com/wcxs-*-*/
  62. // @include http://www.xiaoshuoz.com/wcxs-*-*/
  63. // @include http://www.quledu.com/wcxs-*-*/
  64. // @include http://www.ranwen.cc/*/*/*/*.html
  65. // @include http://www.ranwen.net/files/article/*/*/*.html
  66. // @include http://www.64mi.com/*/*/*/*.html
  67. // @include http://www.bxs.cc/*/*.html*
  68. // @include http://www.laishuwu.com/html/*/*/*.html
  69. // @include http://www.binhuo.com/html/*/*/*.html
  70. // @include http://www.haoqi99.com/haoqi99/*/*/*.shtml
  71. // @include http://www.shuhe.cc/*/*/
  72. // @include http://www.dudukan.net/html/*/*/*.html
  73. // @include http://www.hahawx.com/*/*/*.htm
  74. // @include http://www.zhuzhudao.com/txt/*/*/
  75. // @include http://www.zhuzhudao.cc/txt/*/*/
  76. // @include http://www.dahaomen.net/txt/*/*/
  77. // @include http://www.tadu.com/book/*/*/
  78. // @include http://www.aishoucang.com/*/*.html
  79. // @include http://www.wanshuba.com/Html/*/*/*.html
  80. // @include http://www.zhuishu.net/files/article/html/*/*/*.html
  81. // @include http://www.sqsxs.com/*/*/*.html*
  82. // @include http://www.caiwei.tw/html/*/*.html
  83. // @include http://www.hotsk.com/Html/Book/*/*/*.shtml
  84. // @include http://www.92to.com/*/*/*.html
  85. // @include http://www.qirexs.com/read-*-chapter-*.html
  86. // @include http://www.du00.com/read/*/*/*.html
  87. // @include http://www.qishuwu.com/*/*/
  88. // @include http://www.wandoou.com/book/*/*.html
  89. // @include http://www.6yzw.org/*/*.html
  90. // @include http://www.6yzw.com/*/*.html
  91. // @include http://www.daomengren.com/*/*.html
  92. // @include http://muyuge.com/*/*.html
  93. // @include http://www.muyuge.net/*/*.html
  94. // @include http://bbs.vyming.com/novel-read-*-*.html
  95. // @include http://www.9imw.com/novel-read-*-*.html
  96. // @include http://www.23zw.com/olread/*/*/*.html
  97. // @include http://www.50zw.com/book_*/*.html
  98. // @include http://www.xiangcunxiaoshuo.com/shu/*/*.html
  99. // @include http://www.lwxs520.com/books/*/*/*.html
  100. // @include http://www.zashu.net/books/*/*/*.html
  101. // @include http://www.piaotian.net/html/*/*/*.html
  102. // @include http://www.yunlaige.com/html/*/*/*.html
  103. // @include http://www.cfwx.net/files/article/html/*/*/*.html
  104. // @include http://www.qiuwu.net/html/*/*/*.html
  105. // @include http://www.fengwu.org/html/*/*/*.html
  106. // @include http://www.xs84.com/*_*/*
  107. // @include http://www.geiliwx.com/GeiLi/*/*/*.shtml*
  108. // @include http://www.123yq.com/read/*/*/*.shtml
  109. // @include http://www.dhzw.com/book/*/*/*.html
  110. // @include http://www.du00.cc/read/*/*/*.html
  111. // @include http://www.aszw.com/book/*/*/*.html
  112. // @include http://www.xsbashi.com/*_*/
  113. // @include http://www.vodtw.com/Html/Book/*/*/*.html
  114. // @include http://www.fhxs.com/read/*/*/*.shtml
  115. // @include http://www.snwx.com/book/*/*/*.html
  116.  
  117. // www.sodu.so
  118. // @include http://www.jiaodu8.com/*/*/*/*.html
  119. // @include http://www.fktxt.com/book/*/*.html
  120. // @include http://www.186s.cn/files/article/html/*/*/*.html
  121. // @include http://www.6xs.cn/xs/*/*/*.html
  122. // @include http://www.chaojiqiangbing.com/book/*/*/*.html
  123. // @include http://book.moka123.com/book/*/*/*.html
  124. // @include http://www.suimeng.com/files/article/html/*/*/*.html
  125. // @include http://www.hao662.com/haoshu/*/*/*.html
  126.  
  127. //www.verydu.net
  128. // http://www.yawen8.com/*/*/*.html
  129. // @include http://www.tsxs.cc/files/article/html/*/*/*.html
  130. // @include http://www.ziyuge.com/*/*/*/*/*.html
  131.  
  132. // 其它网站
  133. // @include http://book.sfacg.com/Novel/*/*/*/
  134. // @include http://www.7dsw.com/book/*/*/*.html
  135. // @include http://www.d586.com/*/*/
  136. // @include http://www.bookgew.com/Html/Book/*/*/*.htm
  137. // @include http://read.shuhaha.com/Html/Book/*/*/*.html
  138. // @include http://www.shuhaha.com/Html/Book/*/*/*.html
  139. // @include http://www.biqi.me/files/article/html/*/*/*.html
  140. // @include http://www.ttzw.com/book/*/*.html
  141. // @include http://www.uukanshu.com/*/*/*.html
  142. // @include http://www.173ed.com/read/*/*.html
  143. // @include http://www.a240.com/read/*/*.html
  144. // @include http://www.zhuishu.com/*/*.html
  145. // @include http://www.shuangde.cc/*/*.html
  146. // @include http://www.shenmaxiaoshuo.com/ml-*-*/
  147. // @include http://www.86kankan.com/read/*/*.html
  148. // @include http://www.fkzww.com/*/*/*.html
  149. // @include http://www.151kan.com/*/*/*/*.html
  150. // @include http://www.bookabc.net/*/*/*.html
  151. // @include http://www.xshuotxt.com/*/*/*/*.html
  152. // @include http://www.doulaidu.com/*/*/*.html
  153. // @include http://www.d586.com/*/*/
  154. // @include http://www.kanshu.la/book/*/*html
  155. // @include http://www.wtcxs.com/files/article/html/*/*/*.html
  156. // @include http://www.5du5.com/book/*/*/*.html
  157. // @include http://book.kanunu.org/*/*/*.html
  158. // @include http://www.kanunu8.com/book*/*.html
  159. // @include http://paitxt.com/*/*/*.html
  160. // @include http://www.shunong.com/yuedu/*/*/*.html
  161. // @include http://book.yayacms.com/*/book_*_*.html
  162. // @include http://www.yqhhy.cc/*/*/*.html
  163. // @include http://www.nuoqiu.com/static/*/*.html
  164. // @include http://www.17yue.com/*/*/*.html
  165. // @include http://dukeba.com/book/*/*/*.shtml
  166. // @include http://www.wenchangshuyuan.com/html/*/*/*.html
  167. // @include http://www.pofeng.net/xiaoshuo/*/*.html
  168. // @include http://www.epzww.com/book/*/*
  169. // @include http://*.xiaoshuokan.com/haokan/*/*.html
  170. // @include http://www.wobudu.com/*/*.html
  171. // @include http://www.qb5.com/xiaoshuo/*/*/*.html
  172. // @include http://www.23us.com/html/*/*/*.html
  173. // @include http://www.23wx.com/html/*/*/*.html
  174. // @include http://www.xs222.com/html/*/*/*.html
  175. // @include http://www.bixiage.com/*/*/*/*.html
  176. // @include http://www.ranwenxiaoshuo.com/files/article/html/*/*/*.html
  177. // @include http://www.ranwenxiaoshuo.com/*/*-*-*.html
  178. // @include http://www.bjxiaoshuo.com/bjxs-*-*/
  179. // @include http://www.59shuku.com/xiaoshuo/*/*.htm
  180. // @include http://www.16kbook.org/Html/Book/*/*/*.shtml
  181. // @include http://www.dixiaoshuo.com/Html/*/*.html
  182. // @include http://www.nieshu.com/Book/*/*/*.shtml
  183. // @include http://www.tlxsw.com/files/article/html/*/*/*.html
  184. // @include http://www.1kanshu.com/files/article/html/*/*/*.html
  185. // @include http://www.uutxt.org/book/*/*/*.html
  186. // @include http://www.5800.cc/*/*/*/*.html
  187. // @include http://www.biquge.com/*/*.html
  188. // @include http://www.biquge.la/book/*/*.html
  189. // @include http://www.qududu.com/book/*/*/*.html
  190. // @include http://www.free97.cn/book/*/*/*.html
  191. // @include http://www.122s.com/book/*/*.html
  192. // @include http://www.123du.net/dudu-*/*/*.html
  193. // @include http://www.123du.cc/dudu-*/*/*.html
  194. // @include http://www.123du.net/book/*/*.html
  195. // @include http://www.hwafa.com/*/*.html
  196. // @include http://www.qmshu.com/html/*/*/*.html
  197. // @include http://dlzw.cc/article-*-*.html
  198. // @include http://www.shushu5.com/read/*/*.html
  199. // @include http://www.xiaoyanwenxue.com/files/article/html/*/*/*.html
  200. // @include http://www.3gsc.com.cn/bookcon/*_*_*
  201. // @include http://www.bj-ibook.cn/book/*/*/*.htm
  202. // @include http://www.baoliny.com/*/*.html
  203. // @include http://www.dajiadu.net/files/article/html/*/*/*.html
  204. // @include http://www.yankuai.com/files/article/html/*/*/*.html
  205. // @include http://www.docin.net/*/*.html
  206. // @include http://www.dushuge.net/html/*/*/*.html
  207. // @include http://www.xunshu.org/xunshu/*/*/*.html
  208. // @include http://www.moneyren.com/book/*/*/*.shtml
  209. // @include http://wemaxfilipino.com/*/*/*.html
  210. // @include http://www.85618892.cn/xiaoshuo/*/*/*.shtml
  211. // @include http://www.bookba.net/Html/Book/*/*/*.html
  212. // @include http://www.moksos.com/*/*/*.html
  213. // @include http://dudu8.net/novel/*/*/*.html
  214. // @include http://www.dawenxue.net/html/*/*/*.html
  215. // @include http://www.yanmoxuan.org/book/*/*/*.html
  216. // @include http://www.duyidu.com/xiaoshuo/*/*/*.html
  217. // @include http://www.69zw.com/xiaoshuo/*/*/*.html
  218. // @include http://www.kan7.com/xiaoshuo/*/*/*.html
  219. // @include http://www.laishu.com/book/*/*/*.shtml
  220. // @include http://www.bxwx.org/b/*/*/*.html
  221. // @include http://www.bxzw.org/*/*/*/*.shtml
  222. // @include http://www.360118.com/html/*/*/*.html
  223. // @include http://www.59to.com/files/article/xiaoshuo/*/*/*.html
  224. // @include http://www.dyzww.com/cn/*/*/*.html
  225. // @include http://www.9wh.net/*/*/*.html
  226. // @include http://www.luoqiu.net/html/*/*/*.html
  227. // @include http://www.luoqiu.com/html/*/*/*.html
  228. // @include http://www.epzw.com/files/article/html/*/*/*.html
  229. // @include http://www.dashubao.com/book/*/*/*.html
  230. // @include http://b.faloo.com/p/*/*.html
  231. // @include http://www.baikv.com/*/*.html
  232. // @include http://www.66721.com/*/*/*.html
  233. // @include http://www.3dllc.com/html/*/*/*.html
  234. // @include http://www.xstxt.com/*/*/
  235. // @include http://www.zzzcn.com/3z*/*/
  236. // @include http://www.zzzcn.com/modules/article/App.php*
  237. // @include http://www.nilongdao.com/book/*/*/*.html
  238. // @include http://xs321.net/*/*/
  239. // @include http://read.guanhuaju.com/files/article/html/*/*/*.html
  240. // @include http://www.book108.com/*/*/*.html
  241. // @include http://5ycn.com/*/*/*.html
  242. // @include http://www.zhaoxiaoshuo.com/chapter-*-*-*/
  243. // @include http://*zbzw.com/*/*.html
  244. // @include http://manghuangji.cc/*/*.html
  245. // @include http://www.aiqis.com/*/*.html
  246. // @include http://www.fftxt.net/book/*/*.html
  247. // @include http://www.5kwx.com/book/*/*/*.html
  248. // @include http://www.uuxiaoshuo.net/html/*/*/*.html
  249. // @include http://www.sanyyo.org/*.html
  250. // @include http://www.chinaisbn.com/*/*/*.html
  251. // @include http://www.caihongwenxue.com/Html/Book/*/*/*.html
  252. // @include http://www.shushuw.cn/shu/*/*.html
  253. // @include http://www.78xs.com/article/*/*/*.shtml
  254. // @include http://www.miaobige.com/*/*/*.html
  255. // @include http://www.woaixiaoshuo.com/xiaoshuo/*/*/*.html
  256. // @include http://www.ty2016.com/book/*/*.html
  257. // @include http://wx.ty2016.com/*/*/*.html
  258. // @include http://www.my285.com/*/*/*/*.htm
  259. // @include http://www.5858xs.com/html/*/*/*.html
  260. // @include http://book.58xs.com/html/*/*/*.html
  261. // @include http://book.mihua.net/*/*/*/*.html
  262. // @include http://www.hjwzw.com/Book/Read/*,*
  263. // @include http://www.365essay.com/*/*.htm
  264. // @include http://www.gengxin8.com/read/*/*.html
  265. // @include http://www.365xs.org/books/*/*/*.html
  266. // @include http://www.wuruo.com/files/article/html/*/*/*.html
  267. // @include http://www.remenxs.com/du_*/*/
  268. // @include http://*.8shuw.net/book/*/*.html
  269. // @include http://www.pashuw.com/BookReader/*/*.html
  270. // @include http://read.shanwen.com/html/*/*/*.html
  271. // @include http://www.qqxs.cc/xs/*/*/*.html
  272. // @include http://www.69shu.com/txt/*/*
  273. // @include http://www.e8zw.com/book/*/*/*.html
  274. // @include http://www.biquge.tw/*_*/*.html
  275. // @include http://www.8535.org/*/*/*.html*
  276. // @include http://www.yfzww.com/books/*/*/*.htm
  277. // @include http://www.lewen8.com/lw*/*.html
  278. // @include http://www.pinwenba.com/read/*/*.html
  279. // @include http://down1.qidian.com/bookall/*.htm*
  280. // @include http://www.77nt.com/*/*.html
  281. // @include http://www.quanbenba.com/yuedu/*/*/*.html
  282.  
  283. // @exclude */List.htm
  284. // @exclude */List.html
  285. // @exclude */List.shtml
  286. // @exclude */index.htm
  287. // @exclude */index.html
  288. // @exclude */index.shtml
  289. // @exclude */Default.htm
  290. // @exclude */Default.html
  291. // @exclude */Default.shtml
  292.  
  293. // @run-at document-end
  294. // ==/UserScript==
  295.  
  296.  
  297. var isChrome = !!window.chrome;
  298. var isFirefox = navigator.userAgent.indexOf("Firefox") != -1;
  299.  
  300. // 其它设置
  301. var config = {
  302. soduso: false, // www.sodu.so 跳转
  303. content_replacements: true, // 小说屏蔽字修复
  304. fixImageFloats: true, // 图片居中修正
  305. paragraphBlank: true, // 统一段落开头的空格为 2个全角空格
  306. end_color: "#666666", // 最后一页的链接颜色
  307. PRELOADER: true, // 提前预读下一页
  308. };
  309.  
  310. var READER_AJAX = "reader-ajax"; // 内容需要 ajax 的 className
  311.  
  312.  
  313. // Unicode/2000-2FFF:http://zh.wikibooks.org/wiki/Unicode/2000-2FFF
  314. // Unicode/F000-FFFF:https://zh.wikibooks.org/wiki/Unicode/F000-FFFF
  315.  
  316. // replace 中的简写
  317. var CHAR_ALIAS = {
  318. '\\P': '[\\u2000-\\u2FFF\\u3004-\\u303F\\uFE00-\\uFF60\\uFFC0-\\uFFFF]', // 小说中添加的特殊符号
  319. };
  320.  
  321. // ===== 自动尝试的规则 =====
  322. var Rule = {
  323. titleRegExp: /第?\s*[一二两三四五六七八九十○零百千万亿0-91234567890]{1,6}\s*[章回卷节折篇幕集]/i,
  324. titleReplace: /^章节目录|^文章正文|^正文|全文免费阅读|最新章节|\(文\)/,
  325.  
  326. // nextRegExp: /[上前下后][一]?[页张个篇章节步]/,
  327. nextSelector: "a[rel='next'], a:contains('下一页'), a:contains('下一章'), a:contains('下一节'), a:contains('下页')",
  328. prevSelector: "a[rel='prev'], a:contains('上一页'), a:contains('上一章'), a:contains('上一节'), a:contains('上页')",
  329. // 忽略的下一页链接,匹配 href
  330. nextUrlIgnore: [
  331. /(?:(?:index|list|last|LastPage|end)\.)|BuyChapterUnLogin|^javascript:/i,
  332.  
  333. /BookReader\/vip,/i,
  334. /BookReader\/LastPageNew\.aspx/i,
  335. /read\.qidian\.com\/BookReader\/\d+,0\.aspx$/i,
  336. /read\.qidian\.com\/$/i,
  337. /free\.qidian\.com\/Free\/ShowBook\.aspx\?bookid=/i,
  338.  
  339. /book\.zongheng\.com\/readmore/i,
  340. /www\.shumilou\.com\/to-n-[a-z]+-\d+\.html/i,
  341. /\/0\.html$/i,
  342. ],
  343. nextUrlCompare: /\/\d+(_\d+)?\.html?$|\/wcxs-\d+-\d+\/$|chapter-\d+\.html$|\/\d+_\d+\/$/i, // 忽略的下一页链接(特殊),跟上一页比较
  344.  
  345. // 按顺序匹配,匹配到则停止。econtains 完全相等
  346. indexSelectors: ["a[href='index.html']", "a:contains('返回书目')", "a:contains('章节目录')", "a:contains('章节列表')",
  347. "a:econtains('最新章节')", "a:contains('回目录')","a:contains('回书目')", "a:contains('目 录')", "a:contains('目录')"],
  348.  
  349. contentSelectors: ["#pagecontent", "#contentbox", "#bmsy_content", "#bookpartinfo", "#htmlContent",
  350. "#text_area", "#chapter_content", "#chapterContent", "#partbody",
  351. "#article_content", "#BookTextRead", "#booktext", "#BookText", "#readtext", "#text_c", "#txt_td", "#TXT", "#txt", "#zjneirong",
  352. ".novel_content", ".readmain_inner", ".noveltext", ".booktext",
  353. "#contentTxt", "#oldtext", "#a_content", "#contents", "#content2", "#contentts", "#content", ".content"],
  354.  
  355. // (测试)尝试查找书名。顶部章节导航的最后一个链接可能是书名。
  356. bookTitleSelector: ".h1title > .shuming > a[title], .chapter_nav > div:first > a:last",
  357.  
  358. contentRemove: "script, iframe", // 内容移除选择器
  359. removeLineRegExp: /<p>[ \s。;,!\.∷〖]*<\/p>/g, // 移除只有一个字符的行
  360.  
  361. // 以下不常改
  362. replaceBrs: /(<br[^>]*>[ \n\r\t]*){1,}/gi, // 替换为<p>
  363. };
  364.  
  365. // ===== 自定义站点规则 =====
  366. Rule.specialSite = [
  367. // 详细版规则示例。注:该网站已无法访问。
  368. {siteName: "泡书吧", // 站点名字... (可选)
  369. url: "^http://www\\.paoshu8\\.net/Html/\\S+\\.shtm$", // // 站点正则... (~~必须~~)
  370.  
  371. // 获取标题
  372. titleReg: /(.*?)最新章节 [-_\\\/](.*?)[-_\/].*/, // 书籍标题、章节标题正则 (可选)
  373. titlePos: 0, // 书籍标题位置:0 或 1 (可选,默认为 0)
  374. titleSelector: "#title h1",
  375.  
  376. indexSelector: "a:contains('回目录')", // 首页链接 jQuery 选择器 (不填则尝试自动搜索)
  377. prevSelector: "a:contains('翻上页')", // 上一页链接 jQuery 选择器 (不填则尝试自动搜索)
  378. nextSelector: "a:contains('翻下页')", // 下一页链接 jQuery 选择器 (不填则尝试自动搜索)
  379.  
  380. // 获取内容
  381. contentSelector: "#BookText", // 内容 jQuery 选择器 (不填则尝试自动搜索)
  382. useiframe: false, // (可选)下一页加载是否使用 iframe
  383. // mutationSelector: "#chaptercontainer", // (可选)内容生成监视器
  384. // 对内容的处理
  385. contentHandle: false, // (可选)是否对内容进行特殊处理,诸如拼音字修复等,诸如起点等网站可禁用
  386. fixImage: true, // (可选),图片居中,不分大小
  387. contentReplace: /(\*W|(w|\(w).{10,25}(吧\*|)|\))|看小说就上|本书首发|泡.{1,6}吧|百度搜索阅读最新最全的小说|http:\/\/www.paoshu8.com\/|无弹窗/g, // 需要移除的内容正则 (可选)
  388. contentPatch: function(fakeStub){ // (可选)内容补丁。解决翻页是脚本的情况
  389. var $next = fakeStub.find('#LinkMenu');
  390. $next.html($next.html().replace(/<script>ShowLinkMenu.*?(<a.*?a>).*?(<a.*?a>).*?script>/,'$1$2') +
  391. '<a href=\'List.shtm\'>回目录</a>');
  392. }
  393. },
  394. // 特殊站点,需再次获取且跨域。添加 class="reader-ajax",同时需要 src, charset
  395. {siteName: "起点中文、起点女生、起点文学",
  396. url: "^http://(www|read|readbook|wwwploy|cga|big5ploy)\\.(qidian|qdmm|qdwenxue)\\.com/BookReaderOld/.*",
  397.  
  398. // titleReg: "小说:(.*?)(?:独家首发)/(.*?)/.*",
  399. titleSelector: "#lbChapterName",
  400. bookTitleSelector: ".page_site > a:last",
  401. // contentSelector: "#hdContent",
  402. nextUrl: function($doc){ // 为了避免起点某次改版后把1页拆成2页,然后造成重复载入第一页的情况
  403. var html = $doc.find('script:contains(nextpage=)').html();
  404. if (!html) return;
  405. var m = html.match(/nextpage='(.*?)'/);
  406. if (m) return m[1];
  407. },
  408. prevUrl: function($doc){
  409. var html = $doc.find('script:contains(prevpage=)').html();
  410. if (!html) return;
  411. var m = html.match(/prevpage='(.*?)'/);
  412. if (m) return m[1];
  413. },
  414. contentReplace: {
  415. "\\[img=(.*)\\]": "<p><img src='$1'></p><p>",
  416. "\\[+CP.*(http://file.*\\.jpg)\\]+": "<p><img src='$1'></p><p>",
  417. "\\[bookid=(\\d+),bookname=(.*?)\\]": "<a href='http://www.qidian.com/Book/$1.aspx'>$2</a>",
  418. "www.cmfu.com发布|起点中文网www.qidian.com欢迎广大书友光临阅读.*": "",
  419. '(<p>\\s+)?<a href="?http://www.(?:qidian|cmfu).com"?>起点中文网.*': '',
  420.  
  421. '([\\u4e00-\\u9fa5])[%¥]+([\\u4e00-\\u9fa5])': '$1$2', // 屏蔽词修正,例如:风%%骚
  422. },
  423. contentRemove: "span[id^='ad_'], .read_ma",
  424. contentPatch: function(fakeStub){
  425. fakeStub.find('script[src$=".txt"]').addClass('reader-ajax');
  426. },
  427. },
  428. {siteName: '起点新版',
  429. url: 'http://read\\.qidian\\.com/BookReader/\\d+,\\d+\\.aspx',
  430. bookTitleSelector: '.story_title .textinfo a:nth-child(1)',
  431. titleSelector: '.story_title h1',
  432.  
  433. prevSelector: '#pagePrevRightBtn',
  434. nextSelector: '#pageNextRightBtn',
  435. indexSelector: function() {
  436. return location.href.replace(/,\d+\.aspx$/, '.aspx').replace('BookReaderNew', 'BookReader');
  437. },
  438.  
  439. mutationSelector: "#chaptercontainer", // 内容生成监视器
  440. mutationChildCount: 1,
  441. contentSelector: '#content, .bookreadercontent',
  442. contentRemove: 'a[href="http://www.qidian.com"]',
  443. contentReplace: [
  444. '手机用户请到m.qidian.com阅读。'
  445. ],
  446. contentPatch: function(fakeStub){
  447. fakeStub.find('script[src$=".txt"]').addClass('reader-ajax');
  448. },
  449. },
  450. {siteName: "起点中文网免费频道",
  451. url: "^http://free\\.qidian\\.com/Free/ReadChapter\\.aspx",
  452. titleSelector: ".title > h3",
  453. bookTitleSelector: ".site_rect > a:last",
  454. contentSelector: "#chapter_cont, #content",
  455. contentRemove: ".nice_books",
  456. contentReplace: {
  457. "\\[img=(.*)\\]": "<p><img src='$1'></p><p>",
  458. "\\[+CP.*(http://file.*\\.jpg)\\]+": "<p><img src='$1'></p><p>",
  459. "\\[bookid=(\\d+),bookname=(.*?)\\]": "<a href='http://www.qidian.com/Book/$1.aspx'>$2</a>",
  460. "www.cmfu.com发布|起点中文网www.qidian.com欢迎广大书友光临阅读.*": "",
  461. '(<p>\\s+)?<a href="?http://www.(?:qidian|cmfu).com"?>起点中文网.*': ''
  462. },
  463. contentPatch: function(fakeStub) {
  464. fakeStub.find('#chapter_cont, #content > script:first').addClass('reader-ajax');
  465. }
  466. },
  467. {siteName: "创世中文网",
  468. url: "^http://(?:chuangshi|yunqi)\\.qq\\.com/|^http://dushu\\.qq\\.com/read.html\\?bid=",
  469. bookTitleSelector: '.bookNav > a:last()',
  470. titleSelector: '.story_title > h1',
  471.  
  472. nextSelector: '#rightFloatBar_nextChapterBtn',
  473. prevSelector: '#rightFloatBar_preChapterBtn',
  474. indexSelector: function() {
  475. return 'http://chuangshi.qq.com/bk/ds/' + unsafeWindow.bid + '-l.html';
  476. },
  477.  
  478. contentSelector: ".bookreadercontent",
  479. contentHandle: false,
  480. mutationSelector: "#chaptercontainer", // 内容生成监视器,第一次运行用到,以后用下面的 getContent 函数
  481. mutationChildCount: 1,
  482. startFilter: function() {
  483. // 下一页需要提前加 1
  484. unsafeWindow.uuid = parseInt(unsafeWindow.uuid) + 1 + '';
  485. },
  486. getContent: function(fakeStub, callback) { // this 指 parser
  487. var done = function (data) {
  488. unsafeWindow.uuid = data.nextuuid; // 给下一页用
  489.  
  490. callback({
  491. html: getPageUrlHtml(data.preuuid, data.nextuuid) + data.Content
  492. });
  493. };
  494. exportFunction(done, unsafeWindow, { defineAs: "gm_mnr_cs_callback" });
  495.  
  496. unsafeWindow.CS.page.read.main.getChapterContent(unsafeWindow.bid, unsafeWindow.uuid, unsafeWindow.gm_mnr_cs_callback);
  497.  
  498. function getPageUrlHtml(preChapterUUID, nextChapterUUID) {
  499. var preReadUrl = _getReadPageUrl(preChapterUUID),
  500. nextReadUrl = _getReadPageUrl(nextChapterUUID);
  501.  
  502. return '<a id="rightFloatBar_preChapterBtn" href="' + preReadUrl + '">上一页</a>' +
  503. '<a id="rightFloatBar_nextChapterBtn" href="' + nextReadUrl + '">下一页</a>' + '\n';
  504. }
  505.  
  506. function _getReadPageUrl(uuid) {
  507. if (!uuid) {
  508. return 'javascript:void(0);';
  509. }
  510. var url = location.href.replace(/[?|#].*/gi, '');
  511. return url.replace(/(\d)+\.html/, uuid + '.html');
  512. }
  513. },
  514. },
  515. {siteName: "纵横中文网",
  516. url: "^http://book\\.zongheng\\.com/\\S+\\/\\d+\\.html$",
  517. contentHandle: false,
  518. // titleReg: "(.*?)-(.*)",
  519. titleSelector: "em[itemprop='headline']",
  520. bookTitleSelector: ".nav>a:last",
  521. contentPatch: function(fakeStub){
  522. fakeStub.find('.watermark').remove();
  523. // 给第几章添加空格
  524. var chapterTitle = fakeStub.find(".tc > h2").text();
  525. var chapterTitle1 = fakeStub.find(".tc > h2 em").text();
  526. if(chapterTitle1) {
  527. chapterTitle = chapterTitle.replace(chapterTitle1, " ") + chapterTitle1;
  528. }
  529. fakeStub.find("title").text(
  530. fakeStub.find(".tc > h1").text() + "-" + chapterTitle
  531. );
  532. }
  533. },
  534. {siteName: "晋江文学网",
  535. url: /^http:\/\/www\.jjwxc\.net\/onebook\.php\S*/,
  536. titleReg: /《(.*?)》.*ˇ(.*?)ˇ.*/,
  537. indexSelector: ".noveltitle > h1 > a",
  538. contentSelector: '.noveltext',
  539. contentHandle: false,
  540. contentRemove: 'font[color], hr',
  541. contentPatch: function(fakeStub){
  542. fakeStub.find('h2').remove();
  543. fakeStub.find('#six_list, #sendKingTickets').parent().remove();
  544. fakeStub.find("div.noveltext").find("div:first, h1, div[style]:last").remove();
  545. }
  546. },
  547. {siteName: "潇湘书院",
  548. url: "^http://www\\.xxsy\\.net/books/.*\\.html",
  549. titleReg: "(.*?) (.*)",
  550. contentSelector: "#zjcontentdiv",
  551. nextSelector: "a[title='阅读下一章节']",
  552. contentHandle: false,
  553. contentReplace: "本书由潇湘书院首发,请勿转载!",
  554. contentPatch: function(fakeStub){
  555. fakeStub.find("title").text(fakeStub.find('meta[name="keywords"]').attr("content"));
  556. }
  557. },
  558. {siteName: "逐浪",
  559. url: /^http:\/\/book\.zhulang\.com\/.*\.html/,
  560. titleReg: /(.*?)-(.*)/,
  561. contentSelector: "#readpage_leftntxt",
  562. contentHandle: false,
  563. contentPatch: function(fakeStub){
  564. var title = fakeStub.find(".readpage_leftnzgx a:first").text() + "-" +
  565. fakeStub.find(".readpage_leftntit").text();
  566. fakeStub.find('title').html(title);
  567. }
  568. },
  569. {siteName: "小说阅读网",
  570. url: "http://www\\.readnovel\\.com/novel/.*\\.html",
  571. titleSelector: ".bgtop > h1",
  572. bookTitleSelector: ".nownav > a:eq(4)",
  573. contentSelector: "#article, .zhangjie",
  574. contentRemove: "div[style], .miaoshu, .zhichi, .bottomAdbanner",
  575. contentPatch: function(fakeStub) {
  576. // 删除标题不需要的部分
  577. fakeStub.find(".bgtop > h1 > span").remove();
  578. }
  579. },
  580. // {siteName: "磨铁",
  581. // url: 'http://www.motie.com/book/\\d+_\\d+',
  582. // contentSelector: '.page-content'
  583. // },
  584.  
  585. {siteName: "百度贴吧(手动启用)",
  586. enable: false,
  587. url: /^http:\/\/tieba\.baidu.com\/p\//,
  588. titleSelector: "h1.core_title_txt",
  589. bookTitleSelector: ".card_title_fname",
  590. nextSelector: false,
  591. indexSelector: 'a.card_title_fname',
  592. prevSelector: false,
  593.  
  594. contentSelector: "#j_p_postlist",
  595. contentRemove: "#sofa_post, .d_author, .share_btn_wrapper, .core_reply, .j_user_sign",
  596. style: ".clear { border-top:1px solid #cccccc; margin-bottom: 50px; visibility: visible !important;}", // 显示楼层的分割线
  597. },
  598. // {siteName: "天涯在线书库(部分支持)",
  599. // url: /www\.tianyabook\.com\/.*\.htm/,
  600. // titleSelector: ".max, h1:first",
  601. // bookTitleSelector: "td[width='70%'] > a[href$='index.htm']",
  602. // contentSelector: "div > span.middle, #texts",
  603. // contentHandle: false,
  604. // },
  605. {siteName: "天涯书库",
  606. url: /www\.ty2016\.com\/.+\.html$/,
  607. titleSelector: "h1",
  608. bookTitleSelector: ".crumb a[href='./']",
  609.  
  610. indexSelector: "td a[href='./']",
  611.  
  612. contentSelector: "#main",
  613. contentRemove: '.crumb, table',
  614. contentHandle: false,
  615. },
  616.  
  617. // {siteName: "易读",
  618. // url: "http://www.yi-see.com/read_\\d+_\\d+.html",
  619. // contentSelector: 'table[width="900px"][align="CENTER"]'
  620. // },
  621. {siteName: "燃文",
  622. url: /^http:\/\/www\.(?:ranwen\.cc|64mi\.com)\/.*\.html$/,
  623. titleReg: /(.*?)-(.*?)-燃文/,
  624. contentSelector: "#oldtext, #contents",
  625. contentRemove: "div[style], script",
  626. contentReplace: [
  627. /\((&nbsp;)*\)/g,
  628. /最快更新78小说|\(?百度搜.\)|访问下载tXt小说|百度搜\|索|文\|学|文学全文.字手打|\((&nbsp;)+|牛过中文..hjsm..首发.转载请保留|\[本文来自\]|♠思♥路♣客レ|※五月中文网 5y ※|无错不跳字|最快阅读小说大主宰.*|跟我读H-u-n 请牢记|非常文学|关闭&lt;广告&gt;|w w.*|”娱乐秀”|更多精彩小[说說].*|高速更新/g,
  629. /[\(\*◎]*(百度搜)?文.?[學学].?[馆館][\)\*)]*|\(百度搜\)/g,
  630. /提供无弹窗全文字在线阅读.*|高速首发.*如果你觉的本章节还不错的话.*/g,
  631. /书网∷更新快∷无弹窗∷纯文字∷.t!。/g,
  632. /一秒记住,本站为您提供热门小说免费阅读。/g,
  633. /\(更新速度最快记住即可找到\)|芒果直播网|.mgzhibo .|去 读 读|看小说就到/g,
  634. ]
  635. },
  636. {siteName: "燃文小说网",
  637. url: "http://www\\.ranwenxiaoshuo\\.com/files/article/html/\\d+/\\d+/\\d+\\.html|http://www\\.ranwenxiaoshuo\\.com/\\w+/\\w+-\\d+-\\d+\\.html",
  638. titleReg: /(.*?)最新章节(.*?)在线阅读.*/,
  639. contentSelector: "#fontsize",
  640. contentReplace: "天才一秒记住[\\s\\S]+为您提供精彩小说阅读。",
  641. },
  642. {siteName: "燃文小说",
  643. url: "http://www\\.ranwen\\.net/files/article/\\d+/\\d+/\\d+\\.html",
  644. titleReg: "(\\S+) (.*) - 燃文小说",
  645. contentReplace: "\\(.*燃文小说.*\\)|【 注册会员可获私人书架,看书更方便!永久地址: 】 "
  646. },
  647. {siteName: "无错小说网",
  648. url: /^http:\/\/www\.(?:wcxiaoshuo|xiaoshuoz|quledu)\.com\/wcxs[-\d]+\//,
  649. titleReg: /(.*?)最新章节.*?-(.*?)-.*/,
  650. titlePos: 1,
  651. nextSelector: "a#htmlxiazhang",
  652. prevSelector: "a#htmlshangzhang",
  653. indexSelector: "a#htmlmulu",
  654. contentReplace: [
  655. 'ilo-full-src="\\S+\\.jpg" ',
  656. {
  657. '(<center>)?<?img src..(http://www.wcxiaoshuo.com)?(/sss/\\S+\\.jpg).(>| alt."\\d+_\\d+_\\d*\\.jpg" />)(</center>)?': '$3',
  658. "/sss/da.jpg": "打", "/sss/maws.jpg": "吗?", "/sss/baw.jpg": "吧?", "/sss/wuc.jpg": "无", "/sss/maosu.jpg": ":“", "/sss/cuow.jpg": "错", "/sss/ziji.jpg": "自己", "/sss/shenme.jpg": "什么", "/sss/huiqub.jpg": "回去", "/sss/sjian.jpg": "时间", "/sss/zome.jpg": "怎么", "/sss/zhido.jpg": "知道", "/sss/xiaxin.jpg": "相信", "/sss/faxian.jpg": "发现", "/sss/shhua.jpg": "说话", "/sss/dajiex.jpg": "大姐", "/sss/dongxi.jpg": "东西", "/sss/erzib.jpg": "儿子", "/sss/guolair.jpg": "过来", "/sss/xiabang.jpg": "下班", "/sss/zangfl.jpg": "丈夫", "/sss/dianhua.jpg": "电话", "/sss/huilaim.jpg": "回来", "/sss/xiawu.jpg": "下午", "/sss/guoquu.jpg": "过去", "/sss/shangba.jpg": "上班", "/sss/mingtn.jpg": "明天", "/sss/nvrenjj.jpg": "女人", "/sss/shangwo.jpg": "上午", "/sss/shji.jpg": "手机", "/sss/xiaoxinyy.jpg": "小心", "/sss/furene.jpg": "夫人", "/sss/gongzih.jpg": "公子", "/sss/xiansg.jpg": "先生", "/sss/penyouxi.jpg": "朋友", "/sss/xiaoje.jpg": "小姐", "/sss/xifup.jpg": "媳妇", "/sss/nvxudjj.jpg": "女婿", "/sss/xondi.jpg": "兄弟", "/sss/lagong.jpg": "老公", "/sss/lapo.jpg": "老婆", "/sss/meimeid.jpg": "妹妹", "/sss/jiejiev.jpg": "姐姐", "/sss/jiemeiv.jpg": "姐妹", "/sss/xianggx.jpg": "相公", "/sss/6shenumev.jpg": "什么", "/sss/cuoaw.jpg": "错", "/sss/fpefnyoturxi.jpg": "朋友", "/sss/vfsjgigarn.jpg": "时间", "/sss/zzhiedo3.jpg": "知道", "/sss/zibjib.jpg": "自己", "/sss/qdonglxi.jpg": "东西", "/sss/hxiapxint.jpg": "相信", "/sss/fezrormre.jpg": "怎么", "/sss/nvdrfenfjfj.jpg": "女人", "/sss/jhiheejeieev.jpg": "姐姐", "/sss/xdifagojge.jpg": "小姐", "/sss/gggugolgair.jpg": "过来", "/sss/maoashu.jpg": ":“", "/sss/gnxnifawhu.jpg": "下午", "/sss/rgtugoqgugu.jpg": "过去", "/sss/khjukilkaim.jpg": "回来", "/sss/gxhigfadnoxihnyy.jpg": "小心", "/sss/bkbskhhuka.jpg": "说话", "/sss/xeieavnfsg.jpg": "先生", "/sss/yuhhfuiuqub.jpg": "回去", "/sss/pdianphua.jpg": "电话", "/sss/fabxianr.jpg": "发现", "/sss/feilrpto.jpg": "老婆", "/sss/gxronfdri.jpg": "兄弟", "/sss/flfaggofng.jpg": "老公", "/sss/tymyigngtyn.jpg": "明天", "/sss/dfshfhhfjfi.jpg": "手机", "/sss/gstjhranjgwjo.jpg": "上午", "/sss/fmgeyimehid.jpg": "妹妹", "/sss/gxgihftutp.jpg": "媳妇", "/sss/cerztifb.jpg": "儿子", "/sss/gfxgigagbfadng.jpg":"下班", "/sss/gstjhranjg.jpg":"下午", "/sss/hjeirerm6eihv.jpg": "姐妹", "/sss/edajihexr.jpg": "大姐", "/sss/wesfhranrrgba.jpg": "上班", "/sss/gfognggzigh.jpg": "公子", "/sss/frurtefne.jpg": "夫人", "/sss/fzagnggfbl.jpg": "丈夫", "/sss/nvdxfudfjfj.jpg": "女婿", "/sss/xdidafnggx.jpg": "相公", "/sss/zenme.jpg": "怎么", "/sss/gongzi.jpg": "公子", "/sss/ddefr.jpg": "",
  659. },
  660. ".*ddefr\\.jpg.*|无(?:错|.*cuoa?w\\.jpg.*)小说网不[少跳]字|w[a-z\\.]*om?|.*由[【无*错】].*会员手打[\\s\\S]*",
  661. "无错不跳字|无广告看着就是爽!|一秒记住.*|全文免费阅读.*|8 9 阅阅 读 网|看小说最快更新|“小#说看本书无广告更新最快”",
  662. "[\\x20-\\x7e》]?无(?:.|&gt;)错.小说.{1,2}[Ww]+.*?[cC][oO][mM]",
  663. "<无-错>",
  664. "—无—错—小说",
  665. "\\+无\\+错\\+",
  666. "+无+错+小说+3W.++com",
  667. "无错小说 www.quled[Uu].com",
  668. ],
  669. contentPatch: function(fakeStub){
  670. // 去除内容开头、结尾的重复标题
  671. var title = fakeStub.find("#htmltimu").text().replace(/\s+/, "\\s*");
  672. var content = fakeStub.find("#htmlContent");
  673. content.find("div[align='center']").remove();
  674. if(title.match(/第\S+章/)){
  675. content.html(content.html().replace(new RegExp(title), "").replace(new RegExp(title), ""));
  676. }
  677. }
  678. },
  679. {siteName: '凤舞文学网',
  680. url: '^http://www\\.(?:qiuwu\\.net|fengwu\\.org)/html/\\d+/\\d+/\\d+\\.html',
  681. contentReplace: [
  682. {
  683. '<img src="/keywd/R43.gif">':'爱', '<img src="/keywd/A13.gif">': '情', '<img src="/keywd/D10.gif">': '床',
  684. '<img src="/keywd/Y19.gif">': '奸', '<img src="/keywd/H21.gif">': '屁', '<img src="/keywd/Z23.gif">': '逼',
  685. '<img src="/keywd/G42.gif">': '身', '<img src="/keywd/Y2.gif">':'性', '<img src="/keywd/D32.gif">':'热',
  686. '<img src="/keywd/I44.gif">':'挺', '<img src="/keywd/H30.gif">':'贱', '<img src="/keywd/H25.gif">':'荡',
  687. '<img src="/keywd/V7.gif">':'肉', '<img src="/keywd/O22.gif">':'吮', '<img src="/keywd/H9.gif">':'春',
  688. '<img src="/keywd/K36.gif">':'日', '<img src="/keywd/O15.gif">':'胸', '<img src="/keywd/S31.gif">':'欲',
  689. '<img src="/keywd/F20.gif">':'射', '<img src="/keywd/N12.gif">':'禁', '<img src="/keywd/R26.gif">':'殿',
  690. '<img src="/keywd/X6.gif">':'诱', '<img src="/keywd/U46.gif">': '娇',
  691. '<img src="/keywd/M24.gif">': '操', '<img src="/keywd/B4.gif">':'骚', '<img src="/keywd/O3.gif">':'阴',
  692. }
  693. ]
  694. },
  695. {siteName: "书迷楼",
  696. url: /^http:\/\/www\.shumilou\.com\/.*html$/,
  697. titleReg: /(.*) (.*?) 书迷楼/,
  698. titlePos: 1,
  699. contentSelector: "#content",
  700. contentRemove: 'a, center',
  701. contentReplace: [
  702. 'div lign="ener"&gt;|.*更多章节请到网址隆重推荐去除广告全文字小说阅读器',
  703. '起点中文网www.qidian.com欢迎广大书.*',
  704. '书迷楼最快更新.*',
  705. '更新最快最稳定',
  706. '\\(\\.\\)R?U',
  707. {'<p>\\?\\?': '<p>'},
  708. '\\(www.\\)',
  709. '章节更新最快',
  710. '-乐-读-小-说--乐读x-',
  711. '《乐》《读》小说.乐读.Com',
  712. '纯文字在线阅读本站域名手机同步阅读请访问',
  713. '-优-优-小-说-更-新-最-快-www.uuxs.cc-',
  714. ],
  715. fixImage: true,
  716. contentPatch: function(fakeStub){
  717. fakeStub.find("#content").find("div.title:last")
  718. .appendTo(fakeStub.find('body'));
  719. fakeStub.find("#content").find("div.title, p > b, div[style]").remove();
  720. }
  721. },
  722. {siteName: "冰火中文",
  723. url: /^http:\/\/www\.binhuo\.com\/html\/[\d\/]+\.html$/,
  724. titleReg: /(.*?)最新章节,(.*?)-.*/,
  725. fixImage: true,
  726. contentRemove: 'font[color="red"]',
  727. contentReplace: {
  728. "&lt;冰火#中文.*|冰火中文&nbsp;(www.)?binhuo.com(?:【首发】|)|冰.火.中文|绿色小说|lvsexs|冰火中文": "",
  729. "LU5.coM|lU5.com|LU5.com":"",
  730. "([^/])www\\.binhuo\\.com(?:\\.com|)": "$1",
  731. "\\(.*?平南文学网\\)": "",
  732. },
  733. contentPatch: function(fakeStub){
  734. fakeStub.find("#BookText").append(fakeStub.find("img.imagecontent"));
  735. }
  736. },
  737. {siteName: "百晓生",
  738. url: /^http:\/\/www\.bxs\.cc\/\d+\/\d+\.html/,
  739. titleReg: /(.*?)\d*,(.*)/,
  740. contentRemove: 'a, #txtright',
  741. contentReplace: [
  742. /一秒记住【】www.zaidu.cc,本站为您提供热门小说免费阅读。/ig,
  743. /(文&nbsp;學馆w&nbsp;ww.w&nbsp;xguan.c&nbsp;om)/ig,
  744. /(百晓生更新最快最稳定\)/g,
  745. /\((?:&nbsp;)*(?:无弹窗)?全文阅读\)/ig,
  746. /\[<a.*?首发\[百晓生\] \S+/ig,
  747. /高速首发.*本章节是地址为/ig,
  748. /\/\/(?:&nbsp;|访问下载txt小说|高速更新)+\/\//ig,
  749. /(www\.)?bxs\.cc|www\.bxs(\.com)?/ig,
  750. /百晓生.不跳字|不跳字。|更新快纯文字/ig,
  751. /\.\[,!\]/ig,
  752. /(未完待续&nbsp;http:\/\/www.Bxs.cc&nbsp;89免费小说阅《百晓生文学网》)/g,
  753. /〖百晓生∷.*〗|《?百晓生文学网》?|最快阅读小说大主宰,尽在百晓生文学网.*|ww.x.om|欢迎大家来到.*?bxs\.cc|百晓生阅读最新最全的小说.*|百晓生网不少字|站长推荐.*|文字首发|百.晓.生.|关闭.*广告.*|飘天文学|本站域名就是.*|\(.{0,5}小说更快更好.{0,5}\)|(请在)?百度搜索.*|一秒记住.*为您提供精彩小说阅读.|百晓生|¤本站网址:¤|\/\/&nbsp;访问下载txt小说\/\/◎◎|纯站点\\".*值得收藏的/ig,
  754. /文[学學][馆館]|www\.biquge\.cc|(http:\/\/)?www\.Bxs\.cc|(请牢记)?soudu.org/ig,
  755. /请搜索,小说更好更新更快!|最快文字更新无弹窗无广|\(即可找到本站\)|无广告看着就是爽!|更多全本txt小说请到下载|∷更新快∷∷纯文字∷/ig,
  756. /永久网址,请牢记!/ig,
  757. /&nbsp;&gt;<\/p>/ig,
  758. ],
  759. },
  760. {siteName: "浩奇文学网",
  761. url: /^http:\/\/www\.haoqi99\.com\/.*\.shtml$/,
  762. titleReg: /^(.*?)--(.*?)-/,
  763. },
  764. {siteName: "书河小说网",
  765. url: /^http:\/\/www\.shuhe\.cc\/\d+\/\d+/,
  766. titleReg: "([^\\d]+)\\d*,(.*?)_",
  767. contentSelector: "#TXT",
  768. contentReplace: /一秒记住.*为您提供精彩小说阅读.|\{请在百度搜索.*首发阅读\}|(书河小说网.*?无弹窗)|wxs.o|ww.x.om|[\[【\(].{1,30}[\]\)】]|ff37;.*|书河小说网高速首发.*|TXT下载|全文阅读|第一书河小说网|百书斋.*|首发来自书河小说网|本书最新章节|书河小说网/ig,
  769. },
  770. {siteName: "爱收藏",
  771. url: /http:\/\/www\.aishoucang\.com\/\w+\/\d+\.html/,
  772. titleReg: "(.*?)-(.*?)-爱收藏",
  773. contentSelector: "#zhutone",
  774. contentReplace: {
  775. "<a[^>]*>(.*?)</a>": "$1",
  776. ".爱收藏[^<]*": ""
  777. }
  778. },
  779. {siteName: "木鱼哥",
  780. url: /http:\/\/(www\.)?muyuge\.(com|net)\/\w+\/\d+\.html/,
  781. titleSelector: "#yueduye h1",
  782. bookTitleSelector: ".readerNav > li > a:last",
  783. indexSelector: ".readerFooterPage a[title='(快捷:回车键)']",
  784. // useiframe: true,
  785. // mutationSelector: "#content",
  786. // mutationChildCount: 1,
  787. contentRemove: ".vote",
  788. contentReplace: {
  789. "<a[^>]*>(.*?)</a>": "$1",
  790. "看更新最快的小说就搜索—— 木鱼哥——无弹窗,全文字": "",
  791. "【看最新小说就搜索.*全文字首发】": "",
  792. "<p>.*?无弹窗</p>":"",
  793. "bb\\.king|【木&nbsp;鱼&nbsp;哥&nbsp;.*?】|【一秒钟记住本站:muyuge.com.*木鱼哥】":"",
  794. "——推荐阅读——[\\s\\S]+": "",
  795. "【\\s*木\\s*鱼\\s*哥.*?】":"",
  796. "div&gt;|&lt;-》": "",
  797. "\\(.pn. 平南\\)": "",
  798. },
  799. startFilter: function() {
  800. clearInterval(unsafeWindow.show);
  801. }
  802. },
  803. {siteName: "追书网",
  804. url: "^http://www\\.zhuishu\\.net/files/article/html/.*\\.html",
  805. titleReg: /(?:正文 )?(.*) (\S+) \S+ - .*/,
  806. titlePos: 1,
  807. indexSelector: ".pagebottom>a:contains('目录')",
  808. nextSelector: ".pagebottom>a:contains('下一页')",
  809. prevSelector: ".pagebottom>a:contains('上一页')",
  810. fixImage: true,
  811. contentSelector: "#content",
  812. contentReplace: {
  813. "([^/])www\\.ZhuisHu\\.net": "$1",
  814. },
  815. contentPatch: function(fakeStub){
  816. fakeStub.find("#content > .title, #content > .pagebottom").appendTo(fakeStub.find("body"));
  817.  
  818. fakeStub.find("#content").find("center, b:contains('最快更新')").remove();
  819. }
  820. },
  821. {siteName: "猪猪岛小说",
  822. url: "http://www\\.zhuzhudao\\.(?:com|cc)/txt/",
  823. titleReg: "(.*?)最新章节-(.*?)-",
  824. contentReplace: /[“"”]?猪猪岛小说.*|<\/?a[^>]+>|w+\.zhuZhuDao\.com|看更新最快的.*/ig
  825. },
  826. {siteName: "逸名文学屋",
  827. url: "http://(bbs\\.vyming|www\\.9imw)\\.com/novel-read-\\d+-\\d+\\.html",
  828. contentSelector: "#showcontent",
  829. bookTitleSelector: ".headinfo a:first",
  830. contentRemove: "p:contains(精品推荐:), p:contains(,免费小说阅读基地!), a",
  831. contentReplace: [
  832. "逸名文学屋:"
  833. ]
  834. },
  835. {siteName: "奇书屋",
  836. url: "http://www.qishuwu.com/\\w+/\\d+/",
  837. titleReg: "(.*)_(.*)_.*_奇书屋",
  838. },
  839. {siteName: "17k小说网",
  840. url: /^http:\/\/\S+\.17k\.com\/chapter\/\S+\/\d+\.html$/,
  841. titleReg: /(.*?)-(.*?)-.*/,
  842. contentSelector: "#chapterContent",
  843. contentRemove: "#authorSpenk, .like_box, #hotRecommend, .ct0416, .recent_read, div[style], #miniVoteBox"
  844. },
  845. {siteName: "看下文学",
  846. url: "^http://www\\.kanxia\\.net/k/\\d*/\\d+/\\d+\\.html$",
  847. titleReg: /(.*?)-(.*)TXT下载_看下文学/,
  848. contentReplace: /看下文学/g
  849. },
  850. {siteName: "青帝文学网",
  851. url: /^http:\/\/www\.qingdi\.com\/files\/article\/html\/\d+\/\d+\/\d+\.html$/,
  852. titleReg: /(.*?)最新章节_(.*?)_青帝文学网_.*/
  853. },
  854. {siteName: "侠客中文网",
  855. url: /^http:\/\/www\.xkzw\.org\/\w+\/\d+\.html/,
  856. contentSelector: ".readmain_inner .cont",
  857. contentPatch: function(fakeStub){
  858. fakeStub.find('title').html(fakeStub.find('.readmain_inner h2').text());
  859. }
  860. },
  861. {siteName: "ChinaUnix.net",
  862. url: /^http:\/\/bbs\.chinaunix\.net\/thread-.*\.html/,
  863. contentSelector: ".t_f:first"
  864. },
  865. {siteName: "123du 小说",
  866. url: /^http:\/\/www\.123du\.(?:net|cc)\//,
  867. titleReg: "(.*)-(.*) 百家乐",
  868. titlePos: 1,
  869. contentSelector: "#content, #contents",
  870. contentReplace: "一秒记住.www.*|小说最新更新,来123读书www.123du.net",
  871. contentRemove: "a",
  872. contentPatch: function(fakeStub){
  873. var content = fakeStub.find("#DivContentBG").html().match(/第\d*页([\s\S]*)一秒记住/)[1];
  874. $('<div id="content"/>').html(content).appendTo(fakeStub.find('body'));
  875. }
  876. },
  877. {siteName: "动力中文",
  878. url: "^http://dlzw\\.cc/article.*\\.html",
  879. nextSelector: "span:contains('下一篇') > a",
  880. prevSelector: "span:contains('上一篇') > a",
  881. indexSelector: "#pt a[href^='http']"
  882. },
  883. {siteName: "塔读文学",
  884. url: "^http://www\\.tadu\\.com/book/\\d+/\\d+/",
  885. bookTitleSelector: '.title em:first',
  886. contentSelector: "#partContent",
  887. contentPatch: function(fakeStub){
  888. var m = fakeStub.find("body").html().match(/\.html\(unescape\("(.*)"\)/);
  889. if(m){
  890. var unescapeContent = m[1];
  891. fakeStub.find("#partContent").html(unescape(unescapeContent));
  892. }
  893. }
  894. },
  895. {siteName: "第一中文",
  896. url: "^http://www\\.dyzww\\.com/cn/\\d+/\\d+/\\d+\\.html$" ,
  897. contentReplace: {
  898. '<img.*?ait="(.*?)".*?>': "$1",
  899. 'www\\.dyzww\\.com.*|♂|шШщ.*': ""
  900. }
  901. },
  902. {siteName: "来书屋",
  903. url: "http://www.laishuwu.com/html/\\d+/\\d+/\\d+.html",
  904. titleSelector: ".chaptertitle h2",
  905. bookTitleSelector: ".chaptertitle h1",
  906. contentReplace: "txt\\d+/",
  907. },
  908. {siteName: "万书吧",
  909. url: "http://www\\.wanshuba\\.com/Html/\\d+/\\d+/\\d+\\.html",
  910. titleReg: "(.*?),(.*?)-万书吧",
  911. titlePos: 1,
  912. contentSelector: ".yd_text2",
  913. contentReplace: [
  914. "\\[www.*?\\]",
  915. "\\(&nbsp;&nbsp;\\)",
  916. "提供无弹窗全文字在线阅读,更新速度更快文章质量更好,如果您觉得不错就多多分享本站!谢谢各位读者的支持!",
  917. "高速首发.*?,本章节是.*?地址为如果你觉的本章节还不错的话请不要忘记向您qq群和微博里的朋友推荐哦!"
  918. ]
  919. },
  920. {siteName: "大文学",
  921. url: "^http://www\\.dawenxue\\.net/html/\\d+/\\d+/\\d+\\.html",
  922. titleReg: "(.*?)-(.*)-大文学",
  923. contentSelector: "#clickeye_content",
  924. contentReplace: "\\(?大文学\\s*www\\.dawenxue\\.net\\)?|\\(\\)",
  925. },
  926. {siteName: "奇热",
  927. url: "^http://www\\.qirexs\\.com/read-\\d+-chapter-\\d+\\.html",
  928. titleReg: "(.*?)-(.*?)-",
  929. titlePos: 1,
  930. contentSelector: "div.page-content .note",
  931. contentRemove: "a",
  932. contentReplace: "”奇热小说小说“更新最快|首发,/.奇热小说网阅读网!|奇热小说网提供.*|\\(手机用户请直接访问.*"
  933. },
  934. {siteName: "热点",
  935. url: "^http://www\\.hotsk\\.com/Html/Book/\\d+/\\d+/\\d+\\.shtml",
  936. titleReg: "(.*?) 正文 (.*?)- 热点书库 -",
  937. contentReplace: "\\(热点书库首发:www.hotsk.com\\)|www.zhuZhuDao.com .猪猪岛小说."
  938. },
  939. {siteName: "落秋中文",
  940. url: "^http://www\\.luoqiu\\.(com|net)/html/\\d+/\\d+/\\d+\\.html",
  941. titleReg: "(.*?)-(.*?)-",
  942. contentReplace: "&lt;/p&gt;"
  943. },
  944. {siteName: "全本小说网",
  945. url: "^http://www\\.qb5\\.com/xiaoshuo/\\d+/\\d+/\\d+\\.html",
  946. titleReg: "(.*)_(.*)_",
  947. contentRemove: "div[class]",
  948. contentReplace: "全.{0,2}本.{0,2}小.{0,2}说.{0,2}网.{0,2}|[wWw ]+.{1,10}[CccǒOmMМ ]+",
  949. },
  950. {siteName: "手牵手小说网",
  951. url: "^http://www\\.sqsxs\\.com/.*\\d+/\\d+/\\d+\\.html",
  952. bookTitleSelector: '#sitebar a:last',
  953. contentReplace: [
  954. "◆免费◆",
  955. "★百度搜索,免费阅读万本★|访问下载txt小说.百度搜.|免费电子书下载|\\(百度搜\\)|『文學吧x吧.』|¤本站网址:¤",
  956. "[☆★◆〓『【◎◇].*?(?:yunlaige|云 来 阁|yunlaige|免费看).*?[☆◆★〓』】◎◇]",
  957. "【手机小说阅读&nbsp;m.】",
  958. "BAIDU_CLB_fillSlot.*",
  959. "&nbsp;关闭</p>",
  960. "&nbsp;&nbsp;&nbsp;&nbsp;\\?",
  961. "\\[☆更.新.最.快☆无.弹.窗☆全.免.费\\]",
  962. '\\(.*?平南文学网\\)',
  963. '{首发}|【首发】',
  964. '=长=风',
  965. '-优-优-小-说-更-新-最-快-\\.',
  966. { "。\\.": "。" },
  967. ]
  968. },
  969. {siteName: "六月中文网,盗梦人小说网",
  970. url: "^http://www\\.(?:6yzw\\.org|6yzw\\.com|daomengren\\.com)/.*\\.html",
  971. bookTitleSelector: ".con_top>a:last",
  972. contentRemove: "a[href]",
  973. contentReplace: [
  974. "纯文字在线阅读本站域名 520xs.Com 手机同步阅读请访问 M.520xs.Com",
  975. "{飘天文学[\\s\\S]*您的支持就是我们最大的动力}",
  976. "((未完待续),|精彩推荐:,)?最新最快更新热门小说,享受无弹窗阅读就在:",
  977. "一秒记住【】,本站为您提供热门小说免费阅读。",
  978. "百度搜索 本书名.*",
  979. "欢迎您的光临,任何搜索引擎搜索.*给大家带来的不便深感抱歉!!",
  980. "\\(?&nbsp;&nbsp; ?提供』。如果您喜欢这部作品,欢迎您来创世中文网[\\s\\S]+",
  981. "[\\((]未完待续.{1,2}本文字由.*",
  982. "//添加开头|会员特权抢先体验",
  983. "更新最快|更新快纯文字|看最新章节|六月中文网|78小说|h﹒c﹒d|穿越小说吧 sj131|\\*五月中文网5.c om\\*",
  984. "\\d楼[\\d\\-: ]+(?:&nbsp;)+ \\|(?:&nbsp;)+|吧主\\d+(?:&nbsp;)+|支持威武,嘎嘎!",
  985. "www,|&nbsp;\\\\|“梦”(&nbsp;| )*“小”(&nbsp;| )*(“说” )?“网”|“岛”(&nbsp;| )+“说”",
  986. /(百度搜索 )?本书名 \+ 盗梦人 看最快更新/ig,
  987. "520xs.com ”520小说“小说章节更新最快",
  988. "本文由 …… 首发",
  989. "看最新最全小说|最快更新,(?:无弹窗)?阅读请。",
  990. "(首发)|【首发】",
  991. "纯文字在线阅读本站域名  手机同步阅读请访问",
  992. "&amp;nbsp",
  993. ]
  994. },
  995. {siteName: "飞卢小说网",
  996. url: "^http://b\\.faloo\\.com/p/\\d+/\\d+\\.html",
  997. titleSelector: "#title h1",
  998. bookTitleSelector: "div.nav > a:last",
  999. nextSelector: "a#next_page",
  1000. prevSelector: "a#pre_page",
  1001. indexSelector: "a#huimulu",
  1002. contentSelector: "#main > .main0",
  1003. contentRemove: "> *:not(#con_imginfo, #content)",
  1004. contentReplace: "飞卢小说网 b.faloo.com 欢迎广大书友光临阅读,最新、最快、最火的连载作品尽在飞卢小说网!",
  1005. contentPatch: function(fakeStub){
  1006. fakeStub.find("#content").find(".p_gonggao").remove();
  1007. // fakeStub.find("#con_imginfo").prependTo("#content");
  1008. }
  1009. },
  1010. {siteName: "顶点小说",
  1011. url: "^http://www\\.(?:23us|23wx|xs222)\\.com/html/\\d+/\\d+/\\d+\\.html$",
  1012. titleReg: "(.*?)-\\S*\\s(.*?)-顶点小说",
  1013. titlePos: 0,
  1014. indexSelector: "#footlink a:contains('返回目录')",
  1015. prevSelector: "#footlink a:contains('上一页')",
  1016. nextSelector: "#footlink a:contains('下一页')",
  1017. contentSelector: "#contents",
  1018. contentReplace: [
  1019. "\\(看小说到顶点小说网.*\\)|\\(\\)|【记住本站只需一秒钟.*】",
  1020. '一秒记住【.*读及下载。',
  1021. ],
  1022. contentPatch: function(fakeStub){
  1023. var temp=fakeStub.find('title').text();
  1024. var realtitle = temp.replace(/第.*卷\s/,'');
  1025. fakeStub.find('title').html(realtitle);
  1026. }
  1027. },
  1028. {siteName: '23中文',
  1029. url: '^http://www\\.23zw\\.com/.*\\.html',
  1030. contentReplace: [
  1031. '本文由首发',
  1032. '章节更新最快',
  1033. '顶点小说.23us.。',
  1034. '\\(顶点小说\\)',
  1035. '看最新最全',
  1036. '看.*?最新章节到长风文学',
  1037. 'R1152',
  1038. '手机看小说哪家强\\?手机阅读网',
  1039. ]
  1040. },
  1041. {siteName: '笔下阁',
  1042. url: "^http://www\\.bixiage\\.com/\\w+/\\d+/\\d+/\\d+\\.html",
  1043. titleReg: "(.*)最新章节免费在线阅读_(.*)_笔下阁",
  1044. indexSelector: ".read_tools a:contains('返回目录')",
  1045. prevSelector: ".read_tools a:contains('上一页')",
  1046. nextSelector: ".read_tools a:contains('下一页')",
  1047. contentReplace: [
  1048. "本书最新免费章节请访问|请记住本站的网址|请使用访问本站",
  1049. "看更新最快的.*www.bixiage.com",
  1050. "笔下阁为您提供全文字小说.*",
  1051. "如果你觉得笔下阁不错.*",
  1052. "本篇是小说.*章节内容,如果你发现内容错误.*"
  1053. ]
  1054. },
  1055. {siteName: '双德小说网',
  1056. url: "^http://www\\.shuangde\\.cc/.*\\.html",
  1057. bookTitleSelector: '.title > h2 > a',
  1058. contentRemove: '.title, div[align="center"]',
  1059. },
  1060. {siteName: '爱尚小说网',
  1061. url: 'http://www.a240.com/read/\\d+/\\d+.html',
  1062. titleReg: '(.*) - (.*?) - 爱尚小说网',
  1063. titlePos: 1,
  1064. contentRemove: '.bottem, center',
  1065. contentReplace: '<!--章节内容开始-->'
  1066. },
  1067. {siteName: 'E度文学网',
  1068. url: 'http://www.173ed.com/read/\\d+/\\d+.html',
  1069. contentRemove: 'a[href*="173e"]',
  1070. contentReplace: [
  1071. '全文字小说W.*?\\.com',
  1072. 'E度文学网更新最快',
  1073. 'www\\.♀173ed.com♀'
  1074. ]
  1075. },
  1076. {siteName: "3Z中文网",
  1077. url: "^http://www\\.zzzcn\\.com\\/(3z\\d+/\\d+\\/|modules\\/article\\/App\\.php\\?aid=\\d+&cid=\\d+){1}$",
  1078. // titleReg: "(.*?)-(.*)TXT下载",
  1079. contentSelector: "#content3zcn",
  1080. indexSelector: "a:contains('返回目录')",
  1081. prevSelector: "a:contains('上 一 页')",
  1082. nextSelector: "a:contains('下 一 页'), a:contains('返回书架')",
  1083. contentReplace: [
  1084. /[{(][a-z\/.]+(?:首发文字|更新超快)[})]/ig,
  1085. "手机小说站点(wap.zzzcn.com)",
  1086. "一秒记住.*为您提供精彩小说阅读。",
  1087. ],
  1088. contentPatch: function(fakeStub){
  1089. fakeStub.find("a:contains('返回书架')").html("下 一 页").attr("href", fakeStub.find("a:contains('返回目录')").attr("href"));
  1090. fakeStub.find("#content3zcn").find(".titlePos, font.tips, a").remove();
  1091. }
  1092. },
  1093. {siteName: "比奇中文网",
  1094. url: "http://www\\.biqi\\.me/files/article/html/\\d+/\\d+/\\d+\\.html",
  1095. titleSelector: "#lbChapterName",
  1096. bookTitleSelector: "#TOPNAV td:first > a:last",
  1097. contentReplace: [
  1098. "http://www.biqi.me比奇中文网永久网址,请牢记!",
  1099. "www.biqi.me比奇中文网一直在为提高阅读体验而努力,喜欢请与好友分享!",
  1100. "[{【]比奇中文网首发www.biqi.me[}】]",
  1101. ]
  1102. },
  1103. {siteName: "书哈哈小说网",
  1104. url: "http://(?:read|www)\\.shuhaha\\.com/Html/Book/\\d+/\\d+/\\d+\\.html",
  1105. titleSelector: "#htmltimu",
  1106. bookTitleSelector: [".srcbox > a:nth-child(2)", /目录$/],
  1107. contentSelector: "#BookText",
  1108. contentRemove: 'a[href*="www.shuhaha.com"]',
  1109. contentReplace: [
  1110. '‘‘', '’’',
  1111. '(\\.shuh&amp;n)',
  1112. /<p[^>]*>(&nbsp;){4}网<\/p>/gi
  1113. ]
  1114. },
  1115. {siteName: "SF 轻小说",
  1116. url: '^http://book.sfacg.com/Novel/\\d+/\\d+/\\d+/',
  1117. titleReg: '(.*?)-(.*?)-.*',
  1118. contentSelector: '#ChapterBody',
  1119. },
  1120. {siteName: "武林中文网",
  1121. url: '^http://www\\.50zw\\.com/book_\\d+/\\d+\\.html',
  1122. bookTitleSelector: '.srcbox > a:last',
  1123. contentReplace: [
  1124. '更新最快【】',
  1125. '&lt;/dd&gt;',
  1126. '&lt;center&gt; &lt;fon color=red&gt;'
  1127. ]
  1128. },
  1129. {siteName: "乡村小说网",
  1130. url: '^http://www\\.xiangcunxiaoshuo\\.com/shu/\\d+/\\d+\\.html',
  1131. // bookTitleSelector: '.read_m > .list',
  1132. titleReg: '(.*?)_(.*?)_.*_.*',
  1133. contentSelector: '.yd_text2',
  1134. contentReplace: [
  1135. '[wWw]+.23uS.(?:coM|com)',
  1136. '乡&amp;村&amp;.*?\\.co[mM]',
  1137. ]
  1138. },
  1139. {siteName: "杂书网",
  1140. url: "^http://www\\.zashu\\.net/books/\\d+/\\d+/\\d+\\.html",
  1141. contentReplace: [
  1142. "吋煜牝咱.*?杂书网(?:杠杠的)?",
  1143. "吋煜牝咱看书神器",
  1144. "(?:吋煜牝咱|飝现洅咱|茇阺畱匝).*?[Cc]om",
  1145. "吋煜牝咱",
  1146. "飝现洅咱", "殢萾嘎匝",
  1147. "看小说“杂书网zashu.net”",
  1148. "手机站:m.zashu.net 电脑站:www.zashu.net",
  1149. ]
  1150. },
  1151. {siteName: "小说巴士",
  1152. url: "^http://www\\.xs84\\.com/\\d+_\\d+/",
  1153. bookTitleSelector: ".con_top a:last",
  1154. contentReplace: [
  1155. "§推荐一个无广告的小说站.*? §",
  1156. "☆本站最快更新.*?☆",
  1157. "纯文字在线阅读.*?</br>",
  1158. "www.X S 8 4.com",
  1159. "《》 www.obr />",
  1160. "。。 w.2.obr",
  1161. "\\[w w w.x s.*?.c o m 小说.*?\\]",
  1162. "╂上.*?╂",
  1163. "\\*\\*顶\\*\\*点.{0,3}小说",
  1164. "___小.说.巴.士 www.xS84.com___",
  1165. ],
  1166. contentPatch: function() {
  1167. $('<script>')
  1168. .text('clearInterval(show);')
  1169. .appendTo('body')
  1170. .remove();
  1171. }
  1172. },
  1173. {siteName: "123言情",
  1174. url: 'http://www\\.123yq\\.com/read/\\d+/\\d+/\\d+\\.shtml',
  1175. bookTitleSelector: '.con_top > a:last',
  1176. contentSelector: "#TXT",
  1177. contentRemove: '.bottem, .red',
  1178. },
  1179. {siteName: "热门小说网",
  1180. url: 'http://www.remenxs.com/du_\\d+/\\d+/',
  1181. bookTitleSelector: 'section.readhead > div.read_t > div.lf > a:nth-child(2)',
  1182. contentSelector: ".yd_text2",
  1183. contentRemove: '.adrs, .con_w, a',
  1184. contentReplace: [
  1185. '您可以在百度里搜索“.*',
  1186. '为了方便下次阅读,你可以点击下方的.*'
  1187. ]
  1188. },
  1189.  
  1190. // === 内容补丁
  1191. {siteName: "给力文学小说阅读网",
  1192. url: "^http://www\\.geiliwx\\.com/.*\\.shtml",
  1193. titleReg: "-?(.*)_(.*)最新章节_给力",
  1194. titlePos: 1,
  1195. contentRemove: 'h1, font[color], center',
  1196. contentReplace: [
  1197. "网站升级完毕!感谢对给力文学网的支持!",
  1198. "(百度搜索给力文学网更新最快最稳定\\)",
  1199. "【sogou,360,soso搜免费下载小说】",
  1200. "\\[乐\\]\\[读\\]小说.23.[Cc]m",
  1201. "给力文学网",
  1202. "看最快更新",
  1203. "小说网不跳字",
  1204. "\\.com",
  1205. "BAIDU_CLB_fillSlot\\(.*",
  1206. "--小-说-www-23wx-com",
  1207. "&nbsp;&nbsp;,请",
  1208. ],
  1209. contentPatch: function(d) {
  1210. if (!d.find('#content').length) {
  1211. var html = d.find('body').html();
  1212. var content = html.match(/<!--go-->([\s\S]*?)<!--over-->/i)[1];
  1213.  
  1214. content = $('<div id="content">').html(content);
  1215. if (content.find('#adright').size()) {
  1216. content = content.find('#adright');
  1217. }
  1218. content.appendTo(d.find('body'));
  1219. }
  1220. }
  1221. },
  1222.  
  1223. // ================== 采用 iframe 方式获取的 ====================
  1224. {siteName: "16K小说网",
  1225. url: "^http://www\\.16kbook\\.org/Html/Book/\\d+/\\d+/\\d+\\.shtml$",
  1226. titleReg: '(\\S+) (.*)- 16K小说网',
  1227. useiframe: true,
  1228. contentRemove: '.bdlikebutton',
  1229. contentReplace: {
  1230. '(<center>)?<?img src..(http://www.16kbook.org)?(/tu/\\S+\\.jpg).(>| alt."\\d+_\\d+_\\d*\\.jpg" />)(</center>)?': "$3",
  1231. "/tu/shijie.jpg":"世界", "/tu/xiangdao.jpg":"想到", "/tu/danshi.jpg":"但是", "/tu/huilai.jpg":"回来", "/tu/yijing.jpg":"已经", "/tu/zhende.jpg":"真的", "/tu/liliang.jpg":"力量", "/tu/le.jpg":"了", "/tu/da.jpg":"大", "/tu/shengli.jpg":"胜利", "/tu/xiwang.jpg":"希望", "/tu/wandan.jpg":"完蛋", "/tu/de.jpg":"的",
  1232. "16kbook\\s*(首发更新|小说网)": "",
  1233. }
  1234. },
  1235. {siteName: "读读看",
  1236. url: "^http://www\\.dudukan\\.net/html/.*\\.html$",
  1237. contentReplace: "看小说“就爱读书”|binhuo|www\\.92to\\.com",
  1238. useiframe: true,
  1239. mutationSelector: "#main",
  1240. mutationChildCount: 0,
  1241. },
  1242. {siteName: "读零零",
  1243. url: "http://www\\.du00\\.(?:com|cc)/read/\\d+/\\d+/[\\d_]+\\.html",
  1244. titleReg: "(.*?)(?:第\\d+段)?,(.*) - 读零零小说网",
  1245. titlePos: 1,
  1246. // prevSelector: "#footlink a:first",
  1247. // indexSelector: "#footlink a:contains('目录')",
  1248. // nextSelector: "#footlink a:last",
  1249. // 内容
  1250. contentSelector: "#pagecontent, .divimage",
  1251. // useiframe: true,
  1252. // mutationSelector: "#pagecontent",
  1253. // mutationChildCount: 2,
  1254. contentRemove: "font",
  1255. contentReplace: [
  1256. "读零零小说网欢迎您的光临.*?txt格式下载服务",
  1257. ",好看的小说:|本书最新免费章节请访问。",
  1258. "\\*文學馆\\*",
  1259. "\\(未完待续请搜索,小说更好更新更快!",
  1260. "www\\.DU00\\.com",
  1261. ],
  1262. checkSection: true
  1263. },
  1264. {siteName: "78小说网",
  1265. url: "^http://www\\.78xs\\.com/article/\\d+/\\d+/\\d+.shtml$",
  1266. contentHandle: false,
  1267. titleReg: "(.*?) (?:正文 )?(.*) 78小说网",
  1268. indexSelector: "a:contains('目 录')",
  1269. prevSelector: "a:contains('上一章')",
  1270. nextSelector: "a:contains('下一章')",
  1271. contentSelector: "#content",
  1272. useiframe: true,
  1273. contentReplace: [
  1274. "//.*?78xs.*?//",
  1275. "\\(全文字小说更新最快\\)",
  1276. ],
  1277. contentPatch: function(fakeStub){
  1278. fakeStub.find('p.title').empty(); // 去掉内容中带的章节标题
  1279. }
  1280. },
  1281. {siteName: "151看书网",
  1282. url: "^http://www\\.151kan\\.com/kan/.*\\.html",
  1283. contentSelector: "#msg",
  1284. useiframe: true,
  1285. mutationSelector: "#msg",
  1286. contentReplace: [
  1287. /[\/|]?www\.151(?:看|kan)\.com[\/|]?/ig,
  1288. /151看书网(?:纯文字)?/ig,
  1289. ]
  1290. },
  1291. {siteName: "就爱读书",
  1292. url: "^http://www\\.92to\\.com/\\w+/\\w+/\\d+\\.html$",
  1293. titleReg: "(.*?)-(.*?)-",
  1294. useiframe: true,
  1295. timeout: 500,
  1296. contentReplace: "看小说.就爱.*"
  1297. },
  1298. {siteName: "书书网",
  1299. url: "http://www\\.shushuw\\.cn/shu/\\d+/\\d+\\.html",
  1300. titleReg: "(.*) (.*?) 书书网",
  1301. titlePos: 1,
  1302. useiframe: true,
  1303. timeout: 500,
  1304. contentReplace: "!~![\\s\\S]*"
  1305. },
  1306. {siteName: "找小说网",
  1307. url: "http://www\\.zhaoxiaoshuo\\.com/chapter-\\d+-\\d+-\\w+/",
  1308. titleReg: "(.*) - (.*) - 找小说网",
  1309. titlePos: 1,
  1310. useiframe: true,
  1311. timeout: 500,
  1312. contentRemove: "div[style]"
  1313. },
  1314. {siteName: "ABC小说网",
  1315. url: "^http://www\\.bookabc\\.net/.*\\.html",
  1316. useiframe: true
  1317. },
  1318.  
  1319. // ============== 内容需要2次获取的 =========================
  1320. {siteName: "手打吧",
  1321. url: /^http:\/\/shouda8\.com\/\w+\/\d+\.html/,
  1322. contentReplace: /[w\s\[\/\\\(]*.shouda8.com.*|(\/\/)?[全文字]?首发|手打吧|www.shou.*|\(w\/w\/w.shouda8.c\/o\/m 手、打。吧更新超快\)|小说 阅读网 www.xiaoshuoyd .com/ig,
  1323. contentPatch: function(fakeStub){
  1324. var scriptSrc = fakeStub.find('body').html().match(/outputContent\('(.*txt)'\)/)[1];
  1325. scriptSrc = "http://shouda8.com/ajax.php?f=http://shouda8.com/read" + scriptSrc;
  1326. fakeStub.find('#content').attr({
  1327. "class": 'reader-ajax',
  1328. src: scriptSrc
  1329. });
  1330. }
  1331. },
  1332. {siteName: "哈哈文学",
  1333. url: /^http:\/\/www\.hahawx\.com\/.*htm/,
  1334. titleReg: /(.*?)-(.*?)-.*/,
  1335. contentSelector: "#chapter_content",
  1336. contentReplace: /(?:好书推荐|书友在看|其他书友正在看|好看的小说|推荐阅读):。|(?:www|www|book).*(?:com|net|org|com|net)|全文字阅读|无弹窗广告小说网|哈哈文学\(www.hahawx.com\)|souDU.org|Soudu.org|jīng彩推荐:/ig,
  1337. contentPatch: function(fakeStub){
  1338. var $content = fakeStub.find("#chapter_content");
  1339. var m = $content.find("script").text().match(/output\((\d+), "(\d+\.txt)"\);/);
  1340. if(m && m.length == 3){
  1341. var aid = m[1],
  1342. files = m[2];
  1343. var subDir = "/" + (Math.floor(aid / 1000) + 1),
  1344. subDir2 = "/" + (aid - Math.floor(aid / 1000) * 1000);
  1345. $content.attr({
  1346. class: "reader-ajax",
  1347. src: "http://r.xsjob.net/novel" + subDir + subDir2 + "/" + files,
  1348. charset: "gbk"
  1349. });
  1350. }
  1351. }
  1352. },
  1353. {siteName: "天天中文",
  1354. url: "http://www\\.ttzw\\.com/book/\\d+/\\d+\\.html",
  1355. titleSelector: "#chapter_title",
  1356. bookTitleSelector: ".fl.pl20 a:last",
  1357. contentSelector: "#text_area",
  1358. contentReplace: /www.ttzw.com|www.c66c.com|手机用户请到阅读。|<p>\s*a<\/p>/ig,
  1359. contentPatch: function(fakeStub) {
  1360. var m = fakeStub.find('#text_area script').text().match(/outputTxt\("(.*)"\);/);
  1361. if (m) {
  1362. fakeStub.find('#text_area').attr({
  1363. class: "reader-ajax",
  1364. src: unsafeWindow.getServer() + m[1],
  1365. charset: "gbk"
  1366. });
  1367. }
  1368. }
  1369. },
  1370.  
  1371. // ===========================================================
  1372. {siteName: "好看小說網",
  1373. url: "http://tw\\.xiaoshuokan\\.com/haokan/\\d+/\\d+\\.html",
  1374. contentSelector: ".bookcontent",
  1375. prevSelector: "a.redbutt:contains('上一頁')",
  1376. indexSelector: "a.redbutt:contains('返回章節目錄')",
  1377. nextSelector: "a.redbutt:contains('下一頁')",
  1378. contentReplace: "[a-z;&]*w.[xx]iaoshuokan.com 好看小說網[a-z;&族】)]*"
  1379. },
  1380. {siteName: "E品中文网",
  1381. url: "http://www\\.epzww\\.com/book/\\d+/\\d+",
  1382. titleReg: "(.*?),(.*?),",
  1383. contentSelector: "#showcontent",
  1384. },
  1385. {siteName: "飘天文学",
  1386. url: "http://www\\.piaotian\\.net/html/\\d+/\\d+/\\d+\\.html",
  1387. // titleReg: "(.*)最新章节,(.*),飘天文学",
  1388. bookTitleSelector: '#content > h1 > a',
  1389. contentSelector: "#content",
  1390. useiframe: true, // 否则 content 在 body 下面
  1391. contentRemove: "h1, table, .toplink",
  1392. contentReplace: [
  1393. /[{〖]请在百度搜索.*[}〗]|.(?:百度搜索飄天|无弹窗小说网).*\.Net.|\[飄天.*无弹窗小说网\]/ig,
  1394. '\\{飘天文学www.piaotian.net感谢各位书友的支持,您的支持就是我们最大的动力\\}',
  1395. '章节更新最快',
  1396. '支持网站发展,逛淘宝买东西.*'
  1397. ],
  1398. },
  1399. {siteName: "天使小说网",
  1400. url: "http://www\\.tsxs\\.cc/files/article/html/\\d+/\\d+/\\d+\\.html",
  1401. contentSelector: "#content"
  1402. },
  1403. {siteName: "紫雨阁小说网",
  1404. url: "http://www\\.ziyuge\\.com/\\w+/\\w+/\\d+/\\d+/\\d+\\.html",
  1405. titleReg: "(.*?)-正文-(.*?)-紫雨阁小说网",
  1406. contentSelector: ".reader_content",
  1407. nextSelector: "#divNext a",
  1408. prevSelector: "#divPrev a",
  1409. contentReplace: "\\(.*www.ziyuge.com.*\\)"
  1410. },
  1411. {siteName: "破风中文网",
  1412. url: "http://www\\.pofeng\\.net/xiaoshuo/\\d+/\\d+\\.html",
  1413. useiframe: true
  1414. },
  1415. {siteName: "读客吧",
  1416. url: "http://dukeba\\.com/book/\\d+/\\d+/\\d+\\.shtml",
  1417. useiframe: true,
  1418. contentSelector: "#content > div[style]",
  1419. contentRemove: "a, div[align]:has(font)",
  1420. },
  1421. {siteName: "一起阅",
  1422. url: "http://www\\.17yue\\.com/\\w+/\\d+/\\d+\\.html",
  1423. useiframe: true,
  1424. },
  1425. {siteName: "诺秋网",
  1426. url: "http://www\\.nuoqiu\\.com/static/\\d+/\\d+\\.html",
  1427. titleReg: "(.*) (.*) 诺秋网",
  1428. titlePos: 1,
  1429. useiframe: true,
  1430. contentReplace: "┏━━━━━━━━━━━━━━━━━━━━━━━━━┓[\\s\\S]+诺秋网文字更新最快……】@!!"
  1431. },
  1432. {siteName: "言情后花园",
  1433. url: "http://www\\.yqhhy\\.cc/\\d+/\\d+/\\d+\\.html",
  1434. titleReg: "(.*)-(.*)-.*-言情后花园",
  1435. titlePos: 1,
  1436. contentSelector: "#content",
  1437. contentRemove: "a, span[style], script",
  1438. contentReplace: "请记住本站: www.yqhhy.cc|更多,尽在言情后花园。"
  1439. },
  1440. {siteName: "六九中文",
  1441. url: "http://www.(?:69zw|kan7).com/\\w+/\\d+/\\d+/\\d+.html",
  1442. titleSelector: ".chapter_title",
  1443. bookTitleSelector: ".readhead h1",
  1444. contentSelector: ".yd_text2",
  1445. // titleReg: "(.*)?_(.*)-六九中文",
  1446. contentReplace: [
  1447. "[\\*]+本章节来源六九中文.*请到六九中文阅读最新章节[\\*]+|-\\\\[wW]+.*书友上传/-",
  1448. "\\\\请到 www.69zw.com 六\\*九.*?/",
  1449. "【 注册会员可获私人书架,看书更方便!:】",
  1450. "首发<br />",
  1451. ]
  1452. },
  1453. {siteName: "免费小说阅读网",
  1454. titleReg: "(.*) , (.*) , 免费小说阅读网",
  1455. titlePos: 1,
  1456. url: "^http://book\\.yayacms\\.com/\\w+/book_\\d+_\\d+.html",
  1457. contentRemove: "a, div[style]",
  1458. contentReplace: "http://book.YaYaCMS.com/.*|book.yayacms.com",
  1459. },
  1460. {siteName: "书农在线书库",
  1461. url: "http://www\\.shunong\\.com/yuedu/\\d+/\\d+/\\d+.html",
  1462. contentSelector: ".bookcontent",
  1463. },
  1464. {siteName: "努努书坊",
  1465. url: "http://(?:book\\.kanunu\\.org|www\\.kanunu8\\.com)/.*/\\d+\\.html",
  1466. titleReg: /(.*) - (.*) - 小说在线阅读 - .* - 努努书坊/,
  1467. titlePos: 1,
  1468. contentSelector: "table:eq(4) p",
  1469. indexSelector: "a[href^='./']",
  1470. },
  1471. {siteName: "五月中文网",
  1472. url: "^http://5ycn\\.com/\\d+/\\d+/\\d+\\.html",
  1473. contentRemove: "div[align='center'], a",
  1474. },
  1475. {siteName: "笔下中文",
  1476. url: "^http://www\\.bxzw\\.org/\\w+/\\d+/\\d+/\\d+\\.shtml",
  1477. contentRemove: "div[align='center'], center, #footlink1",
  1478. contentReplace: "www\\.bxzw\\.org|//无弹窗更新快//|\\(看精品小说请上.*\\)|\\(看.*最新更新章节.*\\)"
  1479. },
  1480. {siteName: "着笔中文网",
  1481. url: "^http://.*zbzw\\.com/\\w+/\\d+\\.html",
  1482. contentReplace: "精彩小说尽在.*"
  1483. },
  1484. {siteName: "D586小说网",
  1485. url: 'http://www\\.d586\\.com/',
  1486. contentSelector: ".yd_text2",
  1487. contentRemove: 'a',
  1488. contentReplace: [
  1489. '【www.13800100.com文字首发D586小说网】',
  1490. '【☆D586小说网☆//文字首发】.*'
  1491. ]
  1492. },
  1493. {siteName: "豌豆文学网",
  1494. url: "^http://www.wandoou.com/book/\\d+/\\d+\\.html",
  1495. titleReg: '(.*?)最新章节-(.*)-.*无弹窗广告_豌豆文学网',
  1496. contentRemove: "center",
  1497. contentReplace: [
  1498. /[{(]<a href.*[})]|网欢迎广大书友光临阅读,.*/ig,
  1499. /[レ★]+.*(?:请支持)?豌(?:.|&amp;)?豆.?文.?学.*[レ★]+/ig,
  1500. /[((【]豌.?豆.?文.?学.*[))】]/ig,
  1501. /∷更新快∷∷纯文字∷|http:永久网址,请牢记!/ig,
  1502. /(?:{|\\|\/|\()*豌.?豆.?文.?学.?网.*?(?:高速更新|\\\/|})+/ig,
  1503. /更新最快最稳定|看小说“”/ig,
  1504. /&lt;strng&gt;.*?&lt;\/strng&gt;/ig,
  1505. /\(凤舞文学网\)|\( *\)|「启航文字」|79阅.读.网/ig,
  1506. /高速首发.*?本章节是.*/ig,
  1507. /百度搜索自从知道用百度搜索,妈妈再也不用担心我追不到最快更新了/ig,
  1508. ]
  1509. },
  1510. {siteName: "都来读小说网",
  1511. url: /^http:\/\/www\.doulaidu\.com\/[^\/]+\/\d+\/\d+\.html/,
  1512. useiframe: true,
  1513. contentReplace: [
  1514. /www..+.(?:com|net)/ig,
  1515. /都来读小说网首发|www\.[a-z0-9]+\.(?:org|com)/ig,
  1516. ]
  1517. },
  1518. {siteName: "小说TXT",
  1519. url: /^http:\/\/www\.xshuotxt\.com\//,
  1520. contentReplace: "\\(.*无弹窗全文阅读\\)",
  1521. contentPatch: function(fakeStub) {
  1522. fakeStub.find('#title a').remove();
  1523. }
  1524. },
  1525. {siteName: "疯狂中文网",
  1526. url: "http://www\\.fkzww\\.com/",
  1527. contentRemove: ".bottem, a[href='http://www.fkzww.com']",
  1528. contentReplace: [
  1529. /收藏【.*?疯狂中文网\)/ig,
  1530. ]
  1531. },
  1532. {siteName: "吾读小说网",
  1533. url: "http://www\\.5du5\\.com/book/.*\\.html",
  1534. contentReplace: '\\(吾读小说网 <a.*无弹窗全文阅读\\)'
  1535. },
  1536. {siteName: "UU看书",
  1537. url: "http://www\\.uukanshu\\.com/.*/\\d+/\\d+.html",
  1538. contentReplace: "[UU]*看书[(\\(].*?[)\\)]文字首发。"
  1539. },
  1540. {siteName: "长风文学网",
  1541. url: "http://www\\.cfwx\\.net/files/article/html/\\d+/\\d+/\\d+\\.html",
  1542. titleSelector: '.title',
  1543. bookTitleSelector: '.linkleft > a:last',
  1544. contentReplace: [
  1545.  
  1546. ]
  1547. },
  1548. {siteName: "云来阁",
  1549. url: "http://www\\.yunlaige\\.com/html/\\d+/\\d+/\\d+\\.html",
  1550. titleSelector: '.ctitle',
  1551. bookTitleSelector: '#hlBookName',
  1552. contentSelector: '#content',
  1553. contentRemove: '.bottomlink, a',
  1554. contentReplace: [
  1555. '[☆★◆〓『【◎◇].*?(?:yunlaige|云 来 阁|yunlaige).*?[☆◆★〓』】◎◇]',
  1556. '《更新最快小说网站:雲来阁http://WWW.YunLaiGe.COM》',
  1557. '◢百度搜索雲来阁,最新最快的小说更新◣',
  1558. '【當你閱讀到此章節,請您移步到雲來閣閱讀最新章節,或者,雲來閣】',
  1559. '【最新更新】',
  1560. '值得您收藏。。',
  1561. '小说“小说章节',
  1562. '纯文字在线阅读本站域名',
  1563. '手机同步阅读请访问',
  1564. '\\(云来阁小说文学网www.yunlaige.com\\)',
  1565. '【本书作者推荐:(?:百度搜索)?云来閣,免费观看本书最快的VIP章节】',
  1566. '±顶±点±小±说,ww',
  1567. '■dingddian小说,ww∨23w→■m',
  1568. 'w∨23w',
  1569. 'www23wxcom',
  1570. '¥℉頂¥℉点¥℉小¥℉',
  1571. '£∝頂£∝点£∝小£∝'
  1572. ]
  1573. },
  1574. {siteName: "乐文小说网",
  1575. url: /http:\/\/www\.lwxs520\.com\/books\/\d+\/\d+\/\d+.html/,
  1576. siteExample: 'http://www.lwxs520.com/books/2/2329/473426.html',
  1577. contentRemove: '#content>:not(p)',
  1578. contentReplace: [
  1579. '喜欢乐文小说网就上www.*(?:COM|com)',
  1580. '爱玩爱看就来乐文小说网.*',
  1581. '\\(LWXS520。\\)',
  1582. 'M.LWxS520.com&nbsp;乐文移动网',
  1583. /\(未完待续.+/g,
  1584. /乐文小说网值得.+/g,
  1585. '\\(\\)',
  1586. 'www.LWXS520.com',
  1587. ]
  1588. },
  1589. {siteName: '我爱小说',
  1590. url: '^http://www\\.woaixiaoshuo\\.com/xiaoshuo/\\d+/\\d+/\\d+\\.html',
  1591. bookTitleSelector: '#lbox > b',
  1592. contentSelector: '#readbox',
  1593. contentRemove: '#papgbutton, #content',
  1594. },
  1595. {siteName: "米花在线书库",
  1596. url: /book\.mihua\.net\/\w+\/\d+\/\d+\/.+\.html/,
  1597. titleSelector: "#title",
  1598. contentSelector: "#viewbook"
  1599. },
  1600. {siteName: "58小说网",
  1601. url: /^http:\/\/(www|book)\.(58)?58xs\.com\/html\/\d+\/\d+\/\d+\.html/,
  1602. titleSelector: "h1",
  1603. indexSelector: "#footlink > a:eq(1)",
  1604. prevSelector: "#footlink > a:eq(0)",
  1605. nextSelector: "#footlink > a:eq(2)",
  1606. contentSelector: "#content",
  1607. contentRemove: ".f1, .c1"
  1608. },
  1609. {siteName: "天天美文网",
  1610. url: /www\.365essay\.com\/\w+\/.+.htm/,
  1611. titleSelector: ".title > h1",
  1612. contentSelector: "#zoomc td",
  1613. contentRemove: ".page-bottomc"
  1614. },
  1615. {siteName: "天涯武库",
  1616. url: /wx\.ty2016\.com\/.+\.html$/,
  1617. bookTitleSelector: "td[width='800'][height='25']>a[href='./']",
  1618. titleSelector: "strong>font",
  1619. indexSelector: "td a[href='./']",
  1620. nextSelector: "td[width='28%'] a",
  1621.  
  1622. contentSelector: "td[width='760'] p",
  1623. contentHandle: false,
  1624. },
  1625. {siteName: "黄金屋中文网",
  1626. url: /www\.hjwzw\.com\/Book\/Read\/\d+,\d+$/,
  1627. titleSelector: "h1",
  1628. indexSelector: "td a[href='./']",
  1629. contentSelector: "#AllySite+div",
  1630. contentRemove: "b, b+p"
  1631. },
  1632. {siteName: "梦远书城",
  1633. url: /www\.my285\.com(?:\/\w+){3,5}\/\d+\.htm$/,
  1634. useiframe: true,
  1635. contentSelector: "table:eq(2) tr:eq(3)",
  1636. },
  1637. {siteName: "更新吧",
  1638. url: "^http://www\\.gengxin8\\.com/read/\\d+/\\d+.html$",
  1639. bookTitleSelector: '.left a:last',
  1640. contentSelector: "#chaptertxt",
  1641. useiframe: true,
  1642. },
  1643. {siteName: "乐文小说网",
  1644. url: "http://www\\.365xs\\.org/books/\\d+/\\d+/\\d+\\.html",
  1645. titleSelector: ".kfyd h1",
  1646. bookTitleSelector: "ul.bread-crumbs a:last",
  1647. contentSelector: "#content",
  1648. // contentReplace: []
  1649. },
  1650. {siteName: "舞若小说网",
  1651. url: "http://www\\.wuruo\\.com/files/article/html/\\d+/\\d+/\\d+\\.html",
  1652. bookTitleSelector: ".text a:eq(1)",
  1653. contentSelector: "#zhengwen",
  1654. contentReplace: [
  1655. '【更多精彩小说请访问www.wuruo.com】',
  1656. '(www.wuruo.com舞若小说网首发)',
  1657. '【舞若小说网首发】',
  1658. ]
  1659. },
  1660. {siteName: "大书包小说网",
  1661. url: "http://www\\.dashubao\\.com/book/\\d+/\\d+/\\d+\\.html",
  1662. bookTitleSelector: ".read_t > .lf > a:nth-child(3)",
  1663. contentSelector: ".yd_text2",
  1664. contentReplace: [
  1665. ]
  1666. },
  1667. {siteName: "爬书网",
  1668. url: "http://www\\.pashuw\\.com/BookReader/\\d+-\\d+/\\d+\\.html",
  1669. bookTitleSelector: "#paihangbang_select > a:last()",
  1670. nextSelector: "#next2 a",
  1671. prevSelector: "#prev2 a",
  1672. indexSelector: "#fhml2 a",
  1673. contentRemove: '.novel_bot',
  1674. },
  1675. {siteName: "闪文书库",
  1676. url: "http://read\\.shanwen\\.com/html/\\d+/\\d+/\\d+\\.html",
  1677. titleSelector: '.newstitle',
  1678. contentRemove: '#titlebottom',
  1679. contentReplace: [
  1680. '闪文网址中的.*?注册会员</a>'
  1681. ]
  1682. },
  1683. {siteName: "品书网",
  1684. url: "http://www\\.vodtw\\.com/Html/Book/\\d+/\\d+/\\d+\\.html",
  1685. bookTitleSelector: '.srcbox > a:last()',
  1686. contentRemove: 'a',
  1687. contentReplace: [
  1688. '品书网 www.voDtw.com◇↓',
  1689. '品书网 www.vodtW.com',
  1690. '品 书 网 (w W W . V o Dtw . c o M)',
  1691. '复制网址访问\\s*http://[%\\d\\w]+'
  1692. ]
  1693. },
  1694. {siteName: "凤凰小说网",
  1695. url: "http://www\\.fhxs\\.com/read/\\d+/\\d+/\\d+\\.shtml",
  1696. bookTitleSelector: '.con_top > a:last()',
  1697. contentRemove: '.bottem',
  1698. contentReplace: [
  1699. ]
  1700. },
  1701. {siteName: "小说巴士",
  1702. url: "http://www\\.xsbashi\\.com/\\d+_\\d+/",
  1703. contentReplace: [
  1704. '全文阅读如您已阅读到此章[節节].*?,,,,',
  1705. '看小说首发推荐去眼快看书',
  1706. '最快更新,阅读请。___小/说/巴/士 Www.XSBASHI.coM___',
  1707. '___小/说/巴/士 www.XSBASHI.com___',
  1708. 'lala如您已阅读到此章節,請移步到.*?速记方法:,\\]',
  1709. 'lala如您已阅读到此章節.*?敬請記住我們新的網址筆-趣-閣',
  1710. '起舞电子书访问:. 。',
  1711. '≧哈,m\\.',
  1712. '\\[\\s*超多好看\\]',
  1713. '热门【首发】',
  1714. ]
  1715. },
  1716.  
  1717. // ===== 特殊的获取下一页链接
  1718. {siteName: "看书啦",
  1719. url: "^http://www.kanshu.la/book/\\w+/\\d+\\.shtml",
  1720. titleReg: "(.*)-(.*)-看书啦",
  1721. titlePos: 1,
  1722. nextUrl: function($doc){
  1723. var html = $doc.find('script:contains(next_page = ")').html();
  1724. var m = html.match(/next_page = "(.*?)";/);
  1725. if (m) return m[1];
  1726. },
  1727. prevUrl: function($doc){
  1728. var html = $doc.find('script:contains(preview_page = ")').html();
  1729. var m = html.match(/preview_page = "(.*?)";/);
  1730. if (m) return m[1];
  1731. }
  1732. },
  1733. {siteName: "书阁网",
  1734. url: "^http://www\\.bookgew\\.com/Html/Book/\\d+/\\d+/\\d+\\.htm",
  1735. titleReg: "(.*)-(.*?)-书阁网",
  1736. titlePos: 1,
  1737. // titleSelector: ".newstitle",
  1738. nextUrl: function($doc){
  1739. var html = $doc.find('script:contains(nextpage=)').html();
  1740. var m = html.match(/nextpage="(.*?)";/);
  1741. if (m) return m[1];
  1742. },
  1743. prevUrl: function($doc) {
  1744. var html = $doc.find('script:contains(prevpage=)').html();
  1745. var m = html.match(/prevpage="(.*?)";/);
  1746. if (m) return m[1];
  1747. }
  1748. },
  1749.  
  1750. // {siteName: "雅文言情小说吧", // 一章分段
  1751. // url: "http://www\\.yawen8\\.com/\\w+/\\d+/\\d+\\.html",
  1752. // contentSelector: "#content .txtc"
  1753. // }
  1754.  
  1755. {siteName:'妙笔阁',
  1756. url:/^http:\/\/www\.miaobige\.com\/.*\.html/i,
  1757. siteExample:'http://www.miaobige.com/book/5_1586/1006320.html',
  1758. // 有的会提示防采集章节
  1759. fInit: function () {
  1760. $('<script>')
  1761. .text('$(document).unbind("contextmenu selectstart")')
  1762. .appendTo(document.body);
  1763. },
  1764. contentReplace: '妙笔阁,无弹窗,更新快,记住www.miaobige.com',
  1765. contentPatch: function(fakeStub){
  1766. var txt = fakeStub.find('#content'),
  1767. mNewLink;
  1768.  
  1769. if (0 === txt.text().trim().indexOf('防采集章节,')) {
  1770. mNewLink = txt.html().match(/http:\/\/www\.miaobige\.com\/book\/(\d)_(\d+)\/(\d+)\.html/i);
  1771. if (mNewLink) {
  1772. txt .addClass(READER_AJAX)
  1773. .attr({
  1774. src: '/js/ajaxtxt.asp',
  1775. charset: 'gbk'
  1776. })
  1777. .data('post', {
  1778. sid: mNewLink[2],
  1779. zid: mNewLink[3],
  1780. cid: mNewLink[1]
  1781. })
  1782. .text('请等待加载…');
  1783. }
  1784. }
  1785. }
  1786. },
  1787.  
  1788. ];
  1789.  
  1790. // ===== 小说拼音字、屏蔽字修复 =====
  1791. // 运行在未替换 <br> 之前,.* 可能会造成全部替换
  1792. Rule.replace = {
  1793. // ===格式整理===
  1794. // "\\(|\\[|\\{|(|【|{":"(",
  1795. // "\\)|\\]|\\}|)|】|}":")",
  1796.  
  1797. // 需要?
  1798. ",": ",",
  1799. // ":": ":", "\\?":"?", // 会造成起点的图片无法替换
  1800.  
  1801. "\\*|*":"*",
  1802. "[wWwW]{3}":"www",
  1803. "w{3}(\u3001|\u3002)":"www.",
  1804. "[cCcC][oOoO][mMmM]":"com",
  1805. "[nNnN][eeEE][ttTT]":"net",
  1806. "[cCcC][nNnN]":"cn",
  1807. "(\\.|\u3001|\u3002)com":".com",
  1808. "(\\.|\u3001|\u3002)net":".net",
  1809. "(\\.|\u3001|\u3002)cn":".cn",
  1810. "[pPpP][sSsS][::]":"ps:",
  1811. "。{5,7}":"……","~{2,50}":"——","…{3,40}": "……","-{3,20}":"——",
  1812. //"。(,|,|。)": "。",
  1813. // "?(,|,)": "?",
  1814. //"”(,|,|。)": "”",
  1815. "@{3,}": "",
  1816.  
  1817. // === 一些特殊的替换 ===
  1818. "\\[+CP.*(http://file.*\\.jpg)\\]+": "<img src='$1'>",
  1819. "『(.)』": "$1", // "『色』": "色",
  1820.  
  1821. // === 去广告 ===
  1822. "\\[搜索最新更新尽在[a-z\\.]+\\]": "",
  1823. "<a>手机用户请到m.qidian.com阅读。</a>": "",
  1824. ".{2,4}中文网欢迎广大书友": "",
  1825. "访问下载txt小说|◎雲來閣免费万本m.yunlaige.com◎":"",
  1826. "〖∷更新快∷无弹窗∷纯文字∷.*?〗": "",
  1827. "本文由 。。 首发":"",
  1828. '”小说“小说章节更新最快': '',
  1829. '如果觉得好看,请把本站网址推荐给您的朋友吧!': '',
  1830. '本站手机网址:&nbsp;&nbsp;请互相通知向您QQ群【微博/微信】论坛贴吧推荐宣传介绍!': '',
  1831. "fqXSw\\.com":"", "\\.5du|\\.5du5\\.":"",
  1832. "\\[\\]":"",
  1833. "如果您觉得网不错就多多分享本站谢谢各位读者的支持": "",
  1834. "全文字无广告|\\(看书窝&nbsp;看书窝&nbsp;无弹窗全文阅读\\)": "",
  1835. "。。+[\\s ]*看最新最全小说": "",
  1836. "水印广告测试": "",
  1837. "\\(平南文学网\\)":"", "讀蕶蕶尐說網":"",
  1838. "比奇提示:如何快速搜自己要找的书籍":"", "《百度书名\\+比奇》即可快速直达":"",
  1839. "~无~错~小~说": "",
  1840.  
  1841. "\\(一秒记住小说界\\)|\\*一秒记住\\*":"",
  1842. "uutxt\\.org|3vbook\\.cn|www\\.qbwx\\.com|WWw\\.YaNkuai\\.com|www\\.btzw\\.com|www\\.23uS\\.com": "",
  1843. "txt53712/": "",
  1844. "\xa0{4,12}":"\xa0\xa0\xa0\xa0\xa0\xa0\xa0",
  1845.  
  1846. // === 通用去广告
  1847. "[wwW]{1,3}[.\\.]23uS[.\\.](?:coM|com)": "",
  1848.  
  1849. // === 星号屏蔽字还原 ===
  1850. "十有(\\*{2})":"十有八九","十有bā'九":"十有八九", "\\*{2}不离十":"八九不离十",
  1851. "G(\\*{2})":"GSM", "感(\\*{2})彩":"感情色彩",
  1852. "强(\\*{2})u5B9D":"强大法宝",
  1853. "(\\*{2})凡胎": "肉体凡胎",
  1854.  
  1855. // === 多字替换 ===
  1856. "cao之过急":"操之过急", "chunguang大泄":"春光大泄",
  1857. "大公无si":"大公无私",
  1858. "fu道人家":"妇道人家", "放sōng'xià来":"放松下来",
  1859. "奸yin掳掠":"奸淫掳掠",
  1860. "空dangdang":"空荡荡",
  1861. "突发qing况": "突发情况",
  1862. "yin奉阳违":"阴奉阳违", "一yin一阳":"一阴一阳",
  1863.  
  1864. // === 双字替换 ===
  1865. "暧m[eè][iì]":"暧昧",
  1866. "bàn\\s*fǎ":"办法", "bucuo":"不错", "不liáng":"不良", "b[ěe]i(\\s|&nbsp;)*j[īi]ng":"北京","半shen": "半身", "b[ìi]j[ìi]ng":"毕竟", "报(了?)jing":"报$1警", "bèi'pò":"被迫", "包yǎng":"包养", "(?:biǎo|婊\\\\?)子":"婊子", "biǎo\\s*xiàn\\s*":"表现",
  1867. "chifan":"吃饭", "ch[oō]ngd[oò]ng":"冲动", "chong物":"宠物", "cao(练|作)":"操$1", "出gui":"出轨", "chu\\s*xian":"出现", "缠mian": "缠绵", "成shu": "成熟", "(?:赤|chi)\\s*lu[oǒ]": "赤裸", "春guang": "春光", "chun风":"春风", "chuang伴":"床伴", "沉mi":"沉迷", "沉lun":"沉沦", "刺ji":"刺激", "chao红":"潮红", "初chun":"初春", ""chi luo"":"赤裸",
  1868. "dān\\s*xīn":"当心", "dang校": "党校", "da子": "鞑子", "大tui":"大腿", "dǎ\\s*suàn":"打算", "dengdai":"等待", "电huà":"电话", "diao丝": "屌丝", "d[úu](?:\\s|&nbsp;|<br/>)*l[ìi]": "独立", "d[uú]\\s{0,2}c[áa]i":"独裁", "d?[iì]f[āa]ng":"地方", "d[ìi]\\s*d[ūu]":"帝都", "di国|帝guo":"帝国", "du[oò]落":"堕落", "坠luò":"坠落",
  1869. "f[ǎa]ngf[óo]":"仿佛", "fei踢": "飞踢", "feng流": "风流", "风liu": "风流", "f[èe]nn[ùu]":"愤怒", "fǎn\\s*yīng":"反应",
  1870. "gao潮": "高潮", "高氵朝":"高潮", "gāo\\s*xìng\\s*":"高兴", "干chai": "干柴", "勾yin":"勾引", "gu[oò]ch[ée]ng":"过程", "gu[āa]n\\s*x[iì]":"关系", "g[ǎa]nji[àa]o":"感觉", "国wu院":"国务院", "gù\\s*yì\\s*":"故意", "guofen":"过分",
  1871. "hā\\s*hā\\s*":"哈哈", "h[aǎ]ode":"好的", "hù士":"护士", "火qiang":"火枪", "há'guó":"韩国", "han住": "含住", "hai洛因": "海洛因", "红fen": "红粉", "火yao": "火药", "h[ǎa]oxi[àa]ng":"好像", "hu[áa]ngs[èe]":"黄色", "皇d[ìi]":"皇帝", "昏昏yu睡":"昏昏欲睡", "回dang":"回荡", "huí\\s*qù\\s*":"回去", "hé\\s*shì\\s*":"合适",
  1872. "jian(臣|细)":"奸$1", "奸yin":"奸淫", "jiànmiàn":"见面", "jian货":"贱货", "jing察":"警察", "j[ìi]nháng":"进行", "jīng\\s*guò":"经过", "ji烈":"激烈", "j[iì](nv|女)": "妓女", "jirou": "鸡肉", "ji者":"记者", "jì\\s*xù\\s*":"继续", "ju花":"菊花","j[īi]动":"激动", "jili[èe]":"激烈", "肌r[òo]u":"肌肉","ji射":"激射", "ji[ēe]ch[uù]":"接触", "jiù\\s*shì":"就是", "j[ùu]li[èe]": "剧烈", "jǐng惕": "警惕", "节cao":"节操", "浸yin":"浸淫", "jù\\s*jué\\s*":"拒绝", "jue色":"角色",
  1873. "k[ěe]n[ée]ng": "可能", "开bao": "开苞", "k[àa]o近": "靠近", "口wen":"口吻", "kankan":"看看",
  1874. "ling辱": "凌辱", "luan蛋": "卵蛋", "脸sè": "脸色", "lu出":"露出", "流máng":"流氓", "lun理":"伦理", "lì\\s*qì":"力气",
  1875. "m[ǎa]ny[ìi]":"满意", "m[ǎa]sh[àa]ng":"马上", "m[ée]iy[oǒ]u":"没有", "mei国": "美国", "m[íi]ngb[áa]i":"明白", "迷huan": "迷幻", "mi茫":"迷茫", "mó\\s*yàng":"模样", "m[íi]n\\s{0,2}zh[ǔu]": "民主", "迷jian": "迷奸", "mimi糊糊":"迷迷糊糊", "末(?:\\s|<br/?>)*ì":"末日", "面se":"面色", "mengmeng":"蒙蒙",
  1876. "nàme":"那么", "n[ǎa]o\\s*d[àa]i":"脑袋", "n[ée]ngg[oò]u":"能够", "nán\\s{0,2}hǎi": "那会", "内jian":"内奸", "[内內]y[iī]":"内衣", "内ku":"内裤",
  1877. "pi[áa]o客":"嫖客", "p[áa]ngbi[āa]n":"旁边",
  1878. "q[íi]gu[àa]i":"奇怪", "qing\\s*(ren|人)":"情人", "qin兽":"禽兽", "q[iī]ngch[uǔ]":"清楚", "què\\s*dìng":"确定", "球mi":"球迷", "青chun":"青春", "青lou":"青楼", "qingkuang":"情况", "qiang[ \\s]*jian":"强奸",
  1879. "re\\s*nao":"热闹", "r[úu]gu[oǒ]":"如果", "r[oó]ngy[ìi]":"容易", "ru(房|白色)": "乳$1", "rén员":"人员", "rén形":"人形", "人chao":"人潮", "renmen":"人名",
  1880. "上jiang":"上将", "she(门|术|手|程|击)":"射$1", "sudu":"速度", "shuijue":"睡觉", "shide":"是的", "sh[iì]ji[eè]":"世界", "sh[ií]ji[aā]n":"时间", "sh[ií]h[oò]u": "时候", "sh[ií]me":"什么", "si人":"私人", "shi女":"侍女", "shi身": "失身", "sh[ūu]j[ìi]":"书记", "shu女": "熟女", "shu[ \\s]?xiong":"酥胸", "(?:上|shang)chuang": "上床", "呻y[íi]n": "呻吟", "sh[ēe]ngzh[íi]": "生殖", "深gu": "深谷", "双xiu": "双修", "生r[ìi]": "生日", "si盐":"私盐", "shi卫":"侍卫", "si下":"私下", "sao扰":"骚扰", "shuang feng":"双峰",
  1881. "t[uū]r[áa]n":"突然", "tiaojiao": "调教", "偷qing":"偷情", "推dao": "推倒", "脱guang": "脱光", "t[èe]bi[ée]":"特别", "t[ōo]nggu[òo]":"通过", "同ju":"同居", "tian来tian去":"舔来舔去",
  1882. "w[ēe]ixi[ée]":"威胁", "wèizh[ìi]":"位置", "wei员":"委员", "w[èe]nti":"问题", "wèi\\s*dào\\s*":"味道", "wú\\s*nài":"无奈", "weilai":"未来",
  1883. "xiu长": "修长", "亵du": "亵渎", "xing福": "幸福", "小bo":"小波", "小niū":"小妞", "xiong([^a-z])":"胸$1", "小tui":"小腿", "xiang港":"香港", "xiàohuà":"笑话", "xiàn\\'zhì":"限制", "xiōng\\s*dì":"兄弟",
  1884. "yì\\s*wài\\s*":"意外", "yin(冷|暗|谋|险|沉|沟|癸派|后)":"阴$1", "y[iī]y[àa]ng":"一样", "y[īi]di[ǎa]n":"一点", "yī\\s*zhèn":"一阵", "y[ǐi]j[īi]ng":"已经", "疑huo":"疑惑", "yí\\s*huò":"疑惑", "影mi":"影迷", "yin荡":"淫荡", "yin贼":"淫贼", "阳w[ěe]i": "阳痿", "yao头": "摇头", "yaotou": "摇头", "摇tou": "摇头", "yezhan": "野战", "you饵": "诱饵", "(?:you|诱)(?:惑|huo)": "诱惑", "you导": "诱导", "引you": "引诱", "you人": "诱人", "youshi":"有事", "you\\s*xiu":"优秀", "御yòng":"御用", "旖ni":"旖旎", "yu念":"欲念", "you敌深入":"诱敌深入", "影she":"影射", "牙qian":"牙签", "一yè情":"一夜情",
  1885. "z[iì]j[iǐ]": "自己","z[ìi](?:\\s|<br/?>|&nbsp;)*y[oó]u": "自由","zh[iī]d?[àa]u?o":"知道", "zixin":"自信", "zhì'fú":"制服", "zha药": "炸药", "zhan有": "占有", "zhè\\s*gè":"这个", "政f[ǔu]|zheng府": "政府", "zh[èe]ng\\s{0,2}f[uǔ]": "政府", "zong理":"总理", "zh[ōo]ngy[āa]ng": "中央", "中yang":"中央", "zu[oǒ]\\s*y[oò]u":"左右", "zhǔ\\s*dòng":"主动", "zh[oō]uw[ée]i":"周围", "中nan海":"中南海", "中j委":"中纪委", "中zu部":"中组部", "政zhi局":"政治局", "(昨|一|时|余)(?:<br/?>|&nbsp;|\\s)*ì":"$1日", "照she":"照射", "zhǔn\\s*bèi\\s*":"准备", "zhu义":"主义",
  1886.  
  1887. "</p>\\n<p>\\s*ì":"日",
  1888. };
  1889.  
  1890. // 单字替换,可能会误替换,所以需要特殊处理
  1891. (function(){
  1892. var oneWordReplace = {
  1893. "b[āà]ng":"棒","bào":"爆","bà":"吧","bī":"逼","bō":"波",
  1894. "cāo": "操", "cǎo": "草", "cào": "操", "chāng": "娼", "chang": "娼", "cháo": "潮", "chā": "插", "chéng": "成", "chōu": "抽", "chuáng": "床", "chún": "唇", "chūn": "春", "cuō": "搓", "cū": "粗",
  1895. "dǎng": "党", "dàng": "荡", "dāo": "刀", "dòng": "洞", "diao": "屌", "diǎn": "点",
  1896. "fǎ": "法", "féi": "肥", "fù": "妇",
  1897. "guān": "官",
  1898. "hán": "含", "hóu": "喉", "hòu": "厚", "h(u)?ā": "花", "huá": "华", "huò": "惑", "hùn": "混", "hún": "魂",
  1899. "jiǔ": "九", "jīng": "精", "jìn": "禁", "jǐng": "警", "jiāng": "江", "jiān": "奸", "jiāo": "交", "jūn": "军", "jū": "拘", "jú": "局", "jī": "激", "激ān":"奸",
  1900. "kù": "裤", "kàn": "看",
  1901. "[1l]àng": "浪", "liáo": "撩", "liú":"流", "lì":"莉", "liè":"烈", "[1l]uàn":"乱", "lún":"伦", "luǒ":"裸", "lòu":"露", "[l1]ù":"露", "lǜ":"绿",
  1902. "mǎi": "买", "mài": "卖", "máo": "毛", "mā": "妈", "méng": "蒙", "mén": "门", "miè": "灭", "mí": "迷", "mì": "蜜", "mō": "摸",
  1903. "nǎi": "奶", "nèn": "嫩", "niào": "尿", "niē": "捏", "nòng": "弄", "nǚ": "女",
  1904. "pào": "炮", "piàn": "片",
  1905. "qi[āa]ng": "枪", "qíng": "情", "qīn": "亲", "qiú": "求", "quán": "全",
  1906. "rén":"人", "rì": "日", "rǔ": "乳",
  1907. "sāo":"骚", "sǎo": "骚", "sè": "色", "shā": "杀", "shēn":"呻", "shén":"神", "shè": "射", "shǐ": "屎", "shì": "侍", "sǐ": "死", "sī": "私", "shǔn": "吮", "sǔn": "吮", "sū": "酥",
  1908. "tān":"贪", "tiǎn": "舔", "tǐng":"挺", "tǐ": "体", "tǒng": "捅", "tōu": "偷", "tou": "偷", "tuǐ": "腿", "tūn": "吞", "tún": "臀", "tiáo":"调", "tài":"态",
  1909. "wēn": "温", "wěn": "吻",
  1910. "xiǎo":"小", "xìng": "性", "xiōng": "胸", "xī": "吸", "xí": "习", "xué": "穴", "xuè": "穴", "xùe": "穴", "xuan":"宣",
  1911. "yāng":"央", "yàn":"艳", "yīn":"阴", "yào": "药", "yé": "爷", "yòu": "诱", "zàng": "脏", "yù": "欲", "yín": "淫",
  1912. "zhēn":"针", "zēn":"针", "zhà":"炸", "zhèng":"政", "zǒu": "走", "zuì":"罪", "zuò":"做", "zhōng":"中",
  1913.  
  1914. "ri":"日", "se":"色", "yu":"欲", "xing":"性",
  1915. "jing":"精", "ting":"挺",
  1916. };
  1917.  
  1918. var replaceOthers = {
  1919. // ===误替换还原===
  1920. "碧欲": "碧玉", "美欲": "美玉","欲石": "玉石","惜欲": "惜玉","宝欲": "宝玉",
  1921. "品性": "品行", "德性": "德行",
  1922. "波ok": "book", "波SS": "BOSS",
  1923.  
  1924. // ===其他修正===
  1925. "弥俩": "你俩",
  1926. "妳": "你",
  1927. "圞|垩|卝|龘":""
  1928. };
  1929.  
  1930. _.each(oneWordReplace, function(value, key) {
  1931. Rule.replace['([^a-z\\s])' + key + '(?![a-z\\s])'] = '$1' + value;
  1932. });
  1933.  
  1934. _.extend(Rule.replace, replaceOthers);
  1935. })();
  1936.  
  1937. // ===== 全局移除,在替换 <br> 为 \n 之后 =====
  1938. Rule.replaceAll = [
  1939. // 长文字替换
  1940. '纯文字在线阅读本站域名手机同步阅读请访问',
  1941. '\\(?未完待续请搜索飄天文學,小说更好更新更快!',
  1942. '-优-优-小-说-更-新-最-快-www.UUXS.CC-',
  1943. '【阅读本书最新章节,请搜索800】',
  1944. '亲,百度搜索眼&amp;快,大量小说免费看。',
  1945. '\\|每两个看言情的人当中,就有一个注册过可°乐°小°说°网的账号。',
  1946. '最新章节全文阅读看书神器\\.yankuai\\.',
  1947. '(800小说网 www.800Book.net 提供Txt免费下载)最新章节全文阅读-..-',
  1948. '\\[看本书最新章节请到求书 .\\]',
  1949. '\\[800\\]\\[站页面清爽,广告少,',
  1950. '\\|优\\|优\\|小\\|说\\|更\\|新\\|最\\|快\\|www.uuxs.cc\\|',
  1951. '看本书最新章节请到800小说网(www.800book.net)',
  1952. '(800小说网 www.800Book.net 提供Txt免费下载)',
  1953. '热门小说最新章节全文阅读.。 更新好快。',
  1954. '-优-优-小-说-更-新-最-快x',
  1955. '亲,眼&快,大量小说免费看。',
  1956. '手机看小说哪家强手机阅',
  1957. '思ˊ路ˋ客,更新最快的!',
  1958. '(本章未完,请翻页)',
  1959. '最新章节全文阅读(..首发)',
  1960. '最新章节全文阅读【首发】',
  1961. '最新章节全文阅读',
  1962. '来可乐网看小说',
  1963. 'txt电子书下载/',
  1964. 'txt全集下载',
  1965. 'txt小说下载',
  1966. '(\\s*君子聚义堂)',
  1967. 'readx;',
  1968.  
  1969. // 包含 \P 的替换
  1970. '\\P{1,2}[顶頂].{1,3}[点小].*?o?[mw,]',
  1971. '\\P.?长.{1,2}风.{1,2}文.{1,2}学.*?[tx]',
  1972. '[;\\(]顶.{0,2}点.小说',
  1973. '2长2风2文2学,w¢$',
  1974. '》长>风》',
  1975.  
  1976. // 包含 .* 的,可能有多余的替换
  1977. '如您已(?:閱讀|阅读)到此章节.*?敬请记住我们新的网址\\s*。',
  1978. '↗百度搜:.*?直达网址.*?↖',
  1979. "[:《〈|~∨∟∑]{1,2}长.{1,2}风.*?et",
  1980. '\\[限时抢购\\].*',
  1981. '支持网站发展.逛淘宝买东西就从这里进.*',
  1982. 'ps[::]想听到更多你们的声音,想收到更多你们的建议,现在就搜索微信公众号“qdread”并加关注,给.*?更多支持!',
  1983. '(?:ps[::])?看《.*?》背后的独家故事.*?告诉我吧!',
  1984. '(?天上掉馅饼的好活动.*?微信公众号!)?',
  1985. '(微信添加.*qdread微信公众号!)',
  1986. 'jiemei如您已阅读到此章节,请移步到.*?\\[ads:本站换新网址啦,速记方法:,.\\]',
  1987.  
  1988. // 短文字替换
  1989. '\\[txt全集下载\\]',
  1990. '\\[\\s*超多好看小说\\]',
  1991. '⊙四⊙五⊙中⊙文☆→',
  1992. '\\[ads:本站换新网址啦,速记方法:.*?\\]',
  1993. '[》《|~]无(?:.|&gt;)错(?:.|&gt;)小说',
  1994. '《无〈错《', '》无>错》', '\\+无\\+错\\+', '|无|错|', '~无~错~',
  1995. '`无`错`小说`www.``com', '+无+错+小说+3w++',
  1996. '\\|优\\|优\\|小\\|说\\|更\\|新\\|最\\|快X',
  1997. '▲∴', '8,ww←',
  1998. /www.23+?[Ww][Xx].[Cc]om/ig,
  1999. /热门推荐:、+/g,
  2000. /h2&gt;/g,
  2001.  
  2002. '女凤免费小说抢先看', '女凤小说网全文字 无广告',
  2003. '乐文小说', '《乐〈文《小说', '乐文移动网', '頂点小说', '頂點小說',
  2004. '追小说哪里快去眼快',
  2005. '\\[书库\\].\\[774\\]\\[buy\\].kuai',
  2006.  
  2007. /'ads_wz_txt;',|百度搜索|无弹窗小说网|更新快无弹窗纯文字|高品质更新|小说章节更新最快|\(百度搜.\)|全文字手打|“”&nbsp;看|无.弹.窗.小.说.网|追书网|〖∷∷无弹窗∷纯文字∷ 〗/g,
  2008. ];
  2009.  
  2010.  
  2011. // 自定义的
  2012. Rule.customRules = [];
  2013. Rule.customReplace = {};
  2014.  
  2015. Rule.parseCustomReplaceRules = function(str) {
  2016. var arr = str.split(/\n/);
  2017. var rules = {};
  2018. _.each(arr, function(b) {
  2019. var pos = b.indexOf('=');
  2020. if (pos === -1) return;
  2021.  
  2022. var key = b.substring(0, pos),
  2023. value = b.substring(pos + 1, b.length);
  2024. rules[key] = value;
  2025. });
  2026. return rules;
  2027. };
  2028.  
  2029.  
  2030. var getBooleanConfig = function(configName, defaultValue) {
  2031. var config = GM_getValue(configName);
  2032. if(config === undefined) {
  2033. GM_setValue(configName, defaultValue);
  2034. config = defaultValue;
  2035. }
  2036. return config;
  2037. };
  2038.  
  2039. var Config = {
  2040. getDisableAutoLaunch: function() { // 强制手动启用模式
  2041. return getBooleanConfig("disable_auto_launch", false);
  2042. },
  2043. setDisableAutoLaunch: function(bool) {
  2044. GM_setValue("disable_auto_launch", bool);
  2045. },
  2046.  
  2047. // 按键调用会遇到问题: Greasemonkey 访问违规:unsafeWindow 无法调用 GM_getValue
  2048. // 故改成这种形式
  2049. copyCurTitle: getBooleanConfig("copyCurTitle", true),
  2050. setCopyCurTitle: function (bool) {
  2051. this.copyCurTitle = !!bool;
  2052. GM_setValue("copyCurTitle", !!bool);
  2053. },
  2054.  
  2055. get cn2tw() {
  2056. if (_.isUndefined(this._cn2tw)) {
  2057. this._cn2tw = getBooleanConfig('cn2tw', Config.lang === 'zh-TW' ? true : false);
  2058. }
  2059. return this._cn2tw;
  2060. },
  2061. set cn2tw(bool) {
  2062. GM_setValue('cn2tw', bool);
  2063. this._cn2tw = bool;
  2064. },
  2065.  
  2066. get booklink_enable() { // booklink.me 跳转的自动启动
  2067. return getBooleanConfig("booklink_enable", true);
  2068. },
  2069. set booklink_enable(bool) {
  2070. GM_setValue("booklink_enable", bool);
  2071. },
  2072.  
  2073. get debug() { // 调试
  2074. if (_.isUndefined(this._debug)) {
  2075. this._debug = getBooleanConfig("debug", false);
  2076. }
  2077. return this._debug;
  2078. },
  2079. set debug(bool) {
  2080. this._debug = bool;
  2081. GM_setValue("debug", bool);
  2082. toggleConsole(bool);
  2083. },
  2084.  
  2085. get addToHistory() {
  2086. if (_.isUndefined(this._addToHistory)) {
  2087. this._addToHistory = getBooleanConfig("add_nextpage_to_history", true);
  2088. }
  2089. return this._addToHistory;
  2090. },
  2091. set addToHistory(bool) {
  2092. this._addToHistory = bool;
  2093. GM_setValue("add_nextpage_to_history", bool);
  2094. },
  2095.  
  2096. get dblclickPause() {
  2097. return getBooleanConfig('dblclick_pause', true);
  2098. },
  2099. set dblclickPause(bool) {
  2100. GM_setValue('dblclick_pause', bool);
  2101. },
  2102.  
  2103. get remain_height() { // 距离底部多少高度(px)开始加载下一页
  2104. if(_.isUndefined(this._remain_height)){
  2105. this._remain_height = parseInt(GM_getValue("remain_height"), 10) || 400;
  2106. }
  2107. return this._remain_height;
  2108. },
  2109. set remain_height(val) {
  2110. this._remain_height = val;
  2111. GM_setValue("remain_height", val);
  2112. },
  2113.  
  2114. get lang() {
  2115. if (_.isUndefined(this._lang)) {
  2116. this._lang = GM_getValue("lang") || ((navigator.language === "zh-TW" || navigator.language === "zh-HK") ? "zh-TW" : "zh-CN");
  2117. }
  2118. return this._lang;
  2119. },
  2120. set lang(val) {
  2121. this._lang = val;
  2122. GM_setValue("lang", val);
  2123. },
  2124.  
  2125. get font_family() {
  2126. return GM_getValue("font_family") || "微软雅黑,宋体,黑体,楷体".uiTrans();
  2127. },
  2128. set font_family(val) {
  2129. GM_setValue("font_family", val);
  2130. },
  2131.  
  2132. get font_size() { // 字体大小
  2133. return GM_getValue("font_size") || "18px";
  2134. },
  2135. set font_size(val) {
  2136. GM_setValue("font_size", val);
  2137. },
  2138.  
  2139. get text_line_height(){
  2140. return GM_getValue("text_line_height") || "2em";
  2141. },
  2142. set text_line_height(val){
  2143. GM_setValue("text_line_height", val);
  2144. },
  2145.  
  2146. get content_width() { // 内容宽度
  2147. return GM_getValue("content_width") || "800px";
  2148. },
  2149. set content_width(val) {
  2150. GM_setValue("content_width", val);
  2151. },
  2152.  
  2153. get extra_css() {
  2154. return GM_getValue("extra_css", "");
  2155. },
  2156. set extra_css(val) {
  2157. GM_setValue("extra_css", val);
  2158. },
  2159.  
  2160. get customSiteinfo() {
  2161. return GM_getValue('custom_siteinfo', '[]');
  2162. },
  2163. set customSiteinfo(val) {
  2164. GM_setValue('custom_siteinfo', val);
  2165. },
  2166.  
  2167. get customReplaceRules() {
  2168. var rules = GM_getValue('custom_replace_rules', 'b[āà]ng=棒\n『(.)』=$1');
  2169.  
  2170. return rules;
  2171. },
  2172. set customReplaceRules(val) {
  2173. GM_setValue('custom_replace_rules', val);
  2174. },
  2175.  
  2176. get skin_name() {
  2177. return GM_getValue("skin_name") || "缺省皮肤".uiTrans();
  2178. },
  2179. set skin_name(val) {
  2180. GM_setValue("skin_name", val);
  2181. },
  2182.  
  2183. get menu_list_hiddden() {
  2184. return getBooleanConfig("menu_list_hiddden", false);
  2185. },
  2186. set menu_list_hiddden(bool) {
  2187. GM_setValue("menu_list_hiddden", bool);
  2188. },
  2189.  
  2190. get hide_footer_nav() {
  2191. return getBooleanConfig("hide_footer_nav", true);
  2192. },
  2193. set hide_footer_nav(bool) {
  2194. GM_setValue("hide_footer_nav", bool);
  2195. UI.hideFooterNavStyle(bool);
  2196. },
  2197.  
  2198. get hide_preferences_button() {
  2199. return getBooleanConfig("hide_preferences_button", false);
  2200. },
  2201. set hide_preferences_button(bool) {
  2202. GM_setValue('hide_preferences_button', bool);
  2203. },
  2204.  
  2205. // === 快捷键
  2206.  
  2207. // 安静模式切换快捷键
  2208. get quietModeKey() {
  2209. if (this._quietModeKey) {
  2210. return this._quietModeKey;
  2211. }
  2212. this._quietModeKey = GM_getValue('quietModeKey') || 'q';
  2213.  
  2214. return this._quietModeKey;
  2215. },
  2216. set quietModeKey(keyCode) {
  2217. this._quietModeKey = keyCode;
  2218. GM_setValue('quietModeKey', keyCode);
  2219. },
  2220.  
  2221. // 打开设置窗口的快捷键
  2222. get openPreferencesKey() {
  2223. if (this._openPreferencesKey) {
  2224. return this._openPreferencesKey;
  2225. }
  2226. this._openPreferencesKey = GM_getValue('open_preferences_key') || 's';
  2227.  
  2228. return this._openPreferencesKey;
  2229. },
  2230. set openPreferencesKey(keyCode) {
  2231. this._openPreferencesKey = keyCode;
  2232. GM_setValue('open_preferences_key', keyCode);
  2233. },
  2234.  
  2235. // 隐藏左侧章节列表的快捷键
  2236. get hideMenuListKey() { // 默认为 c
  2237. // 'C'.charCodeAt(0) = 67
  2238. if (this._hideMenuListKey) {
  2239. return this._hideMenuListKey;
  2240. }
  2241. this._hideMenuListKey = GM_getValue('hide_menulist_key') || 'c';
  2242.  
  2243. return this._hideMenuListKey;
  2244. },
  2245. set hideMenuListKey(key) {
  2246. this._hideMenuListKey = key;
  2247. GM_setValue("hide_menulist_key", key);
  2248. },
  2249.  
  2250. get picNightModeCheck() {
  2251. return getBooleanConfig('picNightModeCheck', true);
  2252. },
  2253. set picNightModeCheck(bool) {
  2254. GM_setValue('picNightModeCheck', bool);
  2255. },
  2256.  
  2257. get split_content() {
  2258. if (_.isUndefined(this._split_content)) {
  2259. this._split_content = GM_getValue('split_content', true);
  2260. }
  2261. return this._split_content;
  2262. },
  2263. set split_content(bool) {
  2264. this._split_content = bool;
  2265. GM_setValue('split_content', bool);
  2266. },
  2267.  
  2268. get scrollAnimate() {
  2269. return GM_getValue('scrollAnimate', false);
  2270. },
  2271. set scrollAnimate(bool) {
  2272. GM_setValue('scrollAnimate', bool);
  2273. },
  2274. };
  2275.  
  2276.  
  2277. var uiTrans = {
  2278. "将小说网页文本转换为繁体。\n\n注意:内置的繁简转换表,只收录了简单的单字转换,启用本功能后,如有错误转换的情形,请利用脚本的自订字词取代规则来修正。\n例如:「千里之外」,会错误转换成「千里之外」,你可以加入规则「千里之外=千里之外」来自行修正。": "將小說網頁文字轉換為繁體。\n\n注意:內建的繁簡轉換表,只收錄了簡單的單字轉換,啟用本功能後,如有錯誤轉換的情形,請利用腳本的自訂字詞取代規則來修正。\n例如:「千里之外」,會錯誤轉換成「千裡之外」,你可以加入規則「千裡之外=千里之外」來自行修正。",
  2279. "图片章节用夜间模式没法看,这个选项在启动时会自动切换到缺省皮肤": "圖片章節無法以夜間模式觀看,這個選項在啟動時會自動切換到預設佈景",
  2280. "通过快捷键切换或在 Greasemonkey 用户脚本命令处打开设置窗口": "通過熱鍵切換或在 Greasemonkey 使用者腳本命令處開啟設定視窗",
  2281. "隐藏后通过快捷键或 Greasemonkey 用户脚本命令处调用": "隱藏後通過熱鍵或 Greasemonkey 使用者腳本命令處調用",
  2282. "一行一个,每行第一个 = 为分隔符\n需要刷新页面生效": "一行一條規則,每一行第一個 = 為分隔符\n(需重新載入頁面才能生效)",
  2283. "错误:没有找到下一页的内容,使用右键翻到下一页": "錯誤:沒有找到下一頁的內容,使用右鍵翻到下一頁",
  2284. "左键滚动,中键打开链接(无阅读模式)": "左鍵捲動畫面至該章節,中鍵開啟連結(無閱讀模式)",
  2285. "请输入切换左侧章节列表的快捷键:": "請輸入切換左側章節列表的熱鍵:",
  2286. "详见脚本代码的 Rule.specialSite": "詳見腳本代碼的 Rule.specialSite",
  2287. "booklink.me 点击的网站强制启用": "booklink.me 點擊的網站強制啟用",
  2288. "部分选项需要刷新页面才能生效": "部份選項需重新載入頁面才能生效",
  2289. "取消本次设定,所有选项还原": "取消本次設定,所有選項還原",
  2290. "不影响 booklink.me 的启用": "不影響 booklink.me 的啟用",
  2291. "请输入打开设置的快捷键:": "請輸入開啟設定視窗的熱鍵:",
  2292. "微软雅黑,宋体,黑体,楷体": "Microsoft YaHei,新細明體,PMingLiU,MingLiU,細明體,標楷體",
  2293. "夜间模式的图片章节检测": "夜間模式的圖片章節檢測",
  2294. "点击显示隐藏章节列表": "點此以顯示或隱藏章節列表",
  2295. "添加下一页到历史记录": "加入下一頁到歷史記錄",
  2296. "booklink 自动启用": "booklink 自動啟用",
  2297. "Enter 键打开目录": "Enter 鍵開啟目錄",
  2298. "隐藏左侧章节列表": "隱藏左側章節列表",
  2299. "小说阅读脚本设置":"小說閱讀腳本設定",
  2300. "已到达最后一页": "已到達最後一頁",
  2301. "正在载入下一页": "正在載入下一頁",
  2302. "通过快捷键切换": "通過熱鍵切換",
  2303. "隐藏底部导航栏": "隱藏底部導航列",
  2304. "隐藏左侧导航条": "隱藏左側章節列表彈出鈕",
  2305. "主页链接没有找到": "未找到主頁連結",
  2306. "自定义站点规则": "自訂網站規則",
  2307. "自定义替换规则": "自訂字詞取代規則",
  2308. "网页:转繁体": "網頁:轉繁體",
  2309. "双击暂停翻页": "雙擊暫停翻頁",
  2310. "隐藏设置按钮": "隱藏設定按鈕",
  2311. "强制手动启用": "強制手動啟用",
  2312. "调用阅读器": "調用閱讀器",
  2313. "自定义样式": "自訂樣式",
  2314. "界面语言": "介面語言",
  2315. "打开目录": "開啟本書目錄頁",
  2316. "自动翻页": "自動翻頁",
  2317. "缺省皮肤": "預設佈景",
  2318. "暗色皮肤": "暗色佈景",
  2319. "夜间模式": "夜間模式",
  2320. "夜间模式1": "夜間模式1",
  2321. "夜间模式2": "夜間模式2",
  2322. "橙色背景": "橙色背景",
  2323. "绿色背景": "綠色背景",
  2324. "绿色背景2": "綠色背景2",
  2325. "蓝色背景": "藍色背景",
  2326. "棕黄背景": "棕黃背景",
  2327. "经典皮肤": "經典背景",
  2328. "阅读模式": "閱讀模式",
  2329. "调试模式": "偵錯模式",
  2330. "反馈地址": "反饋與討論",
  2331. "安静模式": "安靜模式",
  2332. "√ 确认": "√ 確定",
  2333. "X 取消": "X 取消",
  2334. "上一页": "上一頁",
  2335. "下一页": "下一頁",
  2336. "状态": "狀態",
  2337. "已经": "已經",
  2338. "暂停": "暫停",
  2339. "启用": "啟用",
  2340. "退出": "離開",
  2341. "测试": "測試",
  2342. "距离": "距離",
  2343. "加载": "載入",
  2344. "字体": "字型",
  2345. "行高": "行距",
  2346. "行宽": "版面寬度",
  2347. "目录": "目錄"
  2348. };
  2349.  
  2350. if(!String.prototype.uiTrans){
  2351. Object.defineProperty(String.prototype, 'uiTrans', {
  2352. value: function(){
  2353. var _this = this.valueOf(), key, regexp;
  2354. if(Config.lang !== 'zh-TW') return _this;
  2355. if(uiTrans.hasOwnProperty(_this)) return uiTrans[_this];
  2356. for (key in uiTrans) {
  2357. regexp = new RegExp(key, 'g');
  2358. _this = _this.replace(regexp, uiTrans[key]);
  2359. }
  2360. return _this;
  2361. },
  2362. enumerable: false
  2363. });
  2364. }
  2365.  
  2366. //------------------- 辅助函数 ----------------------------------------
  2367.  
  2368. var nullFn = function() {};
  2369.  
  2370. // Check if is GM 2.x
  2371. if (typeof exportFunction == 'undefined') {
  2372. // For GM 1.x backward compatibility, should work.
  2373. var exportFunction = (function(foo, scope, defAs) {
  2374. scope[defAs.defineAs] = foo;
  2375. }).bind(unsafeWindow);
  2376. }
  2377.  
  2378. var C;
  2379. toggleConsole(Config.debug);
  2380.  
  2381. function toggleConsole(debug) {
  2382. if (debug) {
  2383. C = console;
  2384. } else {
  2385. C = {
  2386. log: nullFn,
  2387. debug: nullFn,
  2388. error: nullFn,
  2389. group: nullFn,
  2390. groupCollapsed: nullFn,
  2391. groupEnd: nullFn,
  2392. time: nullFn,
  2393. timeEnd: nullFn,
  2394. };
  2395. }
  2396. }
  2397.  
  2398. function L_getValue(key) { // 个别用户禁用本地存储会报错
  2399. try {
  2400. return localStorage.getItem(key);
  2401. } catch (e) {}
  2402. }
  2403.  
  2404. function L_setValue(key, value) {
  2405. try {
  2406. localStorage.setItem(key, value);
  2407. } catch (e) {}
  2408. }
  2409.  
  2410. function L_removeValue(key) {
  2411. try {
  2412. localStorage.removeItem(key);
  2413. } catch (e) {}
  2414. }
  2415.  
  2416.  
  2417. function parseHTML(str) {
  2418. var doc;
  2419. try {
  2420. // firefox and chrome 30+,Opera 12 会报错
  2421. doc = new DOMParser().parseFromString(str, "text/html");
  2422. } catch (ex) {}
  2423.  
  2424. if (!doc) {
  2425. doc = document.implementation.createHTMLDocument("");
  2426. doc.querySelector("html").innerHTML = str;
  2427. }
  2428. return doc;
  2429. }
  2430.  
  2431. function toRE(obj, flag) {
  2432. if (obj instanceof RegExp) {
  2433. return obj;
  2434. } else {
  2435. return new RegExp(obj, (flag || 'ig'));
  2436. }
  2437. }
  2438.  
  2439. function toReStr(str) { // 处理字符串,否则可能会无法用正则替换
  2440. return str.replace(/[()\[\]{}|+.,^$?\\*]/g, "\\$&");
  2441. }
  2442.  
  2443. function wildcardToRegExpStr(urlstr) {
  2444. if (urlstr.source) return urlstr.source;
  2445. var reg = urlstr.replace(/[()\[\]{}|+.,^$?\\]/g, "\\$&").replace(/\*+/g, function(str){
  2446. return str === "*" ? ".*" : "[^/]*";
  2447. });
  2448. return "^" + reg + "$";
  2449. }
  2450.  
  2451. function getUrlHost(url) {
  2452. var a = document.createElement('a');
  2453. a.href = url;
  2454. return a.host;
  2455. }
  2456.  
  2457. $.nano = function(template, data) {
  2458. return template.replace(/\{([\w\.]*)\}/g, function(str, key) {
  2459. var keys = key.split("."),
  2460. v = data[keys.shift()];
  2461. for (var i = 0, l = keys.length; i < l; i++) v = v[keys[i]];
  2462. return (typeof v !== "undefined" && v !== null) ? v : "";
  2463. });
  2464. };
  2465.  
  2466. // jQuery text 完全匹配. e.g. a:econtains('最新章节')
  2467. $.expr[":"].econtains = function(obj, index, meta, stack) {
  2468. return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase();
  2469. };
  2470.  
  2471. /* jshint ignore: start */
  2472.  
  2473. function $x(aXPath, aContext) {
  2474. var nodes = [];
  2475. var doc = document;
  2476. aContext = aContext || doc;
  2477.  
  2478. try {
  2479. var results = doc.evaluate(aXPath, aContext, null,
  2480. XPathResult.ANY_TYPE, null);
  2481. var node;
  2482. while (node = results.iterateNext()) {
  2483. nodes.push(node);
  2484. }
  2485. } catch (ex) {}
  2486.  
  2487. return nodes;
  2488. }
  2489.  
  2490. Function.prototype.getMStr = function() { // 多行String
  2491. var lines = new String(this);
  2492. lines = lines.substring(lines.indexOf("/*") + 3, lines.lastIndexOf("*/"));
  2493. return lines;
  2494. };
  2495.  
  2496. if (typeof String.prototype.startsWith != 'function') {
  2497. String.prototype.startsWith = function(str) {
  2498. return this.slice(0, str.length) == str;
  2499. };
  2500. }
  2501.  
  2502. if (typeof String.prototype.contains != 'function') {
  2503. String.prototype.contains = function(str) {
  2504. return this.indexOf(str) != -1;
  2505. };
  2506. }
  2507.  
  2508. function saveAs(data, filename) {
  2509. if(!filename) filename = 'console.json'
  2510.  
  2511. if (typeof data == 'object') {
  2512. data = JSON.stringify(data, undefined, 4);
  2513. }
  2514.  
  2515. var blob = new Blob([data], { type: 'application/octet-stream' });
  2516. var url = window.URL.createObjectURL(blob);
  2517. var saveas = document.createElement('a');
  2518. saveas.href = url;
  2519. saveas.style.display = 'none';
  2520. document.body.appendChild(saveas);
  2521. saveas.download = filename;
  2522. saveas.click();
  2523. setTimeout(function() {
  2524. saveas.parentNode.removeChild(saveas);
  2525. }, 1000)
  2526. document.addEventListener('unload', function() {
  2527. window.URL.revokeObjectURL(url);
  2528. });
  2529. }
  2530.  
  2531. /*
  2532. * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
  2533. */
  2534. jQuery.easing.jswing=jQuery.easing.swing,jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(a,b,c,d,e){return jQuery.easing[jQuery.easing.def](a,b,c,d,e)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b+c:-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b*b+c:d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return 0==b?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){return 0==b?c:b==e?c+d:(b/=e/2)<1?d/2*Math.pow(2,10*(b-1))+c:d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){return(b/=e/2)<1?-d/2*(Math.sqrt(1-b*b)-1)+c:d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;return 0==b?c:1==(b/=e)?c+d:(g||(g=.3*e),h<Math.abs(d)?(h=d,f=g/4):f=g/(2*Math.PI)*Math.asin(d/h),-(h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g))+c)},easeOutElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;return 0==b?c:1==(b/=e)?c+d:(g||(g=.3*e),h<Math.abs(d)?(h=d,f=g/4):f=g/(2*Math.PI)*Math.asin(d/h),h*Math.pow(2,-10*b)*Math.sin((b*e-f)*2*Math.PI/g)+d+c)},easeInOutElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;return 0==b?c:2==(b/=e/2)?c+d:(g||(g=e*.3*1.5),h<Math.abs(d)?(h=d,f=g/4):f=g/(2*Math.PI)*Math.asin(d/h),1>b?-.5*h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)+c:.5*h*Math.pow(2,-10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)+d+c)},easeInBack:function(a,b,c,d,e,f){return void 0==f&&(f=1.70158),d*(b/=e)*b*((f+1)*b-f)+c},easeOutBack:function(a,b,c,d,e,f){return void 0==f&&(f=1.70158),d*((b=b/e-1)*b*((f+1)*b+f)+1)+c},easeInOutBack:function(a,b,c,d,e,f){return void 0==f&&(f=1.70158),(b/=e/2)<1?d/2*b*b*(((f*=1.525)+1)*b-f)+c:d/2*((b-=2)*b*(((f*=1.525)+1)*b+f)+2)+c},easeInBounce:function(a,b,c,d,e){return d-jQuery.easing.easeOutBounce(a,e-b,0,d,e)+c},easeOutBounce:function(a,b,c,d,e){return(b/=e)<1/2.75?d*7.5625*b*b+c:2/2.75>b?d*(7.5625*(b-=1.5/2.75)*b+.75)+c:2.5/2.75>b?d*(7.5625*(b-=2.25/2.75)*b+.9375)+c:d*(7.5625*(b-=2.625/2.75)*b+.984375)+c},easeInOutBounce:function(a,b,c,d,e){return e/2>b?.5*jQuery.easing.easeInBounce(a,2*b,0,d,e)+c:.5*jQuery.easing.easeOutBounce(a,2*b-e,0,d,e)+.5*d+c}});
  2535.  
  2536. /* jshint ignore: end */
  2537.  
  2538.  
  2539. var UI = {
  2540. tpl_footer_nav: '\
  2541. <div class="chapter-footer-nav">\
  2542. <a class="prev-page" href="{prevUrl}">上一页</a> | \
  2543. <a class="index-page" href="{indexUrl}" title="Enter 键打开目录">目录</a> | \
  2544. <a class="next-page" style="color:{theEndColor}" href="{nextUrl}">下一页</a>\
  2545. </div>\
  2546. '.uiTrans(),
  2547. skins: {},
  2548.  
  2549. init: function(){
  2550. UI.refreshMainStyle();
  2551.  
  2552. UI.refreshSkinStyle(Config.skin_name, true);
  2553.  
  2554. UI.refreshExtraStyle(Config.extra_css);
  2555.  
  2556. UI.fixMobile();
  2557.  
  2558. // 初始变量
  2559. UI.$menu = $('#menu');
  2560. UI.$menuBar = $('#menu-bar');
  2561. UI.$content = $('#mynovelreader-content');
  2562. UI.$preferencesBtn = $('#preferencesBtn');
  2563.  
  2564. // 初始化是否隐藏
  2565. if(Config.hide_footer_nav){
  2566. UI.hideFooterNavStyle(true);
  2567. }
  2568.  
  2569. // UI.toggleQuietMode(); // 初始化安静模式
  2570. UI.hideMenuList(Config.menu_list_hiddden); // 初始化章节列表是否隐藏
  2571. UI.hidePreferencesButton(Config.hide_preferences_button); // 初始化设置按钮是否隐藏
  2572. },
  2573. refreshMainStyle: function(){
  2574. if(UI.mainStyle){
  2575. $(UI.mainStyle).remove();
  2576. }
  2577.  
  2578. UI.mainStyle = GM_addStyle(
  2579. Res.CSS_MAIN
  2580. .replace("{font_family}", Config.font_family)
  2581. .replace("{font_size}", Config.font_size)
  2582. .replace("{title_font_size}", UI.calcTitleFontSize(Config.font_size))
  2583. .replace("{content_width}", Config.content_width)
  2584. .replace("{text_line_height}", Config.text_line_height)
  2585. .replace("{menu-bar-hidden}", Config.menu_bar_hidden ? "display:none;" : "")
  2586. );
  2587. },
  2588. hideFooterNavStyle: function(hidden){
  2589. var navStyle = $("#footer_nav_css");
  2590. if(hidden) {
  2591. if(navStyle.length === 0) {
  2592. $('<style>')
  2593. .attr("id", "footer_nav_css")
  2594. .text(".chapter-footer-nav { display: none; }")
  2595. .appendTo('head');
  2596. }
  2597. } else {
  2598. navStyle.remove();
  2599. }
  2600. },
  2601. hideMenuList: function(hidden){
  2602. if(typeof(hidden) === "undefined"){
  2603. hidden = !UI.menu_list_hiddden;
  2604. }
  2605.  
  2606. if(hidden){
  2607. UI.$menu.addClass('hidden');
  2608. UI.$content.css("margin-left", "");
  2609. }else{
  2610. UI.$menu.removeClass('hidden');
  2611. UI.$content.css("margin-left", "320px");
  2612. }
  2613. UI.menu_list_hiddden = hidden;
  2614. },
  2615. hidePreferencesButton: function(hidden) {
  2616. hidden = _.isUndefined(hidden) ? Config.hide_preferences_button : hidden;
  2617.  
  2618. UI.$preferencesBtn.toggle(!hidden);
  2619. },
  2620. hideMenuBar: function(hidden) {
  2621. hidden = _.isUndefined(hidden) ? Config.menu_bar_hidden : hidden;
  2622.  
  2623. UI.$menuBar.toggle(!hidden);
  2624. },
  2625. refreshSkinStyle: function(skin_name, isFirst){
  2626. var style = $("#skin_style");
  2627. if(style.length === 0){
  2628. style = $('<style id="skin_style">').appendTo('head');
  2629. }
  2630.  
  2631. // 图片章节夜间模式会变的无法看
  2632. if (isFirst && skin_name.indexOf('夜间'.uiTrans()) != -1 && Config.picNightModeCheck) {
  2633. setTimeout(function(){
  2634. var img = $('#mynovelreader-content img')[0];
  2635. // console.log(img.width, img.height)
  2636. if (img && img.width > 500 && img.height > 1000) {
  2637. style.text(UI.skins['缺省皮肤'.uiTrans()]);
  2638. return;
  2639. }
  2640. }, 200);
  2641. }
  2642.  
  2643. style.text(UI.skins[skin_name]);
  2644. },
  2645. refreshExtraStyle: function(css){
  2646. var style = $("#extra_style");
  2647. if(style.length === 0){
  2648. style = $('<style id="extra_style">').appendTo('head');
  2649. }
  2650.  
  2651. style.text(css);
  2652. },
  2653. toggleQuietMode: function() {
  2654. this._isQuietMode = !this._isQuietMode;
  2655. var selector = '#menu-bar, #menu, #preferencesBtn, .readerbtn';
  2656.  
  2657. if (this.$_quietStyle) {
  2658. this.$_quietStyle.remove();
  2659. this.$_quietStyle = null;
  2660. }
  2661.  
  2662. if (this._isQuietMode) {
  2663. $(selector).addClass("quiet-mode");
  2664.  
  2665. if (!isChrome) { // firefox 下隐藏滚动条
  2666. this.$_quietStyle = $('<style>')
  2667. .text('scrollbar {visibility:collapse !important; } body {overflow: hidden !important; overflow-x: hidden !important;}')
  2668. .appendTo('head');
  2669. }
  2670. } else {
  2671. $(selector).removeClass("quiet-mode");
  2672. }
  2673. },
  2674. addButton: function(){
  2675. GM_addStyle('\
  2676. .readerbtn {\
  2677. position: fixed;\
  2678. right: 10px;\
  2679. bottom: 10px;\
  2680. z-index: 2247483648;\
  2681. padding: 20px 5px;\
  2682. width: 50px;\
  2683. height: 20px;\
  2684. line-height: 20px;\
  2685. text-align: center;\
  2686. border: 1px solid;\
  2687. border-color: #888;\
  2688. border-radius: 50%;\
  2689. background: rgba(0,0,0,.5);\
  2690. color: #FFF;\
  2691. font: 12px/1.5 "微软雅黑","宋体",Arial;\
  2692. cursor: pointer;\
  2693. }\
  2694. ');
  2695.  
  2696. $("<div>")
  2697. .addClass("readerbtn")
  2698. .html(App.isEnabled ? "退出".uiTrans() : "阅读模式".uiTrans())
  2699. .mousedown(function(event){
  2700. if(event.which == 1){
  2701. App.toggle();
  2702. }else if(event.which == 2){
  2703. event.preventDefault();
  2704. L_setValue("mynoverlreader_disable_once", true);
  2705.  
  2706. var url = App.activeUrl || App.curPageUrl;
  2707. App.openUrl(url);
  2708. }
  2709. })
  2710. .appendTo('body');
  2711. },
  2712. calcTitleFontSize: function(contentFontSizeStr){
  2713. var m = contentFontSizeStr.match(/([\d\.]+)(px|em|pt)/);
  2714. if(m) {
  2715. var size = m[1],
  2716. type = m[2];
  2717. return parseInt(size, 10) * 1.8 + type;
  2718. }
  2719.  
  2720. return "";
  2721. },
  2722. fixMobile: function(){ // 自适应网页设计
  2723. var meta = document.createElement("meta");
  2724. meta.setAttribute("name", "viewport");
  2725. meta.setAttribute("content", "width=device-width, initial-scale=1");
  2726. document.head.appendChild(meta);
  2727. },
  2728. preferencesShow: function(event){
  2729. if($("#reader_preferences").length){
  2730. return;
  2731. }
  2732.  
  2733. UI._loadBlocker();
  2734.  
  2735. UI.$prefs = $('<div id="reader_preferences">')
  2736. .css('cssText', 'position:fixed; top:12%; left:30%; width:500px; z-index:300000;')
  2737. .append(
  2738. $('<style>').text(Res.preferencesCSS))
  2739. .append(
  2740. $('<div class="body">').html(Res.preferencesHTML))
  2741. .appendTo('body');
  2742.  
  2743. UI.preferencesLoadHandler();
  2744. },
  2745. _loadBlocker: function() {
  2746. UI.$blocker = $('<div>').attr({
  2747. id: 'uil_blocker',
  2748. style: 'position:fixed;top:0px;left:0px;right:0px;bottom:0px;background-color:#000;opacity:0.5;z-index:100000;'
  2749. }).appendTo('body');
  2750. },
  2751. hide: function(){
  2752. if(UI.$prefs) UI.$prefs.remove();
  2753. if(UI.$blocker) UI.$blocker.remove();
  2754. UI.$prefs = null;
  2755. UI.$blocker = null;
  2756. },
  2757. preferencesLoadHandler: function(){
  2758. var $form = $("#preferences");
  2759.  
  2760. // checkbox
  2761. $form.find("#enable-cn2tw").get(0).checked = Config.cn2tw;
  2762. $form.find("#disable-auto-launch").get(0).checked = Config.getDisableAutoLaunch();
  2763. $form.find("#booklink-enable").get(0).checked = Config.booklink_enable;
  2764. $form.find("#debug").get(0).checked = Config.debug;
  2765. $form.find("#quietMode").get(0).checked = Config.isQuietMode;
  2766. $form.find("#pic-nightmode-check").get(0).checked = Config.picNightModeCheck;
  2767. $form.find("#copyCurTitle").get(0).checked = Config.copyCurTitle;
  2768.  
  2769. $form.find("#hide-menu-list").get(0).checked = Config.menu_list_hiddden;
  2770. $form.find("#hide-footer-nav").get(0).checked = Config.hide_footer_nav;
  2771. $form.find("#hide-preferences-button").get(0).checked = Config.hide_preferences_button;
  2772. $form.find("#add-nextpage-to-history").get(0).checked = Config.addToHistory;
  2773. $form.find("#enable-dblclick-pause").get(0).checked = Config.dblclickPause;
  2774.  
  2775. $form.find("#font-family").get(0).value = Config.font_family;
  2776. $form.find("#font-size").get(0).value = Config.font_size;
  2777. $form.find("#content_width").get(0).value = Config.content_width;
  2778. $form.find("#text_line_height").get(0).value = Config.text_line_height;
  2779. $form.find("#split_content").get(0).checked = Config.split_content;
  2780. $form.find("#scroll_animate").get(0).checked = Config.scrollAnimate;
  2781.  
  2782. $form.find("#remain-height").get(0).value = Config.remain_height;
  2783. $form.find("#extra_css").get(0).value = Config.extra_css;
  2784. $form.find("#custom_siteinfo").get(0).value = Config.customSiteinfo;
  2785. UI._rules = $form.find("#custom_replace_rules").get(0).value = Config.customReplaceRules;
  2786.  
  2787. // 界面语言
  2788. var $lang = $form.find("#lang");
  2789. $("<option>").text("zh-CN").appendTo($lang);
  2790. $("<option>").text("zh-TW").appendTo($lang);
  2791. $lang.val(Config.lang).change(function(){
  2792. var key = $(this).find("option:selected").text();
  2793. Config.lang = key;
  2794. });
  2795.  
  2796. // 皮肤
  2797. var $skin = $form.find("#skin");
  2798. for(var key in UI.skins){
  2799. $("<option>").text(key).appendTo($skin);
  2800. }
  2801. $skin.val(Config.skin_name).change(function(){
  2802. var key = $(this).find("option:selected").text();
  2803. UI.refreshSkinStyle(key);
  2804. Config.skin_name = key;
  2805. });
  2806.  
  2807. // 字体大小等预览
  2808. var preview = _.debounce(function(){
  2809. switch(this.id){
  2810. case "font-size":
  2811. var titleFontSize = UI.calcTitleFontSize(this.value);
  2812. if(titleFontSize) {
  2813. UI.$content.css("font-size", this.value);
  2814. UI.$content.find("h1").css("font-size", titleFontSize);
  2815. }
  2816. break;
  2817. case "font-family":
  2818. UI.$content.css("font-family", this.value);
  2819. break;
  2820. case "content_width":
  2821. UI.$content.css("width", this.value);
  2822. break;
  2823. case "text_line_height":
  2824. UI.$content.css("line-height", this.value);
  2825. break;
  2826. default:
  2827. break;
  2828. }
  2829. }, 300);
  2830. $form.on("input", "input", preview);
  2831.  
  2832. // 初始化设置按键
  2833. $form.find("#quietModeKey").get(0).value = Config.quietModeKey;
  2834. $form.find("#openPreferencesKey").get(0).value = Config.openPreferencesKey;
  2835. $form.find("#setHideMenuListKey").get(0).value = Config.hideMenuListKey;
  2836.  
  2837. // 点击事件
  2838. $form.on('click', 'input:checkbox, input:button', function(event){
  2839. UI.preferencesClickHandler(event.target);
  2840. });
  2841. },
  2842. preferencesClickHandler: function(target){
  2843. var key;
  2844. switch (target.id) {
  2845. case 'close_button':
  2846. UI.preferencesCloseHandler();
  2847. break;
  2848. case 'save_button':
  2849. UI.preferencesSaveHandler();
  2850. break;
  2851. case 'debug':
  2852. Config.debug = !Config.debug;
  2853. toggleConsole(Config.debug);
  2854. break;
  2855. case 'quietMode':
  2856. UI.toggleQuietMode(target.checked);
  2857. break;
  2858. case 'hide-menu-list':
  2859. UI.hideMenuList(target.checked);
  2860. break;
  2861. case 'hide-preferences-button':
  2862. UI.hidePreferencesButton(target.checked);
  2863. if (target.checked) {
  2864. alert('隐藏后通过快捷键或 Greasemonkey 用户脚本命令处调用'.uiTrans());
  2865. }
  2866. break;
  2867. case 'hide-footer-nav':
  2868. break;
  2869. case 'quietModeKey':
  2870. key = prompt('请输入打开设置的快捷键:'.uiTrans(), Config.quietModeKey);
  2871. if (key) {
  2872. Config.quietModeKey = key;
  2873. $(target).val(key);
  2874. }
  2875. break;
  2876. case 'openPreferencesKey':
  2877. key = prompt('请输入打开设置的快捷键:'.uiTrans(), Config.openPreferencesKey);
  2878. if (key) {
  2879. Config.openPreferencesKey = key;
  2880. $(target).val(key);
  2881. }
  2882. break;
  2883. case 'setHideMenuListKey':
  2884. key = prompt('请输入切换左侧章节列表的快捷键:'.uiTrans(), Config.hideMenuListKey);
  2885. if (key) {
  2886. Config.hideMenuListKey = key;
  2887. $(target).val(key);
  2888. }
  2889. break;
  2890. case 'saveAsTxt':
  2891. App.saveAsTxt();
  2892. break;
  2893. default:
  2894. break;
  2895. }
  2896. },
  2897. preferencesCloseHandler: function(){
  2898. // UI.$content.removeAttr("style");
  2899. UI.$content.find("h1").css("font-size", "");
  2900.  
  2901. UI.hide();
  2902. },
  2903. preferencesSaveHandler: function(){
  2904. var $form = $("#preferences");
  2905.  
  2906. Config.setDisableAutoLaunch($form.find("#disable-auto-launch").get(0).checked);
  2907.  
  2908. Config.cn2tw = $form.find("#enable-cn2tw").get(0).checked;
  2909. Config.booklink_enable = $form.find("#booklink-enable").get(0).checked;
  2910. Config.isQuietMode = $form.find("#quietMode").get(0).checked;
  2911. Config.debug = $form.find("#debug").get(0).checked;
  2912. Config.picNightModeCheck = $form.find("#pic-nightmode-check").get(0).checked;
  2913. Config.setCopyCurTitle($form.find("#copyCurTitle").get(0).checked);
  2914.  
  2915. Config.addToHistory = $form.find("#add-nextpage-to-history").get(0).checked;
  2916. Config.dblclickPause = $form.find("#enable-dblclick-pause").get(0).checked;
  2917.  
  2918. var skinName = $form.find("#skin").find("option:selected").text();
  2919. Config.skin_name = skinName;
  2920. UI.refreshSkinStyle(skinName);
  2921.  
  2922. Config.font_family = $form.find("#font-family").get(0).value;
  2923. UI.$content.css("font-family", Config.font_family);
  2924.  
  2925. Config.font_size = $form.find("#font-size").get(0).value;
  2926. Config.text_line_height = $form.find("#text_line_height").get(0).value;
  2927. Config.content_width = $form.find("#content_width").get(0).value;
  2928. Config.remain_height = $form.find("#remain-height").get(0).value;
  2929. Config.split_content = $form.find("#split_content").get(0).checked;
  2930. Config.scrollAnimate = $form.find("#scroll_animate").get(0).checked;
  2931.  
  2932. Config.menu_list_hiddden = $form.find("#hide-menu-list").get(0).checked;
  2933. UI.hideMenuList(Config.menu_list_hiddden);
  2934.  
  2935. Config.hide_footer_nav = $form.find("#hide-footer-nav").get(0).checked;
  2936. Config.hide_preferences_button = $form.find("#hide-preferences-button").get(0).checked;
  2937.  
  2938. var css = $form.find("#extra_css").get(0).value;
  2939. UI.refreshExtraStyle(css);
  2940. Config.extra_css = css;
  2941.  
  2942. Config.customSiteinfo = $form.find("#custom_siteinfo").get(0).value;
  2943.  
  2944. // 自定义替换规则直接生效
  2945. var rules = $form.find("#custom_replace_rules").get(0).value;
  2946. Config.customReplaceRules = rules;
  2947. if (rules != UI._rules) {
  2948. var contentHtml = App.oArticles.join('\n');
  2949. if (rules) {
  2950. // 转换规则
  2951. rules = Rule.parseCustomReplaceRules(rules);
  2952. // 替换
  2953. contentHtml = Parser.prototype.replaceHtml(contentHtml, rules);
  2954. }
  2955.  
  2956. UI.$content.html(contentHtml);
  2957.  
  2958. App.resetCache();
  2959.  
  2960. UI._rules = rules;
  2961. }
  2962.  
  2963. UI.hide();
  2964. },
  2965. openHelp: function() {
  2966.  
  2967. },
  2968. notice: function (htmlText){
  2969. var $noticeDiv = $("#alert");
  2970.  
  2971. clearTimeout(UI.noticeDivto);
  2972. $noticeDiv.find("p").html(htmlText);
  2973. $noticeDiv.fadeIn("fast");
  2974.  
  2975. UI.noticeDivto = setTimeout(function(){
  2976. $noticeDiv.fadeOut(500);
  2977. }, 1666);
  2978.  
  2979. return $noticeDiv;
  2980. }
  2981. };
  2982.  
  2983. UI.skins["缺省皮肤".uiTrans()] = "";
  2984. UI.skins["暗色皮肤".uiTrans()] = "body { color: #666; background-color: rgba(0;0;0;.1); }\
  2985. .title { color: #222; }";
  2986. UI.skins["白底黑字".uiTrans()] = "body { color: black; background-color: white;}\
  2987. .title { font-weight: bold; border-bottom: 0.1em solid; margin-bottom: 1.857em; padding-bottom: 0.857em;}";
  2988. UI.skins["夜间模式".uiTrans()] = "body { color: #939392; background: #2d2d2d; } #preferencesBtn { background: white; } #mynovelreader-content img { background-color: #c0c0c0; } .chapter.active div{color: #939392;}";
  2989. UI.skins["夜间模式1".uiTrans()] = "body { color: #679; background-color: black; } #preferencesBtn img { background-color: white !important; } .title { color: #3399FF; background-color: #121212; }";
  2990. UI.skins["夜间模式2".uiTrans()] = "body { color: #AAAAAA; background-color: #121212; } #preferencesBtn img { background-color: white; } #mynovelreader-content img { background-color: #c0c0c0; } .title { color: #3399FF; background-color: #121212; } body a { color: #E0BC2D; } body a:link { color: #E0BC2D; } body a:visited { color:#AAAAAA; } body a:hover { color: #3399FF; } body a:active { color: #423F3F; }";
  2991. // UI.skins["夜间模式(多看)".uiTrans()] = "body { color: #3A5056; background: #101819; } #preferencesBtn { background: white; } #mynovelreader-content img { background-color: #c0c0c0; }";
  2992. UI.skins["夜间模式(多看)".uiTrans()] = "body { color: #4A4A4A; background: #101819; } #preferencesBtn { background: white; } #mynovelreader-content img { background-color: #c0c0c0; }";
  2993.  
  2994. UI.skins["橙色背景".uiTrans()] = "body { color: #24272c; background-color: #FEF0E1; }";
  2995. UI.skins["绿色背景".uiTrans()] = "body { color: black; background-color: #d8e2c8; }";
  2996. UI.skins["绿色背景2".uiTrans()] = "body { color: black; background-color: #CCE8CF; }";
  2997. UI.skins["蓝色背景".uiTrans()] = "body { color: black; background-color: #E7F4FE; }";
  2998. UI.skins["棕黄背景".uiTrans()] = "body { color: black; background-color: #C2A886; }";
  2999. UI.skins["经典皮肤".uiTrans()] = "body { color: black; background-color: #EAEAEE; } .title { background-color: #f0f0f0; }";
  3000.  
  3001.  
  3002. var fontawesomeWoff = GM_getResourceURL('fontawesomeWoff');
  3003. if (!fontawesomeWoff || fontawesomeWoff.length < 10) {
  3004. fontawesomeWoff = "http://libs.baidu.com/fontawesome/4.0.3/fonts/fontawesome-webfont.woff?v=4.0.3";
  3005. } else if (isChrome) {
  3006. fontawesomeWoff = "data:font/woff;charset=utf-8;base64," + fontawesomeWoff;
  3007. }
  3008.  
  3009. var Res = {
  3010. CSS_MAIN: '@font-face {\n font-family: "FontAwesome";\n src: url({fontawesomeWoff});\n font-weight: normal;\n font-style: normal;\n}\nbody > a { display:none !important; }\n.hidden {\n display: none;\n}\n.quiet-mode {\n display: none;\n}\nbody {\n background: #F3F2EE;\n color: #1F0909;\n padding: 0px;\n margin: 0px;\n font-family: "Microsoft YaHei UI", 微软雅黑, 新宋体, 宋体, arial;\n}\na { color: #065488; }\na:link { text-decoration: none; }\n#mynovelreader-content {\n width: {content_width};\n font-size: {font_size};\n font-family: {font_family};\n line-height: {text_line_height};\n margin-left:auto;\n margin-right:auto;\n padding-bottom: 15px;\n}\narticle {\n margin-top: 55px;\n word-wrap: break-word;\n}\narticle h1 {\n clear: both;\n line-height: 50px;\n font-size: {title_font_size};\n font-weight: normal;\n margin: 25px -20px;\n padding: 0 20px 10px;\n border-bottom: 1px solid rgba(0,0,0,.25);\n font-weight: normal;\n text-transform: none;\n}\n.chapter-footer-nav {\n text-align:center;\n font-size:0.9em;\n margin:-10px 0px 30px 0px;\n}\n#loading {\n color: white;\n text-align: center;\n font: 12px "微软雅黑", "宋体", "Times New Roman", "Verdana";\n margin-top: 20px;\n margin-left: auto;\n margin-right: auto;\n width: 376px;\n height: 32px;\n line-height: 32px;\n border-radius: 20px;\n border: 1px solid #666;\n background-color: #333;\n}\n#loading img {\n vertical-align: middle;\n}\n#loading a {\n color: white;\n}\n#preferencesBtn{\n position: fixed;\n top: 10px;\n right: 10px;\n z-index: 1597;\n}\n#alert {\n position: fixed;\n z-index: 100;\n float: auto;\n width: auto;\n height: auto;\n top: 10px;\n left: 500px;\n background: rgba(215, 240, 253, 0.65);\n color: #2d7091;\n border: 1px solid rgba(45,112,145,0.3);\n border-radius: 4px;\n text-shadow: 0 1px 0 #fff;\n}\n#alert p {\n font-size: 13px;\n margin: 6px;\n}\nimg.blockImage {clear: both;float: none;display: block;margin-left: auto;margin-right: auto;}\n#menu-bar {\n border: solid rgba(0, 100, 255, .9);\n border-width: 3px 2px 3px 0px;\n position: fixed;\n left: 0px;\n top: 40%;\n height: 100px;\n width: 2px;\n z-index: 199;\n {menu-bar-hidden}\n}\n#menu-bar { \n top: 0px;\n height: 100%;\n width: 1px;\n background: transparent;\n border: none;\n}\n#menu {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 100;\n width: 270px;\n max-width: 100%;\n background: #333;\n overflow-y: auto;\n}\n#menu:after {\n content: "";\n display: block;\n position: absolute;\n top: 46px;\n bottom: 0;\n right: 0;\n width: 1px;\n background: rgba(0,0,0,0.6);\n box-shadow: 0 0 5px 2px rgba(0,0,0,0.6);\n}\n#header{\n color: #777;\n margin-top: 0;\n border-top: 1px solid rgba(0,0,0,0.3);\n background: #404040;\n box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);\n text-shadow: 0 1px 0 rgba(0,0,0,0.5);\n padding: 10px 12px;\n text-transform: uppercase;\n font-weight: bold;\n font-size: 20px;\n}\n#header a {\n color: #777777;\n}\n#divider {\n position: relative;\n z-index: 300;\n border-top: 1px solid rgba(255,255,255,0.01);\n border-bottom: 1px solid rgba(0,0,0,0.3);\n margin: 0;\n height: 4px;\n background: rgba(0,0,0,0.2);\n box-shadow: 0 1px 0 rgba(255,255,255,0.05), inset 0 1px 3px rgba(0,0,0,0.3);\n}\n#chapter-list {\n position: relative;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 200;\n margin: 0;\n padding: 0;\n cursor: pointer;\n list-style: none;\n overflow-y: auto;\n}\n.chapter {\n list-style: none;\n}\n.chapter:last-child {\n border-bottom: 1px solid rgba(0,0,0,0.3);\n box-shadow: 0 1px 0 rgba(255,255,255,0.05);\n}\n.chapter div {\n color: #ccc;\n font-size: 15px;\n padding: 8px 20px;\n border-top: 1px solid rgba(0,0,0,0.3);\n box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);\n text-shadow: 0 1px 0 rgba(0,0,0,0.5);\n display: block;\n text-decoration: none;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n cursor: pointer;\n}\n.chapter div:before {\n content: "\\f105";\n width: 20px;\n margin-left: -10px;\n float: left;\n font-family: "FontAwesome" !important;\n text-align: center;\n}\n.chapter div:hover {\n background: #404040;\n color: #fff;\n outline: 0;\n}\n.chapter.active div {\n background: #1a1a1a;\n color: #fff;\n font-size: 16px;\n box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);\n}\n::-webkit-scrollbar {\n height: 9px !important;\n width: 9px !important;\n}\n::-webkit-scrollbar-thumb {\n background-color: #7D7D7D !important;\n border-radius: 3px !important;\n}\n::-webkit-scrollbar-track-piece {\n background-color: rgba(0,0,0,.25) !important;\n}'
  3011. .replace('{fontawesomeWoff}', fontawesomeWoff),
  3012.  
  3013. preferencesHTML: '<form id="preferences" name="preferences">\n <div id="setting_table1">\n <span id="top-buttons">\n <input title="部分选项需要刷新页面才能生效" id="save_button" value="√ 确认" type="button">\n <input title="取消本次设定,所有选项还原" id="close_button" value="X 取消" type="button">\n </span>\n <div class="form-row">\n <label>\n 界面语言<select id="lang">\n </select>\n </label>\n <label title="将小说网页文本转换为繁体。\\n\\n注意:内置的繁简转换表,只收录了简单的单字转换,启用本功能后,如有错误转换的情形,请利用脚本的自订字词取代规则来修正。\\n例如:「千里之外」,会错误转换成「千里之外」,你可以加入规则「千里之外=千里之外」来自行修正。">\n <input type="checkbox" id="enable-cn2tw" name="enable-cn2tw"/>网页:转繁体\n </label>\n <label id="quietMode" class="right" title="隐藏其他,只保留正文,适用于全屏状态下">\n <input class="key" type="button" id="quietModeKey"/>安静模式\n </label>\n </div>\n <div class="form-row">\n <label title="不影响 booklink.me 的启用">\n <input type="checkbox" id="disable-auto-launch" name="disable-auto-launch"/>强制手动启用\n </label>\n <label title="booklink.me 点击的网站强制启用">\n <input type="checkbox" id="booklink-enable" name="booklink-enable"/>booklink 自动启用\n </label>\n <label>\n <input type="checkbox" id="debug" name="debug"/>调试模式\n </label>\n <a href="https://greasyfork.org/scripts/292-my-novel-reader/feedback" target="_blank">反馈地址</a>\n </div>\n <div class="form-row">\n <label title="图片章节用夜间模式没法看,这个选项在启动时会自动切换到缺省皮肤">\n <input type="checkbox" id="pic-nightmode-check" name="pic-nightmode-check"/>\n 夜间模式的图片章节检测\n </label>\n <label>\n <input type="checkbox" id="copyCurTitle"/>\n 打开目录复制当前标题\n </label>\n </div>\n <div class="form-row">\n <label title="通过快捷键切换">\n <input type="checkbox" id="hide-menu-list"/>隐藏左侧章节列表\n </label>\n <label>\n <input type="checkbox" id="hide-footer-nav"/>隐藏底部导航栏\n </label>\n <label class="right" title="导出之后的所有章节">\n <input type="button" id="saveAsTxt" value="存为 txt(测试)" />\n </label>\n </div>\n <div class="form-row">\n <label>\n 左侧导航栏切换快捷键:\n </label>\n <input class="key" type="button" id="setHideMenuListKey" />\n <label title="通过快捷键切换或在 Greasemonkey 用户脚本命令处打开设置窗口">\n <input type="checkbox" id="hide-preferences-button"/>隐藏设置按钮\n </label>\n <input class="key" type="button" id="openPreferencesKey"/>\n </div>\n <div class="form-row">\n <label>\n 距离底部\n <input type="textbox" id="remain-height" name="remain-height" size="5"/>\n px 加载下一页\n </label>\n <label>\n <input type="checkbox" id="add-nextpage-to-history"/>添加下一页到历史记录\n </label>\n <label>\n <input type="checkbox" id="enable-dblclick-pause"/>双击暂停翻页\n </label>\n </div>\n <div class="form-row">\n <label>\n <select id="skin">\n </select>\n </label>\n <label>\n 字体\n <input type="textbox" id="font-family" style="min-width:200px;"/>\n </label>\n <br/><br/>\n <label>\n 字体大小\n <input type="textbox" id="font-size" name="font-size" size="6"/>\n </label>\n <label>\n 行高\n <input type="textbox" id="text_line_height" size="6"/>\n </label>\n <label>\n 行宽\n <input type="textbox" id="content_width" size="6"/>\n </label>\n </div>\n <div class="form-row">\n <label title="把一大块未分段的内容文本按照句号分段">\n <input type="checkbox" id="split_content"/>对一坨内容进行强制分段\n </label>\n <label>\n <input type="checkbox" id="scroll_animate"/>章节滚动效果\n </label>\n </div>\n <div class="form-row">\n <div class="prefs_title">自定义样式</div>\n <textarea id="extra_css" class="prefs_textarea" placeholder="自定义样式"></textarea>\n </div>\n </div>\n <div id="setting_table2">\n <div class="form-row" title="详见脚本代码的 Rule.specialSite">\n <div class="prefs_title">自定义站点规则</div>\n <textarea id="custom_siteinfo" class="prefs_textarea" placeholder="自定义站点规则" />\n </div>\n <div class="form-row" title="一行一个,每行的第一个 = 为分隔符。\\n保存后生效">\n <div class="prefs_title">自定义替换规则</div>\n <textarea id="custom_replace_rules" class="prefs_textarea" placeholder="b[āà]ng=棒" />\n </div>\n </div>\n</form>'
  3014. .uiTrans().replace(/\\n/g, '\n'),
  3015.  
  3016. preferencesCSS: '.body {\n color:#333;\n margin: 0 auto;\n background: white;\n padding: 10px;\n height: 420px;\n overflow-y: auto;\n }\n #top-buttons {\n background: none repeat scroll 0% 0% rgb(255, 255, 255);\n display: block;\n position: absolute;\n top: -35px;\n border-right: 12px solid rgb(224, 224, 224);\n border-top: 12px solid rgb(224, 224, 224);\n border-left: 12px solid rgb(224, 224, 224);\n text-align: center;\n }\n input {\n font-size: 12px;\n margin-right: 3px;\n vertical-align: middle;\n }\n .form-row {\n overflow: hidden;\n padding: 8px 12px;\n margin-top: 3px;\n font-size: 11px;\n }\n .form-row label {\n padding-right: 10px;\n }\n .form-row input {\n vertical-align: middle;\n margin-top: 0px;\n }\n textarea, .form-row input {\n padding: 2px 4px;\n border: 1px solid #e5e5e5;\n background: #fff;\n border-radius: 4px;\n color: #666;\n -webkit-transition: all linear .2s;\n transition: all linear .2s;\n }\n textarea {\n width: 100%;\n overflow: auto;\n vertical-align: top;\n }\n textarea:focus, input:focus {\n border-color: #99baca;\n outline: 0;\n background: #f5fbfe;\n color: #666;\n }\n .prefs_title {\n font-size: 12px;\n font-weight: bold;\n }\n .prefs_textarea {\n font-size: 12px;\n margin-top: 5px;\n height: 100px;\n }\n .right {\n float: right;\n }',
  3017. };
  3018.  
  3019.  
  3020. function Parser(){
  3021. this.init.apply(this, arguments);
  3022. }
  3023.  
  3024. Parser.prototype = {
  3025. constructor: Parser,
  3026. get contentTxt() { // callback 才有用
  3027. var text = $('<div>').html(this.content).text().trim();
  3028.  
  3029. // 解决第二个段落和第一个锻炼合在一起的问题
  3030. text = text.replace(/([^\n])  /, '$1\n  ');
  3031.  
  3032. return text;
  3033. },
  3034.  
  3035. init: function (info, doc, curPageUrl) {
  3036. this.info = info || {};
  3037. this.doc = doc;
  3038. this.$doc = $(doc);
  3039. this.curPageUrl = curPageUrl || doc.URL;
  3040. this._curPageHost = getUrlHost(this.curPageUrl); // 当前页的 host,后面用到
  3041.  
  3042. // 设置初始值
  3043. this.isTheEnd = false;
  3044. this.isSection = false;
  3045. },
  3046. applyPatch: function(){
  3047. var contentPatch = this.info.contentPatch;
  3048. if(contentPatch){
  3049. try {
  3050. contentPatch.call(this, this.$doc);
  3051. C.log("Apply Content Patch Success.");
  3052. } catch (e) {
  3053. C.log("Error: Content Patch Error!", e);
  3054. }
  3055. }
  3056. },
  3057. getAll: function(callback){
  3058. var self = this;
  3059.  
  3060. C.debug('开始解析页面');
  3061.  
  3062. this.applyPatch();
  3063.  
  3064. var endFn = function(data) {
  3065. if (data) {
  3066. var div;
  3067. if (data.content) {
  3068. div = $('<div id="content"></div>').html(data.content);
  3069. } else if (data.html) {
  3070. div = $('<div></div>').html(data.html);
  3071. }
  3072.  
  3073. self.$doc.find('body').prepend(div);
  3074. }
  3075.  
  3076. self.parse();
  3077. callback(self);
  3078. };
  3079.  
  3080. if (!this.hasContent() && this.info.getContent) {
  3081. C.log('开始 info.getContent')
  3082. this.info.getContent.call(this, this.$doc, endFn);
  3083. } else {
  3084. // 特殊处理,例如起点
  3085. var ajaxScript = this.$doc.find('.' + READER_AJAX);
  3086. if (ajaxScript.length > 0) {
  3087. var url = ajaxScript.attr('src');
  3088. if(!url) return;
  3089. var charset = ajaxScript.attr('charset') || 'utf-8';
  3090.  
  3091. C.log('Ajax 获取内容: ', url, ". charset=" + charset);
  3092.  
  3093. var reqObj = {
  3094. url: url,
  3095. method: "GET",
  3096. overrideMimeType: "text/html;charset=" + charset,
  3097. headers: {},
  3098. onload: function(res){
  3099. var text = res.responseText;
  3100. text = text.replace(/document.write(ln)?\('/, "")
  3101. .replace("');", "")
  3102. .replace(/[\n\r]+/g, '</p><p>');
  3103.  
  3104. endFn({
  3105. content: text
  3106. });
  3107. }
  3108. };
  3109.  
  3110. // Jixun: Allow post data
  3111. var postData = ajaxScript.data('post');
  3112.  
  3113. if (postData) {
  3114. reqObj.method = 'POST';
  3115. reqObj.data = $.param(postData);
  3116. reqObj.headers['Content-Type'] = 'application/x-www-form-urlencoded';
  3117. }
  3118.  
  3119. GM_xmlhttpRequest(reqObj);
  3120. } else {
  3121. endFn();
  3122. }
  3123. }
  3124.  
  3125. return this;
  3126. },
  3127. parse: function() {
  3128. C.group('开始获取链接');
  3129. this.getPrevUrl();
  3130. this.getIndexUrl();
  3131. this.getNextUrl();
  3132. C.groupEnd();
  3133.  
  3134. C.group('开始获取标题');
  3135. this.getTitles();
  3136. C.groupEnd();
  3137.  
  3138. this.getContent();
  3139. },
  3140.  
  3141. hasContent: function() {
  3142. var $content;
  3143.  
  3144. // var $ajaxScript = this.$doc.find('.' + READER_AJAX);
  3145. // if ($ajaxScript.length > 0) {
  3146. // return true;
  3147. // }
  3148.  
  3149. if(this.info.contentSelector){
  3150. $content = this.$doc.find(this.info.contentSelector);
  3151. }
  3152.  
  3153. if (!$content || !$content.length) {
  3154. // 按照顺序选取
  3155. var selectors = Rule.contentSelectors;
  3156. for(var i = 0, l = selectors.length; i < l; i++){
  3157. $content = this.$doc.find(selectors[i]);
  3158. if($content.length){
  3159. C.log("自动查找内容选择器: " + selectors[i]);
  3160. break;
  3161. }
  3162. }
  3163. }
  3164.  
  3165. this.$content = $content;
  3166. // C.debug($content);
  3167.  
  3168. return $content.size() > 0;
  3169. },
  3170. // 获取书名和章节标题
  3171. getTitles: function(){
  3172. var info = this.info,
  3173. chapterTitle,
  3174. bookTitle,
  3175. docTitle = this.$doc.find("title").text();
  3176.  
  3177. // 获取章节标题
  3178. if (info.titleReg){
  3179. var matches = docTitle.match(toRE(info.titleReg, 'i'));
  3180. if(matches && matches.length == 3){
  3181. var titlePos = ( info.titlePos || 0 ) + 1,
  3182. chapterPos = (titlePos == 1) ? 2 : 1;
  3183. bookTitle = matches[titlePos].trim();
  3184. chapterTitle = matches[chapterPos].trim();
  3185. }
  3186.  
  3187. C.log("TitleReg:", info.titleReg, matches);
  3188. } else {
  3189. chapterTitle = this.getTitleFromInfo(info.titleSelector);
  3190.  
  3191. bookTitle = this.getTitleFromInfo(info.bookTitleSelector);
  3192. }
  3193.  
  3194. if(!chapterTitle){
  3195. chapterTitle = this.autoGetChapterTitle(this.doc);
  3196. }
  3197.  
  3198. if (!bookTitle) {
  3199. bookTitle = this.$doc.find(Rule.bookTitleSelector).text();
  3200. }
  3201.  
  3202. // 标题间增加一个空格,不准确,已注释
  3203. chapterTitle = chapterTitle
  3204. .replace(Rule.titleReplace, "")
  3205. .trim();
  3206. // .replace(/(第?\S+?[章节卷回])(.*)/, "$1 $2");
  3207.  
  3208. // if (info.trimBookTitle !== false) {
  3209. // chapterTitle = chapterTitle.replace(bookTitle, '').trim();
  3210. // }
  3211.  
  3212. bookTitle = bookTitle.replace(/最新章节$/, '');
  3213.  
  3214. docTitle = bookTitle ?
  3215. bookTitle + ' - ' + chapterTitle :
  3216. docTitle;
  3217.  
  3218. if (Config.cn2tw) {
  3219. bookTitle = this.convert2tw(bookTitle);
  3220. chapterTitle = this.convert2tw(chapterTitle);
  3221. docTitle = this.convert2tw(docTitle);
  3222. }
  3223.  
  3224. this.bookTitle = bookTitle || '目录';
  3225. this.chapterTitle = chapterTitle;
  3226. this.docTitle = docTitle;
  3227.  
  3228. C.log("Book Title: " + this.bookTitle);
  3229. C.log("Chapter Title: " + this.chapterTitle);
  3230. C.log("Document Title: " + this.docTitle);
  3231. },
  3232. getTitleFromInfo: function(selectorOrArray) {
  3233. var title = '';
  3234. if (!selectorOrArray) {
  3235. return title;
  3236. }
  3237.  
  3238. var selector,
  3239. replace;
  3240.  
  3241. if (_.isArray(selectorOrArray)) {
  3242. selector = selectorOrArray[0];
  3243. replace = selectorOrArray[1];
  3244. } else {
  3245. selector = selectorOrArray;
  3246. }
  3247.  
  3248. title = this.$doc.find(selector).remove().text().trim();
  3249.  
  3250. if (replace) {
  3251. title = title.replace(toRE(replace), '');
  3252. }
  3253.  
  3254. return title;
  3255. },
  3256. // 智能获取章节标题
  3257. autoGetChapterTitle: function (document) {
  3258. var
  3259. _main_selector = "h1, h2, h3",
  3260. _second_selector = "#TextTitle, #title, .ChapterName, #lbChapterName, div.h1",
  3261. _positive_regexp = Rule.titleRegExp,
  3262. // _positive_regexp = /第?\S+[章节卷回]|\d{2,4}/,
  3263. // _negative_regexp = /[上前下后][一]?[页张个篇章节步]/,
  3264. _title_remove_regexp = /最新章节|书书网/,
  3265. $doc = $(document),
  3266. _document_title = document.title ? document.title : $doc.find("title").text(),
  3267. _search_document_title = ' ' + _document_title.replace(/\s+/gi, ' ') + ' '
  3268. ;
  3269.  
  3270. var _headings = $doc.find(_main_selector);
  3271. // 加上 second selector 并去除包含的
  3272. $doc.find(_second_selector).each(function(){
  3273. if($(this).find(_main_selector).length === 0){
  3274. _headings.push(this);
  3275. }
  3276. });
  3277.  
  3278. var possibleTitles = {},
  3279. _heading_text;
  3280.  
  3281. C.groupCollapsed('自动查找章节标题');
  3282.  
  3283. $(_headings).each(function(){
  3284. var _heading = this,
  3285. _heading_text = _heading.textContent.trim();
  3286.  
  3287. if (_heading_text in possibleTitles) {
  3288. return;
  3289. }
  3290.  
  3291. C.group('开始计算 "' + _heading_text + '" 的得分');
  3292.  
  3293. // h1 为 1, h2 为 2
  3294. var
  3295. nodeNum = parseInt(_heading.nodeName.slice(1), 10) || 10,
  3296. score = 10 / nodeNum,
  3297. _heading_words = _heading_text.replace(/\s+/g, " ").split(" "),
  3298. _matched_words = ""
  3299. ;
  3300.  
  3301. C.log("初始得分:" + score);
  3302.  
  3303. // 后面这种是特殊的判断
  3304. if (_positive_regexp.test(_heading_text) || /\d{2,4}/.test(_heading_text)) {
  3305. score += 50;
  3306. }
  3307. // if(_negative_regexp.test(_heading_text)){
  3308. // score -= 100;
  3309. // }
  3310.  
  3311. C.log("符合正则计算后得分:" + score);
  3312.  
  3313. // count words present in title
  3314. for (var j = 0, _j = _heading_words.length; j < _j; j++) {
  3315. if (_search_document_title.indexOf(_heading_words[j]) > -1) {
  3316. _matched_words += _heading_words[j] + ' ';
  3317. }
  3318. }
  3319. score += _matched_words.length * 1.5;
  3320.  
  3321. C.log("跟页面标题比较后得分:" + score);
  3322.  
  3323. var _font_size_text = "",
  3324. _font_size_add_score = 0,
  3325. _heading_style = window.getComputedStyle(_heading, null);
  3326. if(_heading_style){
  3327. _font_size_text = _heading_style.getPropertyValue("font-size") || 0;
  3328. _font_size_add_score = parseInt(_font_size_text, 10) * 1.5;
  3329. }
  3330.  
  3331. score += _font_size_add_score;
  3332.  
  3333. C.log("计算大小后得分:" + score);
  3334.  
  3335. possibleTitles[_heading_text] = score;
  3336.  
  3337. C.groupEnd();
  3338. });
  3339.  
  3340. // 找到分数最高的值
  3341. var topScoreTitle,
  3342. score_tmp = 0;
  3343. for (_heading_text in possibleTitles) {
  3344. if (possibleTitles[_heading_text] > score_tmp) {
  3345. topScoreTitle = _heading_text;
  3346. score_tmp = possibleTitles[_heading_text];
  3347. }
  3348. }
  3349.  
  3350. var curTitle = topScoreTitle;
  3351. if (!curTitle) {
  3352. curTitle = _document_title;
  3353.  
  3354. // 下面的正则从
  3355. // Firefox-Firefox浏览器论坛-卡饭论坛 - 互助分享 - 大气谦和!
  3356. // 变为
  3357. // Firefox-Firefox浏览器论坛-卡饭论坛
  3358. curTitle = curTitle.replace(/\s-\s.*/i, "")
  3359. .replace(/_[^\[\]【】]+$/, "");
  3360. curTitle = curTitle.trim();
  3361. curTitle = curTitle.replace(_title_remove_regexp, '');
  3362. }
  3363.  
  3364. curTitle = curTitle.replace(Rule.titleReplace, "");
  3365.  
  3366. C.groupEnd();
  3367.  
  3368. return curTitle;
  3369. },
  3370.  
  3371. // 获取和处理内容
  3372. getContent: function(){
  3373. var self = this;
  3374.  
  3375. this.hasContent();
  3376.  
  3377. if (this.$content.size() <= 0) {
  3378. // callback(this);
  3379. console.error('没有找到内容', this.$doc);
  3380. return;
  3381. }
  3382.  
  3383. this.content = this.handleContentText(this.$content.html(), this.info);
  3384. },
  3385. handleContentText: function(text, info){
  3386. if(!text) return null;
  3387.  
  3388. // 贴吧的内容处理比较耗时间
  3389. C.group('开始内容处理');
  3390. C.time('内容处理');
  3391.  
  3392. var contentHandle = (typeof(info.contentHandle) == 'undefined') ? true : info.contentHandle;
  3393.  
  3394. // 拼音字、屏蔽字修复
  3395. if(contentHandle){
  3396. text = this.replaceHtml(text);
  3397. }
  3398.  
  3399. /* Turn all double br's into p's */
  3400. text = text.replace(Rule.replaceBrs, '</p>\n<p>');
  3401. text = text.replace(/<\/p><p>/g, "</p>\n<p>");
  3402.  
  3403. // GM_setClipboard(text);
  3404.  
  3405. // 移除文字广告等
  3406. text = this.replaceText(text, Rule.replaceAll);
  3407.  
  3408. // 去除内容中的标题
  3409. if(this.chapterTitle && Rule.titleRegExp.test(this.chapterTitle)){
  3410. try {
  3411. var reg = toReStr(this.chapterTitle).replace(/\s+/g, '\\s*');
  3412. reg = new RegExp(reg, 'ig');
  3413. text = text.replace(reg, "");
  3414. C.log('去除内容中的标题', reg);
  3415. } catch(e) {
  3416. console.error(e);
  3417. }
  3418. }
  3419.  
  3420. if (this.bookTitle) {
  3421. var regStr = '(' + toReStr(this.bookTitle) + '\\d*章)'
  3422. text = text.replace(new RegExp(regStr, 'ig'), "");
  3423. }
  3424.  
  3425. if (info.contentReplace) {
  3426. text = this.replaceText(text, info.contentReplace);
  3427. }
  3428.  
  3429. if (Config.cn2tw) {
  3430. text = this.convert2tw(text);
  3431. }
  3432.  
  3433. try {
  3434. text = this.contentCustomReplace(text);
  3435. } catch(ex) {
  3436. console.error('自定义替换错误', ex);
  3437. }
  3438.  
  3439. // 采用 DOM 方式进行处理
  3440. var $div = $("<div>").html(text);
  3441.  
  3442. // contentRemove
  3443. $div.find(Rule.contentRemove).remove();
  3444. if(info.contentRemove){
  3445. $div.find(info.contentRemove).remove();
  3446. }
  3447.  
  3448. // 给独立的文本加上 p
  3449. $div.contents().filter(function() {
  3450. return this.nodeType == 3 &&
  3451. this.textContent != '\n' &&
  3452. (!this.nextElementSibling || this.nextElementSibling.nodeName != 'A') &&
  3453. (!this.previousElementSibling || this.previousElementSibling.nodeName != 'A');
  3454. }).wrap('<p>');
  3455.  
  3456. // 删除无效的 p,排除对大块文本的判断
  3457. $div.find('p').filter(function() {
  3458. var $this = $(this);
  3459. if ($this.find('img').size()) // 排除有图片的
  3460. return false;
  3461.  
  3462. // 有效文本(排除注释、换行符、空白)个数为 0
  3463. return $this.contents().filter(function() {
  3464. return this.nodeType != 8 &&
  3465. !this.textContent.match(/^\s*$/);
  3466. }).size() == 0;
  3467. }).remove();
  3468.  
  3469. // 把一大块的文本分段
  3470. if (Config.split_content) {
  3471. var $p = $div.find('p'),
  3472. $newP;
  3473. if ($p.length == 0 ) {
  3474. $newP = $div;
  3475. } else if ($p.length == 1) {
  3476. $newP = $p;
  3477. }
  3478.  
  3479. if ($newP) {
  3480. $newP.replaceWith('<p>' + this.splitContent($newP.html()).join('</p>\n<p>') + '</p>');
  3481. }
  3482. }
  3483.  
  3484. if(contentHandle){
  3485. $div.filter('br').remove();
  3486.  
  3487. $div.find('*').removeAttr('style');
  3488. }
  3489.  
  3490. $div.find('p').removeAttr('class');
  3491.  
  3492. // 图片居中,所有图像?
  3493. // if(info.fixImage){
  3494. // $div.find("img").each(function(){
  3495. // this.className += " blockImage";
  3496. // });
  3497. // }
  3498.  
  3499. text = $div.html();
  3500.  
  3501. // 修复第一行可能是空的情况
  3502. text = text.replace(/(?:\s|&nbsp;)+<p>/, "<p>");
  3503.  
  3504. // 修复当行就一个字符的
  3505. text = text.replace(/<\/p><p>([。])/, "$1");
  3506.  
  3507. if(config.paragraphBlank){
  3508. text = text.replace(/<p>(?:\s|&nbsp;)+/g, "<p>")
  3509. .replace(/<p>/g, "<p>  ");
  3510. }
  3511.  
  3512. // 删除空白的、单个字符的 p
  3513. text = text.replace(Rule.removeLineRegExp, "");
  3514.  
  3515. C.timeEnd('内容处理');
  3516. C.groupEnd();
  3517.  
  3518. return text;
  3519. },
  3520. replaceHtml: function(text, replaceRule) { // replaceRule 给“自定义替换规则直接生效”用
  3521. if (!replaceRule) {
  3522. replaceRule = Rule.replace;
  3523. }
  3524.  
  3525. // 先提取出 img
  3526. var imgs = {};
  3527. var i = 0;
  3528. text = text.replace(/<(img|a)[^>]*>/g, function(img){
  3529. imgs[i] = img;
  3530. return "{" + (i++) + "}";
  3531. });
  3532.  
  3533. // 修正拼音字等
  3534. text = this.contentReplacements(text, replaceRule);
  3535.  
  3536. // 还原图片
  3537. text = $.nano(text, imgs);
  3538.  
  3539. return text;
  3540. },
  3541. contentReplacements: function (text, rule) {
  3542. if (!text) return text;
  3543.  
  3544. for (var key in rule) {
  3545. text = text.replace(toRE(key, "ig"), rule[key]);
  3546. }
  3547. return text;
  3548. },
  3549. replaceText: function(text, rule){
  3550. var self = this;
  3551. switch(true) {
  3552. case _.isRegExp(rule):
  3553. text = text.replace(rule, '');
  3554. break;
  3555. case _.isString(rule):
  3556. // 还原简写
  3557. _.each(CHAR_ALIAS, function(value, key) {
  3558. rule = rule.replace(key, value);
  3559. });
  3560. var regexp = new RegExp(rule, 'ig');
  3561. text = text.replace(regexp, '');
  3562. break;
  3563. case _.isArray(rule):
  3564. rule.forEach(function(r){
  3565. text = self.replaceText(text, r);
  3566. });
  3567. break;
  3568. case _.isObject(rule):
  3569. var key;
  3570. for(key in rule){
  3571. text = text.replace(new RegExp(key, "ig"), rule[key]);
  3572. }
  3573. break;
  3574. }
  3575. return text;
  3576. },
  3577. convert2tw: function (text) {
  3578. if (!text) return text;
  3579.  
  3580. var ii, len, str;
  3581. str = text.split("");
  3582. len = str.length;
  3583. for (ii = 0; ii < len; ii++) {
  3584. str[ii] = cn2tw[str[ii]] || str[ii];
  3585. }
  3586.  
  3587. str = str.join("");
  3588.  
  3589. return str;
  3590. },
  3591. contentCustomReplace: function (text) {
  3592. if (!text) return text;
  3593.  
  3594. for (var key in Rule.customReplace) {
  3595. text = text.replace(new RegExp(key, 'ig'), Rule.customReplace[key]);
  3596. }
  3597. return text;
  3598. },
  3599. splitContent: function (text) { // 有些章节整个都集中在一起,没有分段,这个函数用于简易分段
  3600. if (text.indexOf('。') == -1) {
  3601. return [text];
  3602. }
  3603.  
  3604. var hasMark = false,
  3605. lines = []
  3606. charCotainer = [];
  3607.  
  3608. text.split('').forEach(function(c) {
  3609. charCotainer.push(c);
  3610.  
  3611. if (c == '“') {
  3612. hasMark = true;
  3613. } else if (c == '”') {
  3614. hasMark = false;
  3615. } else if (c == '。' && !hasMark) {
  3616. lines.push(charCotainer.join(''));
  3617. charCotainer = [];
  3618. }
  3619. });
  3620.  
  3621. return lines;
  3622. },
  3623.  
  3624. // 获取上下页及目录页链接
  3625. getPrevUrl: function(){
  3626. var url = '',
  3627. link, selector;
  3628.  
  3629. if (this.info.prevSelector === false) {
  3630. this.prevUrl = url;
  3631. return url;
  3632. }
  3633.  
  3634. if (this.info.prevUrl && _.isFunction(this.info.prevUrl)) {
  3635. url = this.info.prevUrl(this.$doc);
  3636. url = this.checkLinks(url);
  3637. }
  3638.  
  3639. if (!url) {
  3640. selector = this.info.prevSelector || Rule.prevSelector;
  3641. link = this.$doc.find(selector);
  3642. if(link.length){
  3643. url = this.checkLinks(link);
  3644. }
  3645. }
  3646.  
  3647. if (url) {
  3648. C.log("找到上一页链接: " + url);
  3649. } else {
  3650. C.log("无法找到上一页链接");
  3651. }
  3652.  
  3653. this.prevUrl = url || '';
  3654. return url;
  3655. },
  3656. getIndexUrl: function(){
  3657. var url = '',
  3658. link;
  3659.  
  3660. if (this.info.indexSelector === false) {
  3661. this.indexUrl = url;
  3662. return url;
  3663. }
  3664.  
  3665. if (this.info.indexSelector && _.isFunction(this.info.indexSelector)) {
  3666. url = this.info.indexSelector(this.$doc);
  3667. } else if(this.info.indexSelector){
  3668. link = this.$doc.find(this.info.indexSelector);
  3669. } else {
  3670. var selectors = Rule.indexSelectors;
  3671. var _indexLink;
  3672. // 按照顺序选取目录链接
  3673. for(var i = 0, l = selectors.length; i < l; i++){
  3674. _indexLink = this.$doc.find(selectors[i]);
  3675. if(_indexLink.length > 0){
  3676. link = _indexLink;
  3677. break;
  3678. }
  3679. }
  3680. }
  3681.  
  3682. if(link && link.length){
  3683. url = this.checkLinks(link);
  3684. C.log("找到目录链接: " + url);
  3685. }
  3686.  
  3687. if (!url) {
  3688. C.log("无法找到目录链接.");
  3689. }
  3690.  
  3691. this.indexUrl = url;
  3692. return url;
  3693. },
  3694. getNextUrl: function(){
  3695. var url = '',
  3696. link,
  3697. selector = this.info.nextSelector || Rule.nextSelector;
  3698.  
  3699. if (this.info.nextSelector === false) {
  3700. this.nextUrl = url;
  3701. return url;
  3702. }
  3703.  
  3704. if (this.info.nextUrl && _.isFunction(this.info.nextUrl)) {
  3705. url = this.info.nextUrl(this.$doc);
  3706. url = this.checkLinks(url);
  3707. }
  3708.  
  3709. if (!url) {
  3710. link = this.$doc.find(selector);
  3711. if(link.length){
  3712. url = this.checkLinks(link);
  3713. }
  3714. }
  3715.  
  3716. if (url) {
  3717. C.log("找到下一页链接: " + url);
  3718. } else {
  3719. C.log("无法找到下一页链接");
  3720. }
  3721.  
  3722. this.nextUrl = url || '';
  3723. this.isTheEnd = !this.checkNextUrl(url);
  3724. if(this.isTheEnd){
  3725. this.theEndColor = config.end_color;
  3726. }
  3727.  
  3728. return url;
  3729. },
  3730. checkNextUrl: function(url){
  3731. if (this.info.checkSection) {
  3732. if (/\/\d+_\d+\.html$/.test(this.curPageUrl)) {
  3733. this.isSection = true;
  3734. if(url == this.indexUrl){
  3735. return false;
  3736. }else{
  3737. return true;
  3738. }
  3739. }
  3740. }
  3741.  
  3742. switch(true){
  3743. case url === '':
  3744. case Rule.nextUrlIgnore.some(function(re) { return toRE(re).test(url) }):
  3745. case url === this.indexUrl:
  3746. case url === this.prevUrl:
  3747. case url === this.curPageUrl:
  3748. case Rule.nextUrlCompare.test(this.prevUrl) && !Rule.nextUrlCompare.test(url):
  3749. return false;
  3750. default:
  3751. return true;
  3752. }
  3753. },
  3754. checkLinks: function(links){
  3755. var self = this;
  3756. if (_.isString(links)) {
  3757. return this.getFullHref(links);
  3758. }
  3759.  
  3760. var url = "";
  3761. links && links.each(function(){
  3762. url = $(this).attr("href");
  3763. if(!url || url.indexOf("#") === 0 || url.indexOf("javascript:") === 0)
  3764. return;
  3765.  
  3766. url = self.getFullHref(this);
  3767. return false;
  3768. });
  3769.  
  3770. return url;
  3771. },
  3772. getLinkUrl: function(linkOrUrl) {
  3773. // if (linkOrUrl && )
  3774. return linkOrUrl;
  3775. },
  3776. getFullHref: function(href) {
  3777. if(!href) return '';
  3778.  
  3779. if (!_.isString(href)) {
  3780. href = href.getAttribute('href');
  3781. }
  3782.  
  3783. if (href.indexOf('http://') === 0) {
  3784. return href;
  3785. }
  3786.  
  3787. var a = this.a;
  3788. if (!a) {
  3789. this.a = a = document.createElement('a');
  3790. }
  3791. a.href = href;
  3792.  
  3793. // 检测 host 是否和 当前页的一致
  3794. if (a.host != this._curPageHost) {
  3795. a.host = this._curPageHost;
  3796. }
  3797.  
  3798. return a.href;
  3799. },
  3800. };
  3801.  
  3802.  
  3803. var App = {
  3804. isEnabled: false,
  3805. parsedPages: {},
  3806. pageNum: 1,
  3807. paused: false,
  3808. curPageUrl: location.href,
  3809. requestUrl: null,
  3810. iframe: null,
  3811. remove: [],
  3812.  
  3813. init: function() {
  3814. if (["mynovelreader-iframe", "superpreloader-iframe"].indexOf(window.name) != -1) { // 用于加载下一页的 iframe
  3815. return;
  3816. }
  3817.  
  3818. // 手动调用
  3819. var readx = function() {
  3820. // 防止 unsafeWindow cannot call: GM_getValue
  3821. setTimeout(function() {
  3822. App.launch();
  3823. }, 0);
  3824. };
  3825. try {
  3826. exportFunction(readx, unsafeWindow, {defineAs: "readx"});
  3827. } catch(ex) {
  3828. console.error('无法定义 readx 函数');
  3829. }
  3830.  
  3831.  
  3832. App.loadCustomSetting();
  3833. App.site = App.getCurSiteInfo();
  3834. var autoLaunch = App.isAutoLaunch();
  3835.  
  3836. if (autoLaunch === -1) {
  3837. return;
  3838. } else if (autoLaunch) {
  3839. if (App.site.mutationSelector) { // 特殊的启动:等待js把内容生成完毕
  3840. App.addMutationObserve(document, App.launch);
  3841. } else if (App.site.timeout) { // 延迟启动
  3842. setTimeout(App.launch, App.site.timeout);
  3843. } else { // NoScript 下 setTimeout 没用?
  3844. App.launch();
  3845. }
  3846. } else {
  3847. UI.addButton();
  3848. }
  3849. },
  3850. loadCustomSetting: function() {
  3851. var customRules;
  3852. try {
  3853. customRules = eval(Config.customSiteinfo);
  3854. } catch (e) {
  3855. console.error('载入自定义站点配置错误', e);
  3856. }
  3857. if (_.isArray(customRules)) {
  3858. Rule.customRules = customRules;
  3859. C.log('载入自定义站点规则成功', customRules);
  3860. }
  3861.  
  3862. // load custom replace rules
  3863. Rule.customReplace = Rule.parseCustomReplaceRules(Config.customReplaceRules);
  3864.  
  3865. C.log('载入自定义替换规则成功', Rule.customReplace);
  3866. },
  3867. getCurSiteInfo: function() {
  3868. var rules = Rule.customRules.concat(Rule.specialSite);
  3869. var locationHref = location.href;
  3870.  
  3871. var info = _.find(rules, function(x) {
  3872. return toRE(x.url).test(locationHref);
  3873. });
  3874. if (!info) {
  3875. info = {};
  3876. C.log("没有找到规则,尝试自动模式。");
  3877. } else {
  3878. C.log("找到规则:", info);
  3879. }
  3880. return info;
  3881. },
  3882. isAutoLaunch: function() {
  3883. var locationHref = window.location.href,
  3884. locationHost = location.host,
  3885. referrer = document.referrer;
  3886. switch (true) {
  3887. case L_getValue("mynoverlreader_disable_once") == 'true':
  3888. L_removeValue("mynoverlreader_disable_once");
  3889. return false;
  3890. // case location.hostname == 'www.fkzww.net' && !document.title.match(/网文快讯/): // 啃书只自动启用一个地方
  3891. // return false;
  3892. case Config.booklink_enable && /booklink\.me/.test(referrer):
  3893. return true;
  3894. case locationHost == 'tieba.baidu.com':
  3895. var title = $('.core_title_txt').text();
  3896. if (title.match(Rule.titleRegExp)) {
  3897. return false;
  3898. } else {
  3899. return -1;
  3900. }
  3901. case Config.getDisableAutoLaunch():
  3902. return false;
  3903. case GM_getValue("auto_enable"):
  3904. case config.soduso && /www\.sodu\.so/.test(referrer):
  3905. return true;
  3906. default:
  3907. return false;
  3908. }
  3909. },
  3910. addMutationObserve: function(doc, callback) {
  3911. var shouldAdd = false;
  3912. var $doc = $(doc);
  3913.  
  3914. if ($doc.find(App.site.contentSelector).size()) {
  3915. shouldAdd = false;
  3916. } else {
  3917. var mutationSelector = App.site.mutationSelector;
  3918. var target = $doc.find(mutationSelector)[0];
  3919. if (target) {
  3920. var childCount = App.site.mutationChildCount;
  3921. if (childCount === undefined || target.children.length <= childCount) {
  3922. shouldAdd = true;
  3923. }
  3924. }
  3925. }
  3926.  
  3927. if (shouldAdd) {
  3928. var observer = new MutationObserver(function(mutations) {
  3929. var nodeAdded = mutations.some(function(x) {
  3930. return x.addedNodes.length > 0;
  3931. });
  3932.  
  3933. if (nodeAdded) {
  3934. observer.disconnect();
  3935. callback();
  3936. }
  3937. });
  3938.  
  3939. observer.observe(target, {
  3940. childList: true
  3941. });
  3942.  
  3943. C.log("添加 MutationObserve 成功:", mutationSelector);
  3944. } else {
  3945. callback();
  3946. }
  3947. },
  3948. launch: function() {
  3949. // 只解析一次,防止多次重复解析一个页面
  3950. if (document.body && document.body.getAttribute("name") == "MyNovelReader") {
  3951. return App.toggle();
  3952. }
  3953.  
  3954. if (!App.site) {
  3955. App.site = App.getCurSiteInfo();
  3956. }
  3957.  
  3958. if (App.site.startFilter) {
  3959. try {
  3960. App.site.startFilter();
  3961. C.log('run startFilter function success');
  3962. } catch (ex) {
  3963. console.error('运行 startFilter function 错误', ex);
  3964. }
  3965. }
  3966.  
  3967. var parser = new Parser(App.site, document);
  3968. var hasContent = !!parser.hasContent();
  3969. if (hasContent) {
  3970. document.body.setAttribute("name", "MyNovelReader");
  3971. App.parsedPages[window.location.href] = true;
  3972. parser.getAll(function(parser) {
  3973. App.processPage(parser);
  3974. });
  3975. } else {
  3976. console.error("当前页面没有找到内容");
  3977. }
  3978.  
  3979. // 初始化, 取消页面限制等
  3980. if (App.site.fInit)
  3981. App.site.fInit();
  3982. },
  3983. processPage: function(parser) {
  3984. // 对 Document 进行处理
  3985. document.body.innerHTML = '';
  3986. App.prepDocument();
  3987. App.initDocument(parser);
  3988.  
  3989. // cache vars
  3990. App.$doc = $(document);
  3991. App.$menuBar = App.$doc.find("#menu-bar");
  3992. App.$menu = App.$doc.find("#menu");
  3993. App.$content = App.$doc.find("#mynovelreader-content");
  3994. App.$loading = App.$doc.find("#loading");
  3995. App.$preferencesBtn = App.$doc.find("#preferencesBtn");
  3996.  
  3997. App.$menuHeader = App.$menu.find("#chapter-list");
  3998. App.$chapterList = App.$menu.find("#chapter-list");
  3999.  
  4000. App.indexUrl = parser.indexUrl;
  4001. App.prevUrl = parser.prevUrl; // 第一个上一页
  4002.  
  4003. App.oArticles = []; // 原始的内容,用于替换的无需刷新
  4004. App.parsers = [];
  4005.  
  4006. // 加入上一章的链接
  4007. if (parser.prevUrl) {
  4008. $("<li>")
  4009. .addClass('chapter')
  4010. .append(
  4011. $("<div>")
  4012. .attr({
  4013. "realHref": parser.prevUrl,
  4014. "onclick": "return false;"
  4015. })
  4016. .text("上一章".uiTrans())
  4017. )
  4018. .prependTo(App.$chapterList);
  4019. }
  4020.  
  4021. // 插入站点样式
  4022. if (App.site.style) {
  4023. GM_addStyle(App.site.style);
  4024. }
  4025.  
  4026. App.appendPage(parser, true);
  4027.  
  4028. App.registerControls();
  4029.  
  4030. // UI 的初始化
  4031. UI.init();
  4032.  
  4033. App.curFocusElement = $("article:first").get(0); // 初始化当前关注的 element
  4034. App.requestUrl = parser.nextUrl;
  4035. App.isTheEnd = parser.isTheEnd;
  4036.  
  4037. App.isEnabled = true;
  4038. UI.addButton();
  4039.  
  4040. // // 如果已经把当前焦点链接添加到历史记录,则滚动到顶部
  4041. // if (Config.addToHistory) {
  4042. // window.scrollTo(0, 0);
  4043. // }
  4044.  
  4045. // 有些图片网站高度随着图片加载而变长
  4046. setTimeout(App.scroll, 1000);
  4047.  
  4048. App.cleanAgain();
  4049.  
  4050. if (config.PRELOADER) {
  4051. App.doRequest();
  4052. }
  4053. },
  4054. prepDocument: function() {
  4055. window.onload = window.onunload = function() {};
  4056.  
  4057. // 破解右键限制
  4058. var doc = document;
  4059. var bd = doc.body;
  4060. bd.onclick = bd.ondblclick = bd.onselectstart = bd.oncopy = bd.onpaste = bd.onkeydown = bd.oncontextmenu = bd.onmousemove = bd.onselectstart = bd.ondragstart = doc.onselectstart = doc.oncopy = doc.onpaste = doc.onkeydown = doc.oncontextmenu = null;
  4061. doc.onclick = doc.ondblclick = doc.onselectstart = doc.oncontextmenu = doc.onmousedown = doc.onkeydown = function() {
  4062. return true;
  4063. };
  4064.  
  4065. doc = document.wrappedJSObject || document;
  4066. doc.onmouseup = null;
  4067. doc.onmousedown = null;
  4068. doc.oncontextmenu = null;
  4069.  
  4070. var arAllElements = document.getElementsByTagName('*');
  4071. for (var i = arAllElements.length - 1; i >= 0; i--) {
  4072. var elmOne = arAllElements[i];
  4073. elmOne = elmOne.wrappedJSObject || elmOne;
  4074. elmOne.onmouseup = null;
  4075. elmOne.onmousedown = null;
  4076. }
  4077.  
  4078. $(document).unbind("keypress");
  4079. $(document).unbind("keydown");
  4080.  
  4081. // remove body style
  4082. $('link[rel="stylesheet"], script').remove();
  4083. $('body')
  4084. .removeAttr('style')
  4085. .removeAttr('bgcolor');
  4086.  
  4087. $('style').filter(function() {
  4088. var $style = $(this);
  4089. if($style.text().indexOf('#cVim-link-container') != -1) { // chrome 的 cVim 扩展
  4090. return false;
  4091. }
  4092. return true;
  4093. }).remove();
  4094. },
  4095. initDocument: function(parser) {
  4096. document.title = parser.docTitle;
  4097. window.name = "MyNovelReader";
  4098. document.body.innerHTML = $.nano('<div id="container">\n <div id="menu-bar" title="点击显示隐藏章节列表"></div>\n <div id="menu">\n <div id="header" title="打开目录">\n <a href="{indexUrl}" target="_blank">{bookTitle}</a>\n </div>\n <div id="divider"></div>\n <ul id="chapter-list" title="左键滚动,中键打开链接(无阅读模式)">\n </ul>\n </div>\n <div id="mynovelreader-content"></div>\n <div id="loading" style="display:none"></div>\n <div id="preferencesBtn">\n <img style="width:16px" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABwklEQVRIibVVzWrCQBAeQk/bdk+bm0aWDQEPHtwVahdavLU9aw6KAQ+SQ86Sa19Aqu0T9NafSw8ttOgr1CewUB9CBL3Yy26x1qRp0A8GhsnO9yUzmxmAhKjX68cAMAeAufK3C875FQAsAWCp/O3CsqyhFlB+Oti2/cAYewrD8FDHarXahWEYUy1gGMbUdd1z/TwMw0PG2JNt2/ex5IyxR02CEJpIKbuEkJGOrRshZCSl7CKEJjrGGHuIFMjlcs9RZElNcWxGEAQHGONxWnKM8TgIgoPYMkkpL9MKqNx4xNX8LyOEvMeSq5uxMZlz3vN9v+D7foFz3os6V61Wz36QNhqNUyHENaV0CACLTUnFYvF6/WVUbJPIglI6FELctFqtMiT59Ha7TdcFVCxJ6XYs0Gw2T1SJBlsq0ZxSOhBC3Hied/QjSTUoqsn9lSb3o879avI61FXbzTUFACiXy7v70Tqdzj7G+COtwJ+jIpPJvKYl12ZZ1kucwJs+iBD6lFJ2TdOMHB2mab7/a1xXKpW9fD5/6zjO3erCcV33PMnCcRwnfuHEYXVlZrPZQWqiKJRKpe8Bt5Ol73leCQBmADBTfiJ8AebTYCRbI3BUAAAAAElFTkSuQmCC"/>\n </div>\n <div id="alert" style="display: none;">\n <p id="App-notice"></p>\n </div>\n</div>'.uiTrans(), parser);
  4099. },
  4100. clean: function() {
  4101. $('body > *:not("#container, .readerbtn, #reader_preferences, #uil_blocker,iframe[name=\'mynovelreader-iframe\']")').remove();
  4102. $('link[rel="stylesheet"]').remove();
  4103.  
  4104. if (location.host.indexOf('qidian') > 0) {
  4105. unsafeWindow.jQuery(document).off("selectstart").off("contextmenu");
  4106. }
  4107. },
  4108. cleanAgain: function() {
  4109. var host = location.host;
  4110. if (!host.match(/qidian\.com|zongheng\.com/)) { // 只在起点、纵横等网站运行
  4111. return;
  4112. }
  4113.  
  4114. // 再次移除其它不相关的,起点,纵横中文有时候有问题
  4115. setTimeout(App.clean, 2000);
  4116. setTimeout(App.clean, 5000);
  4117. // TM 用 addEventListener('load') 有问题
  4118. window.onload = function() {
  4119. App.clean();
  4120. setTimeout(App.clean, 500);
  4121. };
  4122. },
  4123. toggle: function() {
  4124. if (App.isEnabled) { // 退出
  4125. GM_setValue("auto_enable", false);
  4126. L_setValue("mynoverlreader_disable_once", "true");
  4127.  
  4128. window.location = App.activeUrl;
  4129. } else {
  4130. GM_setValue("auto_enable", true);
  4131. L_removeValue("mynoverlreader_disable_once");
  4132. App.isEnabled = true;
  4133. App.launch();
  4134. }
  4135. },
  4136. removeListener: function() {
  4137. C.log("移除各种事件监听");
  4138. App.remove.forEach(function(_remove) {
  4139. _remove();
  4140. });
  4141. },
  4142. appendPage: function(parser, isFirst) {
  4143. var chapter = $("article:last");
  4144. if (chapter.length && parser.isSection) { // 每次获取的不是一章,而是一节
  4145. var lastText = chapter.find("p:last").remove().text().trim();
  4146. var newPage = parser.content.replace(/<p>\s+/, "<p>" + lastText);
  4147.  
  4148. chapter
  4149. .find(".chapter-footer-nav").remove()
  4150. .end()
  4151. .append(newPage);
  4152.  
  4153. if (!Config.hide_footer_nav) {
  4154. chapter.append($.nano(UI.tpl_footer_nav, parser));
  4155. }
  4156.  
  4157. } else {
  4158. chapter = $("<article>")
  4159. .attr("id", "page-" + App.pageNum)
  4160. .append(
  4161. $("<h1>").addClass("title").text(parser.chapterTitle)
  4162. )
  4163. .append(parser.content)
  4164. .appendTo(App.$content);
  4165.  
  4166. if (!Config.hide_footer_nav) {
  4167. chapter.append($.nano(UI.tpl_footer_nav, parser));
  4168. }
  4169.  
  4170. // App.fixImageFloats(chapter.get(0));
  4171.  
  4172. // 添加到章节列表
  4173. var chapterItem = $("<li>")
  4174. .addClass('chapter')
  4175. .append(
  4176. $("<div>")
  4177. .attr({
  4178. href: "#page-" + App.pageNum,
  4179. "realHref": parser.curPageUrl,
  4180. onclick: "return false;",
  4181. title: parser.chapterTitle
  4182. })
  4183. .text(parser.chapterTitle)
  4184. )
  4185. .prependTo(App.$chapterList);
  4186.  
  4187. if (isFirst) {
  4188. chapterItem.addClass('active');
  4189. }
  4190.  
  4191. App.pageNum += 1;
  4192. App.resetCache();
  4193. }
  4194.  
  4195. App.oArticles.push(chapter[0].outerHTML);
  4196. App.parsers.push(parser);
  4197. },
  4198. resetCache: function() { // 更新缓存变量
  4199. App.menuItems = App.$chapterList.find("div");
  4200. App.scrollItems = $("article");
  4201. },
  4202. registerControls: function() {
  4203. // 内容滚动
  4204. var throttled = _.throttle(App.scroll, 200);
  4205. $(window).scroll(throttled);
  4206.  
  4207. App.registerKeys();
  4208.  
  4209. if (Config.dblclickPause) {
  4210. App.$content.on("dblclick", function() {
  4211. App.pauseHandler();
  4212. });
  4213. }
  4214.  
  4215. // 左侧章节列表
  4216. App.$menuHeader.click(function() {
  4217. App.copyCurTitle();
  4218. });
  4219.  
  4220. App.$menuBar.click(function() {
  4221. UI.hideMenuList();
  4222. });
  4223.  
  4224. App.$doc.on("mousedown", "#chapter-list div", function(event) {
  4225. switch (event.which) {
  4226. case 1:
  4227. var href = $(this).attr("href");
  4228. if (href) {
  4229. App.scrollToArticle($(href));
  4230. } else {
  4231. location.href = $(this).attr("realHref");
  4232. }
  4233. break;
  4234. case 2: // middle click
  4235. L_setValue("mynoverlreader_disable_once", true);
  4236. App.openUrl($(this).attr("realHref"));
  4237. break;
  4238. }
  4239. });
  4240.  
  4241. $("#preferencesBtn").click(function(event) {
  4242. event.preventDefault();
  4243. UI.preferencesShow();
  4244. });
  4245.  
  4246. GM_registerMenuCommand("小说阅读脚本设置".uiTrans(), UI.preferencesShow.bind(UI));
  4247. },
  4248. registerKeys: function() {
  4249. key('enter', function(event) {
  4250. if (UI.$prefs) {
  4251. return;
  4252. }
  4253.  
  4254. App.openUrl(App.indexUrl, "主页链接没有找到".uiTrans());
  4255. App.copyCurTitle();
  4256.  
  4257. event.stopPropagation();
  4258. event.preventDefault();
  4259. });
  4260.  
  4261. key('left', function(event) {
  4262. var scrollTop = $(window).scrollTop();
  4263. if (scrollTop === 0) {
  4264. location.href = App.prevUrl;
  4265. } else {
  4266. var offsetTop = $(App.curFocusElement).offset().top;
  4267. // 在视野窗口内
  4268. if (offsetTop > scrollTop && offsetTop < (scrollTop + $(window).height())) {
  4269. App.scrollToArticle(App.curFocusElement.previousSibling || 0);
  4270. } else {
  4271. App.scrollToArticle(App.curFocusElement);
  4272. }
  4273. }
  4274. return false;
  4275. });
  4276.  
  4277. key('right', function(event) {
  4278. if (App.getRemain() === 0) {
  4279. location.href = App.lastRequestUrl || App.requestUrl;
  4280. } else {
  4281. App.scrollToArticle(App.curFocusElement.nextSibling || App.$doc.height());
  4282. }
  4283.  
  4284. event.preventDefault();
  4285. event.stopPropagation();
  4286. return false;
  4287. });
  4288.  
  4289. key('esc', function(){
  4290. if (UI.$prefs) {
  4291. UI.hide();
  4292. return false;
  4293. }
  4294. });
  4295.  
  4296. key('shift+/', function() {
  4297. UI.openHelp();
  4298. return false;
  4299. });
  4300.  
  4301. key(Config.quietModeKey, function(){
  4302. UI.toggleQuietMode();
  4303. return false;
  4304. });
  4305.  
  4306. key(Config.hideMenuListKey, function(){
  4307. UI.hideMenuList();
  4308. return false;
  4309. });
  4310.  
  4311. key(Config.openPreferencesKey, function(){
  4312. UI.preferencesShow();
  4313. return false;
  4314. });
  4315. },
  4316. copyCurTitle: function() {
  4317. if (Config.copyCurTitle) {
  4318. var title = $(App.curFocusElement).find(".title").text()
  4319. .replace(/第?\S+章/, "").trim();
  4320.  
  4321. GM_setClipboard(title, "text");
  4322. }
  4323. },
  4324. scrollToArticle: function(elem) {
  4325. var offsetTop;
  4326. if (typeof elem == "number") {
  4327. offsetTop = elem;
  4328. } else {
  4329. offsetTop = $(elem).offset().top - parseInt($(elem).css("margin-top"), 10);
  4330. }
  4331.  
  4332. if (Config.scrollAnimate) {
  4333. $("html, body").stop().animate({
  4334. scrollTop: offsetTop
  4335. }, 750, "easeOutExpo");
  4336. } else {
  4337. $("html, body").stop().scrollTop(offsetTop);
  4338. }
  4339. },
  4340. openUrl: function(url, errorMsg) {
  4341. if (url) {
  4342. // ff30 Greasemonkey 会报错:Greasemonkey 访问违规:unsafeWindow 无法调用 GM_openInTab。新建脚本采用按键调用也这样。
  4343. setTimeout(function() {
  4344. GM_openInTab(url, false);
  4345. }, 0);
  4346. } else if (errorMsg) {
  4347. UI.notice(errorMsg);
  4348. }
  4349. },
  4350. pauseHandler: function() {
  4351. App.paused = !App.paused;
  4352. if (App.paused) {
  4353. UI.notice('<b>状态</b>:自动翻页<span style="color:red!important;"><b>暂停</b></span>.'.uiTrans());
  4354. App.$loading.html('自动翻页已经<span style="color:red!important;"><b>暂停</b></span>.'.uiTrans()).show();
  4355. } else {
  4356. UI.notice('<b>状态</b>:自动翻页<span style="color:red!important;"><b>启用</b></span>.'.uiTrans());
  4357. App.scroll();
  4358. }
  4359. },
  4360. scroll: function() {
  4361. if (!App.paused && !App.working && App.getRemain() < Config.remain_height) {
  4362. if (App.tmpDoc) {
  4363. App.loaded(App.tmpDoc);
  4364. } else {
  4365. App.doRequest();
  4366. }
  4367. }
  4368.  
  4369. if (App.isTheEnd) {
  4370. App.$loading.html("已到达最后一页...".uiTrans()).show();
  4371. }
  4372.  
  4373. App.updateCurFocusElement();
  4374. },
  4375. updateCurFocusElement: function() { // 滚动激活章节列表
  4376. // Get container scroll position
  4377. var fromTop = $(window).scrollTop() + $(window).height() / 2;
  4378.  
  4379. // Get id of current scroll item
  4380. var cur = App.scrollItems.map(function() {
  4381. if ($(this).offset().top < fromTop)
  4382. return this;
  4383. });
  4384. // Get the id of the current element
  4385. cur = cur[cur.length - 1];
  4386. var id = cur ? cur.id : "";
  4387.  
  4388. if (App.lastId !== id) {
  4389. App.lastId = id;
  4390.  
  4391. var activeItem = App.menuItems.filter("[href=#" + id + "]"),
  4392. activeTitle = activeItem.text(),
  4393. activeUrl = activeItem.attr("realHref");
  4394.  
  4395. // Set/remove active class
  4396. App.menuItems.parent().removeClass("active");
  4397. activeItem.parent().addClass("active");
  4398.  
  4399. App.curFocusElement = cur;
  4400. App.activeUrl = activeUrl;
  4401.  
  4402. if (Config.addToHistory) {
  4403. var curNum = id.match(/\d+/)[0] - 1; // 当前是第几个
  4404. var curTitle = App.parsers[curNum].docTitle;
  4405. document.title = curTitle;
  4406.  
  4407. // TODO: 起点无法添加整个网址,只能添加后半部分。
  4408. var url = activeUrl.replace('http://read.qidian.com', '');
  4409. try {
  4410. unsafeWindow.history.pushState(null, curTitle, url);
  4411. } catch (e) {
  4412. console.error('添加下一页到历史记录失败', e);
  4413. }
  4414. }
  4415. }
  4416. },
  4417. getRemain: function() {
  4418. var scrollHeight = Math.max(document.documentElement.scrollHeight,
  4419. document.body.scrollHeight);
  4420. var remain = scrollHeight - window.innerHeight - window.scrollY;
  4421. return remain;
  4422. },
  4423. doRequest: function() {
  4424. App.working = true;
  4425. var nextUrl = App.requestUrl;
  4426. App.lastRequestUrl = App.requestUrl;
  4427.  
  4428. if (nextUrl && !App.isTheEnd && !(nextUrl in App.parsedPages)) {
  4429. App.parsedPages[nextUrl] = true;
  4430. App.curPageUrl = App.requestUrl;
  4431. App.requestUrl = null;
  4432.  
  4433. var useiframe = App.site.useiframe;
  4434.  
  4435. App.$loading
  4436. .show()
  4437. .html("")
  4438. .append($("<img>").attr("src", "data:image/gif;base64,R0lGODlhEAAQAMQAAPf39+/v7+bm5t7e3tbW1s7OzsXFxb29vbW1ta2traWlpZycnJSUlIyMjISEhHt7e3Nzc2tra2NjY1paWlJSUkpKSkJCQjo6OjExMSkpKSEhIRkZGRAQEAgICAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBQAeACwAAAEADwAOAAAFdaAnet20GAUCceN4LQlyFMRATC3GLEqM1gIc6dFgPDCii6I2YF0eDkinxUkMBBAPBfLItESW2sEjiWS/ItqALJGgRZrNRtvWoDlxFqZdmbY0cVMdbRMWcx54eSMZExQVFhcYGBmBfxWPkZQbfi0dGpIYGiwjIQAh+QQJBQAeACwAAAEADwAOAAAFeKAnep0FLQojceOYQU6DIsdhtVoEywptEBRRZyKBQDKii+JHYGEkxE6LkyAMIB6KRKJpJQuDg2cr8Y7AgjHULCoQ0pUJZWO+uBGeDIVikbYyDgRYHRUVFhcsHhwaGhsYfhuHFxgZGYwbHH4iHBiUlhuYmlMbjZktIQAh+QQFBQAeACwAAAEADwAOAAAFe6Aneh1GQU9UdeOoTVIEOQ2zWG0mSVP0ODYF4iLq7HgaEaaRQCA4HsyOwhp1FgdDxFOZTDYt0cVQSHgo6PCIPOBWKmpRgdDGWCzQ8KUwOHg2FxcYYRwJdBAiGRgZGXkcC3MEjhkalZYTfBMtHRudnhsKcGodHKUcHVUeIQAh+QQJBQAeACwAAAEADwAOAAAFbKAnjp4kURiplmYEQemoTZMpuY/TkBVFVRtRJtJgMDoejaViWT0WiokHc2muMIoEY0pdiRCIgyeDia0OhoJnk8l4PemEh6OprxQFQkS02WiCIhd4HmoiHRx9ImkEA14ciISMBFJeSAQIEBwjIQAh+QQJBQAeACwAAAEADwAOAAAFd6Anel1WTRKFdeO4WRWFStKktdwFU3JNZ6MM5nLZiDQTCCTC4ghXrU7k4bB4NpoMpyXKNBqQa5Y7YiwWHg6WLFK4SWoW95JAMOAbI05xOEhEHWoaFyJ0BgYHWyIcHA4Fj48EBFYtGJKSAwMFFGQdEAgCAgcQih4hACH5BAkFAB4ALAAAAQAPAA4AAAV0oCeKG2ZVFtaNY6dh10lNU8Z2WwbLkyRpI85Gk+GQKr7JqiME3mYSjIe5WbE8GkhkMhVeR48HpLv5ihoOB9l4xTAYYw9nomCLOgzFoiJSEAoIFiIXCwkJC1YVAwMEfwUGBgeBLBMEAouOBxdfHA8HlwgRdiEAIfkECQUAHgAsAAABAA8ADgAABXOgJ4rdpmWZ1o0sZ2YYdlka63XuKVsVVZOuzcrDufQoQxzH1rFMJJiba8jaPCnSjW30lHgGhMJWBIl4D2DLNvOATDwPwSCxHHUgjseFOJAn1B4YDgwND0MTAWAFBgcICgsMUVwDigYICQt7NhwQCGELE1QhACH5BAkFAB4ALAAAAQAPAA4AAAV4oCeOHWdyY+p1JbdpWoam7fZmGYZtYoeZm46Ik7kYhZBBQ6PyWSoZj0FAuKg8mwrF4glQryIKZdL9gicTiVQw4Ko2aYrnwUbMehGJBOPhDAYECVYeGA8PEBNCHhOABgcJCgwNh0wjFQaOCAoLk1EqHBILmg8Vih4hACH5BAkFAB4ALAAAAQAPAA4AAAV6oCd6Hdmd5ThWCee+XCpOwTBteL6lnCAMLVFHQ9SIHgHBgaPyZDKYjcfwszQ9HMwl40kOriKLuDsggD2VtOcwKFibGwrFCiEUEjJSZTLhcgwGBwsYIhkUEhITKRYGCAkKDA0PiBJcKwoKCwwODxETRk0dFA8NDhIYMiEAIfkECQUAHgAsAAABAA8ADgAABXmgJ3rcYwhcN66eJATCsHEpOwXwQGw8rZKDGMIi6vBmokcswWFtNBvVQUdkcTJQj67AGmEyGU+hYOiKMGiP4oC4dDmXS1iCSDR+xYvFovF0FAoLDxgiGxYUFRY/FwsMDQ4PEhOTFH0jFw6QEBKcE5YrHRcTERIUGHghACH5BAkFAB4ALAAAAQAPAA4AAAV4oCd63GMAgfF04zgNQixjrVcJQz4QRLNxI06Bh7CILpkf0CMpGBLL0ebHWhwOl5qno/l5EGCtqAtUmMWeTNfzWCxoNU4maWs0Vq0OBpMBdh4ODxEaIhsXhxkjGRAQEhITExQVFhdRHhoTjo8UFBYbWnoUjhUZLCIhACH5BAkFAB4ALAAAAQAPAA4AAAV5oCd6HIQIgfFw42gZBDEMgjBMbXUYRlHINEFF1FEgEIqLyHKQJToeikLBgI44iskG+mAsMC0RR7NhNRqM8IjMejgcahHbM4E8Mupx2YOJSCZWIxlkUB0TEhIUG2IYg4tyiH8UFRaNGoEeGYgTkxYXGZhEGBWTGI8iIQA7"))
  4439. .append("<a href='" + nextUrl + "' title='点击打开下一页链接'>正在载入下一页".uiTrans() + (useiframe ? "(iframe)" : "") + "...</a>");
  4440.  
  4441. if (useiframe) {
  4442. App.iframeRequest(nextUrl);
  4443. } else {
  4444. App.httpRequest(nextUrl);
  4445. }
  4446. } else {
  4447. // App.$loading.html("<a href='" + App.curPageUrl + "'>无法使用阅读模式,请手动点击下一页</a>").show();
  4448. }
  4449. },
  4450. httpRequest: function(nextUrl, callback) {
  4451. C.log("获取下一页: " + nextUrl);
  4452. GM_xmlhttpRequest({
  4453. url: nextUrl,
  4454. method: "GET",
  4455. overrideMimeType: "text/html;charset=" + document.characterSet,
  4456. timeout: 30 * 1000,
  4457. onload: function(res) {
  4458. var doc = parseHTML(res.responseText);
  4459. if (_.isFunction(callback)) {
  4460. callback(doc);
  4461. } else {
  4462. App.beforeLoad(doc);
  4463. }
  4464. },
  4465. ontimeout: function() {
  4466. callback();
  4467. }
  4468. });
  4469. },
  4470. iframeRequest: function(nextUrl) {
  4471. C.log("iframeRequest: " + nextUrl);
  4472. if (!App.iframe) {
  4473. var i = document.createElement('iframe');
  4474. App.iframe = i;
  4475. i.name = 'mynovelreader-iframe';
  4476. i.width = '100%';
  4477. i.height = '0';
  4478. i.frameBorder = "0";
  4479. i.style.cssText = '\
  4480. margin:0!important;\
  4481. padding:0!important;\
  4482. visibility:hidden!important;\
  4483. ';
  4484. i.src = nextUrl;
  4485. i.addEventListener('load', App.iframeLoaded, false);
  4486. App.remove.push(function() {
  4487. i.removeEventListener('load', App.iframeLoaded, false);
  4488. });
  4489. document.body.appendChild(i);
  4490. } else {
  4491. App.iframe.contentDocument.location.replace(nextUrl);
  4492. }
  4493. },
  4494. iframeLoaded: function() {
  4495. var iframe = this;
  4496. var body = iframe.contentDocument.body;
  4497.  
  4498. if (body && body.firstChild) {
  4499. doc = iframe.contentDocument;
  4500.  
  4501. var mutationSelector = App.site.mutationSelector;
  4502. if (mutationSelector) {
  4503. App.addMutationObserve(doc, function() {
  4504. App.beforeLoad(doc);
  4505. });
  4506. } else {
  4507. var timeout = App.site.timeout || 0;
  4508.  
  4509. setTimeout(function() {
  4510. App.beforeLoad(doc);
  4511. }, timeout);
  4512. }
  4513. }
  4514. },
  4515. beforeLoad: function(htmlDoc) {
  4516. if (config.PRELOADER) {
  4517. App.tmpDoc = htmlDoc;
  4518. App.working = false;
  4519. App.scroll();
  4520.  
  4521. // 预读图片
  4522. var existSRC = {};
  4523. $(App.tmpDoc).find('img').each(function() {
  4524. var isrc = $(this).attr('src');
  4525. if (!isrc || existSRC[isrc]) {
  4526. return;
  4527. } else {
  4528. existSRC[isrc] = true;
  4529. }
  4530. var img = document.createElement('img');
  4531. img.src = isrc;
  4532. });
  4533. } else {
  4534. App.loaded(htmlDoc);
  4535. }
  4536. },
  4537. loaded: function(doc) {
  4538. var parser = new Parser(App.site, doc, App.curPageUrl);
  4539. parser.getAll(function() {
  4540. App.addNextPage(parser);
  4541. });
  4542. App.tmpDoc = null;
  4543. },
  4544. addNextPage: function(parser) {
  4545. if (parser.content) {
  4546. App.appendPage(parser);
  4547.  
  4548. App.$loading.hide();
  4549. App.requestUrl = parser.nextUrl;
  4550. App.isTheEnd = parser.isTheEnd;
  4551.  
  4552. App.afterLoad();
  4553. } else {
  4554. App.removeListener();
  4555.  
  4556. App.$loading.html(
  4557. '<a href="' + App.curPageUrl + '">错误:没有找到下一页的内容。点击打开下一页链接。</a>'.uiTrans())
  4558. .show();
  4559. }
  4560.  
  4561. App.working = false;
  4562. },
  4563. afterLoad: function() {
  4564. App.tmpDoc = null;
  4565.  
  4566. if (config.PRELOADER) {
  4567. setTimeout(function(){
  4568. App.doRequest();
  4569. }, 200);
  4570. }
  4571. },
  4572. fixImageFloats: function(articleContent) {
  4573. if (!config.fixImageFloats) return;
  4574.  
  4575. articleContent = articleContent || document;
  4576.  
  4577. var imageWidthThreshold = Math.min(articleContent.offsetWidth, 800) * 0.55,
  4578. images = articleContent.querySelectorAll('img:not(.blockImage)');
  4579.  
  4580. for (var i = 0, il = images.length; i < il; i += 1) {
  4581. var image = images[i];
  4582.  
  4583. if (image.offsetWidth > imageWidthThreshold) {
  4584. image.className += " blockImage";
  4585. }
  4586. }
  4587. },
  4588.  
  4589. isSaveing: false,
  4590. saveAsTxt: function() {
  4591. if (App.site.useiframe) {
  4592. alert('暂不支持');
  4593. return;
  4594. }
  4595.  
  4596. if (App.isSaveing) {
  4597. alert('正在保存,请稍后');
  4598. return;
  4599. } else {
  4600. alert('开始一章章获取内容,请耐心等待');
  4601. }
  4602.  
  4603. App.isSaveing = true;
  4604.  
  4605. var chapters = [];
  4606. var fileName;
  4607.  
  4608. var toTxt = function(parser) {
  4609. var html = $.nano('{chapterTitle}\n\n{contentTxt}', parser);
  4610. chapters.push(html);
  4611. };
  4612. var finish = function() {
  4613. saveAs(chapters.join('\n\n'), fileName);
  4614. App.isSaveing = false;
  4615. };
  4616.  
  4617. var getOnePage = function (parser, nextUrl) {
  4618. if (parser) {
  4619. toTxt(parser);
  4620. nextUrl = parser.nextUrl;
  4621. }
  4622.  
  4623. if (!nextUrl) {
  4624. console.log('全部获取完毕');
  4625. finish();
  4626. return;
  4627. }
  4628.  
  4629. if (App.site.useiframe) {
  4630. // App.iframeRequest(nextUrl);
  4631. } else {
  4632. console.log('[存为txt]正在获取:', nextUrl)
  4633. App.httpRequest(nextUrl, function(doc) {
  4634. if (doc) {
  4635. var par = new Parser(App.site, doc, nextUrl);
  4636. par.getAll(getOnePage)
  4637. } else {
  4638. console.error('超时或连接出错');
  4639. finish();
  4640. }
  4641. });
  4642. }
  4643. };
  4644.  
  4645. App.parsers.forEach(toTxt);
  4646. // 保存后面的章节
  4647. var lastParser = App.parsers[App.parsers.length - 1];
  4648. fileName = lastParser.bookTitle + '.txt';
  4649. getOnePage(null, lastParser.nextUrl);
  4650. }
  4651. };
  4652.  
  4653. var BookLinkMe = {
  4654. clickedColor: "666666",
  4655.  
  4656. init: function() {
  4657. if (location.host != 'booklink.me') return;
  4658.  
  4659. this.addUnreadButton();
  4660.  
  4661. if (location.pathname.indexOf("/book-") === 0) {
  4662. this.chapterPageAddTiebaLink();
  4663. }
  4664. },
  4665. addUnreadButton: function(){ // 添加一键打开所有未读链接
  4666. var $parent = $('td[colspan="2"]:contains("未读"):first, td[colspan="2"]:contains("未讀"):first');
  4667. if(!$parent.length) return;
  4668.  
  4669. var openAllUnreadLinks = function(event){
  4670. event.preventDefault();
  4671.  
  4672. var links = $x('./ancestor::table[@width="100%"]/descendant::a[img[@alt="未读"]]', event.target);
  4673. links.forEach(function(link){
  4674. // 忽略没有盗版的
  4675. var chapterLink = link.parentNode.nextSibling.nextSibling.querySelector('a');
  4676. if (chapterLink.querySelector('font[color*="800000"]')) {
  4677. return;
  4678. }
  4679.  
  4680. if(isFirefox)
  4681. link.click();
  4682. else
  4683. GM_openInTab(link.href);
  4684.  
  4685. // 设置点击后的样式
  4686. // 未读左边的 1x 链接
  4687. link.parentNode.previousSibling.querySelector('font')
  4688. .setAttribute('color', BookLinkMe.clickedColor);
  4689. chapterLink.classList.add('mclicked');
  4690. });
  4691. };
  4692.  
  4693.  
  4694. $('<a>')
  4695. .attr({ href: 'javascript:;', title: '一键打开所有未读链接', style: 'width:auto;' })
  4696. .click(openAllUnreadLinks)
  4697. .append($('<img src="me.png" style="max-width: 20px;">'))
  4698. .appendTo($parent);
  4699. },
  4700. chapterPageAddTiebaLink: function() {
  4701. var link = $('font:contains("贴吧")').parent().get(0);
  4702. if (!link) return;
  4703.  
  4704. var tiebaUrl = 'http://tieba.baidu.com/f?kw=' + $('h1').text();
  4705. console.log('GM_xmlhttpRequest', tiebaUrl);
  4706. GM_xmlhttpRequest({
  4707. method: "GET",
  4708. url: tiebaUrl,
  4709. onload: function(response) {
  4710. var doc = parseHTML(response.responseText);
  4711. BookLinkMe.load(doc);
  4712. }
  4713. });
  4714. },
  4715. load: function(doc) {
  4716. var $data = $(doc).find('.threadlist_text > a').map(function() {
  4717. return {
  4718. title: $(this).text(),
  4719. url: 'http://tieba.baidu.com' + $(this).attr('href')
  4720. }
  4721. });
  4722.  
  4723. var trimTitle = function(title, strict) {
  4724. title = title.trim()
  4725. .replace(/\.\.\.$/, '');
  4726.  
  4727. if (strict) {
  4728. title = title.replace(/第.*?章\s*/, '');
  4729. }
  4730.  
  4731. // if (toNum) {
  4732. // title = title.replace(/[零一二三四五六七八九十百千万亿]+/, cnNum2ArabNum);
  4733. // }
  4734.  
  4735. return title;
  4736. };
  4737.  
  4738. var findUrl = function(sTitle) {
  4739. if (!sTitle) return;
  4740.  
  4741. var url;
  4742. $data.each(function(i, item) {
  4743. var tiebaTitle = item.title;
  4744. if (tiebaTitle.indexOf(trimTitle(sTitle)) > 0 ||
  4745. sTitle.indexOf(trimTitle(tiebaTitle, true)) > 0 // 包含贴吧标题的部分
  4746. ) {
  4747. url = item.url;
  4748. return true;
  4749. }
  4750. });
  4751.  
  4752. return url;
  4753. };
  4754.  
  4755. $('a:contains("搜索本章节")').each(function(){
  4756. var $this = $(this),
  4757. $thisLine = $this.parent().parent(),
  4758. chapterTitle = $thisLine.prev().find('a[href^="/jump.php"]:first').text();
  4759.  
  4760. var url = findUrl(chapterTitle);
  4761. if (url) {
  4762. $('<a>')
  4763. .attr({ target: '_blank', href: url })
  4764. .text('贴吧')
  4765. .appendTo($this.parent());
  4766. }
  4767. });
  4768. }
  4769. };
  4770.  
  4771. if (location.host === 'booklink.me') {
  4772. BookLinkMe.init();
  4773. } else {
  4774. App.init();
  4775. }