diff --git a/js(origin)/book.js b/js(origin)/book.js index d13ab56..c6cf127 100644 --- a/js(origin)/book.js +++ b/js(origin)/book.js @@ -25,11 +25,19 @@ chrome.runtime.onMessage.addListener(function(message, sender,sendResponse) cq=cq.children[1]; /**@type {string} 作者名*/ tem.an=cq.children[1].innerText; - /**@type {Array<string>} 分类*/ - tem.fl=[cq.children[3].innerText,cq.children[5].innerText]; - if(cq.childElementCount==10)tem.fl[2]=cq.children[9].innerText; - /**@type {string} 小说状态*/ - tem.s=cq.children[7].innerText; + if(document.URL.split('//')[1].split('/')[1]!='mm') + { + /**@type {Array<string>} 分类*/ + tem.fl=[cq.children[3].innerText,cq.children[5].innerText]; + if(cq.childElementCount==10)tem.fl[2]=cq.children[9].innerText; + /**@type {string} 小说状态*/ + tem.s=cq.children[7].innerText; + } + else + { + tem.fl=cq.children[3].innerText; + tem.s=cq.children[5].innerText; + } list[i]=tem; } info.l=list; @@ -52,8 +60,9 @@ chrome.runtime.onMessage.addListener(function(message, sender,sendResponse) tem2.h=cb.children[1].children[0].href; /**@type {string} 作者名*/ tem2.an=cb.children[4].innerText; - /**@type {Array<string>} 分类*/ - tem2.fl=[cb.children[0].children[0].innerText.substring(1),cb.children[0].children[2].innerText.split("」")[0]]; + /**分类*/ + if(document.URL.split('//')[1].split('/')[1]!='mm')tem2.fl=[cb.children[0].children[0].innerText.substring(1),cb.children[0].children[2].innerText.split("」")[0]]; + else tem2.fl=cb.children[0].innerText.substring(1).split("」")[0]; /**@type {string} 最新章节名*/ tem2.cn=cb.children[2].innerText; /**@type {string} 最新章节链接*/ diff --git a/js(origin)/free.js b/js(origin)/free.js index a4bb7dd..38a850d 100644 --- a/js(origin)/free.js +++ b/js(origin)/free.js @@ -11,6 +11,7 @@ chrome.runtime.onMessage.addListener(function(message, sender,sendResponse) var bo={}; var cm=ci.children[i].children[1]; bo.bn=cm.children[0].innerText;//书名 + bo.h=cm.children[0].children[0].href;//info链接 bo.in=cm.children[2].innerText;//介绍 cm=cm.children[1]; bo.an=cm.children[1].innerText;//作者名 @@ -18,7 +19,6 @@ chrome.runtime.onMessage.addListener(function(message, sender,sendResponse) bo.s=cm.children[5].innerText;//小说状态 cm=ci.children[i].children[2]; bo.p=cm.children[0].children[1].innerText.split('¥')[1]-1+1;//价格(人民币) - bo.h=cm.children[1].children[0].href;//info链接 list[i]=bo; } info.l=list; diff --git a/js(origin)/main.js b/js(origin)/main.js index 8d02ef2..8e0db83 100644 --- a/js(origin)/main.js +++ b/js(origin)/main.js @@ -5,8 +5,8 @@ var bookinfo_md=["http://book.qidian.com/info/*","https://book.qidian.com/info/* var zhbookinfo_md=["http://book.zongheng.com/book/*","https://book.zongheng.com/book/*"]; var zhbookinfom_md=["http://book.zongheng.com/showchapter/*","https://book.zongheng.com/showchapter/*"]; var zhbookinfoo_md=["http://book.zongheng.com/orderchapter*","https://book.zongheng.com/orderchapter*"]; -var bookfree_md=["https://www.qidian.com/free","http://www.qidian.com/free"]; -var book_md=["https://www.qidian.com/all*","http://www.qidian.com/all*","https://www.qidian.com/finish*","http://www.qidian.com/finish*","https://www.qidian.com/free/all*","http://www.qidian.com/free/all*"]; +var bookfree_md=["https://www.qidian.com/free","http://www.qidian.com/free","https://www.qidian.com/mm/free","http://www.qidian.com/mm/free"]; +var book_md=["https://www.qidian.com/all*","http://www.qidian.com/all*","https://www.qidian.com/finish*","http://www.qidian.com/finish*","https://www.qidian.com/free/all*","http://www.qidian.com/free/all*","https://www.qidian.com/mm/all*","http://www.qidian.com/mm/all*","https://www.qidian.com/mm/finish*","http://www.qidian.com/mm/finish*","https://www.qidian.com/mm/free/all*","http://www.qidian.com/mm/free/all*"]; var vip_status=["免费","付费"]; var isBuy=["未购买","已购买"]; var autoBuy=['关闭',"开启"]; @@ -1294,7 +1294,8 @@ function abookc(data) return s; } div.append(cdiv('分类:')) - div.append(cdiv(getflstr(data.fl))); + if(data.fl.constructor.name=="String")div.append(cdiv(data.fl)) + else div.append(cdiv(getflstr(data.fl))); if(c) { div.append(cdiv('作品状态:')); @@ -1345,6 +1346,41 @@ function abookc(data) } function sendmess(tabs) { + (function(){ + /**@param {MouseEvent} e*/ + function adde(e) + { + e.preventDefault(); + chrome.tabs.create({url:e.srcElement.href}); + } + var div=document.createElement('div'); + div.style.width=tabs[0].width/2; + var style=document.createElement('style'); + style.innerText=".vl{display:inline-block;"; + div.append(style); + var div2=document.createElement('div'); + var a=document.createElement('a'); + a.innerText="源代码"; + a.href="https://github.com/lifegpc/qdbookdownload" + a.addEventListener('click',adde); + var div3=document.createElement('div'); + div3.className="vl"; + div3.innerText="已开源至Github"; + div2.append(a); + div2.append(div3); + div.append(div2); + div2=document.createElement('div'); + div3=document.createElement('div'); + div3.innerText="采用"; + div3.className="vl"; + div2.append(div3); + a=document.createElement('a'); + a.innerText="GNU公共许可证"; + a.href="LICENSE"; + a.addEventListener('click',adde); + div2.append(a); + div.append(div2); + document.body.append(div);})(); /**显示指定元素显示并设置宽度 * @param {string} id 元素ID * @param tab 当前标签页数组 diff --git a/manifest.json b/manifest.json index 5a2af23..19e0a48 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version":2, "name":"起点下载器", - "version":"1.0.3", + "version":"1.0.4", "description":"下载起点中文网/纵横中文网上的小说。已在github上开源,项目链接:https://github.com/lifegpc/qdbookdownload", "icons": { @@ -55,11 +55,11 @@ "js":["js/zhremovead.js"] }, { - "matches":["https://www.qidian.com/free","http://www.qidian.com/free"], + "matches":["https://www.qidian.com/free","http://www.qidian.com/free","https://www.qidian.com/mm/free","http://www.qidian.com/mm/free"], "js":["js/free.js"] }, { - "matches":["https://www.qidian.com/all*","http://www.qidian.com/all*","https://www.qidian.com/finish*","http://www.qidian.com/finish*","https://www.qidian.com/free/all*","http://www.qidian.com/free/all*"], + "matches":["https://www.qidian.com/all*","http://www.qidian.com/all*","https://www.qidian.com/finish*","http://www.qidian.com/finish*","https://www.qidian.com/free/all*","http://www.qidian.com/free/all*","https://www.qidian.com/mm/all*","http://www.qidian.com/mm/all*","https://www.qidian.com/mm/finish*","http://www.qidian.com/mm/finish*","https://www.qidian.com/mm/free/all*","http://www.qidian.com/mm/free/all*"], "js":["js/book.js"] }], "options_page":"options.html"