(function(n){var t=null;n.getexportcheck=function(){return $("input[name=sel_export]:checked").val()},n.getcharcheck=function(){return $("input[name=cov_char]:checked").val()},n.getcharsetcheck=function(){return $("input[name=char_set]:checked").val()},n._save_selectdir=function(n){var t;t=typeof n=="string"?n:$.trim($(n).val()),t==""&&(t=$e.path("MZdownload/")),$e.config("export_dir",t,!0)},n._click_selectdir=function(){var n=$e.selectdir($("#exportdir").val());n!=""&&(n=n.replace(/\\/ig,"/")+"/",$("#exportdir").val(n),_save_selectdir(n))},n._click_editexportname=function(n){$(n).find("input").show(),$(n).find("span").hide()},n._click_editexporttemp=function(n){var t="export.txt";$(n).attr("_tmp")!=null&&(t=$(n).attr("_tmp")),alert("请打开目录下的"+t+"进行修改.\r\n\r\n若没有自动打开目录，您需要修改的文件路径为：\r\n"+$e.path("data/"+t)),$e.opendirectory($e.path("data/"),t)},n._click_savesel=function(n){var n=$("#"+$(n).attr("target")).get(0);setTimeout(function(){switch(n.id){case"txt_all":case"txt_chapter":case"epub":$e.config("export_save",getexportcheck(),!0);break;case"cov_def":case"cov_big":case"cov_gb":$e.config("export_cov_save",getcharcheck(),!0);break;case"char_ansi":case"char_utf8":case"char_unicode":$e.config("export_char_set",getcharsetcheck(),!0);break;case"close_check":$e.config("export_close",n.checked?"checked":"false",!0);break;case"dir_check":$e.config("export_opendir",n.checked?"checked":"false",!0)}},500)},n.runExport=function(i){__log("page_view","export","dialog"),n._click_dirhelp=function(){alert("目录中可包含的变量：\r\n\r\n#title#\t\t：\t作品名\r\n#author#\t：\t作者名\r\n\r\n例，输入：c:/#author#/\r\n文件将保存至：c:/"+(i.author?i.author:"未知")+"/")},art.dialog({id:"exportbook",lock:!0,title:"导出作品"+(i.title?":"+i.title.sub(20,"..."):""),opacity:.7,content:n.mzTpl("tpl_export")({dir:$e.config("export_dir",$e.path("MZDownload/"))}),okVal:"开始导出",ok:function(){return t!=null?$e.stop(t):(t=$e.run({_name:"exportTask",_file:"export.dst",dir:$("#exportdir").val().replace(/\\/ig,"/")+"/",mode:getexportcheck(),char:getcharcheck(),charset:getcharsetcheck(),exportname:$("#exportname").val(),id:i.id,_runover:function(n,i,r){if(parseInt(i,10)===0){if($("#dir_check").attr("checked")=="checked"){var u=$('<A href="javascript:void 0">导出成功，点击打开目录：'+r.sub(-25,"...")+"<\/a>").on("click",function(){$e.opendirectory(r)});$("#export_tip td").html("").append(u),$e.opendirectory(r)}$("#close_check").attr("checked")=="checked"&&art.dialog.list.exportbook.unlock().close(),__log("page_view","export","succ")}else i==1?__log("page_view","export","fail"):__log("page_view","export","stop");$(".aui_buttons .aui_state_highlight").eq(0).html("开始导出"),t=null},_runecho:function(n,t){$("#export_tip td").html(t)}}),$(".aui_buttons .aui_state_highlight").eq(0).html("停止导出")),!1},cancelVal:"取消导出",cancel:function(){return t!=null&&$e.stop(t),!0}}),$e.isfile($e.path("data/export.txt"))&&$e.isfile($e.path("data/export_epub.txt"))||$e.run({_name:"init_export",_file:"common.dst",action:"export"}),$("#"+$e.config("export_save","txt_all")).attr("checked",!0),$("#"+$e.config("export_cov_save","cov_def")).attr("checked",!0),$("#"+$e.config("export_char_set","char_ansi")).attr("checked",!0),$("#close_check").attr("checked",$e.config("export_close","checked")=="checked"),$("#dir_check").attr("checked",$e.config("export_opendir","")=="checked"),$("#exportname").val(i.title)}})(window)