Search book in THU lib

在清华图书馆搜索豆瓣中的图书

目前為 2018-07-02 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Search book in THU lib
// @namespace    github.com/tandf
// @version      0.1
// @description  在清华图书馆搜索豆瓣中的图书
// @author       tandf
// @match        https://book.douban.com/subject/*
// @grant        none
// ==/UserScript==

$(document).ready(function(){
    var titleSpan = $("[property = 'v:itemreviewed']");
    var title = titleSpan.text();
    var url = 'https://tsinghua-primo.hosted.exlibrisgroup.com/primo-explore/search?query=any,contains,' + title +'&tab=default_tab&search_scope=default_scope&vid=86THU&lang=zh_CN';

    var btn = document.createElement("button");
    btn.id = "searchBtn";
    titleSpan.after(btn);

    $("#searchBtn").text("在清华大学图书馆搜索").css({"background-color": "transparent", "padding": "3px 4px", "font-size": "20px", "border": "0px", "color": "#3377aa", "text-align": "center"});
    $("#searchBtn").mouseenter(function(){$("#searchBtn").css({"background-color": "#3377aa", "color": "white", "cursor": "pointer"})});
    $("#searchBtn").mouseleave(function(){$("#searchBtn").css({"background-color": "transparent", "color": "#3377aa"})});
    $("#searchBtn").click(function(){
        window.open(url);
    })
})