My Novel Reader

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

Tính đến 29-05-2015. Xem phiên bản mới nhất.

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