(function(n){function i(){for(var i=$e.speech("getvoices").split(/\|\|/ig),r=[],t,n=0,u=i.length;n<u;n++)t=i[n].split(/\$/ig),t.length>1&&r.push({title:t[0],id:t[1]});return r}function t(n,t,i,r){$e.speech("voice",t),$e.speech("volume",i),$e.speech("rate",r);var u=parseInt($e.speech("status"),10);u==1&&$e.speech("isself")||($e.speech("speak",n.element,function(t){t=="end"?n&&n.onEnd&&n.onEnd():n&&n.onStop&&n.onStop()}),__log("page_view","speech","dialog","start"))}n._click_savevoice=function(){setTimeout(function(){$e.config("speech_auto",$("input[name=speech_auto]:checked").length>0?"1":"0",!0)},100)},n.runSpeech=function(r){if(r&&!r.noDialog){__log("page_view","speech","dialog"),art.dialog({id:"speechdialog",lock:!0,title:"语音设置",opacity:.7,content:n.mzTpl("tpl_speech")({voices:i(),currvoice:config("speech_voice",""),volume:config("speech_vol","80"),rate:config("speech_rate","45"),speech_auto:config("speech_auto","0")}),okVal:"开始阅读",ok:function(){return t(r,$e.config("speech_voice",$("#voicelist").val(),!0),parseInt($e.config("speech_vol",$("#voicevolume").val(),!0),10),parseInt($e.config("speech_rate",$("#voicerate").val(),!0),10)),!0},cancelVal:"取消",cancel:function(){return __log("page_view","speech","cancel",""),$e.speech("stop"),!0}}),$("#voicevolume_slider").slider({onChange:function(n){var t="";n>=0&&n<=25?t="蚊子声":n>25&&n<=50?t="苍蝇声":n>50&&n<=75?t="猛虎声":n>75&&(t="拆迁队"),$("#voicevolume_bar").text(t+":"+n+"%"),$("#voicevolume").val(n),$e.speech("volume",parseInt(n,10))}}),$("#voicerate_slider").slider({onChange:function(n){var t="";n>=0&&n<=25?t="慢速":n>25&&n<=45?t="近正常":n>45&&n<=65?t="正常":n>65&&n<=85?t="快板":n>85&&(t="神速"),$("#voicerate_bar").text(t+":"+n+"%"),$("#voicerate").val(n),$e.speech("rate",parseInt(n,10))}});$("#voicelist").on("change",function(){var n=$(this).val();n&&$e.speech("voice",n)})}else r&&r.noDialog&&t(r,config("speech_voice",""),parseInt(config("speech_vol","80"),10),parseInt(config("speech_rate","80"),10))}})(window,config)