图书互助查询小帮手: 读秀超星图书联盟显示图书编号

免注册,查询超星、读秀、全国图书馆参考咨询联盟等文献馆书籍编号(SSID, DXID),并发起互助获取全文。

// ==UserScript==
// @name         图书互助查询小帮手: 读秀超星图书联盟显示图书编号
// @name:zh-CN   图书互助查询小帮手: 读秀超星图书联盟显示图书编号
// @name:zh-TW   圖書互助查詢小幫手: 讀秀超星圖書聯盟顯示圖書編號
// @name:en      Book Search Helper: DXID SSID helper.
// @namespace    duxiuhelp
// @version      0.0.1
// @author       Moon
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAMhklEQVR42u2d0W9cx3WHv9/cuxtaNVhCEARBEARCIFzbNRRFKGRXClltGyd13aauUyBoC8PJX5D6sY/5C+L3PKQO0KJFINdqDDtxFK9CJpYtOw7DqgwjEIIgCARhCIRqCCSze3dOH+4SZiSSu0vO7FJ77wfwYZe7Z2bu/u7cmTlnzkBJSUlx0eYXf/Pq2nngrMEfDrpiwP95S/7jrVeqNwZdkWEm3fzCsFPA14GDg64YsCz8ZaAUQETuEwCjwDHtDwEgrDroOgw7btAVKBkspQAKTimAglMKoOCUAig4pQAKTimAglMKoOCUAig4pQAKTimAglMKoOCUAig4pQAKTimAglMKoOCUAig46X2vV8hDsFZ6sHEUGKEU00OJ9mrgr19dq4OdAQ4ErtttTC+9+cojlwdyZQpCuncTg6UxnXxDsmNAJYZ9mX4FXEqnWvcG2MYXJZsA/iC07YdeAJIdQ/omMBbDvok7wLPAQASwVueYHP8CGifCY/bhF4Dxpol/Io9ojtGeUUxPNWfSu5XJ7NN+ty9JktPk46xDMew/9AO3pOXngfeBu5GKSCWryVmUH6ATEs8Bj0Yw3QAWH3oBqEZDRh34JFYZBucxjlq9fzfMWh23VmcU8SXyWVZo1jEuP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1OtWCHlu2vzoCuwX2jOcLQd7xfyVI/PMH4pb30L9+6WUgAbyJ0FniKKy5dFYfOJ9zFOLd8TpQCAtTojoGch+Jl+AAj+G6eF/TL330w5BqB9oGN+98eI+FmVtwuu5QcS8tWJUgCAS9zLBD7PbwPBVXO6pan9d/dDKQDW6owL/h6CR/wA4D2vMcCIn04UXgBJJfkWYY+L2yCTbNnQ60TK8ReCwgqgfa7vgZaYMosy8v/UvL5fndrdmb79orACyJKkCpwmj/erRihiVd7eHnQ7O1FYAeAYBf6BsMe5bXAPWEi87+tW791dhgLSmE5GgBNSlIgfgCWJC6qFO9snFkXtAY6Y8TxwOILtDLiRNFpvDLqR3VBIAchxGPhyJPPLgrlQ5/rF5v8BDmz0K0u0ul0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMjItMDktMjhUMTY6MTg6MTErMDA6MDDezpeSAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIyLTA5LTI4VDE2OjE4OjExKzAwOjAwr5MvLgAAACh0RVh0ZGF0ZTp0aW1lc3RhbXAAMjAyMi0wOS0yOFQxNjoxODoxMSswMDowMPiGDvEAAAAASUVORK5CYII=
// @match        *://*.duxiu.com/search*
// @match        *://book.ucdrs.superlib.net/views/specific/*
// @match        *://book.ucdrs.superlib.net/search*
// @match        *://book.dglib.superlib.net/views/specific/*
// @match        *://book.dglib.superlib.net/search*
// @match        *://book.douban.com/isbn/*
// @match        *://cadal.edu.cn/cadalinfo/search*
// @match        *://cadal.edu.cn/cardpage/bookCardPage?*ssno=*
// @match        *://fx.ccelib.com/detail_*
// @match        *://fx.ccelib.com/s?*
// @include      */search?*
// @include      *bookDetail.jsp?*
// @include      *chapter.jsp?*
// @include      *book.do?*
// @include	     *advsearch*
// @include		 *book.do?go=guide*
// @include		 *book.do?go=showmorelib*
// @include		 *searchEBook*
// @include		 *www.duxiu.com*
// @include		 *n/jpgfs/book/base*
// @include		 *n/slib/book/slib*
// @description        免注册,查询超星、读秀、全国图书馆参考咨询联盟等文献馆书籍编号(SSID, DXID),并发起互助获取全文。
// @description:zh-CN  免注册,查询超星、读秀、全国图书馆参考咨询联盟等文献馆试读书籍是否可以发起互助获取全文。
// @description:zh-tw  免註冊,查詢超星、讀秀、全國圖書館參考咨詢聯盟等文獻館書籍編號(SSID, DXID),並發起互助獲取全文。
// @description:en No registration, check the book numbers (SSID, DXID) of literature libraries such as Super Star, Duxiu, UCDRS, and initiate mutual assistance to obtain the full text.
// @license     Copyright Moon
// ==/UserScript==

function main() {
	var bookList = document.querySelectorAll("table.book1");
	if (bookList.length == 0) {
		bookList = document.querySelectorAll("table.books");
	}
	if (bookList.length == 0) {
		bookList = document.querySelectorAll("table");
	}
	for (var i = 0; i < bookList.length; i++) {
		var ssid = document.getElementById("ssid" + i);
		var ssidVal = ssid.value;
		var dxid = document.getElementById("dxid" + i);
		var dxidVal = dxid.value;

		ssid.setAttribute("type", "");
		ssid.value = "SS " + ssid.value;
		dxid.setAttribute("type", "");
		dxid.value = "DX " + dxid.value;

		var node = ssid.parentNode;
		var blink = createBookLink(ssidVal, dxidVal);
		if (blink) {
			node.appendChild(blink);
		}
	}
}

function createBookLink(ssid, dxid) {
	var b = document.createElement("a");
	b.target = "_blank";
	b.innerText = "立即互助";

	if (ssid) {
		b.href = getBookLink(ssid);
	} else if (dxid) {
		b.href = searchBookLink(dxid);
	}

	return b;
}

function getBookLink(ssid) {
	return "https://1yuanbook.com/book/" + ssid;
}

function searchBookLink(dxid) {
	return "https://1yuanbook.com/search/" + dxid;
}

(function () {
	/// entry
	try {
		main();
	} catch (e) {
		console.error(e);
	}
})();