diff --git a/README.md b/README.md
index a7774ea..e4c2a70 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,13 @@ GM的"用户脚本设置"下的"Popup Search设置"打开选项选择需要的
Update Log:
+* 3.2.5 : Translation fixup for large texts
+* 3.2.4 : Multiline fixup
+* 3.2.3 : fix popup position
+* 3.2.2 : Multiline fixup
+* 3.2.1 : fix translation
+* 3.2.0 : transform to Youdao
+* 3.1.7 : Ip fix
* 3.1.6 : Ip Updated
* 3.1.5 : no jquery conflicts
* 3.1.4 : fix Background mode for chrome
diff --git a/meta/popsearch.meta.js b/meta/popsearch.meta.js
index 9a5e953..e9bc8c6 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://libs.baidu.com/jquery/2.1.3/jquery.min.js
-// @version 3.2.4
+// @version 3.2.5
// @icon http://lkytal.qiniudn.com/ic.ico
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
diff --git a/meta/scroll.meta.js b/meta/scroll.meta.js
index 0ba59bf..ed7bb50 100644
--- a/meta/scroll.meta.js
+++ b/meta/scroll.meta.js
@@ -6,7 +6,7 @@
// @include *
// @exclude *pan.baidu.com/*
// @exclude *c5.yunpan.360.cn/*
-// @version 1.4.0
+// @version 1.4.1
// @icon http://lkytal.qiniudn.com/ic.ico
// @grant GM_getValue
// @grant GM_setValue
diff --git a/popsearch.user.js b/popsearch.user.js
index e83eae0..a601831 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://libs.baidu.com/jquery/2.1.3/jquery.min.js
-// @version 3.2.4
+// @version 3.2.5
// @icon http://lkytal.qiniudn.com/ic.ico
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
@@ -28,7 +28,7 @@
// ==/UserScript==
"use strict";
-var GetOpt, InTextBox, Init, Load, OpenSet, SaveOpt, SetOpt, SettingWin, ShowBar, TimeOutHide, addCSS, fixPos, getLastRange, get_offsets_and_remove, get_selection_offsets, log, popData, praseTranslation,
+var GetOpt, InTextBox, Init, Load, OpenSet, SaveOpt, SetOpt, SettingWin, ShowBar, TimeOutHide, addCSS, fixPos, getLastRange, get_offsets_and_remove, get_selection_offsets, log, popData, praseTranslation, praseTranslationMore,
hasProp = {}.hasOwnProperty;
this.$ = this.jQuery = jQuery.noConflict(true);
@@ -169,16 +169,28 @@ Init = function() {
$('#popupwapper').hide();
fixPos(document.defaultView.getSelection());
callback = function(err) {
- return console.log(err);
+ console.log(err);
+ return $('#Gspan').empty().append("Error:\n" + err).show();
};
- GM_xmlhttpRequest({
- method: 'GET',
- timeout: 4000,
- url: "http://fanyi.youdao.com/openapi.do?keyfrom=tinxing&key=1312427901&type=data&doctype=json&version=1.1&q=" + popData.text,
- onload: praseTranslation,
- onerror: callback,
- ontimeout: callback
- });
+ if (popData.text.length < 380) {
+ GM_xmlhttpRequest({
+ method: 'GET',
+ timeout: 3000,
+ url: "http://fanyi.youdao.com/openapi.do?keyfrom=tinxing&key=1312427901&type=data&doctype=json&version=1.1&q=" + popData.text,
+ onload: praseTranslation,
+ onerror: callback,
+ ontimeout: callback
+ });
+ } else {
+ GM_xmlhttpRequest({
+ method: 'GET',
+ timeout: 3000,
+ url: "http://fanyi.baidu.com/transapi?from=auto&to=auto&query=" + popData.text,
+ onload: praseTranslationMore,
+ onerror: callback,
+ ontimeout: callback
+ });
+ }
return event.preventDefault();
});
if (GetOpt('Dis_st')) {
@@ -215,6 +227,23 @@ praseTranslation = function(responseDetails) {
fixPos(document.defaultView.getSelection());
};
+praseTranslationMore = function(responseDetails) {
+ var Result, Rline, Rtxt, i, len, lines, ref;
+ if (!popData.bTrans) {
+ return;
+ }
+ Rtxt = JSON.parse(responseDetails.responseText);
+ Rline = "";
+ ref = Rtxt.data;
+ for (i = 0, len = ref.length; i < len; i++) {
+ lines = ref[i];
+ Rline += lines.dst + "
";
+ }
+ Result = "
\n " + Rline + "\n
\n