您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Press Ctrl+J(Command+J on Mac) to search highlighted Japanese words with jisho.org or Ctrl+Shift+J for pronunciation on forvo.com
// ==UserScript== // @name japanese search // @namespace https://gist.github.com/TheFantasticWarrior/a56b5c975818d9060ded8f8f3db07deb // @version 0.2 // @description Press Ctrl+J(Command+J on Mac) to search highlighted Japanese words with jisho.org or Ctrl+Shift+J for pronunciation on forvo.com // @author TFW // @include * // @grant none // ==/UserScript== (function() { 'use strict'; function getSelectionText() { var text = ""; if (window.getSelection) { text = window.getSelection().toString(); } else if (document.selection && document.selection.type != "Control") { text = document.selection.createRange().text; } return text; } document.addEventListener("keypress", checkKeyPressed, false); function checkKeyPressed(e) { if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.keyCode == "106") { window.open('https://forvo.com/search/'+getSelectionText()); } else if ((e.ctrlKey || e.metaKey) && e.keyCode == "106") { window.open('https://jisho.org/search/'+getSelectionText()); } } })();