My Novel Reader

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

当前为 2015-10-27 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @id mynovelreader@ywzhaiqi@gmail.com
  3. // @name My Novel Reader
  4. // @name:zh-CN 小说阅读脚本
  5. // @name:zh-TW 小說閱讀腳本
  6. // @version 5.2.5
  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.co/*/*.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. // @include http://*.sto.cc/*-*/
  283.  
  284. // @exclude */List.htm
  285. // @exclude */List.html
  286. // @exclude */List.shtml
  287. // @exclude */index.htm
  288. // @exclude */index.html
  289. // @exclude */index.shtml
  290. // @exclude */Default.htm
  291. // @exclude */Default.html
  292. // @exclude */Default.shtml
  293.  
  294. // @run-at document-end
  295. // ==/UserScript==
  296.  
  297.  
  298. var isChrome = !!window.chrome;
  299. var isFirefox = navigator.userAgent.indexOf("Firefox") != -1;
  300.  
  301. // 其它设置
  302. var config = {
  303. soduso: false, // www.sodu.so 跳转
  304. content_replacements: true, // 小说屏蔽字修复
  305. fixImageFloats: true, // 图片居中修正
  306. paragraphBlank: true, // 统一段落开头的空格为 2个全角空格
  307. end_color: "#666666", // 最后一页的链接颜色
  308. PRELOADER: true, // 提前预读下一页
  309. };
  310.  
  311. var READER_AJAX = "reader-ajax"; // 内容需要 ajax 的 className
  312.  
  313.  
  314. // Unicode/2000-2FFF:http://zh.wikibooks.org/wiki/Unicode/2000-2FFF
  315. // Unicode/F000-FFFF:https://zh.wikibooks.org/wiki/Unicode/F000-FFFF
  316.  
  317. // replace 中的简写
  318. var CHAR_ALIAS = {
  319. '\\P': '[\\u2000-\\u2FFF\\u3004-\\u303F\\uFE00-\\uFF60\\uFFC0-\\uFFFF]', // 小说中添加的特殊符号
  320. };
  321.  
  322. // ===== 自动尝试的规则 =====
  323. var Rule = {
  324. titleRegExp: /第?\s*[一二两三四五六七八九十○零百千万亿0-91234567890]{1,6}\s*[章回卷节折篇幕集]/i,
  325. titleReplace: /^章节目录|^文章正文|^正文|全文免费阅读|最新章节|\(文\)/,
  326.  
  327. // nextRegExp: /[上前下后][一]?[页张个篇章节步]/,
  328. nextSelector: "a[rel='next'], a:contains('下一页'), a:contains('下一章'), a:contains('下一节'), a:contains('下页')",
  329. prevSelector: "a[rel='prev'], a:contains('上一页'), a:contains('上一章'), a:contains('上一节'), a:contains('上页')",
  330. // 忽略的下一页链接,匹配 href
  331. nextUrlIgnore: [
  332. /(?:(?:index|list|last|LastPage|end)\.)|BuyChapterUnLogin|^javascript:/i,
  333.  
  334. /BookReader\/vip,/i,
  335. /BookReader\/LastPageNew\.aspx/i,
  336. /read\.qidian\.com\/BookReader\/\d+,0\.aspx$/i,
  337. /read\.qidian\.com\/$/i,
  338. /free\.qidian\.com\/Free\/ShowBook\.aspx\?bookid=/i,
  339.  
  340. /book\.zongheng\.com\/readmore/i,
  341. /www\.shumilou\.com\/to-n-[a-z]+-\d+\.html/i,
  342. /\/0\.html$/i,
  343. ],
  344. nextUrlCompare: /\/\d+(_\d+)?\.html?$|\/wcxs-\d+-\d+\/$|chapter-\d+\.html$|\/\d+_\d+\/$/i, // 忽略的下一页链接(特殊),跟上一页比较
  345.  
  346. // 按顺序匹配,匹配到则停止。econtains 完全相等
  347. indexSelectors: ["a[href='index.html']", "a:contains('返回书目')", "a:contains('章节目录')", "a:contains('章节列表')",
  348. "a:econtains('最新章节')", "a:contains('回目录')","a:contains('回书目')", "a:contains('目 录')", "a:contains('目录')"],
  349.  
  350. contentSelectors: ["#pagecontent", "#contentbox", "#bmsy_content", "#bookpartinfo", "#htmlContent",
  351. "#text_area", "#chapter_content", "#chapterContent", "#partbody",
  352. "#article_content", "#BookTextRead", "#booktext", "#BookText", "#readtext", "#text_c", "#txt_td", "#TXT", "#txt", "#zjneirong",
  353. ".novel_content", ".readmain_inner", ".noveltext", ".booktext", ".yd_text2",
  354. "#contentTxt", "#oldtext", "#a_content", "#contents", "#content2", "#contentts", "#content", ".content"],
  355.  
  356. // (测试)尝试查找书名。顶部章节导航的最后一个链接可能是书名。
  357. bookTitleSelector: ".h1title > .shuming > a[title], .chapter_nav > div:first > a:last",
  358.  
  359. contentRemove: "script, iframe", // 内容移除选择器
  360. removeLineRegExp: /<p>[ \s。;,!\.∷〖]*<\/p>/g, // 移除只有一个字符的行
  361.  
  362. // 以下不常改
  363. replaceBrs: /(<br[^>]*>[ \n\r\t]*){1,}/gi, // 替换为<p>
  364. };
  365.  
  366. // ===== 自定义站点规则 =====
  367. Rule.specialSite = [
  368. // 详细版规则示例。注:该网站已无法访问。
  369. {siteName: "泡书吧", // 站点名字... (可选)
  370. url: "^http://www\\.paoshu8\\.net/Html/\\S+\\.shtm$", // // 站点正则... (~~必须~~)
  371.  
  372. // 获取标题
  373. titleReg: /(.*?)最新章节 [-_\\\/](.*?)[-_\/].*/, // 书籍标题、章节标题正则 (可选)
  374. titlePos: 0, // 书籍标题位置:0 或 1 (可选,默认为 0)
  375. titleSelector: "#title h1",
  376.  
  377. indexSelector: "a:contains('回目录')", // 首页链接 jQuery 选择器 (不填则尝试自动搜索)
  378. prevSelector: "a:contains('翻上页')", // 上一页链接 jQuery 选择器 (不填则尝试自动搜索)
  379. nextSelector: "a:contains('翻下页')", // 下一页链接 jQuery 选择器 (不填则尝试自动搜索)
  380.  
  381. // 获取内容
  382. contentSelector: "#BookText", // 内容 jQuery 选择器 (不填则尝试自动搜索)
  383. useiframe: false, // (可选)下一页加载是否使用 iframe
  384. // mutationSelector: "#chaptercontainer", // (可选)内容生成监视器
  385. // 对内容的处理
  386. contentHandle: false, // (可选)是否对内容进行特殊处理,诸如拼音字修复等,诸如起点等网站可禁用
  387. fixImage: true, // (可选),图片居中,不分大小
  388. contentReplace: /(\*W|(w|\(w).{10,25}(吧\*|)|\))|看小说就上|本书首发|泡.{1,6}吧|百度搜索阅读最新最全的小说|http:\/\/www.paoshu8.com\/|无弹窗/g, // 需要移除的内容正则 (可选)
  389. contentPatch: function(fakeStub){ // (可选)内容补丁。解决翻页是脚本的情况
  390. var $next = fakeStub.find('#LinkMenu');
  391. $next.html($next.html().replace(/<script>ShowLinkMenu.*?(<a.*?a>).*?(<a.*?a>).*?script>/,'$1$2') +
  392. '<a href=\'List.shtm\'>回目录</a>');
  393. }
  394. },
  395. // 特殊站点,需再次获取且跨域。添加 class="reader-ajax",同时需要 src, charset
  396. {siteName: '起点新版',
  397. url: 'http://read\\.qidian\\.com/BookReader/.*\\.aspx',
  398. bookTitleSelector: '.story_title .textinfo a:nth-child(1)',
  399. titleSelector: '.story_title h1',
  400.  
  401. prevSelector: '#pagePrevRightBtn',
  402. nextSelector: '#pageNextRightBtn',
  403. indexSelector: function() {
  404. return location.href.replace(/,\w+\.aspx$/, '.aspx').replace('BookReaderNew', 'BookReader');
  405. },
  406.  
  407. mutationSelector: "#chaptercontainer", // 内容生成监视器
  408. mutationChildCount: 1,
  409. contentSelector: '#content, .bookreadercontent',
  410. contentRemove: 'a[href="http://www.qidian.com"]',
  411. contentReplace: [
  412. '手机用户请到m.qidian.com阅读。'
  413. ],
  414. contentPatch: function(fakeStub){
  415. fakeStub.find('script[src$=".txt"]').addClass('reader-ajax');
  416. },
  417. },
  418. {siteName: "起点中文、起点女生、起点文学",
  419. url: "^http://(www|read|readbook|wwwploy|cga|big5ploy)\\.(qidian|qdmm|qdwenxue)\\.com/BookReader/.*",
  420. // titleReg: "小说:(.*?)(?:独家首发)/(.*?)/.*",
  421. titleSelector: "#lbChapterName",
  422. bookTitleSelector: ".page_site > a:last",
  423. // contentSelector: "#hdContent",
  424. nextUrl: function($doc){ // 为了避免起点某次改版后把1页拆成2页,然后造成重复载入第一页的情况
  425. var html = $doc.find('script:contains(nextpage=)').html();
  426. if (!html) return;
  427. var m = html.match(/nextpage='(.*?)'/);
  428. if (m) return m[1];
  429. },
  430. prevUrl: function($doc){
  431. var html = $doc.find('script:contains(prevpage=)').html();
  432. if (!html) return;
  433. var m = html.match(/prevpage='(.*?)'/);
  434. if (m) return m[1];
  435. },
  436. contentReplace: {
  437. "\\[img=(.*)\\]": "<p><img src='$1'></p><p>",
  438. "\\[+CP.*(http://file.*\\.jpg)\\]+": "<p><img src='$1'></p><p>",
  439. "\\[bookid=(\\d+),bookname=(.*?)\\]": "<a href='http://www.qidian.com/Book/$1.aspx'>$2</a>",
  440. "www.cmfu.com发布|起点中文网www.qidian.com欢迎广大书友光临阅读.*": "",
  441. '(<p>\\s+)?<a href="?http://www.(?:qidian|cmfu).com"?>起点中文网.*': '',
  442.  
  443. '([\\u4e00-\\u9fa5])[%¥]+([\\u4e00-\\u9fa5])': '$1$2', // 屏蔽词修正,例如:风%%骚
  444. },
  445. contentRemove: "span[id^='ad_'], .read_ma",
  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. "&amp;无&amp;错&amp;小说",
  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. },
  1130. {siteName: "乡村小说网",
  1131. url: '^http://www\\.xiangcunxiaoshuo\\.com/shu/\\d+/\\d+\\.html',
  1132. // bookTitleSelector: '.read_m > .list',
  1133. titleReg: '(.*?)_(.*?)_.*_.*',
  1134. contentSelector: '.yd_text2',
  1135. contentReplace: [
  1136. '[wWw]+.23uS.(?:coM|com)',
  1137. '乡&amp;村&amp;.*?\\.co[mM]',
  1138. ]
  1139. },
  1140. {siteName: "杂书网",
  1141. url: "^http://www\\.zashu\\.net/books/\\d+/\\d+/\\d+\\.html",
  1142. contentReplace: [
  1143. "吋煜牝咱.*?杂书网(?:杠杠的)?",
  1144. "吋煜牝咱看书神器",
  1145. "(?:吋煜牝咱|飝现洅咱|茇阺畱匝).*?[Cc]om",
  1146. "吋煜牝咱",
  1147. "飝现洅咱", "殢萾嘎匝",
  1148. "看小说“杂书网zashu.net”",
  1149. "手机站:m.zashu.net 电脑站:www.zashu.net",
  1150. ]
  1151. },
  1152. {siteName: "小说巴士",
  1153. url: "^http://www\\.xs84\\.com/\\d+_\\d+/",
  1154. bookTitleSelector: ".con_top a:last",
  1155. contentReplace: [
  1156. "§推荐一个无广告的小说站.*? §",
  1157. "☆本站最快更新.*?☆",
  1158. "纯文字在线阅读.*?</br>",
  1159. "www.X S 8 4.com",
  1160. "《》 www.obr />",
  1161. "。。 w.2.obr",
  1162. "\\[w w w.x s.*?.c o m 小说.*?\\]",
  1163. "╂上.*?╂",
  1164. "\\*\\*顶\\*\\*点.{0,3}小说",
  1165. "___小.说.巴.士 www.xS84.com___",
  1166. ],
  1167. contentPatch: function() {
  1168. $('<script>')
  1169. .text('clearInterval(show);')
  1170. .appendTo('body')
  1171. .remove();
  1172. }
  1173. },
  1174. {siteName: "123言情",
  1175. url: 'http://www\\.123yq\\.com/read/\\d+/\\d+/\\d+\\.shtml',
  1176. bookTitleSelector: '.con_top > a:last',
  1177. contentSelector: "#TXT",
  1178. contentRemove: '.bottem, .red',
  1179. },
  1180. {siteName: "热门小说网",
  1181. url: 'http://www.remenxs.com/du_\\d+/\\d+/',
  1182. bookTitleSelector: 'section.readhead > div.read_t > div.lf > a:nth-child(2)',
  1183. nextSelector: '.pagego > font:contains("下一章") + a',
  1184. prevSelector: '.pagego > font:contains("上一章") + a',
  1185. contentSelector: ".yd_text2",
  1186. contentRemove: '.adrs, .con_w, a',
  1187. contentReplace: [
  1188. '您可以在百度里搜索“.*',
  1189. '为了方便下次阅读,你可以点击下方的.*'
  1190. ]
  1191. },
  1192.  
  1193. // === 内容补丁
  1194. {siteName: "给力文学小说阅读网",
  1195. url: "^http://www\\.geiliwx\\.com/.*\\.shtml",
  1196. titleReg: "-?(.*)_(.*)最新章节_给力",
  1197. titlePos: 1,
  1198. contentRemove: 'h1, font[color], center',
  1199. contentReplace: [
  1200. "网站升级完毕!感谢对给力文学网的支持!",
  1201. "(百度搜索给力文学网更新最快最稳定\\)",
  1202. "【sogou,360,soso搜免费下载小说】",
  1203. "\\[乐\\]\\[读\\]小说.23.[Cc]m",
  1204. "给力文学网",
  1205. "看最快更新",
  1206. "小说网不跳字",
  1207. "\\.com",
  1208. "BAIDU_CLB_fillSlot\\(.*",
  1209. "--小-说-www-23wx-com",
  1210. "&nbsp;&nbsp;,请",
  1211. ],
  1212. contentPatch: function(d) {
  1213. if (!d.find('#content').length) {
  1214. var html = d.find('body').html();
  1215. var content = html.match(/<!--go-->([\s\S]*?)<!--over-->/i)[1];
  1216.  
  1217. content = $('<div id="content">').html(content);
  1218. if (content.find('#adright').size()) {
  1219. content = content.find('#adright');
  1220. }
  1221. content.appendTo(d.find('body'));
  1222. }
  1223. }
  1224. },
  1225.  
  1226. // ================== 采用 iframe 方式获取的 ====================
  1227. {siteName: "16K小说网",
  1228. url: "^http://www\\.16kbook\\.org/Html/Book/\\d+/\\d+/\\d+\\.shtml$",
  1229. titleReg: '(\\S+) (.*)- 16K小说网',
  1230. useiframe: true,
  1231. contentRemove: '.bdlikebutton',
  1232. contentReplace: {
  1233. '(<center>)?<?img src..(http://www.16kbook.org)?(/tu/\\S+\\.jpg).(>| alt."\\d+_\\d+_\\d*\\.jpg" />)(</center>)?': "$3",
  1234. "/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":"的",
  1235. "16kbook\\s*(首发更新|小说网)": "",
  1236. }
  1237. },
  1238. {siteName: "读读看",
  1239. url: "^http://www\\.dudukan\\.net/html/.*\\.html$",
  1240. contentReplace: "看小说“就爱读书”|binhuo|www\\.92to\\.com",
  1241. useiframe: true,
  1242. mutationSelector: "#main",
  1243. mutationChildCount: 0,
  1244. },
  1245. {siteName: "读零零",
  1246. url: "http://www\\.du00\\.(?:com|cc)/read/\\d+/\\d+/[\\d_]+\\.html",
  1247. titleReg: "(.*?)(?:第\\d+段)?,(.*) - 读零零小说网",
  1248. titlePos: 1,
  1249. // prevSelector: "#footlink a:first",
  1250. // indexSelector: "#footlink a:contains('目录')",
  1251. // nextSelector: "#footlink a:last",
  1252. // 内容
  1253. contentSelector: "#pagecontent, .divimage",
  1254. // useiframe: true,
  1255. // mutationSelector: "#pagecontent",
  1256. // mutationChildCount: 2,
  1257. contentRemove: "font",
  1258. contentReplace: [
  1259. "读零零小说网欢迎您的光临.*?txt格式下载服务",
  1260. ",好看的小说:|本书最新免费章节请访问。",
  1261. "\\*文學馆\\*",
  1262. "\\(未完待续请搜索,小说更好更新更快!",
  1263. "www\\.DU00\\.com",
  1264. ],
  1265. checkSection: true
  1266. },
  1267. {siteName: "78小说网",
  1268. url: "^http://www\\.78xs\\.com/article/\\d+/\\d+/\\d+.shtml$",
  1269. contentHandle: false,
  1270. titleReg: "(.*?) (?:正文 )?(.*) 78小说网",
  1271. indexSelector: "a:contains('目 录')",
  1272. prevSelector: "a:contains('上一章')",
  1273. nextSelector: "a:contains('下一章')",
  1274. contentSelector: "#content",
  1275. useiframe: true,
  1276. contentReplace: [
  1277. "//.*?78xs.*?//",
  1278. "\\(全文字小说更新最快\\)",
  1279. ],
  1280. contentPatch: function(fakeStub){
  1281. fakeStub.find('p.title').empty(); // 去掉内容中带的章节标题
  1282. }
  1283. },
  1284. {siteName: "151看书网",
  1285. url: "^http://www\\.151kan\\.com/kan/.*\\.html",
  1286. contentSelector: "#msg",
  1287. useiframe: true,
  1288. mutationSelector: "#msg",
  1289. contentReplace: [
  1290. /[\/|]?www\.151(?:看|kan)\.com[\/|]?/ig,
  1291. /151看书网(?:纯文字)?/ig,
  1292. ]
  1293. },
  1294. {siteName: "就爱读书",
  1295. url: "^http://www\\.92to\\.com/\\w+/\\w+/\\d+\\.html$",
  1296. titleReg: "(.*?)-(.*?)-",
  1297. useiframe: true,
  1298. timeout: 500,
  1299. contentReplace: "看小说.就爱.*"
  1300. },
  1301. {siteName: "书书网",
  1302. url: "http://www\\.shushuw\\.cn/shu/\\d+/\\d+\\.html",
  1303. titleReg: "(.*) (.*?) 书书网",
  1304. titlePos: 1,
  1305. useiframe: true,
  1306. timeout: 500,
  1307. contentReplace: "!~![\\s\\S]*"
  1308. },
  1309. {siteName: "找小说网",
  1310. url: "http://www\\.zhaoxiaoshuo\\.com/chapter-\\d+-\\d+-\\w+/",
  1311. titleReg: "(.*) - (.*) - 找小说网",
  1312. titlePos: 1,
  1313. useiframe: true,
  1314. timeout: 500,
  1315. contentRemove: "div[style]"
  1316. },
  1317. {siteName: "ABC小说网",
  1318. url: "^http://www\\.bookabc\\.net/.*\\.html",
  1319. useiframe: true
  1320. },
  1321.  
  1322. // ============== 内容需要2次获取的 =========================
  1323. {siteName: "手打吧",
  1324. url: /^http:\/\/shouda8\.com\/\w+\/\d+\.html/,
  1325. contentReplace: /[w\s\[\/\\\(]*.shouda8.com.*|(\/\/)?[全文字]?首发|手打吧|www.shou.*|\(w\/w\/w.shouda8.c\/o\/m 手、打。吧更新超快\)|小说 阅读网 www.xiaoshuoyd .com/ig,
  1326. contentPatch: function(fakeStub){
  1327. var scriptSrc = fakeStub.find('body').html().match(/outputContent\('(.*txt)'\)/)[1];
  1328. scriptSrc = "http://shouda8.com/ajax.php?f=http://shouda8.com/read" + scriptSrc;
  1329. fakeStub.find('#content').attr({
  1330. "class": 'reader-ajax',
  1331. src: scriptSrc
  1332. });
  1333. }
  1334. },
  1335. {siteName: "哈哈文学",
  1336. url: /^http:\/\/www\.hahawx\.com\/.*htm/,
  1337. titleReg: /(.*?)-(.*?)-.*/,
  1338. contentSelector: "#chapter_content",
  1339. contentReplace: /(?:好书推荐|书友在看|其他书友正在看|好看的小说|推荐阅读):。|(?:www|www|book).*(?:com|net|org|com|net)|全文字阅读|无弹窗广告小说网|哈哈文学\(www.hahawx.com\)|souDU.org|Soudu.org|jīng彩推荐:/ig,
  1340. contentPatch: function(fakeStub){
  1341. var $content = fakeStub.find("#chapter_content");
  1342. var m = $content.find("script").text().match(/output\((\d+), "(\d+\.txt)"\);/);
  1343. if(m && m.length == 3){
  1344. var aid = m[1],
  1345. files = m[2];
  1346. var subDir = "/" + (Math.floor(aid / 1000) + 1),
  1347. subDir2 = "/" + (aid - Math.floor(aid / 1000) * 1000);
  1348. $content.attr({
  1349. class: "reader-ajax",
  1350. src: "http://r.xsjob.net/novel" + subDir + subDir2 + "/" + files,
  1351. charset: "gbk"
  1352. });
  1353. }
  1354. }
  1355. },
  1356. {siteName: "天天中文",
  1357. url: "http://www\\.ttzw\\.com/book/\\d+/\\d+\\.html",
  1358. titleSelector: "#chapter_title",
  1359. bookTitleSelector: ".fl.pl20 a:last",
  1360. contentSelector: "#text_area",
  1361. contentReplace: /www.ttzw.com|www.c66c.com|手机用户请到阅读。|<p>\s*a<\/p>/ig,
  1362. contentPatch: function(fakeStub) {
  1363. var m = fakeStub.find('#text_area script').text().match(/outputTxt\("(.*)"\);/);
  1364. if (m) {
  1365. fakeStub.find('#text_area').attr({
  1366. class: "reader-ajax",
  1367. src: unsafeWindow.getServer() + m[1],
  1368. charset: "gbk"
  1369. });
  1370. }
  1371. }
  1372. },
  1373.  
  1374. // ===========================================================
  1375. {siteName: "好看小說網",
  1376. url: "http://tw\\.xiaoshuokan\\.com/haokan/\\d+/\\d+\\.html",
  1377. contentSelector: ".bookcontent",
  1378. prevSelector: "a.redbutt:contains('上一頁')",
  1379. indexSelector: "a.redbutt:contains('返回章節目錄')",
  1380. nextSelector: "a.redbutt:contains('下一頁')",
  1381. contentReplace: "[a-z;&]*w.[xx]iaoshuokan.com 好看小說網[a-z;&族】)]*"
  1382. },
  1383. {siteName: "E品中文网",
  1384. url: "http://www\\.epzww\\.com/book/\\d+/\\d+",
  1385. titleReg: "(.*?),(.*?),",
  1386. contentSelector: "#showcontent",
  1387. },
  1388. {siteName: "飘天文学",
  1389. url: "http://www\\.piaotian\\.net/html/\\d+/\\d+/\\d+\\.html",
  1390. // titleReg: "(.*)最新章节,(.*),飘天文学",
  1391. bookTitleSelector: '#content > h1 > a',
  1392. contentSelector: "#content",
  1393. useiframe: true, // 否则 content 在 body 下面
  1394. contentRemove: "h1, table, .toplink",
  1395. contentReplace: [
  1396. /[{〖]请在百度搜索.*[}〗]|.(?:百度搜索飄天|无弹窗小说网).*\.Net.|\[飄天.*无弹窗小说网\]/ig,
  1397. '\\{飘天文学www.piaotian.net感谢各位书友的支持,您的支持就是我们最大的动力\\}',
  1398. '章节更新最快',
  1399. '支持网站发展,逛淘宝买东西.*'
  1400. ],
  1401. },
  1402. {siteName: "天使小说网",
  1403. url: "http://www\\.tsxs\\.cc/files/article/html/\\d+/\\d+/\\d+\\.html",
  1404. contentSelector: "#content"
  1405. },
  1406. {siteName: "紫雨阁小说网",
  1407. url: "http://www\\.ziyuge\\.com/\\w+/\\w+/\\d+/\\d+/\\d+\\.html",
  1408. titleReg: "(.*?)-正文-(.*?)-紫雨阁小说网",
  1409. contentSelector: ".reader_content",
  1410. nextSelector: "#divNext a",
  1411. prevSelector: "#divPrev a",
  1412. contentReplace: "\\(.*www.ziyuge.com.*\\)"
  1413. },
  1414. {siteName: "破风中文网",
  1415. url: "http://www\\.pofeng\\.net/xiaoshuo/\\d+/\\d+\\.html",
  1416. useiframe: true
  1417. },
  1418. {siteName: "读客吧",
  1419. url: "http://dukeba\\.com/book/\\d+/\\d+/\\d+\\.shtml",
  1420. useiframe: true,
  1421. contentSelector: "#content > div[style]",
  1422. contentRemove: "a, div[align]:has(font)",
  1423. },
  1424. {siteName: "一起阅",
  1425. url: "http://www\\.17yue\\.com/\\w+/\\d+/\\d+\\.html",
  1426. useiframe: true,
  1427. },
  1428. {siteName: "诺秋网",
  1429. url: "http://www\\.nuoqiu\\.com/static/\\d+/\\d+\\.html",
  1430. titleReg: "(.*) (.*) 诺秋网",
  1431. titlePos: 1,
  1432. useiframe: true,
  1433. contentReplace: "┏━━━━━━━━━━━━━━━━━━━━━━━━━┓[\\s\\S]+诺秋网文字更新最快……】@!!"
  1434. },
  1435. {siteName: "言情后花园",
  1436. url: "http://www\\.yqhhy\\.cc/\\d+/\\d+/\\d+\\.html",
  1437. titleReg: "(.*)-(.*)-.*-言情后花园",
  1438. titlePos: 1,
  1439. contentSelector: "#content",
  1440. contentRemove: "a, span[style], script",
  1441. contentReplace: "请记住本站: www.yqhhy.cc|更多,尽在言情后花园。"
  1442. },
  1443. {siteName: "六九中文",
  1444. url: "http://www.(?:69zw|kan7).com/\\w+/\\d+/\\d+/\\d+.html",
  1445. titleSelector: ".chapter_title",
  1446. bookTitleSelector: ".readhead h1",
  1447. contentSelector: ".yd_text2",
  1448. // titleReg: "(.*)?_(.*)-六九中文",
  1449. contentReplace: [
  1450. "[\\*]+本章节来源六九中文.*请到六九中文阅读最新章节[\\*]+|-\\\\[wW]+.*书友上传/-",
  1451. "\\\\请到 www.69zw.com 六\\*九.*?/",
  1452. "【 注册会员可获私人书架,看书更方便!:】",
  1453. "首发<br />",
  1454. ]
  1455. },
  1456. {siteName: "免费小说阅读网",
  1457. titleReg: "(.*) , (.*) , 免费小说阅读网",
  1458. titlePos: 1,
  1459. url: "^http://book\\.yayacms\\.com/\\w+/book_\\d+_\\d+.html",
  1460. contentRemove: "a, div[style]",
  1461. contentReplace: "http://book.YaYaCMS.com/.*|book.yayacms.com",
  1462. },
  1463. {siteName: "书农在线书库",
  1464. url: "http://www\\.shunong\\.com/yuedu/\\d+/\\d+/\\d+.html",
  1465. contentSelector: ".bookcontent",
  1466. },
  1467. {siteName: "努努书坊",
  1468. url: "http://(?:book\\.kanunu\\.org|www\\.kanunu8\\.com)/.*/\\d+\\.html",
  1469. titleReg: /(.*) - (.*) - 小说在线阅读 - .* - 努努书坊/,
  1470. titlePos: 1,
  1471. contentSelector: "table:eq(4) p",
  1472. indexSelector: "a[href^='./']",
  1473. },
  1474. {siteName: "五月中文网",
  1475. url: "^http://5ycn\\.com/\\d+/\\d+/\\d+\\.html",
  1476. contentRemove: "div[align='center'], a",
  1477. },
  1478. {siteName: "笔下中文",
  1479. url: "^http://www\\.bxzw\\.org/\\w+/\\d+/\\d+/\\d+\\.shtml",
  1480. contentRemove: "div[align='center'], center, #footlink1",
  1481. contentReplace: "www\\.bxzw\\.org|//无弹窗更新快//|\\(看精品小说请上.*\\)|\\(看.*最新更新章节.*\\)"
  1482. },
  1483. {siteName: "着笔中文网",
  1484. url: "^http://.*zbzw\\.com/\\w+/\\d+\\.html",
  1485. contentReplace: "精彩小说尽在.*"
  1486. },
  1487. {siteName: "D586小说网",
  1488. url: 'http://www\\.d586\\.com/',
  1489. contentSelector: ".yd_text2",
  1490. contentRemove: 'a',
  1491. contentReplace: [
  1492. '【www.13800100.com文字首发D586小说网】',
  1493. '【☆D586小说网☆//文字首发】.*'
  1494. ]
  1495. },
  1496. {siteName: "豌豆文学网",
  1497. url: "^http://www.wandoou.com/book/\\d+/\\d+\\.html",
  1498. titleReg: '(.*?)最新章节-(.*)-.*无弹窗广告_豌豆文学网',
  1499. contentRemove: "center",
  1500. contentReplace: [
  1501. /[{(]<a href.*[})]|网欢迎广大书友光临阅读,.*/ig,
  1502. /[レ★]+.*(?:请支持)?豌(?:.|&amp;)?豆.?文.?学.*[レ★]+/ig,
  1503. /[((【]豌.?豆.?文.?学.*[))】]/ig,
  1504. /∷更新快∷∷纯文字∷|http:永久网址,请牢记!/ig,
  1505. /(?:{|\\|\/|\()*豌.?豆.?文.?学.?网.*?(?:高速更新|\\\/|})+/ig,
  1506. /更新最快最稳定|看小说“”/ig,
  1507. /&lt;strng&gt;.*?&lt;\/strng&gt;/ig,
  1508. /\(凤舞文学网\)|\( *\)|「启航文字」|79阅.读.网/ig,
  1509. /高速首发.*?本章节是.*/ig,
  1510. /百度搜索自从知道用百度搜索,妈妈再也不用担心我追不到最快更新了/ig,
  1511. ]
  1512. },
  1513. {siteName: "都来读小说网",
  1514. url: /^http:\/\/www\.doulaidu\.com\/[^\/]+\/\d+\/\d+\.html/,
  1515. useiframe: true,
  1516. contentReplace: [
  1517. /www..+.(?:com|net)/ig,
  1518. /都来读小说网首发|www\.[a-z0-9]+\.(?:org|com)/ig,
  1519. ]
  1520. },
  1521. {siteName: "小说TXT",
  1522. url: /^http:\/\/www\.xshuotxt\.com\//,
  1523. contentReplace: "\\(.*无弹窗全文阅读\\)",
  1524. contentPatch: function(fakeStub) {
  1525. fakeStub.find('#title a').remove();
  1526. }
  1527. },
  1528. {siteName: "疯狂中文网",
  1529. url: "http://www\\.fkzww\\.com/",
  1530. contentRemove: ".bottem, a[href='http://www.fkzww.com']",
  1531. contentReplace: [
  1532. /收藏【.*?疯狂中文网\)/ig,
  1533. ]
  1534. },
  1535. {siteName: "吾读小说网",
  1536. url: "http://www\\.5du5\\.com/book/.*\\.html",
  1537. contentReplace: '\\(吾读小说网 <a.*无弹窗全文阅读\\)'
  1538. },
  1539. {siteName: "UU看书",
  1540. url: "http://www\\.uukanshu\\.com/.*/\\d+/\\d+.html",
  1541. contentReplace: "[UU]*看书[(\\(].*?[)\\)]文字首发。"
  1542. },
  1543. {siteName: "长风文学网",
  1544. url: "http://www\\.cfwx\\.net/files/article/html/\\d+/\\d+/\\d+\\.html",
  1545. titleSelector: '.title',
  1546. bookTitleSelector: '.linkleft > a:last',
  1547. contentReplace: [
  1548. '([^\\u4E00-\\u9FFF]+)长\\1风\\1文\\1学[^\\n]+t',
  1549. ]
  1550. },
  1551. {siteName: "云来阁",
  1552. url: "http://www\\.yunlaige\\.com/html/\\d+/\\d+/\\d+\\.html",
  1553. titleSelector: '.ctitle',
  1554. bookTitleSelector: '#hlBookName',
  1555. contentSelector: '#content',
  1556. contentRemove: '.bottomlink, a, .cad, .footer, .adbottom',
  1557. contentReplace: [
  1558. '[☆★◆〓『【◎◇].*?(?:yunlaige|云 来 阁|yunlaige).*?[☆◆★〓』】◎◇]',
  1559. '《更新最快小说网站:雲来阁http://WWW.YunLaiGe.COM》',
  1560. '◢百度搜索雲来阁,最新最快的小说更新◣',
  1561. '【當你閱讀到此章節,請您移步到雲來閣閱讀最新章節,或者,雲來閣】',
  1562. '【看恐怖小说、玄幻小说、请大家登陆黑岩居http://www.heiyanju.com万本小说免费看】',
  1563. '如您已阅读到此章节,请移步到.*',
  1564. '===百!?度搜索.*?新章节===',
  1565. '【最新更新】',
  1566. '值得您收藏。。',
  1567. '小说“小说章节',
  1568. '纯文字在线阅读本站域名',
  1569. '手机同步阅读请访问',
  1570. '\\(云来阁小说文学网www.yunlaige.com\\)',
  1571. '【本书作者推荐:(?:百度搜索)?云来閣,免费观看本书最快的VIP章节】',
  1572. '±顶±点±小±说,ww',
  1573. '■dingddian小说,ww∨23w→■m',
  1574. 'w∨23w',
  1575. 'www23wxcom',
  1576. '¥℉頂¥℉点¥℉小¥℉',
  1577. '£∝頂£∝点£∝小£∝',
  1578. '篮。色。书。巴,',
  1579. ]
  1580. },
  1581. {siteName: "乐文小说网",
  1582. url: /http:\/\/www\.lwxs520\.com\/books\/\d+\/\d+\/\d+.html/,
  1583. siteExample: 'http://www.lwxs520.com/books/2/2329/473426.html',
  1584. contentRemove: '#content>:not(p)',
  1585. contentReplace: [
  1586. '喜欢乐文小说网就上www.*(?:COM|com)',
  1587. '爱玩爱看就来乐文小说网.*',
  1588. '\\(LWXS520。\\)',
  1589. 'M.LWxS520.com&nbsp;乐文移动网',
  1590. /\(未完待续.+/g,
  1591. /乐文小说网值得.+/g,
  1592. '\\(\\)',
  1593. 'www.LWXS520.com',
  1594. ]
  1595. },
  1596. {siteName: '我爱小说',
  1597. url: '^http://www\\.woaixiaoshuo\\.com/xiaoshuo/\\d+/\\d+/\\d+\\.html',
  1598. bookTitleSelector: '#lbox > b',
  1599. contentSelector: '#readbox',
  1600. contentRemove: '#papgbutton, #content',
  1601. },
  1602. {siteName: "米花在线书库",
  1603. url: /book\.mihua\.net\/\w+\/\d+\/\d+\/.+\.html/,
  1604. titleSelector: "#title",
  1605. contentSelector: "#viewbook"
  1606. },
  1607. {siteName: "58小说网",
  1608. url: /^http:\/\/(www|book)\.(58)?58xs\.com\/html\/\d+\/\d+\/\d+\.html/,
  1609. titleSelector: "h1",
  1610. indexSelector: "#footlink > a:eq(1)",
  1611. prevSelector: "#footlink > a:eq(0)",
  1612. nextSelector: "#footlink > a:eq(2)",
  1613. contentSelector: "#content",
  1614. contentRemove: ".f1, .c1"
  1615. },
  1616. {siteName: "天天美文网",
  1617. url: /www\.365essay\.com\/\w+\/.+.htm/,
  1618. titleSelector: ".title > h1",
  1619. contentSelector: "#zoomc td",
  1620. contentRemove: ".page-bottomc"
  1621. },
  1622. {siteName: "天涯武库",
  1623. url: /wx\.ty2016\.com\/.+\.html$/,
  1624. bookTitleSelector: "td[width='800'][height='25']>a[href='./']",
  1625. titleSelector: "strong>font",
  1626. indexSelector: "td a[href='./']",
  1627. nextSelector: "td[width='28%'] a",
  1628.  
  1629. contentSelector: "td[width='760'] p",
  1630. contentHandle: false,
  1631. },
  1632. {siteName: "黄金屋中文网",
  1633. url: /www\.hjwzw\.com\/Book\/Read\/\d+,\d+$/,
  1634. titleSelector: "h1",
  1635. indexSelector: "td a[href='./']",
  1636. contentSelector: "#AllySite+div",
  1637. contentRemove: "b, b+p"
  1638. },
  1639. {siteName: "梦远书城",
  1640. url: /www\.my285\.com(?:\/\w+){3,5}\/\d+\.htm$/,
  1641. useiframe: true,
  1642. contentSelector: "table:eq(2) tr:eq(3)",
  1643. },
  1644. {siteName: "更新吧",
  1645. url: "^http://www\\.gengxin8\\.com/read/\\d+/\\d+.html$",
  1646. bookTitleSelector: '.left a:last',
  1647. contentSelector: "#chaptertxt",
  1648. useiframe: true,
  1649. },
  1650. {siteName: "乐文小说网",
  1651. url: "http://www\\.365xs\\.org/books/\\d+/\\d+/\\d+\\.html",
  1652. titleSelector: ".kfyd h1",
  1653. bookTitleSelector: "ul.bread-crumbs a:last",
  1654. contentSelector: "#content",
  1655. // contentReplace: []
  1656. },
  1657. {siteName: "舞若小说网",
  1658. url: "http://www\\.wuruo\\.com/files/article/html/\\d+/\\d+/\\d+\\.html",
  1659. bookTitleSelector: ".text a:eq(1)",
  1660. contentSelector: "#zhengwen",
  1661. contentReplace: [
  1662. '【更多精彩小说请访问www.wuruo.com】',
  1663. '(www.wuruo.com舞若小说网首发)',
  1664. '【舞若小说网首发】',
  1665. ]
  1666. },
  1667. {siteName: "大书包小说网",
  1668. url: "http://www\\.dashubao\\.com/book/\\d+/\\d+/\\d+\\.html",
  1669. bookTitleSelector: ".read_t > .lf > a:nth-child(3)",
  1670. contentSelector: ".yd_text2",
  1671. contentReplace: [
  1672. ]
  1673. },
  1674. {siteName: "爬书网",
  1675. url: "http://www\\.pashuw\\.com/BookReader/\\d+-\\d+/\\d+\\.html",
  1676. bookTitleSelector: "#paihangbang_select > a:last()",
  1677. nextSelector: "#next2 a",
  1678. prevSelector: "#prev2 a",
  1679. indexSelector: "#fhml2 a",
  1680. contentRemove: '.novel_bot',
  1681. },
  1682. {siteName: "闪文书库",
  1683. url: "http://read\\.shanwen\\.com/html/\\d+/\\d+/\\d+\\.html",
  1684. titleSelector: '.newstitle',
  1685. contentRemove: '#titlebottom',
  1686. contentReplace: [
  1687. '闪文网址中的.*?注册会员</a>'
  1688. ]
  1689. },
  1690. {siteName: "品书网",
  1691. url: "http://www\\.vodtw\\.com/Html/Book/\\d+/\\d+/\\d+\\.html",
  1692. bookTitleSelector: '.srcbox > a:last()',
  1693. contentRemove: 'a',
  1694. contentReplace: [
  1695. '品书网 www.voDtw.com◇↓',
  1696. '品书网 www.vodtW.com',
  1697. '品 书 网 (w W W . V o Dtw . c o M)',
  1698. '复制网址访问\\s*http://[%\\d\\w]+'
  1699. ]
  1700. },
  1701. {siteName: "凤凰小说网",
  1702. url: "http://www\\.fhxs\\.com/read/\\d+/\\d+/\\d+\\.shtml",
  1703. bookTitleSelector: '.con_top > a:last()',
  1704. contentRemove: '.bottem',
  1705. contentReplace: [
  1706. ]
  1707. },
  1708. {siteName: "小说巴士",
  1709. url: "http://www\\.xsbashi\\.com/\\d+_\\d+/",
  1710. contentReplace: [
  1711. '全文阅读如您已阅读到此章[節节].*?,,,,',
  1712. '看小说首发推荐去眼快看书',
  1713. '最快更新,阅读请。___小/说/巴/士 Www.XSBASHI.coM___',
  1714. '___小/说/巴/士 www.XSBASHI.com___',
  1715. 'lala如您已阅读到此章節,請移步到.*?速记方法:,\\]',
  1716. 'lala如您已阅读到此章節.*?敬請記住我們新的網址筆-趣-閣',
  1717. '起舞电子书访问:. 。',
  1718. '≧哈,m\\.',
  1719. '\\[\\s*超多好看\\]',
  1720. '热门【首发】',
  1721. '===百度搜索.*?===',
  1722. '===\\*\\*小说巴士.*?===',
  1723. ]
  1724. },
  1725. {siteName: "思兔阅读",
  1726. url: "http://\\w+\\.sto\\.cc/\\d+-\\d+/",
  1727. titleReg: "(.*?)_(.*?)_全文在線閱讀_思兔",
  1728. titlePos: 0,
  1729. //bookTitleSelector: "h1",
  1730. prevSelector: "a:contains('上壹頁')",
  1731. nextSelector: "a:contains('下壹頁')",
  1732. contentSelector: "div#BookContent",
  1733. contentRemove: 'span',
  1734. },
  1735.  
  1736.  
  1737. // ===== 特殊的获取下一页链接
  1738. {siteName: "看书啦",
  1739. url: "^http://www.kanshu.la/book/\\w+/\\d+\\.shtml",
  1740. titleReg: "(.*)-(.*)-看书啦",
  1741. titlePos: 1,
  1742. nextUrl: function($doc){
  1743. var html = $doc.find('script:contains(next_page = ")').html();
  1744. var m = html.match(/next_page = "(.*?)";/);
  1745. if (m) return m[1];
  1746. },
  1747. prevUrl: function($doc){
  1748. var html = $doc.find('script:contains(preview_page = ")').html();
  1749. var m = html.match(/preview_page = "(.*?)";/);
  1750. if (m) return m[1];
  1751. }
  1752. },
  1753. {siteName: "书阁网",
  1754. url: "^http://www\\.bookgew\\.com/Html/Book/\\d+/\\d+/\\d+\\.htm",
  1755. titleReg: "(.*)-(.*?)-书阁网",
  1756. titlePos: 1,
  1757. // titleSelector: ".newstitle",
  1758. nextUrl: function($doc){
  1759. var html = $doc.find('script:contains(nextpage=)').html();
  1760. var m = html.match(/nextpage="(.*?)";/);
  1761. if (m) return m[1];
  1762. },
  1763. prevUrl: function($doc) {
  1764. var html = $doc.find('script:contains(prevpage=)').html();
  1765. var m = html.match(/prevpage="(.*?)";/);
  1766. if (m) return m[1];
  1767. }
  1768. },
  1769.  
  1770. // {siteName: "雅文言情小说吧", // 一章分段
  1771. // url: "http://www\\.yawen8\\.com/\\w+/\\d+/\\d+\\.html",
  1772. // contentSelector: "#content .txtc"
  1773. // }
  1774.  
  1775. {siteName:'妙笔阁',
  1776. url:/^http:\/\/www\.miaobige\.com\/.*\.html/i,
  1777. siteExample:'http://www.miaobige.com/book/5_1586/1006320.html',
  1778. // 有的会提示防采集章节
  1779. fInit: function () {
  1780. $('<script>')
  1781. .text('$(document).unbind("contextmenu selectstart")')
  1782. .appendTo(document.body);
  1783. },
  1784. contentReplace: '妙笔阁,无弹窗,更新快,记住www.miaobige.com',
  1785. contentPatch: function(fakeStub){
  1786. var txt = fakeStub.find('#content'),
  1787. mNewLink;
  1788.  
  1789. if (0 === txt.text().trim().indexOf('防采集章节,')) {
  1790. mNewLink = txt.html().match(/http:\/\/www\.miaobige\.com\/book\/(\d)_(\d+)\/(\d+)\.html/i);
  1791. if (mNewLink) {
  1792. txt .addClass(READER_AJAX)
  1793. .attr({
  1794. src: '/js/ajaxtxt.asp',
  1795. charset: 'gbk'
  1796. })
  1797. .data('post', {
  1798. sid: mNewLink[2],
  1799. zid: mNewLink[3],
  1800. cid: mNewLink[1]
  1801. })
  1802. .text('请等待加载…');
  1803. }
  1804. }
  1805. }
  1806. },
  1807.  
  1808. ];
  1809.  
  1810. // ===== 小说拼音字、屏蔽字修复 =====
  1811. // 运行在未替换 <br> 之前,.* 可能会造成全部替换
  1812. Rule.replace = {
  1813. // ===格式整理===
  1814. // "\\(|\\[|\\{|(|【|{":"(",
  1815. // "\\)|\\]|\\}|)|】|}":")",
  1816.  
  1817. // 需要?
  1818. ",": ",",
  1819. // ":": ":", "\\?":"?", // 会造成起点的图片无法替换
  1820.  
  1821. "\\*|*":"*",
  1822. "[wWwW]{3}":"www",
  1823. "w{3}(\u3001|\u3002)":"www.",
  1824. "[cCcC][oOoO][mMmM]":"com",
  1825. "[nNnN][eeEE][ttTT]":"net",
  1826. "[cCcC][nNnN]":"cn",
  1827. "(\\.|\u3001|\u3002)com":".com",
  1828. "(\\.|\u3001|\u3002)net":".net",
  1829. "(\\.|\u3001|\u3002)cn":".cn",
  1830. "[pPpP][sSsS][::]":"ps:",
  1831. "。{5,7}":"……","~{2,50}":"——","…{3,40}": "……","-{3,20}":"——",
  1832. //"。(,|,|。)": "。",
  1833. // "?(,|,)": "?",
  1834. //"”(,|,|。)": "”",
  1835. "@{3,}": "",
  1836.  
  1837. // === 一些特殊的替换 ===
  1838. "\\[+CP.*(http://file.*\\.jpg)\\]+": "<img src='$1'>",
  1839. "『(.)』": "$1", // "『色』": "色",
  1840.  
  1841. // === 去广告 ===
  1842. "\\[搜索最新更新尽在[a-z\\.]+\\]": "",
  1843. "<a>手机用户请到m.qidian.com阅读。</a>": "",
  1844. ".{2,4}中文网欢迎广大书友": "",
  1845. "访问下载txt小说|◎雲來閣免费万本m.yunlaige.com◎":"",
  1846. "〖∷更新快∷无弹窗∷纯文字∷.*?〗": "",
  1847. "本文由 。。 首发":"",
  1848. '”小说“小说章节更新最快': '',
  1849. '如果觉得好看,请把本站网址推荐给您的朋友吧!': '',
  1850. '本站手机网址:&nbsp;&nbsp;请互相通知向您QQ群【微博/微信】论坛贴吧推荐宣传介绍!': '',
  1851. "fqXSw\\.com":"", "\\.5du|\\.5du5\\.":"",
  1852. "\\[\\]":"",
  1853. "如果您觉得网不错就多多分享本站谢谢各位读者的支持": "",
  1854. "全文字无广告|\\(看书窝&nbsp;看书窝&nbsp;无弹窗全文阅读\\)": "",
  1855. "。。+[\\s ]*看最新最全小说": "",
  1856. "水印广告测试": "",
  1857. "\\(平南文学网\\)":"", "讀蕶蕶尐說網":"",
  1858. "比奇提示:如何快速搜自己要找的书籍":"", "《百度书名\\+比奇》即可快速直达":"",
  1859. "~无~错~小~说": "",
  1860.  
  1861. "\\(一秒记住小说界\\)|\\*一秒记住\\*":"",
  1862. "uutxt\\.org|3vbook\\.cn|www\\.qbwx\\.com|WWw\\.YaNkuai\\.com|www\\.btzw\\.com|www\\.23uS\\.com": "",
  1863. "txt53712/": "",
  1864. "\xa0{4,12}":"\xa0\xa0\xa0\xa0\xa0\xa0\xa0",
  1865.  
  1866. // === 通用去广告
  1867. "[wwW]{1,3}[.\\.]23uS[.\\.](?:coM|com)": "",
  1868.  
  1869. // === 星号屏蔽字还原 ===
  1870. "十有(\\*{2})":"十有八九","十有bā'九":"十有八九", "\\*{2}不离十":"八九不离十",
  1871. "G(\\*{2})":"GSM", "感(\\*{2})彩":"感情色彩",
  1872. "强(\\*{2})u5B9D":"强大法宝",
  1873. "(\\*{2})凡胎": "肉体凡胎",
  1874.  
  1875. // === 多字替换 ===
  1876. "cao之过急":"操之过急", "chunguang大泄":"春光大泄",
  1877. "大公无si":"大公无私",
  1878. "fu道人家":"妇道人家", "放sōng'xià来":"放松下来",
  1879. "奸yin掳掠":"奸淫掳掠",
  1880. "空dangdang":"空荡荡",
  1881. "突发qing况": "突发情况",
  1882. "yin奉阳违":"阴奉阳违", "一yin一阳":"一阴一阳",
  1883.  
  1884. // === 双字替换 ===
  1885. "暧m[eè][iì]":"暧昧",
  1886. "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*":"表现",
  1887. "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"":"赤裸",
  1888. "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ò":"坠落",
  1889. "f[ǎa]ngf[óo]":"仿佛", "fei踢": "飞踢", "feng流": "风流", "风liu": "风流", "f[èe]nn[ùu]":"愤怒", "fǎn\\s*yīng":"反应",
  1890. "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":"过分",
  1891. "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*":"合适",
  1892. "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色":"角色",
  1893. "k[ěe]n[ée]ng": "可能", "开bao": "开苞", "k[àa]o近": "靠近", "口wen":"口吻", "kankan":"看看",
  1894. "ling辱": "凌辱", "luan蛋": "卵蛋", "脸sè": "脸色", "lu出":"露出", "流máng":"流氓", "lun理":"伦理", "lì\\s*qì":"力气",
  1895. "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":"蒙蒙",
  1896. "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":"内裤",
  1897. "pi[áa]o客":"嫖客", "p[áa]ngbi[āa]n":"旁边",
  1898. "q[íi]gu[àa]i":"奇怪", "qing\\s*(ren|人)":"情人", "qin兽":"禽兽", "q[iī]ngch[uǔ]":"清楚", "què\\s*dìng":"确定", "球mi":"球迷", "青chun":"青春", "青lou":"青楼", "qingkuang":"情况", "qiang[ \\s]*jian":"强奸",
  1899. "re\\s*nao":"热闹", "r[úu]gu[oǒ]":"如果", "r[oó]ngy[ìi]":"容易", "ru(房|白色)": "乳$1", "rén员":"人员", "rén形":"人形", "人chao":"人潮", "renmen":"人名",
  1900. "上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":"双峰",
  1901. "t[uū]r[áa]n":"突然", "tiaojiao": "调教", "偷qing":"偷情", "推dao": "推倒", "脱guang": "脱光", "t[èe]bi[ée]":"特别", "t[ōo]nggu[òo]":"通过", "同ju":"同居", "tian来tian去":"舔来舔去",
  1902. "w[ēe]ixi[ée]":"威胁", "wèizh[ìi]":"位置", "wei员":"委员", "w[èe]nti":"问题", "wèi\\s*dào\\s*":"味道", "wú\\s*nài":"无奈", "weilai":"未来",
  1903. "xiu长": "修长", "亵du": "亵渎", "xing福": "幸福", "小bo":"小波", "小niū":"小妞", "xiong([^a-z])":"胸$1", "小tui":"小腿", "xiang港":"香港", "xiàohuà":"笑话", "xiàn\\'zhì":"限制", "xiōng\\s*dì":"兄弟",
  1904. "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è情":"一夜情",
  1905. "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义":"主义",
  1906.  
  1907. "</p>\\n<p>\\s*ì":"日",
  1908. };
  1909.  
  1910. // 单字替换,可能会误替换,所以需要特殊处理
  1911. (function(){
  1912. var oneWordReplace = {
  1913. "b[āà]ng":"棒","bào":"爆","bà":"吧","bī":"逼","bō":"波",
  1914. "cāo": "操", "cǎo": "草", "cào": "操", "chāng": "娼", "chang": "娼", "cháo": "潮", "chā": "插", "chéng": "成", "chōu": "抽", "chuáng": "床", "chún": "唇", "chūn": "春", "cuō": "搓", "cū": "粗",
  1915. "dǎng": "党", "dàng": "荡", "dāo": "刀", "dòng": "洞", "diao": "屌", "diǎn": "点",
  1916. "fǎ": "法", "féi": "肥", "fù": "妇",
  1917. "guān": "官",
  1918. "hán": "含", "hóu": "喉", "hòu": "厚", "h(u)?ā": "花", "huá": "华", "huò": "惑", "hùn": "混", "hún": "魂",
  1919. "jiǔ": "九", "jīng": "精", "jìn": "禁", "jǐng": "警", "jiāng": "江", "jiān": "奸", "jiāo": "交", "jūn": "军", "jū": "拘", "jú": "局", "jī": "激", "激ān":"奸",
  1920. "kù": "裤", "kàn": "看",
  1921. "[1l]àng": "浪", "liáo": "撩", "liú":"流", "lì":"莉", "liè":"烈", "[1l]uàn":"乱", "lún":"伦", "luǒ":"裸", "lòu":"露", "[l1]ù":"露", "lǜ":"绿",
  1922. "mǎi": "买", "mài": "卖", "máo": "毛", "mā": "妈", "méng": "蒙", "mén": "门", "miè": "灭", "mí": "迷", "mì": "蜜", "mō": "摸",
  1923. "nǎi": "奶", "nèn": "嫩", "niào": "尿", "niē": "捏", "nòng": "弄", "nǚ": "女",
  1924. "pào": "炮", "piàn": "片",
  1925. "qi[āa]ng": "枪", "qíng": "情", "qīn": "亲", "qiú": "求", "quán": "全",
  1926. "rén":"人", "rì": "日", "rǔ": "乳",
  1927. "sāo":"骚", "sǎo": "骚", "sè": "色", "shā": "杀", "shēn":"呻", "shén":"神", "shè": "射", "shǐ": "屎", "shì": "侍", "sǐ": "死", "sī": "私", "shǔn": "吮", "sǔn": "吮", "sū": "酥",
  1928. "tān":"贪", "tiǎn": "舔", "tǐng":"挺", "tǐ": "体", "tǒng": "捅", "tōu": "偷", "tou": "偷", "tuǐ": "腿", "tūn": "吞", "tún": "臀", "tiáo":"调", "tài":"态",
  1929. "wēn": "温", "wěn": "吻",
  1930. "xiǎo":"小", "xìng": "性", "xiōng": "胸", "xī": "吸", "xí": "习", "xué": "穴", "xuè": "穴", "xùe": "穴", "xuan":"宣",
  1931. "yāng":"央", "yàn":"艳", "yīn":"阴", "yào": "药", "yé": "爷", "yòu": "诱", "zàng": "脏", "yù": "欲", "yín": "淫",
  1932. "zhēn":"针", "zēn":"针", "zhà":"炸", "zhèng":"政", "zǒu": "走", "zuì":"罪", "zuò":"做", "zhōng":"中",
  1933.  
  1934. "ri":"日", "se":"色", "yu":"欲", "xing":"性",
  1935. "jing":"精", "ting":"挺",
  1936. };
  1937.  
  1938. var replaceOthers = {
  1939. // ===误替换还原===
  1940. "碧欲": "碧玉", "美欲": "美玉","欲石": "玉石","惜欲": "惜玉","宝欲": "宝玉",
  1941. "品性": "品行", "德性": "德行",
  1942. "波ok": "book", "波SS": "BOSS",
  1943.  
  1944. // ===其他修正===
  1945. "弥俩": "你俩",
  1946. "妳": "你",
  1947. "圞|垩|卝|龘":""
  1948. };
  1949.  
  1950. _.each(oneWordReplace, function(value, key) {
  1951. Rule.replace['([^a-z\\s])' + key + '(?![a-z\\s])'] = '$1' + value;
  1952. });
  1953.  
  1954. _.extend(Rule.replace, replaceOthers);
  1955. })();
  1956.  
  1957. // ===== 全局移除,在替换 <br> 为 \n 之后 =====
  1958. Rule.replaceAll = [
  1959. // 长文字替换
  1960. '纯文字在线阅读本站域名手机同步阅读请访问',
  1961. '\\(?未完待续请搜索飄天文學,小说更好更新更快!',
  1962. '-优-优-小-说-更-新-最-快-www.UUXS.CC-',
  1963. '【阅读本书最新章节,请搜索800】',
  1964. '亲,百度搜索眼&amp;快,大量小说免费看。',
  1965. '\\|每两个看言情的人当中,就有一个注册过可°乐°小°说°网的账号。',
  1966. '最新章节全文阅读看书神器\\.yankuai\\.',
  1967. '(800小说网 www.800Book.net 提供Txt免费下载)最新章节全文阅读-..-',
  1968. '\\[看本书最新章节请到求书 .\\]',
  1969. '\\[800\\]\\[站页面清爽,广告少,',
  1970. '\\|优\\|优\\|小\\|说\\|更\\|新\\|最\\|快\\|www.uuxs.cc\\|',
  1971. '看本书最新章节请到800小说网(www.800book.net)',
  1972. '(800小说网 www.800Book.net 提供Txt免费下载)',
  1973. '热门小说最新章节全文阅读.。 更新好快。',
  1974. '-优-优-小-说-更-新-最-快x',
  1975. '亲,眼&快,大量小说免费看。',
  1976. '手机看小说哪家强手机阅',
  1977. '思ˊ路ˋ客,更新最快的!',
  1978. '(本章未完,请翻页)',
  1979. '最新章节全文阅读(..首发)',
  1980. '最新章节全文阅读【首发】',
  1981. '最新章节全文阅读',
  1982. '来可乐网看小说',
  1983. 'txt电子书下载/',
  1984. 'txt全集下载',
  1985. 'txt小说下载',
  1986. '(\\s*君子聚义堂)',
  1987. 'readx;',
  1988.  
  1989. // 包含 \P 的替换
  1990. '\\P{1,2}[顶頂].{1,3}[点小].*?o?[mw,]',
  1991. '\\P.?长.{1,2}风.{1,2}文.{1,2}学.*?[tx]',
  1992. '\\P无.错.*?[cC][oO][mM]',
  1993. '[;\\(]顶.{0,2}点.小说',
  1994. '2长2风2文2学,w¢$',
  1995. '》长>风》',
  1996.  
  1997. // 包含 .* 的,可能有多余的替换
  1998. '如您已(?:閱讀|阅读)到此章节.*?敬请记住我们新的网址\\s*。',
  1999. '↗百度搜:.*?直达网址.*?↖',
  2000. "[:《〈|~∨∟∑]{1,2}长.{1,2}风.*?et",
  2001. '\\[限时抢购\\].*',
  2002. '支持网站发展.逛淘宝买东西就从这里进.*',
  2003. 'ps[::]想听到更多你们的声音,想收到更多你们的建议,现在就搜索微信公众号“qdread”并加关注,给.*?更多支持!',
  2004. '(?:ps[::])?看《.*?》背后的独家故事.*?告诉我吧!',
  2005. '(?天上掉馅饼的好活动.*?微信公众号!)?',
  2006. '(微信添加.*qdread微信公众号!)',
  2007. 'jiemei如您已阅读到此章节,请移步到.*?\\[ads:本站换新网址啦,速记方法:,.\\]',
  2008.  
  2009. // 短文字替换
  2010. '\\[txt全集下载\\]',
  2011. '\\[\\s*超多好看小说\\]',
  2012. '⊙四⊙五⊙中⊙文☆→',
  2013. '\\[ads:本站换新网址啦,速记方法:.*?\\]',
  2014. '[》《|~]无(?:.|&gt;)错(?:.|&gt;)小说',
  2015. '`无`错`小说`www.``com', '+无+错+小说+3w++',
  2016. '\\|优\\|优\\|小\\|说\\|更\\|新\\|最\\|快X',
  2017. '▲∴', '8,ww←',
  2018. /www.23+?[Ww][Xx].[Cc]om/ig,
  2019. /热门推荐:、+/g,
  2020. /h2&gt;/g,
  2021. '[《〈》>\\+|~[\\]]无\\1错\\1', '》无>错》',
  2022.  
  2023. '女凤免费小说抢先看', '女凤小说网全文字 无广告',
  2024. '乐文小说', '《乐〈文《小说', '乐文移动网', '頂点小说', '頂點小說',
  2025. '追小说哪里快去眼快',
  2026. '\\[书库\\].\\[774\\]\\[buy\\].kuai',
  2027.  
  2028. /'ads_wz_txt;',|百度搜索|无弹窗小说网|更新快无弹窗纯文字|高品质更新|小说章节更新最快|\(百度搜.\)|全文字手打|“”&nbsp;看|无.弹.窗.小.说.网|追书网|〖∷∷无弹窗∷纯文字∷ 〗/g,
  2029. ];
  2030.  
  2031.  
  2032. // 自定义的
  2033. Rule.customRules = [];
  2034. Rule.customReplace = {};
  2035.  
  2036. Rule.parseCustomReplaceRules = function(str) {
  2037. var arr = str.split(/\n/);
  2038. var rules = {};
  2039. _.each(arr, function(b) {
  2040. var pos = b.indexOf('=');
  2041. if (pos === -1) return;
  2042.  
  2043. var key = b.substring(0, pos),
  2044. value = b.substring(pos + 1, b.length);
  2045. rules[key] = value;
  2046. });
  2047. return rules;
  2048. };
  2049.  
  2050.  
  2051. var getBooleanConfig = function(configName, defaultValue) {
  2052. var config = GM_getValue(configName);
  2053. if(config === undefined) {
  2054. GM_setValue(configName, defaultValue);
  2055. config = defaultValue;
  2056. }
  2057. return config;
  2058. };
  2059.  
  2060. var Config = {
  2061. getDisableAutoLaunch: function() { // 强制手动启用模式
  2062. return getBooleanConfig("disable_auto_launch", false);
  2063. },
  2064. setDisableAutoLaunch: function(bool) {
  2065. GM_setValue("disable_auto_launch", bool);
  2066. },
  2067.  
  2068. // 按键调用会遇到问题: Greasemonkey 访问违规:unsafeWindow 无法调用 GM_getValue
  2069. // 故改成这种形式
  2070. copyCurTitle: getBooleanConfig("copyCurTitle", true),
  2071. setCopyCurTitle: function (bool) {
  2072. this.copyCurTitle = !!bool;
  2073. GM_setValue("copyCurTitle", !!bool);
  2074. },
  2075.  
  2076. get cn2tw() {
  2077. if (_.isUndefined(this._cn2tw)) {
  2078. this._cn2tw = getBooleanConfig('cn2tw', Config.lang === 'zh-TW' ? true : false);
  2079. }
  2080. return this._cn2tw;
  2081. },
  2082. set cn2tw(bool) {
  2083. GM_setValue('cn2tw', bool);
  2084. this._cn2tw = bool;
  2085. },
  2086.  
  2087. get booklink_enable() { // booklink.me 跳转的自动启动
  2088. return getBooleanConfig("booklink_enable", true);
  2089. },
  2090. set booklink_enable(bool) {
  2091. GM_setValue("booklink_enable", bool);
  2092. },
  2093.  
  2094. get debug() { // 调试
  2095. if (_.isUndefined(this._debug)) {
  2096. this._debug = getBooleanConfig("debug", false);
  2097. }
  2098. return this._debug;
  2099. },
  2100. set debug(bool) {
  2101. this._debug = bool;
  2102. GM_setValue("debug", bool);
  2103. toggleConsole(bool);
  2104. },
  2105.  
  2106. get addToHistory() {
  2107. if (_.isUndefined(this._addToHistory)) {
  2108. this._addToHistory = getBooleanConfig("add_nextpage_to_history", true);
  2109. }
  2110. return this._addToHistory;
  2111. },
  2112. set addToHistory(bool) {
  2113. this._addToHistory = bool;
  2114. GM_setValue("add_nextpage_to_history", bool);
  2115. },
  2116.  
  2117. get dblclickPause() {
  2118. return getBooleanConfig('dblclick_pause', true);
  2119. },
  2120. set dblclickPause(bool) {
  2121. GM_setValue('dblclick_pause', bool);
  2122. },
  2123.  
  2124. get remain_height() { // 距离底部多少高度(px)开始加载下一页
  2125. if(_.isUndefined(this._remain_height)){
  2126. this._remain_height = parseInt(GM_getValue("remain_height"), 10) || 400;
  2127. }
  2128. return this._remain_height;
  2129. },
  2130. set remain_height(val) {
  2131. this._remain_height = val;
  2132. GM_setValue("remain_height", val);
  2133. },
  2134.  
  2135. get lang() {
  2136. if (_.isUndefined(this._lang)) {
  2137. this._lang = GM_getValue("lang") || ((navigator.language === "zh-TW" || navigator.language === "zh-HK") ? "zh-TW" : "zh-CN");
  2138. }
  2139. return this._lang;
  2140. },
  2141. set lang(val) {
  2142. this._lang = val;
  2143. GM_setValue("lang", val);
  2144. },
  2145.  
  2146. get font_family() {
  2147. return GM_getValue("font_family") || "微软雅黑,宋体,黑体,楷体".uiTrans();
  2148. },
  2149. set font_family(val) {
  2150. GM_setValue("font_family", val);
  2151. },
  2152.  
  2153. get font_size() { // 字体大小
  2154. return GM_getValue("font_size") || "18px";
  2155. },
  2156. set font_size(val) {
  2157. GM_setValue("font_size", val);
  2158. },
  2159.  
  2160. get text_line_height(){
  2161. return GM_getValue("text_line_height") || "2em";
  2162. },
  2163. set text_line_height(val){
  2164. GM_setValue("text_line_height", val);
  2165. },
  2166.  
  2167. get content_width() { // 内容宽度
  2168. return GM_getValue("content_width") || "800px";
  2169. },
  2170. set content_width(val) {
  2171. GM_setValue("content_width", val);
  2172. },
  2173.  
  2174. get extra_css() {
  2175. return GM_getValue("extra_css", "");
  2176. },
  2177. set extra_css(val) {
  2178. GM_setValue("extra_css", val);
  2179. },
  2180.  
  2181. get customSiteinfo() {
  2182. return GM_getValue('custom_siteinfo', '[]');
  2183. },
  2184. set customSiteinfo(val) {
  2185. GM_setValue('custom_siteinfo', val);
  2186. },
  2187.  
  2188. get customReplaceRules() {
  2189. var rules = GM_getValue('custom_replace_rules', 'b[āà]ng=棒\n『(.)』=$1');
  2190.  
  2191. return rules;
  2192. },
  2193. set customReplaceRules(val) {
  2194. GM_setValue('custom_replace_rules', val);
  2195. },
  2196.  
  2197. get skin_name() {
  2198. return GM_getValue("skin_name") || "缺省皮肤".uiTrans();
  2199. },
  2200. set skin_name(val) {
  2201. GM_setValue("skin_name", val);
  2202. },
  2203.  
  2204. get menu_list_hiddden() {
  2205. return getBooleanConfig("menu_list_hiddden", false);
  2206. },
  2207. set menu_list_hiddden(bool) {
  2208. GM_setValue("menu_list_hiddden", bool);
  2209. },
  2210.  
  2211. get hide_footer_nav() {
  2212. return getBooleanConfig("hide_footer_nav", true);
  2213. },
  2214. set hide_footer_nav(bool) {
  2215. GM_setValue("hide_footer_nav", bool);
  2216. UI.hideFooterNavStyle(bool);
  2217. },
  2218.  
  2219. get hide_preferences_button() {
  2220. return getBooleanConfig("hide_preferences_button", false);
  2221. },
  2222. set hide_preferences_button(bool) {
  2223. GM_setValue('hide_preferences_button', bool);
  2224. },
  2225.  
  2226. // === 快捷键
  2227.  
  2228. // 安静模式切换快捷键
  2229. get quietModeKey() {
  2230. if (this._quietModeKey) {
  2231. return this._quietModeKey;
  2232. }
  2233. this._quietModeKey = GM_getValue('quietModeKey') || 'q';
  2234.  
  2235. return this._quietModeKey;
  2236. },
  2237. set quietModeKey(keyCode) {
  2238. this._quietModeKey = keyCode;
  2239. GM_setValue('quietModeKey', keyCode);
  2240. },
  2241.  
  2242. // 打开设置窗口的快捷键
  2243. get openPreferencesKey() {
  2244. if (this._openPreferencesKey) {
  2245. return this._openPreferencesKey;
  2246. }
  2247. this._openPreferencesKey = GM_getValue('open_preferences_key') || 's';
  2248.  
  2249. return this._openPreferencesKey;
  2250. },
  2251. set openPreferencesKey(keyCode) {
  2252. this._openPreferencesKey = keyCode;
  2253. GM_setValue('open_preferences_key', keyCode);
  2254. },
  2255.  
  2256. // 隐藏左侧章节列表的快捷键
  2257. get hideMenuListKey() { // 默认为 c
  2258. // 'C'.charCodeAt(0) = 67
  2259. if (this._hideMenuListKey) {
  2260. return this._hideMenuListKey;
  2261. }
  2262. this._hideMenuListKey = GM_getValue('hide_menulist_key') || 'c';
  2263.  
  2264. return this._hideMenuListKey;
  2265. },
  2266. set hideMenuListKey(key) {
  2267. this._hideMenuListKey = key;
  2268. GM_setValue("hide_menulist_key", key);
  2269. },
  2270.  
  2271. get picNightModeCheck() {
  2272. return getBooleanConfig('picNightModeCheck', true);
  2273. },
  2274. set picNightModeCheck(bool) {
  2275. GM_setValue('picNightModeCheck', bool);
  2276. },
  2277.  
  2278. get split_content() {
  2279. if (_.isUndefined(this._split_content)) {
  2280. this._split_content = GM_getValue('split_content', true);
  2281. }
  2282. return this._split_content;
  2283. },
  2284. set split_content(bool) {
  2285. this._split_content = bool;
  2286. GM_setValue('split_content', bool);
  2287. },
  2288.  
  2289. get scrollAnimate() {
  2290. return GM_getValue('scrollAnimate', false);
  2291. },
  2292. set scrollAnimate(bool) {
  2293. GM_setValue('scrollAnimate', bool);
  2294. },
  2295. };
  2296.  
  2297.  
  2298. var uiTrans = {
  2299. "将小说网页文本转换为繁体。\n\n注意:内置的繁简转换表,只收录了简单的单字转换,启用本功能后,如有错误转换的情形,请利用脚本的自订字词取代规则来修正。\n例如:「千里之外」,会错误转换成「千里之外」,你可以加入规则「千里之外=千里之外」来自行修正。": "將小說網頁文字轉換為繁體。\n\n注意:內建的繁簡轉換表,只收錄了簡單的單字轉換,啟用本功能後,如有錯誤轉換的情形,請利用腳本的自訂字詞取代規則來修正。\n例如:「千里之外」,會錯誤轉換成「千裡之外」,你可以加入規則「千裡之外=千里之外」來自行修正。",
  2300. "图片章节用夜间模式没法看,这个选项在启动时会自动切换到缺省皮肤": "圖片章節無法以夜間模式觀看,這個選項在啟動時會自動切換到預設佈景",
  2301. "通过快捷键切换或在 Greasemonkey 用户脚本命令处打开设置窗口": "通過熱鍵切換或在 Greasemonkey 使用者腳本命令處開啟設定視窗",
  2302. "隐藏后通过快捷键或 Greasemonkey 用户脚本命令处调用": "隱藏後通過熱鍵或 Greasemonkey 使用者腳本命令處調用",
  2303. "一行一个,每行第一个 = 为分隔符\n需要刷新页面生效": "一行一條規則,每一行第一個 = 為分隔符\n(需重新載入頁面才能生效)",
  2304. "错误:没有找到下一页的内容,使用右键翻到下一页": "錯誤:沒有找到下一頁的內容,使用右鍵翻到下一頁",
  2305. "左键滚动,中键打开链接(无阅读模式)": "左鍵捲動畫面至該章節,中鍵開啟連結(無閱讀模式)",
  2306. "请输入切换左侧章节列表的快捷键:": "請輸入切換左側章節列表的熱鍵:",
  2307. "详见脚本代码的 Rule.specialSite": "詳見腳本代碼的 Rule.specialSite",
  2308. "booklink.me 点击的网站强制启用": "booklink.me 點擊的網站強制啟用",
  2309. "部分选项需要刷新页面才能生效": "部份選項需重新載入頁面才能生效",
  2310. "取消本次设定,所有选项还原": "取消本次設定,所有選項還原",
  2311. "不影响 booklink.me 的启用": "不影響 booklink.me 的啟用",
  2312. "请输入打开设置的快捷键:": "請輸入開啟設定視窗的熱鍵:",
  2313. "微软雅黑,宋体,黑体,楷体": "Microsoft YaHei,新細明體,PMingLiU,MingLiU,細明體,標楷體",
  2314. "夜间模式的图片章节检测": "夜間模式的圖片章節檢測",
  2315. "点击显示隐藏章节列表": "點此以顯示或隱藏章節列表",
  2316. "添加下一页到历史记录": "加入下一頁到歷史記錄",
  2317. "booklink 自动启用": "booklink 自動啟用",
  2318. "Enter 键打开目录": "Enter 鍵開啟目錄",
  2319. "隐藏左侧章节列表": "隱藏左側章節列表",
  2320. "小说阅读脚本设置":"小說閱讀腳本設定",
  2321. "已到达最后一页": "已到達最後一頁",
  2322. "正在载入下一页": "正在載入下一頁",
  2323. "通过快捷键切换": "通過熱鍵切換",
  2324. "隐藏底部导航栏": "隱藏底部導航列",
  2325. "隐藏左侧导航条": "隱藏左側章節列表彈出鈕",
  2326. "主页链接没有找到": "未找到主頁連結",
  2327. "自定义站点规则": "自訂網站規則",
  2328. "自定义替换规则": "自訂字詞取代規則",
  2329. "网页:转繁体": "網頁:轉繁體",
  2330. "双击暂停翻页": "雙擊暫停翻頁",
  2331. "隐藏设置按钮": "隱藏設定按鈕",
  2332. "强制手动启用": "強制手動啟用",
  2333. "调用阅读器": "調用閱讀器",
  2334. "自定义样式": "自訂樣式",
  2335. "界面语言": "介面語言",
  2336. "打开目录": "開啟本書目錄頁",
  2337. "自动翻页": "自動翻頁",
  2338. "缺省皮肤": "預設佈景",
  2339. "暗色皮肤": "暗色佈景",
  2340. "夜间模式": "夜間模式",
  2341. "夜间模式1": "夜間模式1",
  2342. "夜间模式2": "夜間模式2",
  2343. "橙色背景": "橙色背景",
  2344. "绿色背景": "綠色背景",
  2345. "绿色背景2": "綠色背景2",
  2346. "蓝色背景": "藍色背景",
  2347. "棕黄背景": "棕黃背景",
  2348. "经典皮肤": "經典背景",
  2349. "阅读模式": "閱讀模式",
  2350. "调试模式": "偵錯模式",
  2351. "反馈地址": "反饋與討論",
  2352. "安静模式": "安靜模式",
  2353. "√ 确认": "√ 確定",
  2354. "X 取消": "X 取消",
  2355. "上一页": "上一頁",
  2356. "下一页": "下一頁",
  2357. "状态": "狀態",
  2358. "已经": "已經",
  2359. "暂停": "暫停",
  2360. "启用": "啟用",
  2361. "退出": "離開",
  2362. "测试": "測試",
  2363. "距离": "距離",
  2364. "加载": "載入",
  2365. "字体": "字型",
  2366. "行高": "行距",
  2367. "行宽": "版面寬度",
  2368. "目录": "目錄"
  2369. };
  2370.  
  2371. if(!String.prototype.uiTrans){
  2372. Object.defineProperty(String.prototype, 'uiTrans', {
  2373. value: function(){
  2374. var _this = this.valueOf(), key, regexp;
  2375. if(Config.lang !== 'zh-TW') return _this;
  2376. if(uiTrans.hasOwnProperty(_this)) return uiTrans[_this];
  2377. for (key in uiTrans) {
  2378. regexp = new RegExp(key, 'g');
  2379. _this = _this.replace(regexp, uiTrans[key]);
  2380. }
  2381. return _this;
  2382. },
  2383. enumerable: false
  2384. });
  2385. }
  2386.  
  2387. //------------------- 辅助函数 ----------------------------------------
  2388.  
  2389. var nullFn = function() {};
  2390.  
  2391. // Check if is GM 2.x
  2392. if (typeof exportFunction == 'undefined') {
  2393. // For GM 1.x backward compatibility, should work.
  2394. var exportFunction = (function(foo, scope, defAs) {
  2395. scope[defAs.defineAs] = foo;
  2396. }).bind(unsafeWindow);
  2397. }
  2398.  
  2399. var C;
  2400. toggleConsole(Config.debug);
  2401.  
  2402. function toggleConsole(debug) {
  2403. if (debug) {
  2404. C = console;
  2405. } else {
  2406. C = {
  2407. log: nullFn,
  2408. debug: nullFn,
  2409. error: nullFn,
  2410. group: nullFn,
  2411. groupCollapsed: nullFn,
  2412. groupEnd: nullFn,
  2413. time: nullFn,
  2414. timeEnd: nullFn,
  2415. };
  2416. }
  2417. }
  2418.  
  2419. function L_getValue(key) { // 个别用户禁用本地存储会报错
  2420. try {
  2421. return localStorage.getItem(key);
  2422. } catch (e) {}
  2423. }
  2424.  
  2425. function L_setValue(key, value) {
  2426. try {
  2427. localStorage.setItem(key, value);
  2428. } catch (e) {}
  2429. }
  2430.  
  2431. function L_removeValue(key) {
  2432. try {
  2433. localStorage.removeItem(key);
  2434. } catch (e) {}
  2435. }
  2436.  
  2437.  
  2438. function parseHTML(str) {
  2439. var doc;
  2440. try {
  2441. // firefox and chrome 30+,Opera 12 会报错
  2442. doc = new DOMParser().parseFromString(str, "text/html");
  2443. } catch (ex) {}
  2444.  
  2445. if (!doc) {
  2446. doc = document.implementation.createHTMLDocument("");
  2447. doc.querySelector("html").innerHTML = str;
  2448. }
  2449. return doc;
  2450. }
  2451.  
  2452. function toRE(obj, flag) {
  2453. if (obj instanceof RegExp) {
  2454. return obj;
  2455. } else {
  2456. return new RegExp(obj, (flag || 'ig'));
  2457. }
  2458. }
  2459.  
  2460. function toReStr(str) { // 处理字符串,否则可能会无法用正则替换
  2461. return str.replace(/[()\[\]{}|+.,^$?\\*]/g, "\\$&");
  2462. }
  2463.  
  2464. function wildcardToRegExpStr(urlstr) {
  2465. if (urlstr.source) return urlstr.source;
  2466. var reg = urlstr.replace(/[()\[\]{}|+.,^$?\\]/g, "\\$&").replace(/\*+/g, function(str){
  2467. return str === "*" ? ".*" : "[^/]*";
  2468. });
  2469. return "^" + reg + "$";
  2470. }
  2471.  
  2472. function getUrlHost(url) {
  2473. var a = document.createElement('a');
  2474. a.href = url;
  2475. return a.host;
  2476. }
  2477.  
  2478. $.nano = function(template, data) {
  2479. return template.replace(/\{([\w\.]*)\}/g, function(str, key) {
  2480. var keys = key.split("."),
  2481. v = data[keys.shift()];
  2482. for (var i = 0, l = keys.length; i < l; i++) v = v[keys[i]];
  2483. return (typeof v !== "undefined" && v !== null) ? v : "";
  2484. });
  2485. };
  2486.  
  2487. // jQuery text 完全匹配. e.g. a:econtains('最新章节')
  2488. $.expr[":"].econtains = function(obj, index, meta, stack) {
  2489. return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase();
  2490. };
  2491.  
  2492. /* jshint ignore: start */
  2493.  
  2494. function $x(aXPath, aContext) {
  2495. var nodes = [];
  2496. var doc = document;
  2497. aContext = aContext || doc;
  2498.  
  2499. try {
  2500. var results = doc.evaluate(aXPath, aContext, null,
  2501. XPathResult.ANY_TYPE, null);
  2502. var node;
  2503. while (node = results.iterateNext()) {
  2504. nodes.push(node);
  2505. }
  2506. } catch (ex) {}
  2507.  
  2508. return nodes;
  2509. }
  2510.  
  2511. Function.prototype.getMStr = function() { // 多行String
  2512. var lines = new String(this);
  2513. lines = lines.substring(lines.indexOf("/*") + 3, lines.lastIndexOf("*/"));
  2514. return lines;
  2515. };
  2516.  
  2517. if (typeof String.prototype.startsWith != 'function') {
  2518. String.prototype.startsWith = function(str) {
  2519. return this.slice(0, str.length) == str;
  2520. };
  2521. }
  2522.  
  2523. if (typeof String.prototype.contains != 'function') {
  2524. String.prototype.contains = function(str) {
  2525. return this.indexOf(str) != -1;
  2526. };
  2527. }
  2528.  
  2529. function saveAs(data, filename) {
  2530. if(!filename) filename = 'console.json'
  2531.  
  2532. if (typeof data == 'object') {
  2533. data = JSON.stringify(data, undefined, 4);
  2534. }
  2535.  
  2536. var blob = new Blob([data], { type: 'application/octet-stream' });
  2537. var url = window.URL.createObjectURL(blob);
  2538. var saveas = document.createElement('a');
  2539. saveas.href = url;
  2540. saveas.style.display = 'none';
  2541. document.body.appendChild(saveas);
  2542. saveas.download = filename;
  2543. saveas.click();
  2544. setTimeout(function() {
  2545. saveas.parentNode.removeChild(saveas);
  2546. }, 1000)
  2547. document.addEventListener('unload', function() {
  2548. window.URL.revokeObjectURL(url);
  2549. });
  2550. }
  2551.  
  2552. /*
  2553. * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
  2554. */
  2555. 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}});
  2556.  
  2557. /* jshint ignore: end */
  2558.  
  2559.  
  2560. var UI = {
  2561. tpl_footer_nav: '\
  2562. <div class="chapter-footer-nav">\
  2563. <a class="prev-page" href="{prevUrl}">上一页</a> | \
  2564. <a class="index-page" href="{indexUrl}" title="Enter 键打开目录">目录</a> | \
  2565. <a class="next-page" style="color:{theEndColor}" href="{nextUrl}">下一页</a>\
  2566. </div>\
  2567. '.uiTrans(),
  2568. skins: {},
  2569.  
  2570. init: function(){
  2571. UI.refreshMainStyle();
  2572.  
  2573. UI.refreshSkinStyle(Config.skin_name, true);
  2574.  
  2575. UI.refreshExtraStyle(Config.extra_css);
  2576.  
  2577. UI.fixMobile();
  2578.  
  2579. // 初始变量
  2580. UI.$menu = $('#menu');
  2581. UI.$menuBar = $('#menu-bar');
  2582. UI.$content = $('#mynovelreader-content');
  2583. UI.$preferencesBtn = $('#preferencesBtn');
  2584.  
  2585. // 初始化是否隐藏
  2586. if(Config.hide_footer_nav){
  2587. UI.hideFooterNavStyle(true);
  2588. }
  2589.  
  2590. // UI.toggleQuietMode(); // 初始化安静模式
  2591. UI.hideMenuList(Config.menu_list_hiddden); // 初始化章节列表是否隐藏
  2592. UI.hidePreferencesButton(Config.hide_preferences_button); // 初始化设置按钮是否隐藏
  2593. },
  2594. refreshMainStyle: function(){
  2595. if(UI.mainStyle){
  2596. $(UI.mainStyle).remove();
  2597. }
  2598.  
  2599. UI.mainStyle = GM_addStyle(
  2600. Res.CSS_MAIN
  2601. .replace("{font_family}", Config.font_family)
  2602. .replace("{font_size}", Config.font_size)
  2603. .replace("{title_font_size}", UI.calcTitleFontSize(Config.font_size))
  2604. .replace("{content_width}", Config.content_width)
  2605. .replace("{text_line_height}", Config.text_line_height)
  2606. .replace("{menu-bar-hidden}", Config.menu_bar_hidden ? "display:none;" : "")
  2607. );
  2608. },
  2609. hideFooterNavStyle: function(hidden){
  2610. var navStyle = $("#footer_nav_css");
  2611. if(hidden) {
  2612. if(navStyle.length === 0) {
  2613. $('<style>')
  2614. .attr("id", "footer_nav_css")
  2615. .text(".chapter-footer-nav { display: none; }")
  2616. .appendTo('head');
  2617. }
  2618. } else {
  2619. navStyle.remove();
  2620. }
  2621. },
  2622. hideMenuList: function(hidden){
  2623. if(typeof(hidden) === "undefined"){
  2624. hidden = !UI.menu_list_hiddden;
  2625. }
  2626.  
  2627. if(hidden){
  2628. UI.$menu.addClass('hidden');
  2629. UI.$content.css("margin-left", "");
  2630. }else{
  2631. UI.$menu.removeClass('hidden');
  2632. UI.$content.css("margin-left", "320px");
  2633. }
  2634. UI.menu_list_hiddden = hidden;
  2635. },
  2636. hidePreferencesButton: function(hidden) {
  2637. hidden = _.isUndefined(hidden) ? Config.hide_preferences_button : hidden;
  2638.  
  2639. UI.$preferencesBtn.toggle(!hidden);
  2640. },
  2641. hideMenuBar: function(hidden) {
  2642. hidden = _.isUndefined(hidden) ? Config.menu_bar_hidden : hidden;
  2643.  
  2644. UI.$menuBar.toggle(!hidden);
  2645. },
  2646. refreshSkinStyle: function(skin_name, isFirst){
  2647. var style = $("#skin_style");
  2648. if(style.length === 0){
  2649. style = $('<style id="skin_style">').appendTo('head');
  2650. }
  2651.  
  2652. // 图片章节夜间模式会变的无法看
  2653. if (isFirst && skin_name.indexOf('夜间'.uiTrans()) != -1 && Config.picNightModeCheck) {
  2654. setTimeout(function(){
  2655. var img = $('#mynovelreader-content img')[0];
  2656. // console.log(img.width, img.height)
  2657. if (img && img.width > 500 && img.height > 1000) {
  2658. style.text(UI.skins['缺省皮肤'.uiTrans()]);
  2659. return;
  2660. }
  2661. }, 200);
  2662. }
  2663.  
  2664. style.text(UI.skins[skin_name]);
  2665. },
  2666. refreshExtraStyle: function(css){
  2667. var style = $("#extra_style");
  2668. if(style.length === 0){
  2669. style = $('<style id="extra_style">').appendTo('head');
  2670. }
  2671.  
  2672. style.text(css);
  2673. },
  2674. toggleQuietMode: function() {
  2675. this._isQuietMode = !this._isQuietMode;
  2676. var selector = '#menu-bar, #menu, #preferencesBtn, .readerbtn';
  2677.  
  2678. if (this.$_quietStyle) {
  2679. this.$_quietStyle.remove();
  2680. this.$_quietStyle = null;
  2681. }
  2682.  
  2683. if (this._isQuietMode) {
  2684. $(selector).addClass("quiet-mode");
  2685.  
  2686. if (!isChrome) { // firefox 下隐藏滚动条
  2687. this.$_quietStyle = $('<style>')
  2688. .text('scrollbar {visibility:collapse !important; } body {overflow: hidden !important; overflow-x: hidden !important;}')
  2689. .appendTo('head');
  2690. }
  2691. } else {
  2692. $(selector).removeClass("quiet-mode");
  2693. }
  2694. },
  2695. addButton: function(){
  2696. GM_addStyle('\
  2697. .readerbtn {\
  2698. position: fixed;\
  2699. right: 10px;\
  2700. bottom: 10px;\
  2701. z-index: 2247483648;\
  2702. padding: 20px 5px;\
  2703. width: 50px;\
  2704. height: 20px;\
  2705. line-height: 20px;\
  2706. text-align: center;\
  2707. border: 1px solid;\
  2708. border-color: #888;\
  2709. border-radius: 50%;\
  2710. background: rgba(0,0,0,.5);\
  2711. color: #FFF;\
  2712. font: 12px/1.5 "微软雅黑","宋体",Arial;\
  2713. cursor: pointer;\
  2714. }\
  2715. ');
  2716.  
  2717. $("<div>")
  2718. .addClass("readerbtn")
  2719. .html(App.isEnabled ? "退出".uiTrans() : "阅读模式".uiTrans())
  2720. .mousedown(function(event){
  2721. if(event.which == 1){
  2722. App.toggle();
  2723. }else if(event.which == 2){
  2724. event.preventDefault();
  2725. L_setValue("mynoverlreader_disable_once", true);
  2726.  
  2727. var url = App.activeUrl || App.curPageUrl;
  2728. App.openUrl(url);
  2729. }
  2730. })
  2731. .appendTo('body');
  2732. },
  2733. calcTitleFontSize: function(contentFontSizeStr){
  2734. var m = contentFontSizeStr.match(/([\d\.]+)(px|em|pt)/);
  2735. if(m) {
  2736. var size = m[1],
  2737. type = m[2];
  2738. return parseInt(size, 10) * 1.8 + type;
  2739. }
  2740.  
  2741. return "";
  2742. },
  2743. fixMobile: function(){ // 自适应网页设计
  2744. var meta = document.createElement("meta");
  2745. meta.setAttribute("name", "viewport");
  2746. meta.setAttribute("content", "width=device-width, initial-scale=1");
  2747. document.head.appendChild(meta);
  2748. },
  2749. preferencesShow: function(event){
  2750. if($("#reader_preferences").length){
  2751. return;
  2752. }
  2753.  
  2754. UI._loadBlocker();
  2755.  
  2756. UI.$prefs = $('<div id="reader_preferences">')
  2757. .css('cssText', 'position:fixed; top:12%; left:30%; width:500px; z-index:300000;')
  2758. .append(
  2759. $('<style>').text(Res.preferencesCSS))
  2760. .append(
  2761. $('<div class="body">').html(Res.preferencesHTML))
  2762. .appendTo('body');
  2763.  
  2764. UI.preferencesLoadHandler();
  2765. },
  2766. _loadBlocker: function() {
  2767. UI.$blocker = $('<div>').attr({
  2768. id: 'uil_blocker',
  2769. style: 'position:fixed;top:0px;left:0px;right:0px;bottom:0px;background-color:#000;opacity:0.5;z-index:100000;'
  2770. }).appendTo('body');
  2771. },
  2772. hide: function(){
  2773. if(UI.$prefs) UI.$prefs.remove();
  2774. if(UI.$blocker) UI.$blocker.remove();
  2775. UI.$prefs = null;
  2776. UI.$blocker = null;
  2777. },
  2778. preferencesLoadHandler: function(){
  2779. var $form = $("#preferences");
  2780.  
  2781. // checkbox
  2782. $form.find("#enable-cn2tw").get(0).checked = Config.cn2tw;
  2783. $form.find("#disable-auto-launch").get(0).checked = Config.getDisableAutoLaunch();
  2784. $form.find("#booklink-enable").get(0).checked = Config.booklink_enable;
  2785. $form.find("#debug").get(0).checked = Config.debug;
  2786. $form.find("#quietMode").get(0).checked = Config.isQuietMode;
  2787. $form.find("#pic-nightmode-check").get(0).checked = Config.picNightModeCheck;
  2788. $form.find("#copyCurTitle").get(0).checked = Config.copyCurTitle;
  2789.  
  2790. $form.find("#hide-menu-list").get(0).checked = Config.menu_list_hiddden;
  2791. $form.find("#hide-footer-nav").get(0).checked = Config.hide_footer_nav;
  2792. $form.find("#hide-preferences-button").get(0).checked = Config.hide_preferences_button;
  2793. $form.find("#add-nextpage-to-history").get(0).checked = Config.addToHistory;
  2794. $form.find("#enable-dblclick-pause").get(0).checked = Config.dblclickPause;
  2795.  
  2796. $form.find("#font-family").get(0).value = Config.font_family;
  2797. $form.find("#font-size").get(0).value = Config.font_size;
  2798. $form.find("#content_width").get(0).value = Config.content_width;
  2799. $form.find("#text_line_height").get(0).value = Config.text_line_height;
  2800. $form.find("#split_content").get(0).checked = Config.split_content;
  2801. $form.find("#scroll_animate").get(0).checked = Config.scrollAnimate;
  2802.  
  2803. $form.find("#remain-height").get(0).value = Config.remain_height;
  2804. $form.find("#extra_css").get(0).value = Config.extra_css;
  2805. $form.find("#custom_siteinfo").get(0).value = Config.customSiteinfo;
  2806. UI._rules = $form.find("#custom_replace_rules").get(0).value = Config.customReplaceRules;
  2807.  
  2808. // 界面语言
  2809. var $lang = $form.find("#lang");
  2810. $("<option>").text("zh-CN").appendTo($lang);
  2811. $("<option>").text("zh-TW").appendTo($lang);
  2812. $lang.val(Config.lang).change(function(){
  2813. var key = $(this).find("option:selected").text();
  2814. Config.lang = key;
  2815. });
  2816.  
  2817. // 皮肤
  2818. var $skin = $form.find("#skin");
  2819. for(var key in UI.skins){
  2820. $("<option>").text(key).appendTo($skin);
  2821. }
  2822. $skin.val(Config.skin_name).change(function(){
  2823. var key = $(this).find("option:selected").text();
  2824. UI.refreshSkinStyle(key);
  2825. Config.skin_name = key;
  2826. });
  2827.  
  2828. // 字体大小等预览
  2829. var preview = _.debounce(function(){
  2830. switch(this.id){
  2831. case "font-size":
  2832. var titleFontSize = UI.calcTitleFontSize(this.value);
  2833. if(titleFontSize) {
  2834. UI.$content.css("font-size", this.value);
  2835. UI.$content.find("h1").css("font-size", titleFontSize);
  2836. }
  2837. break;
  2838. case "font-family":
  2839. UI.$content.css("font-family", this.value);
  2840. break;
  2841. case "content_width":
  2842. UI.$content.css("width", this.value);
  2843. break;
  2844. case "text_line_height":
  2845. UI.$content.css("line-height", this.value);
  2846. break;
  2847. default:
  2848. break;
  2849. }
  2850. }, 300);
  2851. $form.on("input", "input", preview);
  2852.  
  2853. // 初始化设置按键
  2854. $form.find("#quietModeKey").get(0).value = Config.quietModeKey;
  2855. $form.find("#openPreferencesKey").get(0).value = Config.openPreferencesKey;
  2856. $form.find("#setHideMenuListKey").get(0).value = Config.hideMenuListKey;
  2857.  
  2858. // 点击事件
  2859. $form.on('click', 'input:checkbox, input:button', function(event){
  2860. UI.preferencesClickHandler(event.target);
  2861. });
  2862. },
  2863. preferencesClickHandler: function(target){
  2864. var key;
  2865. switch (target.id) {
  2866. case 'close_button':
  2867. UI.preferencesCloseHandler();
  2868. break;
  2869. case 'save_button':
  2870. UI.preferencesSaveHandler();
  2871. break;
  2872. case 'debug':
  2873. Config.debug = !Config.debug;
  2874. toggleConsole(Config.debug);
  2875. break;
  2876. case 'quietMode':
  2877. UI.toggleQuietMode(target.checked);
  2878. break;
  2879. case 'hide-menu-list':
  2880. UI.hideMenuList(target.checked);
  2881. break;
  2882. case 'hide-preferences-button':
  2883. UI.hidePreferencesButton(target.checked);
  2884. if (target.checked) {
  2885. alert('隐藏后通过快捷键或 Greasemonkey 用户脚本命令处调用'.uiTrans());
  2886. }
  2887. break;
  2888. case 'hide-footer-nav':
  2889. break;
  2890. case 'quietModeKey':
  2891. key = prompt('请输入打开设置的快捷键:'.uiTrans(), Config.quietModeKey);
  2892. if (key) {
  2893. Config.quietModeKey = key;
  2894. $(target).val(key);
  2895. }
  2896. break;
  2897. case 'openPreferencesKey':
  2898. key = prompt('请输入打开设置的快捷键:'.uiTrans(), Config.openPreferencesKey);
  2899. if (key) {
  2900. Config.openPreferencesKey = key;
  2901. $(target).val(key);
  2902. }
  2903. break;
  2904. case 'setHideMenuListKey':
  2905. key = prompt('请输入切换左侧章节列表的快捷键:'.uiTrans(), Config.hideMenuListKey);
  2906. if (key) {
  2907. Config.hideMenuListKey = key;
  2908. $(target).val(key);
  2909. }
  2910. break;
  2911. case 'saveAsTxt':
  2912. App.saveAsTxt();
  2913. break;
  2914. default:
  2915. break;
  2916. }
  2917. },
  2918. preferencesCloseHandler: function(){
  2919. // UI.$content.removeAttr("style");
  2920. UI.$content.find("h1").css("font-size", "");
  2921.  
  2922. UI.hide();
  2923. },
  2924. preferencesSaveHandler: function(){
  2925. var $form = $("#preferences");
  2926.  
  2927. Config.setDisableAutoLaunch($form.find("#disable-auto-launch").get(0).checked);
  2928.  
  2929. Config.cn2tw = $form.find("#enable-cn2tw").get(0).checked;
  2930. Config.booklink_enable = $form.find("#booklink-enable").get(0).checked;
  2931. Config.isQuietMode = $form.find("#quietMode").get(0).checked;
  2932. Config.debug = $form.find("#debug").get(0).checked;
  2933. Config.picNightModeCheck = $form.find("#pic-nightmode-check").get(0).checked;
  2934. Config.setCopyCurTitle($form.find("#copyCurTitle").get(0).checked);
  2935.  
  2936. Config.addToHistory = $form.find("#add-nextpage-to-history").get(0).checked;
  2937. Config.dblclickPause = $form.find("#enable-dblclick-pause").get(0).checked;
  2938.  
  2939. var skinName = $form.find("#skin").find("option:selected").text();
  2940. Config.skin_name = skinName;
  2941. UI.refreshSkinStyle(skinName);
  2942.  
  2943. Config.font_family = $form.find("#font-family").get(0).value;
  2944. UI.$content.css("font-family", Config.font_family);
  2945.  
  2946. Config.font_size = $form.find("#font-size").get(0).value;
  2947. Config.text_line_height = $form.find("#text_line_height").get(0).value;
  2948. Config.content_width = $form.find("#content_width").get(0).value;
  2949. Config.remain_height = $form.find("#remain-height").get(0).value;
  2950. Config.split_content = $form.find("#split_content").get(0).checked;
  2951. Config.scrollAnimate = $form.find("#scroll_animate").get(0).checked;
  2952.  
  2953. Config.menu_list_hiddden = $form.find("#hide-menu-list").get(0).checked;
  2954. UI.hideMenuList(Config.menu_list_hiddden);
  2955.  
  2956. Config.hide_footer_nav = $form.find("#hide-footer-nav").get(0).checked;
  2957. Config.hide_preferences_button = $form.find("#hide-preferences-button").get(0).checked;
  2958.  
  2959. var css = $form.find("#extra_css").get(0).value;
  2960. UI.refreshExtraStyle(css);
  2961. Config.extra_css = css;
  2962.  
  2963. Config.customSiteinfo = $form.find("#custom_siteinfo").get(0).value;
  2964.  
  2965. // 自定义替换规则直接生效
  2966. var rules = $form.find("#custom_replace_rules").get(0).value;
  2967. Config.customReplaceRules = rules;
  2968. if (rules != UI._rules) {
  2969. var contentHtml = App.oArticles.join('\n');
  2970. if (rules) {
  2971. // 转换规则
  2972. rules = Rule.parseCustomReplaceRules(rules);
  2973. // 替换
  2974. contentHtml = Parser.prototype.replaceHtml(contentHtml, rules);
  2975. }
  2976.  
  2977. UI.$content.html(contentHtml);
  2978.  
  2979. App.resetCache();
  2980.  
  2981. UI._rules = rules;
  2982. }
  2983.  
  2984. UI.hide();
  2985. },
  2986. openHelp: function() {
  2987.  
  2988. },
  2989. notice: function (htmlText){
  2990. var $noticeDiv = $("#alert");
  2991.  
  2992. clearTimeout(UI.noticeDivto);
  2993. $noticeDiv.find("p").html(htmlText);
  2994. $noticeDiv.fadeIn("fast");
  2995.  
  2996. UI.noticeDivto = setTimeout(function(){
  2997. $noticeDiv.fadeOut(500);
  2998. }, 1666);
  2999.  
  3000. return $noticeDiv;
  3001. }
  3002. };
  3003.  
  3004. UI.skins["缺省皮肤".uiTrans()] = "";
  3005. UI.skins["暗色皮肤".uiTrans()] = "body { color: #666; background-color: rgba(0;0;0;.1); }\
  3006. .title { color: #222; }";
  3007. UI.skins["白底黑字".uiTrans()] = "body { color: black; background-color: white;}\
  3008. .title { font-weight: bold; border-bottom: 0.1em solid; margin-bottom: 1.857em; padding-bottom: 0.857em;}";
  3009. UI.skins["夜间模式".uiTrans()] = "body { color: #939392; background: #2d2d2d; } #preferencesBtn { background: white; } #mynovelreader-content img { background-color: #c0c0c0; } .chapter.active div{color: #939392;}";
  3010. UI.skins["夜间模式1".uiTrans()] = "body { color: #679; background-color: black; } #preferencesBtn img { background-color: white !important; } .title { color: #3399FF; background-color: #121212; }";
  3011. 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; }";
  3012. // UI.skins["夜间模式(多看)".uiTrans()] = "body { color: #3A5056; background: #101819; } #preferencesBtn { background: white; } #mynovelreader-content img { background-color: #c0c0c0; }";
  3013. UI.skins["夜间模式(多看)".uiTrans()] = "body { color: #4A4A4A; background: #101819; } #preferencesBtn { background: white; } #mynovelreader-content img { background-color: #c0c0c0; }";
  3014.  
  3015. UI.skins["橙色背景".uiTrans()] = "body { color: #24272c; background-color: #FEF0E1; }";
  3016. UI.skins["绿色背景".uiTrans()] = "body { color: black; background-color: #d8e2c8; }";
  3017. UI.skins["绿色背景2".uiTrans()] = "body { color: black; background-color: #CCE8CF; }";
  3018. UI.skins["蓝色背景".uiTrans()] = "body { color: black; background-color: #E7F4FE; }";
  3019. UI.skins["棕黄背景".uiTrans()] = "body { color: black; background-color: #C2A886; }";
  3020. UI.skins["经典皮肤".uiTrans()] = "body { color: black; background-color: #EAEAEE; } .title { background-color: #f0f0f0; }";
  3021.  
  3022.  
  3023. var fontawesomeWoff = GM_getResourceURL('fontawesomeWoff');
  3024. if (!fontawesomeWoff || fontawesomeWoff.length < 10) {
  3025. fontawesomeWoff = "http://libs.baidu.com/fontawesome/4.0.3/fonts/fontawesome-webfont.woff?v=4.0.3";
  3026. } else if (isChrome) {
  3027. fontawesomeWoff = "data:font/woff;charset=utf-8;base64," + fontawesomeWoff;
  3028. }
  3029.  
  3030. var Res = {
  3031. 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}'
  3032. .replace('{fontawesomeWoff}', fontawesomeWoff),
  3033.  
  3034. 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>'
  3035. .uiTrans().replace(/\\n/g, '\n'),
  3036.  
  3037. 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 }',
  3038. };
  3039.  
  3040.  
  3041. function Parser(){
  3042. this.init.apply(this, arguments);
  3043. }
  3044.  
  3045. Parser.prototype = {
  3046. constructor: Parser,
  3047. get contentTxt() { // callback 才有用
  3048. var text = $('<div>').html(this.content).text().trim();
  3049.  
  3050. // 解决第二个段落和第一个锻炼合在一起的问题
  3051. text = text.replace(/([^\n])  /, '$1\n  ');
  3052.  
  3053. return text;
  3054. },
  3055.  
  3056. init: function (info, doc, curPageUrl) {
  3057. this.info = info || {};
  3058. this.doc = doc;
  3059. this.$doc = $(doc);
  3060. this.curPageUrl = curPageUrl || doc.URL;
  3061. this._curPageHost = getUrlHost(this.curPageUrl); // 当前页的 host,后面用到
  3062.  
  3063. // 设置初始值
  3064. this.isTheEnd = false;
  3065. this.isSection = false;
  3066. },
  3067. applyPatch: function(){
  3068. var contentPatch = this.info.contentPatch;
  3069. if(contentPatch){
  3070. try {
  3071. contentPatch.call(this, this.$doc);
  3072. C.log("Apply Content Patch Success.");
  3073. } catch (e) {
  3074. C.log("Error: Content Patch Error!", e);
  3075. }
  3076. }
  3077. },
  3078. getAll: function(callback){
  3079. var self = this;
  3080.  
  3081. C.debug('开始解析页面');
  3082.  
  3083. this.applyPatch();
  3084.  
  3085. var endFn = function(data) {
  3086. if (data) {
  3087. var div;
  3088. if (data.content) {
  3089. div = $('<div id="content"></div>').html(data.content);
  3090. } else if (data.html) {
  3091. div = $('<div></div>').html(data.html);
  3092. }
  3093.  
  3094. self.$doc.find('body').prepend(div);
  3095. }
  3096.  
  3097. self.parse();
  3098. callback(self);
  3099. };
  3100.  
  3101. if (!this.hasContent() && this.info.getContent) {
  3102. C.log('开始 info.getContent')
  3103. this.info.getContent.call(this, this.$doc, endFn);
  3104. } else {
  3105. // 特殊处理,例如起点
  3106. var ajaxScript = this.$doc.find('.' + READER_AJAX);
  3107. if (ajaxScript.length > 0) {
  3108. var url = ajaxScript.attr('src');
  3109. if(!url) return;
  3110. var charset = ajaxScript.attr('charset') || 'utf-8';
  3111.  
  3112. C.log('Ajax 获取内容: ', url, ". charset=" + charset);
  3113.  
  3114. var reqObj = {
  3115. url: url,
  3116. method: "GET",
  3117. overrideMimeType: "text/html;charset=" + charset,
  3118. headers: {},
  3119. onload: function(res){
  3120. var text = res.responseText;
  3121. text = text.replace(/document.write(ln)?\('/, "")
  3122. .replace("');", "")
  3123. .replace(/[\n\r]+/g, '</p><p>');
  3124.  
  3125. endFn({
  3126. content: text
  3127. });
  3128. }
  3129. };
  3130.  
  3131. // Jixun: Allow post data
  3132. var postData = ajaxScript.data('post');
  3133.  
  3134. if (postData) {
  3135. reqObj.method = 'POST';
  3136. reqObj.data = $.param(postData);
  3137. reqObj.headers['Content-Type'] = 'application/x-www-form-urlencoded';
  3138. }
  3139.  
  3140. GM_xmlhttpRequest(reqObj);
  3141. } else {
  3142. endFn();
  3143. }
  3144. }
  3145.  
  3146. return this;
  3147. },
  3148. parse: function() {
  3149. C.group('开始获取链接');
  3150. this.getPrevUrl();
  3151. this.getIndexUrl();
  3152. this.getNextUrl();
  3153. C.groupEnd();
  3154.  
  3155. C.group('开始获取标题');
  3156. this.getTitles();
  3157. C.groupEnd();
  3158.  
  3159. this.getContent();
  3160. },
  3161.  
  3162. hasContent: function() {
  3163. var $content;
  3164.  
  3165. // var $ajaxScript = this.$doc.find('.' + READER_AJAX);
  3166. // if ($ajaxScript.length > 0) {
  3167. // return true;
  3168. // }
  3169.  
  3170. if(this.info.contentSelector){
  3171. $content = this.$doc.find(this.info.contentSelector);
  3172. }
  3173.  
  3174. if (!$content || !$content.length) {
  3175. // 按照顺序选取
  3176. var selectors = Rule.contentSelectors;
  3177. for(var i = 0, l = selectors.length; i < l; i++){
  3178. $content = this.$doc.find(selectors[i]);
  3179. if($content.length){
  3180. C.log("自动查找内容选择器: " + selectors[i]);
  3181. break;
  3182. }
  3183. }
  3184. }
  3185.  
  3186. this.$content = $content;
  3187. // C.debug($content);
  3188.  
  3189. return $content.size() > 0;
  3190. },
  3191. // 获取书名和章节标题
  3192. getTitles: function(){
  3193. var info = this.info,
  3194. chapterTitle,
  3195. bookTitle,
  3196. docTitle = this.$doc.find("title").text();
  3197.  
  3198. // 获取章节标题
  3199. if (info.titleReg){
  3200. var matches = docTitle.match(toRE(info.titleReg, 'i'));
  3201. if(matches && matches.length == 3){
  3202. var titlePos = ( info.titlePos || 0 ) + 1,
  3203. chapterPos = (titlePos == 1) ? 2 : 1;
  3204. bookTitle = matches[titlePos].trim();
  3205. chapterTitle = matches[chapterPos].trim();
  3206. }
  3207.  
  3208. C.log("TitleReg:", info.titleReg, matches);
  3209. } else {
  3210. chapterTitle = this.getTitleFromInfo(info.titleSelector);
  3211.  
  3212. bookTitle = this.getTitleFromInfo(info.bookTitleSelector);
  3213. }
  3214.  
  3215. if(!chapterTitle){
  3216. chapterTitle = this.autoGetChapterTitle(this.doc);
  3217. }
  3218.  
  3219. if (!bookTitle) {
  3220. bookTitle = this.$doc.find(Rule.bookTitleSelector).text();
  3221. }
  3222.  
  3223. // 标题间增加一个空格,不准确,已注释
  3224. chapterTitle = chapterTitle
  3225. .replace(Rule.titleReplace, "")
  3226. .trim();
  3227. // .replace(/(第?\S+?[章节卷回])(.*)/, "$1 $2");
  3228.  
  3229. // if (info.trimBookTitle !== false) {
  3230. // chapterTitle = chapterTitle.replace(bookTitle, '').trim();
  3231. // }
  3232.  
  3233. bookTitle = bookTitle.replace(/最新章节$/, '');
  3234.  
  3235. docTitle = bookTitle ?
  3236. bookTitle + ' - ' + chapterTitle :
  3237. docTitle;
  3238.  
  3239. if (Config.cn2tw) {
  3240. bookTitle = this.convert2tw(bookTitle);
  3241. chapterTitle = this.convert2tw(chapterTitle);
  3242. docTitle = this.convert2tw(docTitle);
  3243. }
  3244.  
  3245. this.bookTitle = bookTitle || '目录';
  3246. this.chapterTitle = chapterTitle;
  3247. this.docTitle = docTitle;
  3248.  
  3249. C.log("Book Title: " + this.bookTitle);
  3250. C.log("Chapter Title: " + this.chapterTitle);
  3251. C.log("Document Title: " + this.docTitle);
  3252. },
  3253. getTitleFromInfo: function(selectorOrArray) {
  3254. var title = '';
  3255. if (!selectorOrArray) {
  3256. return title;
  3257. }
  3258.  
  3259. var selector,
  3260. replace;
  3261.  
  3262. if (_.isArray(selectorOrArray)) {
  3263. selector = selectorOrArray[0];
  3264. replace = selectorOrArray[1];
  3265. } else {
  3266. selector = selectorOrArray;
  3267. }
  3268.  
  3269. title = this.$doc.find(selector).remove().text().trim();
  3270.  
  3271. if (replace) {
  3272. title = title.replace(toRE(replace), '');
  3273. }
  3274.  
  3275. return title;
  3276. },
  3277. // 智能获取章节标题
  3278. autoGetChapterTitle: function (document) {
  3279. var
  3280. _main_selector = "h1, h2, h3",
  3281. _second_selector = "#TextTitle, #title, .ChapterName, #lbChapterName, div.h1",
  3282. _positive_regexp = Rule.titleRegExp,
  3283. // _positive_regexp = /第?\S+[章节卷回]|\d{2,4}/,
  3284. // _negative_regexp = /[上前下后][一]?[页张个篇章节步]/,
  3285. _title_remove_regexp = /最新章节|书书网/,
  3286. $doc = $(document),
  3287. _document_title = document.title ? document.title : $doc.find("title").text(),
  3288. _search_document_title = ' ' + _document_title.replace(/\s+/gi, ' ') + ' '
  3289. ;
  3290.  
  3291. var _headings = $doc.find(_main_selector);
  3292. // 加上 second selector 并去除包含的
  3293. $doc.find(_second_selector).each(function(){
  3294. if($(this).find(_main_selector).length === 0){
  3295. _headings.push(this);
  3296. }
  3297. });
  3298.  
  3299. var possibleTitles = {},
  3300. _heading_text;
  3301.  
  3302. C.groupCollapsed('自动查找章节标题');
  3303.  
  3304. $(_headings).each(function(){
  3305. var _heading = this,
  3306. _heading_text = _heading.textContent.trim();
  3307.  
  3308. if (_heading_text in possibleTitles) {
  3309. return;
  3310. }
  3311.  
  3312. C.group('开始计算 "' + _heading_text + '" 的得分');
  3313.  
  3314. // h1 为 1, h2 为 2
  3315. var
  3316. nodeNum = parseInt(_heading.nodeName.slice(1), 10) || 10,
  3317. score = 10 / nodeNum,
  3318. _heading_words = _heading_text.replace(/\s+/g, " ").split(" "),
  3319. _matched_words = ""
  3320. ;
  3321.  
  3322. C.log("初始得分:" + score);
  3323.  
  3324. // 后面这种是特殊的判断
  3325. if (_positive_regexp.test(_heading_text) || /\d{2,4}/.test(_heading_text)) {
  3326. score += 50;
  3327. }
  3328. // if(_negative_regexp.test(_heading_text)){
  3329. // score -= 100;
  3330. // }
  3331.  
  3332. C.log("符合正则计算后得分:" + score);
  3333.  
  3334. // count words present in title
  3335. for (var j = 0, _j = _heading_words.length; j < _j; j++) {
  3336. if (_search_document_title.indexOf(_heading_words[j]) > -1) {
  3337. _matched_words += _heading_words[j] + ' ';
  3338. }
  3339. }
  3340. score += _matched_words.length * 1.5;
  3341.  
  3342. C.log("跟页面标题比较后得分:" + score);
  3343.  
  3344. var _font_size_text = "",
  3345. _font_size_add_score = 0,
  3346. _heading_style = window.getComputedStyle(_heading, null);
  3347. if(_heading_style){
  3348. _font_size_text = _heading_style.getPropertyValue("font-size") || 0;
  3349. _font_size_add_score = parseInt(_font_size_text, 10) * 1.5;
  3350. }
  3351.  
  3352. score += _font_size_add_score;
  3353.  
  3354. C.log("计算大小后得分:" + score);
  3355.  
  3356. possibleTitles[_heading_text] = score;
  3357.  
  3358. C.groupEnd();
  3359. });
  3360.  
  3361. // 找到分数最高的值
  3362. var topScoreTitle,
  3363. score_tmp = 0;
  3364. for (_heading_text in possibleTitles) {
  3365. if (possibleTitles[_heading_text] > score_tmp) {
  3366. topScoreTitle = _heading_text;
  3367. score_tmp = possibleTitles[_heading_text];
  3368. }
  3369. }
  3370.  
  3371. var curTitle = topScoreTitle;
  3372. if (!curTitle) {
  3373. curTitle = _document_title;
  3374.  
  3375. // 下面的正则从
  3376. // Firefox-Firefox浏览器论坛-卡饭论坛 - 互助分享 - 大气谦和!
  3377. // 变为
  3378. // Firefox-Firefox浏览器论坛-卡饭论坛
  3379. curTitle = curTitle.replace(/\s-\s.*/i, "")
  3380. .replace(/_[^\[\]【】]+$/, "");
  3381. curTitle = curTitle.trim();
  3382. curTitle = curTitle.replace(_title_remove_regexp, '');
  3383. }
  3384.  
  3385. curTitle = curTitle.replace(Rule.titleReplace, "");
  3386.  
  3387. C.groupEnd();
  3388.  
  3389. return curTitle;
  3390. },
  3391.  
  3392. // 获取和处理内容
  3393. getContent: function(){
  3394. var self = this;
  3395.  
  3396. this.hasContent();
  3397.  
  3398. if (this.$content.size() <= 0) {
  3399. // callback(this);
  3400. console.error('没有找到内容', this.$doc);
  3401. return;
  3402. }
  3403.  
  3404. this.content = this.handleContentText(this.$content.html(), this.info);
  3405. },
  3406. handleContentText: function(text, info){
  3407. if(!text) return null;
  3408.  
  3409. // 贴吧的内容处理比较耗时间
  3410. C.group('开始内容处理');
  3411. C.time('内容处理');
  3412.  
  3413. var contentHandle = (typeof(info.contentHandle) == 'undefined') ? true : info.contentHandle;
  3414.  
  3415. // 拼音字、屏蔽字修复
  3416. if(contentHandle){
  3417. text = this.replaceHtml(text);
  3418. }
  3419.  
  3420. /* Turn all double br's into p's */
  3421. text = text.replace(Rule.replaceBrs, '</p>\n<p>');
  3422. text = text.replace(/<\/p><p>/g, "</p>\n<p>");
  3423.  
  3424. // GM_setClipboard(text);
  3425.  
  3426. // 移除文字广告等
  3427. text = this.replaceText(text, Rule.replaceAll);
  3428.  
  3429. // 去除内容中的标题
  3430. if(this.chapterTitle && Rule.titleRegExp.test(this.chapterTitle)){
  3431. try {
  3432. var reg = toReStr(this.chapterTitle).replace(/\s+/g, '\\s*');
  3433. reg = new RegExp(reg, 'ig');
  3434. text = text.replace(reg, "");
  3435. C.log('去除内容中的标题', reg);
  3436. } catch(e) {
  3437. console.error(e);
  3438. }
  3439. }
  3440.  
  3441. if (this.bookTitle) {
  3442. var regStr = '(' + toReStr(this.bookTitle) + '\\d*章)'
  3443. text = text.replace(new RegExp(regStr, 'ig'), "");
  3444. }
  3445.  
  3446. if (info.contentReplace) {
  3447. text = this.replaceText(text, info.contentReplace);
  3448. }
  3449.  
  3450. if (Config.cn2tw) {
  3451. text = this.convert2tw(text);
  3452. }
  3453.  
  3454. try {
  3455. text = this.contentCustomReplace(text);
  3456. } catch(ex) {
  3457. console.error('自定义替换错误', ex);
  3458. }
  3459.  
  3460. // 采用 DOM 方式进行处理
  3461. var $div = $("<div>").html(text);
  3462.  
  3463. // contentRemove
  3464. $div.find(Rule.contentRemove).remove();
  3465. if(info.contentRemove){
  3466. $div.find(info.contentRemove).remove();
  3467. }
  3468.  
  3469. // 给独立的文本加上 p
  3470. $div.contents().filter(function() {
  3471. return this.nodeType == 3 &&
  3472. this.textContent != '\n' &&
  3473. (!this.nextElementSibling || this.nextElementSibling.nodeName != 'A') &&
  3474. (!this.previousElementSibling || this.previousElementSibling.nodeName != 'A');
  3475. }).wrap('<p>');
  3476.  
  3477. // 删除无效的 p,排除对大块文本的判断
  3478. $div.find('p').filter(function() {
  3479. var $this = $(this);
  3480. if ($this.find('img').size()) // 排除有图片的
  3481. return false;
  3482.  
  3483. // 有效文本(排除注释、换行符、空白)个数为 0
  3484. return $this.contents().filter(function() {
  3485. return this.nodeType != 8 &&
  3486. !this.textContent.match(/^\s*$/);
  3487. }).size() == 0;
  3488. }).remove();
  3489.  
  3490. // 把一大块的文本分段
  3491. if (Config.split_content) {
  3492. var $p = $div.find('p'),
  3493. $newP;
  3494. if ($p.length == 0 ) {
  3495. $newP = $div;
  3496. } else if ($p.length == 1) {
  3497. $newP = $p;
  3498. }
  3499.  
  3500. if ($newP) {
  3501. $newP.replaceWith('<p>' + this.splitContent($newP.html()).join('</p>\n<p>') + '</p>');
  3502. }
  3503. }
  3504.  
  3505. if(contentHandle){
  3506. $div.filter('br').remove();
  3507.  
  3508. $div.find('*').removeAttr('style');
  3509. }
  3510.  
  3511. $div.find('p').removeAttr('class');
  3512.  
  3513. // 图片居中,所有图像?
  3514. // if(info.fixImage){
  3515. // $div.find("img").each(function(){
  3516. // this.className += " blockImage";
  3517. // });
  3518. // }
  3519.  
  3520. text = $div.html();
  3521.  
  3522. // 修复第一行可能是空的情况
  3523. text = text.replace(/(?:\s|&nbsp;)+<p>/, "<p>");
  3524.  
  3525. // 修复当行就一个字符的
  3526. text = text.replace(/<\/p><p>([。])/, "$1");
  3527.  
  3528. if(config.paragraphBlank){
  3529. text = text.replace(/<p>(?:\s|&nbsp;)+/g, "<p>")
  3530. .replace(/<p>/g, "<p>  ");
  3531. }
  3532.  
  3533. // 删除空白的、单个字符的 p
  3534. text = text.replace(Rule.removeLineRegExp, "");
  3535.  
  3536. C.timeEnd('内容处理');
  3537. C.groupEnd();
  3538.  
  3539. return text;
  3540. },
  3541. replaceHtml: function(text, replaceRule) { // replaceRule 给“自定义替换规则直接生效”用
  3542. if (!replaceRule) {
  3543. replaceRule = Rule.replace;
  3544. }
  3545.  
  3546. // 先提取出 img
  3547. var imgs = {};
  3548. var i = 0;
  3549. text = text.replace(/<(img|a)[^>]*>/g, function(img){
  3550. imgs[i] = img;
  3551. return "{" + (i++) + "}";
  3552. });
  3553.  
  3554. // 修正拼音字等
  3555. text = this.contentReplacements(text, replaceRule);
  3556.  
  3557. // 还原图片
  3558. text = $.nano(text, imgs);
  3559.  
  3560. return text;
  3561. },
  3562. contentReplacements: function (text, rule) {
  3563. if (!text) return text;
  3564.  
  3565. for (var key in rule) {
  3566. text = text.replace(toRE(key, "ig"), rule[key]);
  3567. }
  3568. return text;
  3569. },
  3570. replaceText: function(text, rule){
  3571. var self = this;
  3572. switch(true) {
  3573. case _.isRegExp(rule):
  3574. text = text.replace(rule, '');
  3575. break;
  3576. case _.isString(rule):
  3577. // 还原简写
  3578. _.each(CHAR_ALIAS, function(value, key) {
  3579. rule = rule.replace(key, value);
  3580. });
  3581. var regexp = new RegExp(rule, 'ig');
  3582. text = text.replace(regexp, '');
  3583. break;
  3584. case _.isArray(rule):
  3585. rule.forEach(function(r){
  3586. text = self.replaceText(text, r);
  3587. });
  3588. break;
  3589. case _.isObject(rule):
  3590. var key;
  3591. for(key in rule){
  3592. text = text.replace(new RegExp(key, "ig"), rule[key]);
  3593. }
  3594. break;
  3595. }
  3596. return text;
  3597. },
  3598. convert2tw: function (text) {
  3599. if (!text) return text;
  3600.  
  3601. var ii, len, str;
  3602. str = text.split("");
  3603. len = str.length;
  3604. for (ii = 0; ii < len; ii++) {
  3605. str[ii] = cn2tw[str[ii]] || str[ii];
  3606. }
  3607.  
  3608. str = str.join("");
  3609.  
  3610. return str;
  3611. },
  3612. contentCustomReplace: function (text) {
  3613. if (!text) return text;
  3614.  
  3615. for (var key in Rule.customReplace) {
  3616. text = text.replace(new RegExp(key, 'ig'), Rule.customReplace[key]);
  3617. }
  3618. return text;
  3619. },
  3620. splitContent: function (text) { // 有些章节整个都集中在一起,没有分段,这个函数用于简易分段
  3621. if (text.indexOf('。') == -1) {
  3622. return [text];
  3623. }
  3624.  
  3625. var hasMark = false,
  3626. lines = []
  3627. charCotainer = [];
  3628.  
  3629. text.split('').forEach(function(c) {
  3630. charCotainer.push(c);
  3631.  
  3632. if (c == '“') {
  3633. hasMark = true;
  3634. } else if (c == '”') {
  3635. hasMark = false;
  3636. } else if (c == '。' && !hasMark) {
  3637. lines.push(charCotainer.join(''));
  3638. charCotainer = [];
  3639. }
  3640. });
  3641.  
  3642. return lines;
  3643. },
  3644.  
  3645. // 获取上下页及目录页链接
  3646. getPrevUrl: function(){
  3647. var url = '',
  3648. link, selector;
  3649.  
  3650. if (this.info.prevSelector === false) {
  3651. this.prevUrl = url;
  3652. return url;
  3653. }
  3654.  
  3655. if (this.info.prevUrl && _.isFunction(this.info.prevUrl)) {
  3656. url = this.info.prevUrl(this.$doc);
  3657. url = this.checkLinks(url);
  3658. }
  3659.  
  3660. if (!url) {
  3661. selector = this.info.prevSelector || Rule.prevSelector;
  3662. link = this.$doc.find(selector);
  3663. if(link.length){
  3664. url = this.checkLinks(link);
  3665. }
  3666. }
  3667.  
  3668. if (url) {
  3669. C.log("找到上一页链接: " + url);
  3670. } else {
  3671. C.log("无法找到上一页链接");
  3672. }
  3673.  
  3674. this.prevUrl = url || '';
  3675. return url;
  3676. },
  3677. getIndexUrl: function(){
  3678. var url = '',
  3679. link;
  3680.  
  3681. if (this.info.indexSelector === false) {
  3682. this.indexUrl = url;
  3683. return url;
  3684. }
  3685.  
  3686. if (this.info.indexSelector && _.isFunction(this.info.indexSelector)) {
  3687. url = this.info.indexSelector(this.$doc);
  3688. } else if(this.info.indexSelector){
  3689. link = this.$doc.find(this.info.indexSelector);
  3690. } else {
  3691. var selectors = Rule.indexSelectors;
  3692. var _indexLink;
  3693. // 按照顺序选取目录链接
  3694. for(var i = 0, l = selectors.length; i < l; i++){
  3695. _indexLink = this.$doc.find(selectors[i]);
  3696. if(_indexLink.length > 0){
  3697. link = _indexLink;
  3698. break;
  3699. }
  3700. }
  3701. }
  3702.  
  3703. if(link && link.length){
  3704. url = this.checkLinks(link);
  3705. C.log("找到目录链接: " + url);
  3706. }
  3707.  
  3708. if (!url) {
  3709. C.log("无法找到目录链接.");
  3710. }
  3711.  
  3712. this.indexUrl = url;
  3713. return url;
  3714. },
  3715. getNextUrl: function(){
  3716. var url = '',
  3717. link,
  3718. selector = this.info.nextSelector || Rule.nextSelector;
  3719.  
  3720. if (this.info.nextSelector === false) {
  3721. this.nextUrl = url;
  3722. return url;
  3723. }
  3724.  
  3725. if (this.info.nextUrl && _.isFunction(this.info.nextUrl)) {
  3726. url = this.info.nextUrl(this.$doc);
  3727. url = this.checkLinks(url);
  3728. }
  3729.  
  3730. if (!url) {
  3731. link = this.$doc.find(selector);
  3732. if(link.length){
  3733. url = this.checkLinks(link);
  3734. }
  3735. }
  3736.  
  3737. if (url) {
  3738. C.log("找到下一页链接: " + url);
  3739. } else {
  3740. C.log("无法找到下一页链接");
  3741. }
  3742.  
  3743. this.nextUrl = url || '';
  3744. this.isTheEnd = !this.checkNextUrl(url);
  3745. if(this.isTheEnd){
  3746. this.theEndColor = config.end_color;
  3747. }
  3748.  
  3749. return url;
  3750. },
  3751. checkNextUrl: function(url){
  3752. if (this.info.checkSection) {
  3753. if (/\/\d+_\d+\.html$/.test(this.curPageUrl)) {
  3754. this.isSection = true;
  3755. if(url == this.indexUrl){
  3756. return false;
  3757. }else{
  3758. return true;
  3759. }
  3760. }
  3761. }
  3762.  
  3763. switch(true){
  3764. case url === '':
  3765. case Rule.nextUrlIgnore.some(function(re) { return toRE(re).test(url) }):
  3766. case url === this.indexUrl:
  3767. case url === this.prevUrl:
  3768. case url === this.curPageUrl:
  3769. case Rule.nextUrlCompare.test(this.prevUrl) && !Rule.nextUrlCompare.test(url):
  3770. return false;
  3771. default:
  3772. return true;
  3773. }
  3774. },
  3775. checkLinks: function(links){
  3776. var self = this;
  3777. if (_.isString(links)) {
  3778. return this.getFullHref(links);
  3779. }
  3780.  
  3781. var url = "";
  3782. links && links.each(function(){
  3783. url = $(this).attr("href");
  3784. if(!url || url.indexOf("#") === 0 || url.indexOf("javascript:") === 0)
  3785. return;
  3786.  
  3787. url = self.getFullHref(this);
  3788. return false;
  3789. });
  3790.  
  3791. return url;
  3792. },
  3793. getLinkUrl: function(linkOrUrl) {
  3794. // if (linkOrUrl && )
  3795. return linkOrUrl;
  3796. },
  3797. getFullHref: function(href) {
  3798. if(!href) return '';
  3799.  
  3800. if (!_.isString(href)) {
  3801. href = href.getAttribute('href');
  3802. }
  3803.  
  3804. if (href.indexOf('http://') === 0) {
  3805. return href;
  3806. }
  3807.  
  3808. var a = this.a;
  3809. if (!a) {
  3810. this.a = a = document.createElement('a');
  3811. }
  3812. a.href = href;
  3813.  
  3814. // 检测 host 是否和 当前页的一致
  3815. if (a.host != this._curPageHost) {
  3816. a.host = this._curPageHost;
  3817. }
  3818.  
  3819. return a.href;
  3820. },
  3821. };
  3822.  
  3823.  
  3824. var App = {
  3825. isEnabled: false,
  3826. parsedPages: {},
  3827. pageNum: 1,
  3828. paused: false,
  3829. curPageUrl: location.href,
  3830. requestUrl: null,
  3831. iframe: null,
  3832. remove: [],
  3833.  
  3834. init: function() {
  3835. if (["mynovelreader-iframe", "superpreloader-iframe"].indexOf(window.name) != -1) { // 用于加载下一页的 iframe
  3836. return;
  3837. }
  3838.  
  3839. // 手动调用
  3840. var readx = function() {
  3841. // 防止 unsafeWindow cannot call: GM_getValue
  3842. setTimeout(function() {
  3843. App.launch();
  3844. }, 0);
  3845. };
  3846. try {
  3847. exportFunction(readx, unsafeWindow, {defineAs: "readx"});
  3848. } catch(ex) {
  3849. console.error('无法定义 readx 函数');
  3850. }
  3851.  
  3852.  
  3853. App.loadCustomSetting();
  3854. App.site = App.getCurSiteInfo();
  3855. var autoLaunch = App.isAutoLaunch();
  3856.  
  3857. if (autoLaunch === -1) {
  3858. return;
  3859. } else if (autoLaunch) {
  3860. if (App.site.mutationSelector) { // 特殊的启动:等待js把内容生成完毕
  3861. App.addMutationObserve(document, App.launch);
  3862. } else if (App.site.timeout) { // 延迟启动
  3863. setTimeout(App.launch, App.site.timeout);
  3864. } else { // NoScript 下 setTimeout 没用?
  3865. App.launch();
  3866. }
  3867. } else {
  3868. UI.addButton();
  3869. }
  3870. },
  3871. loadCustomSetting: function() {
  3872. var customRules;
  3873. try {
  3874. customRules = eval(Config.customSiteinfo);
  3875. } catch (e) {
  3876. console.error('载入自定义站点配置错误', e);
  3877. }
  3878. if (_.isArray(customRules)) {
  3879. Rule.customRules = customRules;
  3880. C.log('载入自定义站点规则成功', customRules);
  3881. }
  3882.  
  3883. // load custom replace rules
  3884. Rule.customReplace = Rule.parseCustomReplaceRules(Config.customReplaceRules);
  3885.  
  3886. C.log('载入自定义替换规则成功', Rule.customReplace);
  3887. },
  3888. getCurSiteInfo: function() {
  3889. var rules = Rule.customRules.concat(Rule.specialSite);
  3890. var locationHref = location.href;
  3891.  
  3892. var info = _.find(rules, function(x) {
  3893. return toRE(x.url).test(locationHref);
  3894. });
  3895. if (!info) {
  3896. info = {};
  3897. C.log("没有找到规则,尝试自动模式。");
  3898. } else {
  3899. C.log("找到规则:", info);
  3900. }
  3901. return info;
  3902. },
  3903. isAutoLaunch: function() {
  3904. var locationHref = window.location.href,
  3905. locationHost = location.host,
  3906. referrer = document.referrer;
  3907. switch (true) {
  3908. case L_getValue("mynoverlreader_disable_once") == 'true':
  3909. L_removeValue("mynoverlreader_disable_once");
  3910. return false;
  3911. // case location.hostname == 'www.fkzww.net' && !document.title.match(/网文快讯/): // 啃书只自动启用一个地方
  3912. // return false;
  3913. case Config.booklink_enable && /booklink\.me/.test(referrer):
  3914. return true;
  3915. case locationHost == 'tieba.baidu.com':
  3916. var title = $('.core_title_txt').text();
  3917. if (title.match(Rule.titleRegExp)) {
  3918. return false;
  3919. } else {
  3920. return -1;
  3921. }
  3922. case Config.getDisableAutoLaunch():
  3923. return false;
  3924. case GM_getValue("auto_enable"):
  3925. case config.soduso && /www\.sodu\.so/.test(referrer):
  3926. return true;
  3927. default:
  3928. return false;
  3929. }
  3930. },
  3931. addMutationObserve: function(doc, callback) {
  3932. var shouldAdd = false;
  3933. var $doc = $(doc);
  3934.  
  3935. if ($doc.find(App.site.contentSelector).size()) {
  3936. shouldAdd = false;
  3937. } else {
  3938. var mutationSelector = App.site.mutationSelector;
  3939. var target = $doc.find(mutationSelector)[0];
  3940. if (target) {
  3941. var childCount = App.site.mutationChildCount;
  3942. if (childCount === undefined || target.children.length <= childCount) {
  3943. shouldAdd = true;
  3944. }
  3945. }
  3946. }
  3947.  
  3948. if (shouldAdd) {
  3949. var observer = new MutationObserver(function(mutations) {
  3950. var nodeAdded = mutations.some(function(x) {
  3951. return x.addedNodes.length > 0;
  3952. });
  3953.  
  3954. if (nodeAdded) {
  3955. observer.disconnect();
  3956. callback();
  3957. }
  3958. });
  3959.  
  3960. observer.observe(target, {
  3961. childList: true
  3962. });
  3963.  
  3964. C.log("添加 MutationObserve 成功:", mutationSelector);
  3965. } else {
  3966. callback();
  3967. }
  3968. },
  3969. launch: function() {
  3970. // 只解析一次,防止多次重复解析一个页面
  3971. if (document.body && document.body.getAttribute("name") == "MyNovelReader") {
  3972. return App.toggle();
  3973. }
  3974.  
  3975. if (!App.site) {
  3976. App.site = App.getCurSiteInfo();
  3977. }
  3978.  
  3979. if (App.site.startFilter) {
  3980. try {
  3981. App.site.startFilter();
  3982. C.log('run startFilter function success');
  3983. } catch (ex) {
  3984. console.error('运行 startFilter function 错误', ex);
  3985. }
  3986. }
  3987.  
  3988. var parser = new Parser(App.site, document);
  3989. var hasContent = !!parser.hasContent();
  3990. if (hasContent) {
  3991. document.body.setAttribute("name", "MyNovelReader");
  3992. App.parsedPages[window.location.href] = true;
  3993. parser.getAll(function(parser) {
  3994. App.processPage(parser);
  3995. });
  3996. } else {
  3997. console.error("当前页面没有找到内容");
  3998. }
  3999.  
  4000. // 初始化, 取消页面限制等
  4001. if (App.site.fInit)
  4002. App.site.fInit();
  4003. },
  4004. processPage: function(parser) {
  4005. // 对 Document 进行处理
  4006. document.body.innerHTML = '';
  4007. App.prepDocument();
  4008. App.initDocument(parser);
  4009.  
  4010. // cache vars
  4011. App.$doc = $(document);
  4012. App.$menuBar = App.$doc.find("#menu-bar");
  4013. App.$menu = App.$doc.find("#menu");
  4014. App.$content = App.$doc.find("#mynovelreader-content");
  4015. App.$loading = App.$doc.find("#loading");
  4016. App.$preferencesBtn = App.$doc.find("#preferencesBtn");
  4017.  
  4018. App.$menuHeader = App.$menu.find("#chapter-list");
  4019. App.$chapterList = App.$menu.find("#chapter-list");
  4020.  
  4021. App.indexUrl = parser.indexUrl;
  4022. App.prevUrl = parser.prevUrl; // 第一个上一页
  4023.  
  4024. App.oArticles = []; // 原始的内容,用于替换的无需刷新
  4025. App.parsers = [];
  4026.  
  4027. // 加入上一章的链接
  4028. if (parser.prevUrl) {
  4029. $("<li>")
  4030. .addClass('chapter')
  4031. .append(
  4032. $("<div>")
  4033. .attr({
  4034. "realHref": parser.prevUrl,
  4035. "onclick": "return false;"
  4036. })
  4037. .text("上一章".uiTrans())
  4038. )
  4039. .prependTo(App.$chapterList);
  4040. }
  4041.  
  4042. // 插入站点样式
  4043. if (App.site.style) {
  4044. GM_addStyle(App.site.style);
  4045. }
  4046.  
  4047. App.appendPage(parser, true);
  4048.  
  4049. App.registerControls();
  4050.  
  4051. // UI 的初始化
  4052. UI.init();
  4053.  
  4054. App.curFocusElement = $("article:first").get(0); // 初始化当前关注的 element
  4055. App.requestUrl = parser.nextUrl;
  4056. App.isTheEnd = parser.isTheEnd;
  4057.  
  4058. App.isEnabled = true;
  4059. UI.addButton();
  4060.  
  4061. // // 如果已经把当前焦点链接添加到历史记录,则滚动到顶部
  4062. // if (Config.addToHistory) {
  4063. // window.scrollTo(0, 0);
  4064. // }
  4065.  
  4066. // 有些图片网站高度随着图片加载而变长
  4067. setTimeout(App.scroll, 1000);
  4068.  
  4069. App.cleanAgain();
  4070.  
  4071. if (config.PRELOADER) {
  4072. App.doRequest();
  4073. }
  4074. },
  4075. prepDocument: function() {
  4076. window.onload = window.onunload = function() {};
  4077.  
  4078. // 破解右键限制
  4079. var doc = document;
  4080. var bd = doc.body;
  4081. 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;
  4082. doc.onclick = doc.ondblclick = doc.onselectstart = doc.oncontextmenu = doc.onmousedown = doc.onkeydown = function() {
  4083. return true;
  4084. };
  4085.  
  4086. doc = document.wrappedJSObject || document;
  4087. doc.onmouseup = null;
  4088. doc.onmousedown = null;
  4089. doc.oncontextmenu = null;
  4090.  
  4091. var arAllElements = document.getElementsByTagName('*');
  4092. for (var i = arAllElements.length - 1; i >= 0; i--) {
  4093. var elmOne = arAllElements[i];
  4094. elmOne = elmOne.wrappedJSObject || elmOne;
  4095. elmOne.onmouseup = null;
  4096. elmOne.onmousedown = null;
  4097. }
  4098.  
  4099. $(document).unbind("keypress");
  4100. $(document).unbind("keydown");
  4101.  
  4102. // remove body style
  4103. $('link[rel="stylesheet"], script').remove();
  4104. $('body')
  4105. .removeAttr('style')
  4106. .removeAttr('bgcolor');
  4107.  
  4108. $('style').filter(function() {
  4109. var $style = $(this);
  4110. if($style.text().indexOf('#cVim-link-container') != -1) { // chrome 的 cVim 扩展
  4111. return false;
  4112. }
  4113. return true;
  4114. }).remove();
  4115. },
  4116. initDocument: function(parser) {
  4117. document.title = parser.docTitle;
  4118. window.name = "MyNovelReader";
  4119. 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);
  4120. },
  4121. clean: function() {
  4122. $('body > *:not("#container, .readerbtn, #reader_preferences, #uil_blocker,iframe[name=\'mynovelreader-iframe\']")').remove();
  4123. $('link[rel="stylesheet"]').remove();
  4124.  
  4125. if (location.host.indexOf('qidian') > 0) {
  4126. unsafeWindow.jQuery(document).off("selectstart").off("contextmenu");
  4127. }
  4128. },
  4129. cleanAgain: function() {
  4130. var host = location.host;
  4131. if (!host.match(/qidian\.com|zongheng\.com/)) { // 只在起点、纵横等网站运行
  4132. return;
  4133. }
  4134.  
  4135. // 再次移除其它不相关的,起点,纵横中文有时候有问题
  4136. setTimeout(App.clean, 2000);
  4137. setTimeout(App.clean, 5000);
  4138. // TM 用 addEventListener('load') 有问题
  4139. window.onload = function() {
  4140. App.clean();
  4141. setTimeout(App.clean, 500);
  4142. };
  4143. },
  4144. toggle: function() {
  4145. if (App.isEnabled) { // 退出
  4146. GM_setValue("auto_enable", false);
  4147. L_setValue("mynoverlreader_disable_once", "true");
  4148.  
  4149. window.location = App.activeUrl;
  4150. } else {
  4151. GM_setValue("auto_enable", true);
  4152. L_removeValue("mynoverlreader_disable_once");
  4153. App.isEnabled = true;
  4154. App.launch();
  4155. }
  4156. },
  4157. removeListener: function() {
  4158. C.log("移除各种事件监听");
  4159. App.remove.forEach(function(_remove) {
  4160. _remove();
  4161. });
  4162. },
  4163. appendPage: function(parser, isFirst) {
  4164. var chapter = $("article:last");
  4165. if (chapter.length && parser.isSection) { // 每次获取的不是一章,而是一节
  4166. var lastText = chapter.find("p:last").remove().text().trim();
  4167. var newPage = parser.content.replace(/<p>\s+/, "<p>" + lastText);
  4168.  
  4169. chapter
  4170. .find(".chapter-footer-nav").remove()
  4171. .end()
  4172. .append(newPage);
  4173.  
  4174. if (!Config.hide_footer_nav) {
  4175. chapter.append($.nano(UI.tpl_footer_nav, parser));
  4176. }
  4177.  
  4178. } else {
  4179. chapter = $("<article>")
  4180. .attr("id", "page-" + App.pageNum)
  4181. .append(
  4182. $("<h1>").addClass("title").text(parser.chapterTitle)
  4183. )
  4184. .append(parser.content)
  4185. .appendTo(App.$content);
  4186.  
  4187. if (!Config.hide_footer_nav) {
  4188. chapter.append($.nano(UI.tpl_footer_nav, parser));
  4189. }
  4190.  
  4191. // App.fixImageFloats(chapter.get(0));
  4192.  
  4193. // 添加到章节列表
  4194. var chapterItem = $("<li>")
  4195. .addClass('chapter')
  4196. .append(
  4197. $("<div>")
  4198. .attr({
  4199. href: "#page-" + App.pageNum,
  4200. "realHref": parser.curPageUrl,
  4201. onclick: "return false;",
  4202. title: parser.chapterTitle
  4203. })
  4204. .text(parser.chapterTitle)
  4205. )
  4206. .prependTo(App.$chapterList);
  4207.  
  4208. if (isFirst) {
  4209. chapterItem.addClass('active');
  4210. }
  4211.  
  4212. App.pageNum += 1;
  4213. App.resetCache();
  4214. }
  4215.  
  4216. App.oArticles.push(chapter[0].outerHTML);
  4217. App.parsers.push(parser);
  4218. },
  4219. resetCache: function() { // 更新缓存变量
  4220. App.menuItems = App.$chapterList.find("div");
  4221. App.scrollItems = $("article");
  4222. },
  4223. registerControls: function() {
  4224. // 内容滚动
  4225. var throttled = _.throttle(App.scroll, 200);
  4226. $(window).scroll(throttled);
  4227.  
  4228. App.registerKeys();
  4229.  
  4230. if (Config.dblclickPause) {
  4231. App.$content.on("dblclick", function() {
  4232. App.pauseHandler();
  4233. });
  4234. }
  4235.  
  4236. // 左侧章节列表
  4237. App.$menuHeader.click(function() {
  4238. App.copyCurTitle();
  4239. });
  4240.  
  4241. App.$menuBar.click(function() {
  4242. UI.hideMenuList();
  4243. });
  4244.  
  4245. App.$doc.on("mousedown", "#chapter-list div", function(event) {
  4246. switch (event.which) {
  4247. case 1:
  4248. var href = $(this).attr("href");
  4249. if (href) {
  4250. App.scrollToArticle($(href));
  4251. } else {
  4252. location.href = $(this).attr("realHref");
  4253. }
  4254. break;
  4255. case 2: // middle click
  4256. L_setValue("mynoverlreader_disable_once", true);
  4257. App.openUrl($(this).attr("realHref"));
  4258. break;
  4259. }
  4260. });
  4261.  
  4262. $("#preferencesBtn").click(function(event) {
  4263. event.preventDefault();
  4264. UI.preferencesShow();
  4265. });
  4266.  
  4267. GM_registerMenuCommand("小说阅读脚本设置".uiTrans(), UI.preferencesShow.bind(UI));
  4268. },
  4269. registerKeys: function() {
  4270. key('enter', function(event) {
  4271. if (UI.$prefs) {
  4272. return;
  4273. }
  4274.  
  4275. App.openUrl(App.indexUrl, "主页链接没有找到".uiTrans());
  4276. App.copyCurTitle();
  4277.  
  4278. event.stopPropagation();
  4279. event.preventDefault();
  4280. });
  4281.  
  4282. key('left', function(event) {
  4283. var scrollTop = $(window).scrollTop();
  4284. if (scrollTop === 0) {
  4285. location.href = App.prevUrl;
  4286. } else {
  4287. var offsetTop = $(App.curFocusElement).offset().top;
  4288. // 在视野窗口内
  4289. if (offsetTop > scrollTop && offsetTop < (scrollTop + $(window).height())) {
  4290. App.scrollToArticle(App.curFocusElement.previousSibling || 0);
  4291. } else {
  4292. App.scrollToArticle(App.curFocusElement);
  4293. }
  4294. }
  4295. return false;
  4296. });
  4297.  
  4298. key('right', function(event) {
  4299. if (App.getRemain() === 0) {
  4300. location.href = App.lastRequestUrl || App.requestUrl;
  4301. } else {
  4302. App.scrollToArticle(App.curFocusElement.nextSibling || App.$doc.height());
  4303. }
  4304.  
  4305. event.preventDefault();
  4306. event.stopPropagation();
  4307. return false;
  4308. });
  4309.  
  4310. key('esc', function(){
  4311. if (UI.$prefs) {
  4312. UI.hide();
  4313. return false;
  4314. }
  4315. });
  4316.  
  4317. key('shift+/', function() {
  4318. UI.openHelp();
  4319. return false;
  4320. });
  4321.  
  4322. key(Config.quietModeKey, function(){
  4323. UI.toggleQuietMode();
  4324. return false;
  4325. });
  4326.  
  4327. key(Config.hideMenuListKey, function(){
  4328. UI.hideMenuList();
  4329. return false;
  4330. });
  4331.  
  4332. key(Config.openPreferencesKey, function(){
  4333. UI.preferencesShow();
  4334. return false;
  4335. });
  4336. },
  4337. copyCurTitle: function() {
  4338. if (Config.copyCurTitle) {
  4339. var title = $(App.curFocusElement).find(".title").text()
  4340. .replace(/第?\S+章/, "").trim();
  4341.  
  4342. GM_setClipboard(title, "text");
  4343. }
  4344. },
  4345. scrollToArticle: function(elem) {
  4346. var offsetTop;
  4347. if (typeof elem == "number") {
  4348. offsetTop = elem;
  4349. } else {
  4350. offsetTop = $(elem).offset().top - parseInt($(elem).css("margin-top"), 10);
  4351. }
  4352.  
  4353. if (Config.scrollAnimate) {
  4354. $("html, body").stop().animate({
  4355. scrollTop: offsetTop
  4356. }, 750, "easeOutExpo");
  4357. } else {
  4358. $("html, body").stop().scrollTop(offsetTop);
  4359. }
  4360. },
  4361. openUrl: function(url, errorMsg) {
  4362. if (url) {
  4363. if (location.host.indexOf('qidian.com') != -1) { // 起点做了防盗链处理?
  4364. $('#header a')[0].click();
  4365. } else {
  4366. // ff30 Greasemonkey 会报错:Greasemonkey 访问违规:unsafeWindow 无法调用 GM_openInTab。新建脚本采用按键调用也这样。
  4367. setTimeout(function() {
  4368. GM_openInTab(url, false);
  4369. }, 0);
  4370. }
  4371. } else if (errorMsg) {
  4372. UI.notice(errorMsg);
  4373. }
  4374. },
  4375. pauseHandler: function() {
  4376. App.paused = !App.paused;
  4377. if (App.paused) {
  4378. UI.notice('<b>状态</b>:自动翻页<span style="color:red!important;"><b>暂停</b></span>.'.uiTrans());
  4379. App.$loading.html('自动翻页已经<span style="color:red!important;"><b>暂停</b></span>.'.uiTrans()).show();
  4380. } else {
  4381. UI.notice('<b>状态</b>:自动翻页<span style="color:red!important;"><b>启用</b></span>.'.uiTrans());
  4382. App.scroll();
  4383. }
  4384. },
  4385. scroll: function() {
  4386. if (!App.paused && !App.working && App.getRemain() < Config.remain_height) {
  4387. if (App.tmpDoc) {
  4388. App.loaded(App.tmpDoc);
  4389. } else {
  4390. App.doRequest();
  4391. }
  4392. }
  4393.  
  4394. if (App.isTheEnd) {
  4395. App.$loading.html("已到达最后一页...".uiTrans()).show();
  4396. }
  4397.  
  4398. App.updateCurFocusElement();
  4399. },
  4400. updateCurFocusElement: function() { // 滚动激活章节列表
  4401. // Get container scroll position
  4402. var fromTop = $(window).scrollTop() + $(window).height() / 2;
  4403.  
  4404. // Get id of current scroll item
  4405. var cur = App.scrollItems.map(function() {
  4406. if ($(this).offset().top < fromTop)
  4407. return this;
  4408. });
  4409. // Get the id of the current element
  4410. cur = cur[cur.length - 1];
  4411. var id = cur ? cur.id : "";
  4412.  
  4413. if (App.lastId !== id) {
  4414. App.lastId = id;
  4415.  
  4416. var activeItem = App.menuItems.filter("[href=#" + id + "]"),
  4417. activeTitle = activeItem.text(),
  4418. activeUrl = activeItem.attr("realHref");
  4419.  
  4420. // Set/remove active class
  4421. App.menuItems.parent().removeClass("active");
  4422. activeItem.parent().addClass("active");
  4423.  
  4424. App.curFocusElement = cur;
  4425. App.activeUrl = activeUrl;
  4426.  
  4427. if (Config.addToHistory) {
  4428. var curNum = id.match(/\d+/)[0] - 1; // 当前是第几个
  4429. var curTitle = App.parsers[curNum].docTitle;
  4430. document.title = curTitle;
  4431.  
  4432. // TODO: 起点无法添加整个网址,只能添加后半部分。
  4433. var url = activeUrl.replace('http://read.qidian.com', '');
  4434. try {
  4435. unsafeWindow.history.pushState(null, curTitle, url);
  4436. } catch (e) {
  4437. console.error('添加下一页到历史记录失败', e);
  4438. }
  4439. }
  4440. }
  4441. },
  4442. getRemain: function() {
  4443. var scrollHeight = Math.max(document.documentElement.scrollHeight,
  4444. document.body.scrollHeight);
  4445. var remain = scrollHeight - window.innerHeight - window.scrollY;
  4446. return remain;
  4447. },
  4448. doRequest: function() {
  4449. App.working = true;
  4450. var nextUrl = App.requestUrl;
  4451. App.lastRequestUrl = App.requestUrl;
  4452.  
  4453. if (nextUrl && !App.isTheEnd && !(nextUrl in App.parsedPages)) {
  4454. App.parsedPages[nextUrl] = true;
  4455. App.curPageUrl = App.requestUrl;
  4456. App.requestUrl = null;
  4457.  
  4458. var useiframe = App.site.useiframe;
  4459.  
  4460. App.$loading
  4461. .show()
  4462. .html("")
  4463. .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"))
  4464. .append("<a href='" + nextUrl + "' title='点击打开下一页链接'>正在载入下一页".uiTrans() + (useiframe ? "(iframe)" : "") + "...</a>");
  4465.  
  4466. if (useiframe) {
  4467. App.iframeRequest(nextUrl);
  4468. } else {
  4469. App.httpRequest(nextUrl);
  4470. }
  4471. } else {
  4472. // App.$loading.html("<a href='" + App.curPageUrl + "'>无法使用阅读模式,请手动点击下一页</a>").show();
  4473. }
  4474. },
  4475. httpRequest: function(nextUrl, callback) {
  4476. C.log("获取下一页: " + nextUrl);
  4477. GM_xmlhttpRequest({
  4478. url: nextUrl,
  4479. method: "GET",
  4480. overrideMimeType: "text/html;charset=" + document.characterSet,
  4481. timeout: 30 * 1000,
  4482. onload: function(res) {
  4483. var doc = parseHTML(res.responseText);
  4484. if (_.isFunction(callback)) {
  4485. callback(doc);
  4486. } else {
  4487. App.beforeLoad(doc);
  4488. }
  4489. },
  4490. ontimeout: function() {
  4491. callback();
  4492. }
  4493. });
  4494. },
  4495. iframeRequest: function(nextUrl) {
  4496. C.log("iframeRequest: " + nextUrl);
  4497. if (!App.iframe) {
  4498. var i = document.createElement('iframe');
  4499. App.iframe = i;
  4500. i.name = 'mynovelreader-iframe';
  4501. i.width = '100%';
  4502. i.height = '0';
  4503. i.frameBorder = "0";
  4504. i.style.cssText = '\
  4505. margin:0!important;\
  4506. padding:0!important;\
  4507. visibility:hidden!important;\
  4508. ';
  4509. i.src = nextUrl;
  4510. i.addEventListener('load', App.iframeLoaded, false);
  4511. App.remove.push(function() {
  4512. i.removeEventListener('load', App.iframeLoaded, false);
  4513. });
  4514. document.body.appendChild(i);
  4515. } else {
  4516. App.iframe.contentDocument.location.replace(nextUrl);
  4517. }
  4518. },
  4519. iframeLoaded: function() {
  4520. var iframe = this;
  4521. var body = iframe.contentDocument.body;
  4522.  
  4523. if (body && body.firstChild) {
  4524. doc = iframe.contentDocument;
  4525.  
  4526. var mutationSelector = App.site.mutationSelector;
  4527. if (mutationSelector) {
  4528. App.addMutationObserve(doc, function() {
  4529. App.beforeLoad(doc);
  4530. });
  4531. } else {
  4532. var timeout = App.site.timeout || 0;
  4533.  
  4534. setTimeout(function() {
  4535. App.beforeLoad(doc);
  4536. }, timeout);
  4537. }
  4538. }
  4539. },
  4540. beforeLoad: function(htmlDoc) {
  4541. if (config.PRELOADER) {
  4542. App.tmpDoc = htmlDoc;
  4543. App.working = false;
  4544. App.scroll();
  4545.  
  4546. // 预读图片
  4547. var existSRC = {};
  4548. $(App.tmpDoc).find('img').each(function() {
  4549. var isrc = $(this).attr('src');
  4550. if (!isrc || existSRC[isrc]) {
  4551. return;
  4552. } else {
  4553. existSRC[isrc] = true;
  4554. }
  4555. var img = document.createElement('img');
  4556. img.src = isrc;
  4557. });
  4558. } else {
  4559. App.loaded(htmlDoc);
  4560. }
  4561. },
  4562. loaded: function(doc) {
  4563. var parser = new Parser(App.site, doc, App.curPageUrl);
  4564. parser.getAll(function() {
  4565. App.addNextPage(parser);
  4566. });
  4567. App.tmpDoc = null;
  4568. },
  4569. addNextPage: function(parser) {
  4570. if (parser.content) {
  4571. App.appendPage(parser);
  4572.  
  4573. App.$loading.hide();
  4574. App.requestUrl = parser.nextUrl;
  4575. App.isTheEnd = parser.isTheEnd;
  4576.  
  4577. App.afterLoad();
  4578. } else {
  4579. App.removeListener();
  4580.  
  4581. App.$loading.html(
  4582. '<a href="' + App.curPageUrl + '">错误:没有找到下一页的内容。点击打开下一页链接。</a>'.uiTrans())
  4583. .show();
  4584. }
  4585.  
  4586. App.working = false;
  4587. },
  4588. afterLoad: function() {
  4589. App.tmpDoc = null;
  4590.  
  4591. if (config.PRELOADER) {
  4592. setTimeout(function(){
  4593. App.doRequest();
  4594. }, 200);
  4595. }
  4596. },
  4597. fixImageFloats: function(articleContent) {
  4598. if (!config.fixImageFloats) return;
  4599.  
  4600. articleContent = articleContent || document;
  4601.  
  4602. var imageWidthThreshold = Math.min(articleContent.offsetWidth, 800) * 0.55,
  4603. images = articleContent.querySelectorAll('img:not(.blockImage)');
  4604.  
  4605. for (var i = 0, il = images.length; i < il; i += 1) {
  4606. var image = images[i];
  4607.  
  4608. if (image.offsetWidth > imageWidthThreshold) {
  4609. image.className += " blockImage";
  4610. }
  4611. }
  4612. },
  4613.  
  4614. isSaveing: false,
  4615. saveAsTxt: function() {
  4616. if (App.site.useiframe) {
  4617. alert('暂不支持');
  4618. return;
  4619. }
  4620.  
  4621. if (App.isSaveing) {
  4622. alert('正在保存,请稍后');
  4623. return;
  4624. } else {
  4625. alert('开始一章章获取内容,请耐心等待');
  4626. }
  4627.  
  4628. App.isSaveing = true;
  4629.  
  4630. var chapters = [];
  4631. var fileName;
  4632.  
  4633. var toTxt = function(parser) {
  4634. var html = $.nano('{chapterTitle}\n\n{contentTxt}', parser);
  4635. chapters.push(html);
  4636. };
  4637. var finish = function() {
  4638. saveAs(chapters.join('\n\n'), fileName);
  4639. App.isSaveing = false;
  4640. };
  4641.  
  4642. var getOnePage = function (parser, nextUrl) {
  4643. if (parser) {
  4644. toTxt(parser);
  4645. nextUrl = parser.nextUrl;
  4646. }
  4647.  
  4648. if (!nextUrl) {
  4649. console.log('全部获取完毕');
  4650. finish();
  4651. return;
  4652. }
  4653.  
  4654. if (App.site.useiframe) {
  4655. // App.iframeRequest(nextUrl);
  4656. } else {
  4657. console.log('[存为txt]正在获取:', nextUrl)
  4658. App.httpRequest(nextUrl, function(doc) {
  4659. if (doc) {
  4660. var par = new Parser(App.site, doc, nextUrl);
  4661. par.getAll(getOnePage)
  4662. } else {
  4663. console.error('超时或连接出错');
  4664. finish();
  4665. }
  4666. });
  4667. }
  4668. };
  4669.  
  4670. App.parsers.forEach(toTxt);
  4671. // 保存后面的章节
  4672. var lastParser = App.parsers[App.parsers.length - 1];
  4673. fileName = lastParser.bookTitle + '.txt';
  4674. getOnePage(null, lastParser.nextUrl);
  4675. }
  4676. };
  4677.  
  4678. var BookLinkMe = {
  4679. clickedColor: "666666",
  4680.  
  4681. init: function() {
  4682. if (location.host != 'booklink.me') return;
  4683.  
  4684. this.addUnreadButton();
  4685.  
  4686. if (location.pathname.indexOf("/book-") === 0) {
  4687. this.chapterPageAddTiebaLink();
  4688. }
  4689. },
  4690. addUnreadButton: function(){ // 添加一键打开所有未读链接
  4691. var $parent = $('td[colspan="2"]:contains("未读"):first, td[colspan="2"]:contains("未讀"):first');
  4692. if(!$parent.length) return;
  4693.  
  4694. var openAllUnreadLinks = function(event){
  4695. event.preventDefault();
  4696.  
  4697. var links = $x('./ancestor::table[@width="100%"]/descendant::a[img[@alt="未读"]]', event.target);
  4698. links.forEach(function(link){
  4699. // 忽略没有盗版的
  4700. var chapterLink = link.parentNode.nextSibling.nextSibling.querySelector('a');
  4701. if (chapterLink.querySelector('font[color*="800000"]')) {
  4702. return;
  4703. }
  4704.  
  4705. if(isFirefox)
  4706. link.click();
  4707. else
  4708. GM_openInTab(link.href);
  4709.  
  4710. // 设置点击后的样式
  4711. // 未读左边的 1x 链接
  4712. link.parentNode.previousSibling.querySelector('font')
  4713. .setAttribute('color', BookLinkMe.clickedColor);
  4714. chapterLink.classList.add('mclicked');
  4715. });
  4716. };
  4717.  
  4718.  
  4719. $('<a>')
  4720. .attr({ href: 'javascript:;', title: '一键打开所有未读链接', style: 'width:auto;' })
  4721. .click(openAllUnreadLinks)
  4722. .append($('<img src="me.png" style="max-width: 20px;">'))
  4723. .appendTo($parent);
  4724. },
  4725. chapterPageAddTiebaLink: function() {
  4726. var link = $('font:contains("贴吧")').parent().get(0);
  4727. if (!link) return;
  4728.  
  4729. var tiebaUrl = 'http://tieba.baidu.com/f?kw=' + $('h1').text();
  4730. console.log('GM_xmlhttpRequest', tiebaUrl);
  4731. GM_xmlhttpRequest({
  4732. method: "GET",
  4733. url: tiebaUrl,
  4734. onload: function(response) {
  4735. var doc = parseHTML(response.responseText);
  4736. BookLinkMe.load(doc);
  4737. }
  4738. });
  4739. },
  4740. load: function(doc) {
  4741. var $data = $(doc).find('.threadlist_text > a').map(function() {
  4742. return {
  4743. title: $(this).text(),
  4744. url: 'http://tieba.baidu.com' + $(this).attr('href')
  4745. }
  4746. });
  4747.  
  4748. var trimTitle = function(title, strict) {
  4749. title = title.trim()
  4750. .replace(/\.\.\.$/, '');
  4751.  
  4752. if (strict) {
  4753. title = title.replace(/第.*?章\s*/, '');
  4754. }
  4755.  
  4756. // if (toNum) {
  4757. // title = title.replace(/[零一二三四五六七八九十百千万亿]+/, cnNum2ArabNum);
  4758. // }
  4759.  
  4760. return title;
  4761. };
  4762.  
  4763. var findUrl = function(sTitle) {
  4764. if (!sTitle) return;
  4765.  
  4766. var url;
  4767. $data.each(function(i, item) {
  4768. var tiebaTitle = item.title;
  4769. if (tiebaTitle.indexOf(trimTitle(sTitle)) > 0 ||
  4770. sTitle.indexOf(trimTitle(tiebaTitle, true)) > 0 // 包含贴吧标题的部分
  4771. ) {
  4772. url = item.url;
  4773. return true;
  4774. }
  4775. });
  4776.  
  4777. return url;
  4778. };
  4779.  
  4780. $('a:contains("搜索本章节")').each(function(){
  4781. var $this = $(this),
  4782. $thisLine = $this.parent().parent(),
  4783. chapterTitle = $thisLine.prev().find('a[href^="/jump.php"]:first').text();
  4784.  
  4785. var url = findUrl(chapterTitle);
  4786. if (url) {
  4787. $('<a>')
  4788. .attr({ target: '_blank', href: url })
  4789. .text('贴吧')
  4790. .appendTo($this.parent());
  4791. }
  4792. });
  4793. }
  4794. };
  4795.  
  4796. if (location.host === 'booklink.me') {
  4797. BookLinkMe.init();
  4798. } else {
  4799. App.init();
  4800. }