Greasy Fork

来自缓存

Greasy Fork is available in English.

图书查找

鼠标选中文字,快捷键alt+1/2/3/4,依次跳转到豆瓣,当当,图灵,京东图书界面,并进行搜索

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         图书查找
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  鼠标选中文字,快捷键alt+1/2/3/4,依次跳转到豆瓣,当当,图灵,京东图书界面,并进行搜索
// @author       You
// @match        http://*/*
// @match        https://*/*
// @exclude      http://*.baidu.com/*
// @exclude      https://*.baidu.com/*
// @grant        none
// @require      https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js
// @supportURL   [email protected]
// @downloadURl  https://github.com/dianligegege/Tampermonkey-script

// ==/UserScript==

(function() {
   $(document).keydown(function (e) {

			var sel = window.getSelection().toString();
			if (sel !== '' && e.altKey) {
				switch (e.which) {
                        // alt+1
                        //豆瓣读书
					case 49:
						window.open('https://book.douban.com/subject_search?search_text=' + sel);
						break;
                        //alt+2
                        //当当图书
					case 50:
						window.open('http://search.dangdang.com/?key=' + sel);
						break;
                        //alt+3
                        //图灵社区
					case 51:
						window.open('http://www.ituring.com.cn/search?q=' + sel);
						break;
                        //alt+4
                        //京东图书
					case 52:
                        //document.execCommand("Copy")
						window.open('https://search.jd.com/Search?keyword='+sel+'&enc=utf-8&wq='+sel)
						break;
					default:
						break;
				}
			}

		});

//		if (window.url = 'https://www.jiumodiary.com/') {
//			var search = $('#SearchWord');
//			var searchbtn = $('#SearchButton');
//			console.log(search);
//			search.val(sel) ;
//            console.log(search.val());
//			searchbtn.click();
//			console.log(123)
//		};
})();