var total_number_of_content=0,request_iter=0,sourceMap={},targetMap={},dict={},list_length=10,Source_language="",Target_language="",percentage=0,list_iter=0,list_total=0,translation_list=[],translation_node=[],yuzhongstr="",myFunction={parseDOM:function(t,n){for(n(t),t=t.firstChild;t;)this.parseDOM(t,n),t=t.nextSibling},getTranslateNumber:function(){return total_number_of_content=0,this.parseDOM(document.body,function(t){if(3===t.nodeType){var n=t.data.trim(),e=t.parentNode;"SCRIPT"!=e.nodeName&&"NOSCRIPT"!=e.nodeName&&"STYLE"!=e.nodeName&&"TEXTAREA"!=e.nodeName&&"PRE"!=e.nodeName&&"CODE"!=e.nodeName&&-1==e.id.indexOf("mzfy")&&n.length>0&&n.length<5120&&(total_number_of_content+=1)}}),total_number_of_content},translate:function(t,n,e){var a=e.join("\n");return $.ajax({type:"post",contentType:"application/json;charset=UTF-8",url:"http://218.241.146.90:8888/translate/api/trans2",data:JSON.stringify({appKey:"K0WUJE0HOJU7L7NWBWV5VFM54BGDC0FJ",appSecret:"OYUQE6J441BSRY7UVPE334COEWCVSYPA",from:t,to:n,content:a}),dataType:"json",xhrFields:{withCredentials:!0}})},translatebatch:function(t,n,e,a){myFunction.translate(t,n,e).success(function(t){try{var n=t.responseData.split("<br/>"),o=0;for(o=0;o<n.length;o++){var r=n[o];r=r.split("&nbsp;").join("");var i=e[o];n[o]=null==n[o]?"":n[o],i&&i.length>0&&0==n[o].replace(/\s+/g,"").length&&(r=i),sourceMap[i]=r,targetMap[r.trim()]=i,a[o].data=r,request_iter+=1}}catch(t){request_iter+=list_length}}).error(function(t){request_iter+=list_length})},fybtn1Click:function(){myFunction.parseDOM(document.body,function(t){if(3===t.nodeType){var n=t.data.trim(),e=t.parentNode;"SCRIPT"!==e.nodeName&&"NOSCRIPT"!==e.nodeName&&"STYLE"!==e.nodeName&&"TEXTAREA"!==e.nodeName&&"PRE"!==e.nodeName&&"CODE"!==e.nodeName&&-1==e.id.indexOf("mzfy")&&n.length>0&&(term_translation=targetMap[n],term_translation&&(t.data=term_translation))}})},fybtnClick:function(){percentage=0,list_iter=0,list_total=0,translation_list=[],translation_node=[],request_iter=0,myFunction.parseDOM(document.body,function(t){if(3===t.nodeType){var n=t.data.trim();n=n.split("\n").join(" ");var e=t.parentNode;if(console.info(e.nodeName+"@"+e.id),"SCRIPT"!==e.nodeName&&"NOSCRIPT"!==e.nodeName&&"STYLE"!==e.nodeName&&"TEXTAREA"!==e.nodeName&&"PRE"!==e.nodeName&&"CODE"!==e.nodeName&&-1==e.id.indexOf("mzfy")&&n.length>0&&n.length<5120)try{var a=dict[n];a?(t.data=a,sourceMap[a]=n,targetMap[n]=a,request_iter+=1):(translation_list[list_iter]=n,translation_node[list_iter]=t,list_total+=1,(list_iter+=1)!=list_length&&list_total!=total_number_of_content||(myFunction.translatebatch(Source_language,Target_language,translation_list,translation_node),list_iter=0,translation_list=[],translation_node=[]))}catch(t){request_iter+=1}}})}};chrome.runtime.onMessage.addListener(function(t,n,e){var a={_style_bar:{position:"fixed",top:0,zIndex:9999999999,border:"0px",left:0,width:"100%",height:"50px"},_style_bar_close:{marginTop:0,position:""},_showbar:function(){if($("#fanyitool").length>0)return fanyitool=document.getElementById($("#fanyitool").attr("id")),$(document.body).css(this._style_bar_close),fanyitool.parentNode.removeChild(fanyitool),!1;$(document.body).append($("<iframe>",{id:"fanyitool",style:"",text:"!",scrolling:"no",src:chrome.extension.getURL("bar.html")})),$("#fanyitool").css(this._style_bar),chrome.storage.sync.get("yuzhong",function(t){void 0===(yuzhongstr=t.yuzhong)&&(yuzhongstr="zh-zw"),console.info("@result@"+yuzhongstr)}),$("#fanyitool").load(function(){document.getElementById("fanyitool").contentWindow.postMessage({action:"CHANGE_YUZHONG",mzfyopt:yuzhongstr},"*")})},SETTING:function(){return chrome.runtime.openOptionsPage(),!1},TRANSLATE:function(){Source_language=t.srclan,Target_language=t.tgtlan,chrome.storage.sync.set({yuzhong:Source_language+"-"+Target_language},function(){console.info(Source_language+"@@"+Target_language)}),total_number_of_content=myFunction.getTranslateNumber(t),myFunction.fybtnClick(t)},TRANSLATE1:function(){Source_language=t.srclan,Target_language=t.tgtlan,total_number_of_content=myFunction.getTranslateNumber(t),myFunction.fybtn1Click(t)}};t.action&&a[t.action]()});
function load_button(){var _0x280ca2={'sRfMi':'4|3|0|1|2','WmvmH':function(_0x28a112,_0x16872a){return _0x28a112==_0x16872a;},'lOQgr':'attachEvent','vVHfj':'onmessage','jAktu':'message','khzvl':function(_0x17d09e,_0xfd2523,_0x3444ba,_0x17ab5a){return _0x17d09e(_0xfd2523,_0x3444ba,_0x17ab5a);},'GFfzy':'addEventListener','CvXye':function(_0x58a039,_0x477d7e){return _0x58a039+_0x477d7e;},'JlFUT':'CHANGE_YUZHONG','ytwFX':function(_0x3a9114,_0x4d6d0b){return _0x3a9114(_0x4d6d0b);},'bwVnV':'#mzfy4','BqfLx':'#mzfybtn1'};var _0x5017fe=_0x280ca2['sRfMi']['split']('|'),_0x397fff=0x0;while(!![]){switch(_0x5017fe[_0x397fff++]){case'0':var _0x4002ab=window[_0x3f074a];continue;case'1':var _0x14a99b=_0x280ca2['WmvmH'](_0x280ca2['lOQgr'],_0x3f074a)?_0x280ca2['vVHfj']:_0x280ca2['jAktu'];continue;case'2':_0x280ca2['khzvl'](_0x4002ab,_0x14a99b,function(_0x19ab47){var _0x373dc6={'RfwjY':function(_0x626c29,_0x41dced){return _0x38fa89['drgCK'](_0x626c29,_0x41dced);},'mfFCJ':_0x38fa89['FTycw'],'bHMvT':function(_0x227bb0,_0x1af4c3){return _0x38fa89['CEjIO'](_0x227bb0,_0x1af4c3);},'zHFQl':_0x38fa89['QdYbX'],'WQTzs':function(_0xe989dc,_0x2ce3e9){return _0x38fa89['CEjIO'](_0xe989dc,_0x2ce3e9);},'Kezzw':_0x38fa89['wGJGs']};var _0x12cc2a=_0x19ab47['data'];var _0x68f31f={'CHANGE_YUZHONG':function(){console['info'](_0x373dc6['RfwjY'](_0x12cc2a['mzfyopt'],_0x373dc6['mfFCJ']));_0x373dc6['bHMvT']($,_0x373dc6['zHFQl'])['val'](_0x12cc2a['mzfyopt']);_0x373dc6['WQTzs']($,_0x373dc6['Kezzw'])['hide']();}};if(!!_0x19ab47['data']['action'])_0x68f31f[_0x19ab47['data']['action']]();},![]);continue;case'3':var _0x3f074a=window['addEventListener']?_0x280ca2['GFfzy']:_0x280ca2['lOQgr'];continue;case'4':var _0x38fa89={'drgCK':function(_0x6a7958,_0x34be27){return _0x280ca2['CvXye'](_0x6a7958,_0x34be27);},'FTycw':_0x280ca2['JlFUT'],'CEjIO':function(_0x20dd3f,_0x1daa36){return _0x280ca2['ytwFX'](_0x20dd3f,_0x1daa36);},'QdYbX':_0x280ca2['bwVnV'],'wGJGs':_0x280ca2['BqfLx']};continue;}break;}}load_button();