-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGetTranslation.js
66 lines (59 loc) · 2.52 KB
/
GetTranslation.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function GetTranslation(key){
uTrType = "";
isPrep = 0;
$("#blurResult").show();
$("#autoInfo").html('');
$("#socialServices").hide();
$("#AdvInResult").hide();
$("#AdvInResult").removeAttr('style');
$("#linkAT").show(); $("#linkATPic").show();
$("#ttSourceText").hide();
$("#btt").hide();
visitLink=false;
$("#addTranslationText").unbind('keypress');
closewAddTranslation();
closeTranslationLinks();
$("#divFullWordResult").hide();
if (rtrim($("#SiteContent_sourceText").val())=="") {
$("#SiteContent_sourceText").val('');
$("#SiteContent_sourceText").focus();
return false;}
var arr = GetDir();
var dir=arr[0]+'-'+arr[1];
//var dir=GetDir();
var text=rtrim($("#SiteContent_sourceText").val());
text = encodeURIComponent(text).split("'").join("\\'");
var templ=$("#template").val();
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/services/TranslationService.asmx/GetTranslateNew",
data: "{ dirCode:'"+dir+"', template:'"+templ+"', text:'"+text+"', lang:'ru', limit:"+maxlen+",useAutoDetect:true, key:'"+key+"', ts:'"+TS+"',tid:'',IsMobile:false}",
dataType: "json",
success: function(result){
var res=GetAjaxResult(result);
SetValsAfterTr(res);
trFdLnk = res.fdLink;
curPtsDirCode = res.ptsDirCode;
var curPtsDirCodeArr=curPtsDirCode.split('-')
if (res.isWord && rtrim($('#SiteContent_sourceText').val())!='') {GetTopPhrases();}
// $("#SiteContent_sourceText").css('min-height','');
// $("#editResult_test").css('min-height','');
//if (((GetDir()[0]== res.ptsDirCode[1])||(GetDir()[0]== 'a'))&&(GetDir()[1]== res.ptsDirCode[0])){
if (((arr[0]== curPtsDirCodeArr[1])||(arr[0]== 'au'))&&(arr[1]== curPtsDirCodeArr[0])){
//alert('автоматическая смена направления перевода');
gaCustomVarsSet(res.ptsDirCode.split('-'));
_gaq.push(['_trackEvent', 'Linguistic', 'Language', 'Auto']);}
if (curVMode == 'vert'){$("#SiteContent_sourceText").attr('class','expand101-2400');
jQuery("textarea[class*=expand]").TextAreaExpander();}
// RefreshAdv();
RefreshAdv_inRes();
// RefreshAdvTop();
reload_ban();
customEvents.fire("onTranslate", '');
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
GetErrMsg("К сожалению, сервис временно недоступен. Попробуйте повторить запрос позже."); trDirCode = "";
}
});
}//GetTr