// ==UserScript== // @name 万能页内选中搜索【失效联系作者24小时更新】 // @namespace http://tampermonkey.net/ // @version 1.0.2 // @description 任何页面选中以后都可以快捷搜索,实现不跳出网页浏览进行搜索,目前支持必应搜索。 // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js // @author 蜡小新 // @match *://*/* // @icon https://www.google.com/s2/favicons?sz=64&domain=greasyfork.org // @grant none // @license MIT // @downloadURL https://update.greasyfork.icu/scripts/445266/%E4%B8%87%E8%83%BD%E9%A1%B5%E5%86%85%E9%80%89%E4%B8%AD%E6%90%9C%E7%B4%A2%E3%80%90%E5%A4%B1%E6%95%88%E8%81%94%E7%B3%BB%E4%BD%9C%E8%80%8524%E5%B0%8F%E6%97%B6%E6%9B%B4%E6%96%B0%E3%80%91.user.js // @updateURL https://update.greasyfork.icu/scripts/445266/%E4%B8%87%E8%83%BD%E9%A1%B5%E5%86%85%E9%80%89%E4%B8%AD%E6%90%9C%E7%B4%A2%E3%80%90%E5%A4%B1%E6%95%88%E8%81%94%E7%B3%BB%E4%BD%9C%E8%80%8524%E5%B0%8F%E6%97%B6%E6%9B%B4%E6%96%B0%E3%80%91.meta.js // ==/UserScript== (function() { 'use strict'; var content = ""; $("body").bind('mouseup', function(e) { processSelection(e); }); function processSelection(e) { var text = getSelectedText(); if (!!text && text != "" && text.length != 0) { showBubble(e, text); } else { hideBubble(); } } function getSelectedText() { var text = ""; if (window.getSelection) { text = window.getSelection() .toString(); } else if (document.selection && document.selection.type != "Control") { text = document.selection.createRange() .text; } return text; } function showBubble(e, text) { content = text; if($('#any-searcher-bubble').length == 0) { $("body").append("