From 9ee6001d51a091cf3e7be7016327e7a9f796a71a Mon Sep 17 00:00:00 2001 From: Lkytal Date: Sun, 17 Jul 2016 19:44:24 +0800 Subject: [PATCH] 3.2.8fix --- meta/popsearch.meta.js | 2 +- popsearch.user.js | 58 +++++++++++++++++++----------------------- 2 files changed, 27 insertions(+), 33 deletions(-) diff --git a/meta/popsearch.meta.js b/meta/popsearch.meta.js index 2e4a3dd..5501b29 100644 --- a/meta/popsearch.meta.js +++ b/meta/popsearch.meta.js @@ -9,7 +9,7 @@ // @exclude http://acid3.acidtests.org/* // @exclude http://www.acfun.tv/* // @require http://cdn.bootcss.com/jquery/3.1.0/jquery.min.js -// @version 3.2.7 +// @version 3.2.8 // @icon http://lkytal.qiniudn.com/ic.ico // @grant GM_xmlhttpRequest // @grant GM_addStyle diff --git a/popsearch.user.js b/popsearch.user.js index cc723ba..683df1f 100644 --- a/popsearch.user.js +++ b/popsearch.user.js @@ -9,7 +9,7 @@ // @exclude http://acid3.acidtests.org/* // @exclude http://www.acfun.tv/* // @require http://cdn.bootcss.com/jquery/3.1.0/jquery.min.js -// @version 3.2.7 +// @version 3.2.8 // @icon http://lkytal.qiniudn.com/ic.ico // @grant GM_xmlhttpRequest // @grant GM_addStyle @@ -96,7 +96,7 @@ TimeOutHide = function() { Init = function() { var $DivBox, UIList, id, opt; $('#ShowUpBox').remove(); - $('body').append("\n \n \n \n \n"); + $('body').append(" "); $DivBox = $('#ShowUpBox'); $DivBox.hide(); $DivBox.on("mouseup", function(event) { @@ -118,27 +118,23 @@ Init = function() { $DivBox.on("click mousedown dblclick mouseup", function(event) { return event.stopPropagation(); }); - $DivBox.hover((function(_this) { - return function() { - $(_this).fadeTo(150, 1); - return popData.mouseIn = 1; - }; - })(this), (function(_this) { - return function() { - if (!popData.bTrans) { - $(_this).fadeTo(300, 0.7); - clearTimeout(popData.timer); - popData.timer = setTimeout(TimeOutHide, 5500); - } - return popData.mouseIn = 0; - }; - })(this)); + $DivBox.hover(function() { + $(this).fadeTo(150, 1); + return popData.mouseIn = 1; + }, function() { + if (!popData.bTrans) { + $(this).fadeTo(300, 0.7); + clearTimeout(popData.timer); + popData.timer = setTimeout(TimeOutHide, 5500); + } + return popData.mouseIn = 0; + }); $('#popupwapper').append(" "); $('#sgoogle, #sbing, #sbaidu, #openurl').on("click", (function(_this) { return function(e) { + e.preventDefault(); $('#ShowUpBox').hide(); if ((typeof GM_download !== "undefined" && GM_download !== null) || navigator.userAgent.indexOf("Chrome") > -1) { - e.preventDefault(); return GM_openInTab($(_this).attr('href'), { active: GetOpt("Focus_st") === 1 }); @@ -226,7 +222,7 @@ praseTranslation = function(responseDetails) { Rst = lines + "
"; } } - Result = "
\n
" + Rline + "
\n

\n " + Rst + "\n

\n
"; + Result = "
" + Rline + "

" + Rst + "

"; $('#Gspan').empty().append(Result).show(); fixPos(document.defaultView.getSelection()); }; @@ -243,7 +239,7 @@ praseTranslationMore = function(responseDetails) { lines = ref[i]; Rline += lines.dst + "
"; } - Result = "
\n

\n " + Rline + "\n

\n
"; + Result = "

" + Rline + "

"; $('#Gspan').empty().append(Result).show(); fixPos(document.defaultView.getSelection()); }; @@ -302,7 +298,6 @@ ShowBar = function(event) { } popData.text = encodeURIComponent(seltxt); $('#Gspan').empty().hide(); - fixPos(sel, event); $('#sbaidu').attr('href', "https://www.baidu.com/s?wd=" + popData.text); $('#sbing').attr('href', "https://bing.com/search?q=" + popData.text + "&form=MOZSBR"); $('#sgoogle').attr('href', "https://www.google.com/search?newwindow=1&safe=off&q=" + popData.text); @@ -312,6 +307,7 @@ ShowBar = function(event) { } else { $('#openurl').attr('href', seltxt); } + fixPos(sel, event); $('#ShowUpBox').css('opacity', 0.9).fadeIn(150); popData.mouseIn = 0; popData.bTrans = 0; @@ -331,16 +327,14 @@ SetOpt = function(id) { dom.addClass('close'); } dom.data('val', val); - return dom.click((function(_this) { - return function() { - $(_this).toggleClass('close'); - if ($(_this).data('val') === 1) { - return $(_this).data('val', 0); - } else { - return $(_this).data('val', 1); - } - }; - })(this)); + return dom.click(function() { + $(this).toggleClass('close'); + if ($(this).data('val') === 1) { + return $(this).data('val', 0); + } else { + return $(this).data('val', 1); + } + }); }; SaveOpt = function(id) { @@ -359,7 +353,7 @@ SettingWin = function() { if ($('#popup_setting_bg').length !== 0) { $('#popup_setting_bg').remove(); } - $("body").append("
\n
\n
PopUp Search 设置
\n
\n
\n
\n Google搜索\n Bing搜索\n Baidu搜索\n
\n
\n 站内搜索按钮\n 超时自动隐藏\n 显示于文字上方\n
\n
\n 新标签页打开\n 前台标签页打开\n 在Iframe中显示\n
\n
\n 自动复制选中文字\n 打开选中文本按钮\n 仅按下Ctrl时显示\n
\n
\n
\n
\n
可在GreaseMonkey\"用户脚本命令\"菜单下的\"Popup Search设置\"打开此选项
\n
Close
\n
Save
\n
\n
\n
\n
"); + $("body").append(''); $("#rol1 > span, #rol2 > span, #rol3 > span, #rol4 > span").addClass("setting_sp_btn"); ref = $("#popup_setting_win .setting_sp_btn"); for (i = 0, len = ref.length; i < len; i++) {