// ==UserScript== // @name 磁力搜索 // @namespace // @version 0.4 // @description 磁力搜索,基于“磁力mp4搜索 ”修改而成 // @author yuelpl // @match *://*/* // @grant GM_addStyle // @require https://code.jquery.com/jquery-3.1.0.js // @license MIT // @icon https://s1.ax1x.com/2018/12/21/FsZEvT.png // @downloadURL https://update.greasyfork.icu/scripts/388123/%E7%A3%81%E5%8A%9B%E6%90%9C%E7%B4%A2.user.js // @updateURL https://update.greasyfork.icu/scripts/388123/%E7%A3%81%E5%8A%9B%E6%90%9C%E7%B4%A2.meta.js // ==/UserScript== (function() { 'use strict'; GM_addStyle(`#zizhuIcon {width: 36px; height: 36px;box-shadow: 2px 2px 4px rgba(12,12,12,.3); border-radius: 5px; cursor: pointer;} #zizhuMain {position: absolute; top: 0; left: 0; width: 0; height: 0; background: #fff; font-size: 12px; opacity: 0;z-index: 9999;display:none;box-sizing: border-box;}`) var innerIcon = "磁力mp4搜索" var txt = '' var odom = document.createElement("div"); odom.id = "zizhuMain"; odom.innerHTML = innerIcon; document.body.appendChild(odom); document.querySelector("#zizhuMain").addEventListener("click",searchSetting); function searchSetting(){ //location.href="https://biedian.me/"+txt if(txt.length != 0){ //window.open('https://biedian.me/search?source=idope&k='+txt+'&s=time&p=1') window.open('https://biedian.me/search?source=idope&k='+txt+'&s=time&p=1') } } $('body').mouseup(function(e){ txt = window.getSelection?window.getSelection().toString():document.selection.createRange().text; let sel = window.getSelection() var range = sel.getRangeAt(0); var rect = range.getBoundingClientRect(); var scrollH = $(document).scrollTop(); var scrollW = $(document).scrollLeft(); if(txt && txt.length != 0){ $('#zizhuMain').css({ "top": rect.y+scrollH+20+'px', "left": rect.x+scrollW+'px','opacity':1,'width':'36px','height':'36px','display': 'block' }) } else { $('#zizhuMain').css({'opacity':0 ,'width':'0','height':'0','display': 'none' }) } }) })();