// ==UserScript== // @name 图书文献助手🔥图书馆联盟🔥豆瓣🔥一键查询 // @namespace https://eeshu.net https://eesk.top // @version 0.2.2 // @description 全国图书馆咨询联盟,图书互助,文献互助,电子书资源,pdf电子书代找,电子书下载,电子书互助,电子书分享,图书To搜索[红太狼的平底锅]。 // @include *search* // @include *bookDetail.jsp?* // @include *advsearch* // @include *book.do?go=guide* // @include *book.do?go=showmorelib* // @include *searchEBook* // @include *www.duxiu.com* // @include *img.duxiu.com* // @include *book.douban.com* // @include *product.dangdang.com* // @include *kongfz.com* // @copyright houge // @grant none // @downloadURL none // ==/UserScript== //获取当前网页地址 var myurl = window.location.href; //定义统一的样式 var mystyle = "font-family:Verdana;color:red;font-size:15px;font-weight:bold;text-align:center;margin-top:5px;margin-bottom:5px;text-decoration:none;"; var app = { run: function() { processUCDSRList(); processUCDSR(); processDouban(); processDangDang(); processKongFZ(); } }; function processKongFZ() { var id = null; if (myurl.match(/item\.kongfz\.com\/book\/\d+\.html/)) { id=isbn; } else if (myurl.match(/book\.kongfz\.com\/\d+\/\d+/)){ id=DETAIL.isbn; } if (id && id.length >= 10){ document.querySelector("h1").appendChild(createImageLink(false,id,null)); } } function processDangDang() { if (myurl.match(/product\.dangdang\.com\/\d+\.html/)) { var detail = document.getElementById("detail_describe").innerHTML; if (detail) { var isbn = detail.match(/(\d{12}[\dxX])/)[1]; if (isbn.length >= 10) { document.querySelector("h1").insertBefore(createImageLink(false,isbn,"position:relative;top:3px;"),document.querySelector("h1").childNodes[0]); } } } } function processDouban() { if (myurl.match(/douban\.com\/subject\/\d+\//)) { var metas = document.querySelectorAll("meta[property='book:isbn']"); if (metas.length == 1) { var isbn = metas[0].getAttribute("content"); document.querySelector("h1").insertBefore(createImageLink(false,isbn,null),document.querySelector("h1").childNodes[2]); } } } function processUCDSRList() { if (myurl.indexOf("search?") != -1) { var tables = document.getElementsByClassName("book1"); for (var i = 0; i < tables.length; i++) { var table = tables[i]; var dxid = document.getElementById("title"+i).getAttribute('value'); var dxid =dxid.replace(/<\/?[^>]*>/g, '');//过滤所有的html标签 var newTr = table.insertRow(table.rows.length); var newTd0 = newTr.insertCell(0); var newTd1 = newTr.insertCell(1); var newTd2 = newTr.insertCell(2); newTd1.align = "center"; newTd1.appendChild(createTextLink(false,dxid)); newTd1.appendChild(createImageLink(false,dxid,null)); clearP(table.rows[0]); } } } function clearP(tr){ var ps = tr.querySelectorAll("p"); for(var i=ps.length-1;i>=0;i--){ tr.removeChild(ps[i]) } setTimeout(clearP, 1000,tr); } function processUCDSR() { if (myurl.indexOf("bookDetail.jsp?") != -1 && myurl.indexOf("/views/specific/") != -1) { var ssids= document.getElementById('ssidfav'); var ssid = ssids.value; console.log(ssid); document.querySelector(".tubookimg").appendChild(createTextLink(true,ssid)); document.querySelector(".tubookimg").appendChild(createImageLink(true,ssid,null)); } } function buildUrl(searchKey) { return "https://www.eebook.net/so/?ie=utf-8&name="+searchKey; } function createTextLink(withP,id) { var ssNode = document.createElement("p"); ssNode.innerHTML = id; var aLink = document.createElement("a"); aLink.href = buildUrl(id); aLink.target = "_blank"; aLink.style = mystyle; aLink.innerHTML = id; return withP?wrapP(aLink):aLink; } function createImageLink(withP,id,aCss) { var stockNode = document.createElement("img"); stockNode.src = "https://t00img.yangkeduo.com/chat/images/2024-03-26/29cecb5f4b9c49b29995889e05f59e65.png#?id=" + (id||""); stockNode.style = "display: inline;"; var csgbutton = document.createElement("a"); csgbutton.href = buildUrl(id); csgbutton.target = "_blank"; csgbutton.appendChild(stockNode); if (aCss){ csgbutton.style = aCss; } return withP?wrapP(csgbutton):csgbutton; } function wrapP(node){ var p = document.createElement("p"); p.style = "text-align:center;margin-top: 4px;"; p.appendChild(node); return p; } try { app.run(); } catch(e) { console.log(e); }