App.loader.libs.editormdPreview=["#editor/markdown/lib/marked.min.js","#editor/markdown/lib/prettify.min.js","#editor/markdown/lib/raphael.min.js","#editor/markdown/lib/underscore.min.js","#editor/markdown/css/editormd.preview.min.css","#editor/markdown/editormd.min.js"];App.loader.libs.codemirror=["#editor/markdown/lib/codemirror/codemirror.min.css","#editor/markdown/lib/codemirror/addon/fold/foldgutter.css","#editor/markdown/lib/codemirror/addon/hint/show-hint.css","#editor/markdown/lib/codemirror/theme/ambiance.css","#editor/markdown/lib/codemirror/codemirror.min.js","#editor/markdown/lib/codemirror/modes.min.js","#editor/markdown/lib/codemirror/addons.min.js","#editor/markdown/lib/codemirror/addon/hint/show-hint.js"];App.loader.libs.editormd=["#editor/markdown/css/editormd.min.css","#editor/markdown/css/editormd.preview.min.css","#editor/markdown/editormd.min.js"];App.loader.libs.flowChart=["#editor/markdown/lib/flowchart.min.js"];App.loader.libs.flowChartJQuery=["#editor/markdown/lib/jquery.flowchart.min.js"];App.loader.libs.sequenceDiagram=["#editor/markdown/lib/sequence-diagram.min.js"];App.loader.libs.tinymce=["#editor/tinymce/custom.css","#editor/tinymce/tinymce.min.js","#editor/tinymce/jquery.tinymce.min.js","#editor/tinymce/langs/"+App.langTag("_")+".js"];App.loader.libs.dialog=["#dialog/bootstrap-dialog.min.css","#dialog/bootstrap-dialog.min.js"];App.loader.libs.markdownit=["#markdown/it/markdown-it.min.js","#markdown/it/plugins/emoji/markdown-it-emoji.min.js"];App.loader.libs.codehighlight=["#markdown/it/plugins/highlight/loader/prettify.js","#markdown/it/plugins/highlight/loader/run_prettify.js?skin=sons-of-obsidian"];App.loader.libs.powerFloat=["#float/powerFloat.min.css","#float/powerFloat.min.js"];App.loader.libs.uploadPreviewer=["#jquery.uploadPreviewer/css/jquery.uploadPreviewer.min.css","#jquery.uploadPreviewer/jquery.uploadPreviewer.min.js"];App.loader.libs.fileUpload=["#jquery.upload/js/vendor/jquery.ui.widget.min.js","#jquery.upload/js/jquery.iframe-transport.min.js","#jquery.upload/js/jquery.fileupload.min.js","#jquery.upload/js/jquery.fileupload-process.min.js"];App.loader.libs.jcrop=["#jquery.crop/css/jquery.Jcrop.min.css","#jquery.crop/js/jquery.Jcrop.min.js"];App.loader.libs.cropImage=["#jquery.crop/css/jquery.Jcrop.min.css","#jquery.crop/js/jquery.Jcrop.min.js","#behavior/page/crop-image.min.js"];App.loader.libs.select2=["#jquery.select2/select2.css","#jquery.select2/select2.min.js"];App.loader.libs.select2ex=["#behaviour/page/select2.min.js"];App.loader.libs.selectPage=["#selectpage/selectpage.css","#selectpage/selectpage.min.js"];App.loader.libs.cascadeSelect=["#behaviour/page/cascade-select.min.js"];App.loader.libs.forms=["#behaviour/page/forms.min.js"];App.loader.libs.jqueryui=["#jquery.ui/jquery-ui.custom.min.js","#jquery.ui/jquery-ui.touch-punch.min.js"];App.loader.libs.dropzone=["#jquery.ui/css/dropzone.min.css","#dropzone/dropzone.min.js"];App.loader.libs.loadingOverlay=["#loadingoverlay/loadingoverlay.min.js"];App.loader.libs.dateRangePicker=["#daterangepicker/daterangepicker.min.css","#daterangepicker/moment.min.js","#daterangepicker/jquery.daterangepicker.min.js","#behaviour/page/datetime.min.js"];App.loader.libs.magnificPopup=["#magnific-popup/magnific-popup.min.css","#magnific-popup/jquery.magnific-popup.min.js"];App.loader.libs.inputmask=["#inputmask/inputmask.min.js","#inputmask/jquery.inputmask.min.js"];App.loader.libs.clipboard=["#clipboard/clipboard.min.js","#clipboard/utils.js"];App.editor={browsingFileURL:App.loader.siteURL+(typeof window.IS_BACKEND!=="undefined"&&window.IS_BACKEND?BACKEND_URL:FRONTEND_URL+"/user/file")+"/finder"};App.editor.loadingOverlay=function(e){App.loader.defined(typeof $.fn.LoadingOverlay,"loadingOverlay");return $.LoadingOverlay(e||{})};App.editor.dialog=function(e){App.loader.defined(typeof BootstrapDialog,"dialog");return BootstrapDialog.show(e||{})};App.editor.contypeAttachers={};App.editor.contypeAttachers.markdown=function(e){App.editor.markdownToHTML(e)};App.editor.contypeAttachers.html=function(e){var t=$(e).find("pre[class^=language-]");if(t.length>0)App.editor.codeHighlight(t)};App.editor.attachContype=function(e,t){var i=e?$(e):$(document);i.find("[data-contype]:not([contype-attached])").each(function(){$(this).attr("contype-attached","1");var e=$(this).data("contype");if(typeof App.editor.contypeAttachers[e]!="undefined"){App.editor.contypeAttachers[e](this);t&&t.apply(this,arguments)}})};App.editor.markdownReset=function(){var e=ASSETS_URL+"/js/editor/markdown/";editormd.emoji.path=e+"images/emojis/";editormd.katexURL.css=e+"lib/katex/katex.min";editormd.katexURL.js=e+"lib/katex/katex.min"};App.editor.markdownToHTML=function(i,o,e){if(typeof i=="string"){i=document.querySelector(i);if(!i)return}if($(i).data("markdownRendered"))return;$(i).data("markdownRendered",true);var t=function(e,t){var i={markdown:o,htmlDecode:"style,script,iframe|on*",toc:true,tocm:true,emoji:true,taskList:true,tex:true,flowChart:true,sequenceDiagram:true};if(typeof window.THEME_COLOR=="string"&&window.THEME_COLOR=="dark"){i.theme="dark"}var r=$.extend({},i,e||{});var a=function(){return t(r)};App.loader.defined(typeof marked,"editormdPreview",function(){if(r.flowChart){return App.loader.defined(typeof flowchart,"flowChart",function(){return App.loader.defined(typeof $.fn.flowChart,"flowChartJQuery",function(){if(r.sequenceDiagram)return App.loader.defined(typeof $.fn.sequenceDiagram,"sequenceDiagram",function(){a()});a()})})}if(needSequenceDiagram){return App.loader.defined(typeof $.fn.sequenceDiagram,"sequenceDiagram",function(){a()})}a()},function(){App.editor.markdownReset()});return r};var r="markdown-render-processing-"+App.utils.unixtime();var a='<div id="'+r+'"><i class="fa fa-spinner fa-spin fa-3x"></i></div>';if(o==null||typeof o=="boolean"){var n=$(i),d=$(i).hasClass("markdown-code");if(!o&&!d){n=$(i).find(".markdown-code");if(n.length<1)return}if(d){n.prepend(a)}else{n.first().before(a)}t(e,function(t){n.each(function(){if($(this).children("textarea").length>0){t.markdown=$(this).children("textarea").text()}else{t.markdown=$(this).text()}var e=editormd.markdownToHTML(this,t);$(this).data("markdown-viewer",e)});$("#"+r).remove()});return}$(i).before(a);t(e,function(e){var t=editormd.markdownToHTML(i,e);$(i).data("markdown-viewer",t);$("#"+r).remove()})};App.editor.markdowns=function(e,t,i){$(e).each(function(){App.editor.markdown(this,t,i)})};App.editor.markdown=function(e,t,i){var r=false;if(!t)t=$(e).attr("action");App.loader.defined(typeof editormd,"editormd",null,function(){App.editor.markdownReset()});if(t){if(t.substr(0,1)=="!"){t=t.substr(1);r=true}if(t.indexOf("?")>=0){t+="&"}else{t+="?"}if(!r)t+="format=json&";t+="filetype=image&client=markdown"}var a=function(t){App.editor.finderDialog(App.editor.browsingFileURL+"?from=parent&size=12&filetype=image&multiple=0",function(e){if(e.length<=0){return App.message({type:"error",text:App.t("没有选择任何选项！")})}t.dialog.find("[data-url]").val(e[0])},1e5)};var o=$(e).parent(),n=o.attr("id");if(n===undefined){n="webx-md-"+App.utils.unixtime();o.attr("id",n)}var d=ASSETS_URL+"/js/editor/markdown/";var p={width:"100%",height:o.height(),path:d+"lib/",markdown:$(e).val(),placeholder:$(e).attr("placeholder")||"",codeFold:true,saveHTMLToTextarea:true,searchReplace:true,watch:true,htmlDecode:"style,script,iframe|on*",emoji:true,taskList:true,tocm:true,tex:true,flowChart:true,sequenceDiagram:true,imageUpload:true,imageFormats:["jpg","jpeg","gif","png","bmp"],imageUploadURL:t,imageBrowseFn:a,crossDomainUpload:true,uploadCallbackURL:d+"plugins/image-dialog/upload_callback.htm",dialogLockScreen:false,onload:function(){var e=this;editormd.loadPlugin(d+"plugins/drop-or-paste-upload/drop-or-paste-upload.min",function(){e.dropOrPasteUpload()})}};if(typeof window.THEME_COLOR=="string"&&window.THEME_COLOR=="dark"){p.theme="dark"}var l=$.extend({},p,i||{});if(r){l.toolbarIcons=function(){return["undo","redo","|","bold","del","italic","quote","ucwords","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","link","reference-link","browsing-image","code","preformatted-text","code-block","table","datetime","emoji","html-entities","pagebreak","|","goto-line","watch","preview","fullscreen","clear","search","|","help","info"]};l.toolbarIconsClass={"browsing-image":"fa-image"};l.toolbarIconTexts={"browsing-image":App.t("选择图片")};l.toolbarHandlers={"browsing-image":function(n,e,t,i){App.editor.finderDialog(App.editor.browsingFileURL+"?from=parent&size=12&filetype=image&multiple=1",function(e,t){if(e.length<=0){return App.message({type:"error",text:App.t("没有选择任何选项！")})}var i=[];for(var r=0;r<e.length;r++){var a=e[r];var o=t[r].name;i.push("!["+o+"]("+a+")")}i=i.join("\n")+"\n";n.replaceSelection(i)})}};l.lang={toolbar:{"browsing-image":App.t("从服务器选择图片")}}}if(!t)l.imageUpload=false;var s=editormd(n,l);$(e).data("editor-name","markdown");$(e).data("editor-object",s);return s};App.editor.md=App.editor.markdown;App.editor.codeHighlight=function(e){if(e==null)e="pre[class^=language-]";var t;if(typeof e=="object"){t=$.isPlainObject(e)?$(e):e}else{t=$(e)}if(t.length<1)return;App.loader.defined(typeof window.prettyPrint,"codehighlight",function(){t.not(".prettyprint").addClass("prettyprint linenums");if(typeof prettyPrint!=="undefined")prettyPrint()})};App.editor.markdownItToHTML=function e(t,i){App.loader.defined(typeof window.markdownit,"markdownit");App.loader.defined(typeof window.prettyPrint,"codehighlight");if(typeof t!="object"){t=$(t)}if(i!=false)t=t.find(".markdown-code");var r=App.editor.markdownItInstance();t.each(function(){var e;if($(this).children("textarea").length>0){e=$(this).children("textarea").text()}else{e=$(this).text()}$(this).html(r.render($.trim(e)));$(this).find("pre > code").each(function(){$(this).parent("pre").addClass("prettyprint linenums")});if(typeof prettyPrint!=="undefined")prettyPrint()})};App.editor.markdownItInstance=function(){App.loader.defined(typeof window.markdownit,"markdownit");var e=window.markdownit();if(typeof window.markdownitEmoji!="undefined")e.use(window.markdownitEmoji);return e};App.editor.tinymces=function(e,t,i,r){$(e).each(function(){App.editor.tinymce(this,t,i,r)})};App.editor.finderDialog=function(t,r,i){if(!i)i=2e3;App.loader.defined(typeof BootstrapDialog,"dialog");var e=BootstrapDialog.show({title:App.t("选择文件"),message:function(i){var e="finderDialogCallback"+App.utils.unixtime();window[e]=function(e,t){r(e,t);if(e&&e.length>0)i.close()};return $('<iframe src="'+t+"&callback="+e+'" style="width:100%;height:635px;border:0;padding:0;margin:0"></iframe>')},onshown:function(e){e.$modal.css("zIndex",i);e.$modalBody.css("padding",0)}});return e};App.editor.tinymceOnceFix=false;App.editor.tinymce=function(e,o,t,i){if(!App.editor.tinymceOnceFix){App.editor.tinymceOnceFix=true;$(document).on("focusin",function(e){if($(e.target).closest(".tox-tinymce-aux, .moxman-window, .tam-assetmanager-root").length){e.stopImmediatePropagation()}})}App.loader.defined(typeof $.fn.tinymce,"tinymce");if(!o)o=$(e).attr("action");var r=App.editor.browsingFileURL;if(o&&o.substr(0,1)=="!"){r=o.substr(1);o=$(e).data("upload-url")}if(o){if(o.indexOf("?")>=0){o+="&"}else{o+="?"}o+="format=json&client=tinymce&filetype="}if(r){r=r.replace(/[\?&]multiple=1/,"");if(r.indexOf("?")>=0){r+="&"}else{r+="?"}r+="from=parent&client=tinymce&filetype="}var a="undo redo | formatselect | bold italic backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | customDateButton";var n="undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview save print | insertfile image media template link anchor codesample | ltr rtl | customDateButton";var d=function(i,e,t){switch(t.filetype){case"file":App.editor.finderDialog(r+t.filetype,function(e,t){if(e&&e.length>0)i(e[0],{text:t[0].name})});break;case"image":App.editor.finderDialog(r+t.filetype,function(e,t){if(e&&e.length>0)i(e[0],{alt:t[0].name})});break;case"media":App.editor.finderDialog(r+t.filetype,function(e,t){if(e&&e.length>0)i(e[0],{})});break;default:alert("Unsupported file type")}};var p=function(e,t,i){var r=new XMLHttpRequest,a=new FormData;r.withCredentials=false;r.open("POST",o);r.onload=function(){if(r.status!=200){i("HTTP Error: "+r.status);return}var e=JSON.parse(r.responseText);if(!e||typeof e.Code=="undefined"){i("Invalid JSON: "+r.responseText);return}if(e.Code!=1){i(e.Info);return}t(e.Data.Url)};a.append("filedata",e.blob(),e.filename());r.send(a)};var l="link table";var s="bold italic | quicklink h2 h3 blockquote quicktable";var c="print preview paste importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern noneditable charmap quickbars emoticons";if(o){l+=" image imagetools";s+=" quickimage"}var f={height:i?200:500,menubar:true,language:App.langTag("_"),plugins:[c],toolbar:i?a:n,toolbar_sticky:true,autosave_ask_before_unload:false,autosave_interval:"30s",autosave_prefix:"{path}{query}-{id}-",autosave_restore_when_empty:true,autosave_retention:"2m",image_advtab:true,templates:[{title:"New Table",description:"creates a new table",content:'<div class="mceTmpl">\t\t\t<table width="98%" border="0" cellspacing="0" cellpadding="0" class="table table-bordered table-striped">\t\t\t<thead>\t\t\t\t<tr>\t\t\t\t\t<th scope="col"> </th>\t\t\t\t\t<th scope="col"> </th>\t\t\t\t</tr>\t\t\t</thead>\t\t\t<tbody>\t\t\t\t<tr>\t\t\t\t\t<td> </td>\t\t\t\t\t<td> </td>\t\t\t\t</tr>\t\t\t</tbody>\t\t\t</table>\t\t\t</div>'}],image_caption:true,relative_urls:false,image_title:true,quickbars_selection_toolbar:s,noneditable_noneditable_class:"mceNonEditable",toolbar_drawer:"sliding",contextmenu:l,setup:function(r){var t=function(e){return'<time datetime="'+e.toString()+'">'+e.toLocaleString()+"</time>"};r.ui.registry.addButton("customDateButton",{icon:"insert-time",tooltip:"Insert Current Date",disabled:true,onAction:function(e){r.insertContent(t(new Date))},onSetup:function(t){var i=function(e){t.setDisabled(e.element.nodeName.toLowerCase()==="time")};r.on("NodeChange",i);return function(e){r.off("NodeChange",i)}}})}};if(typeof window.THEME_COLOR=="string"&&window.THEME_COLOR=="dark"){f.skin="oxide-dark";f.content_css="dark"}if(r)f.file_picker_callback=d;if(o){f.paste_data_images=true;f.urlconverter_callback=function(e,t,i,r){return e};f.images_upload_handler=p}var u=App.utils.elemToId(e).replace(/^#/,"");$(e).tinymce($.extend({},f,t||{}));$(e).data("editor-name","tinymce");var m=tinymce.get(u);$(e).data("editor-object",m)};App.editor.switcher=function(e,r,a){if($(e).length<1)return;var t,i=String($(e).get(0).tagName).toLowerCase();switch(i){case"select":t="change";break;default:t="click"}$(e).on(t,function(){var e=$(this).val()||$(this).attr("value");var t=$(r);var i=t.data("editor-name")||a;t.data("editor-type",e);return App.editor.switch(i,t)});$(r).data("placeholder",$(r).attr("placeholder"));switch(i){case"input":$(e).filter(":checked").first().trigger(t);break;case"select":$(e).filter(":selected").first().trigger(t);break;default:$(e).filter(".active").first().trigger(t)}};App.editor.switch=function(e,r,t,i){var a=r.attr("action")||r.data("upload-url")||"!"+App.editor.browsingFileURL+"?size=12&multiple=1",o=r.data("editor-type"),n=r.data("editor-name"),d=r.data("editor-object"),p=r.data("current-editor-type");if(p==o)return;var l=r.data("class"),s=r.data("style");if(l===undefined){l=r.attr("class");if(!l)l="";r.data("class",l)}if(s===undefined){s=r.attr("style");if(!s)s="";r.data("style",s)}var c=r.data("content-elem"),f=c;if(c)f=App.loader.parseTmpl(c,{type:o});var u=r.get(0);var m=function(){r.attr("class",l).attr("style",s)};var g=function(){switch(n){case"ueditor":d&&d.destroy();break;case"tinymce":default:d&&typeof d.remove=="function"&&d.remove()}};var h=function(e){var t=r.data(e+"-options")||{};switch(e){case"ueditor":App.editor.ueditor(u,a,t);break;case"tinymce":default:App.editor.tinymce(u,a,t);var i=window.setInterval(function(){if(r.next(".tox-tinymce").length>0){r.next(".tox-tinymce").show();window.clearInterval(i)}},100);break}};var w=function(){var e=r.data("markdown-options")||{};App.editor.markdown(u,a,e)};var y=function(){if(f&&$(f).length>0){var e=App.loader.parseTmpl(c,{type:p});if(e&&$(e).length>0){$(e).text(r.val());var t=$('textarea[name="'+r.parent().attr("id")+'-html-code"]');if(t.length>0&&t.val()!=""){$(f).text(t.val());$(f).val(t.val())}}r.val($(f).val());r.text($(f).val())}r.parent().removeAttr("class").css("height","auto");r.siblings().remove();m()};switch(o){case"markdown":if(i){var v=App.loader.parseTmpl(c,{type:p});if(v&&$(v).length>0){if(r.val()!=$(v).val()&&!confirm("确定要切换吗？切换编辑器将会丢失您当前所做的修改。")){if(t!=null)t();return false}}}if(f&&$(f).length>0){r.text($(f).val());r.val($(f).val())}g();w();r.data("current-editor-type",o);break;case"text":g();y();r.show();if(r.prop("autofocus"))r.focus();r.data("current-editor-type",o);break;default:y();h(e);r.data("current-editor-type","html")}return true};if(typeof App.utils=="undefined")App.utils={};App.utils.elemToId=function(e){if(typeof e!="object"){if(String(e).substring(0,1)!="#"){e="#"+e}return e}var t=$(e).attr("id");if(t)return"#"+t;t="generated-id-"+App.utils.unixtime();$(e).attr("id",t);return"#"+t};App.utils.unixtime=function(){return(new Date).getTime()};App.editor.selectPages=function(){App.loader.defined(typeof $.fn.selectPage,"selectPage");for(var e=0;e<arguments.length;e+=2){App.editor.selectPage(arguments[e],arguments[e+1],true)}};App.editor.selectPage=function(e,t,i){if($(e).length<1)return;var r="listData",a="pagination";if(t!=null){if(typeof t.listKey!="undefined")r=t.listKey;if(typeof t.pagingKey!="undefined")a=t.pagingKey}else{t=$(e).data()||{}}if(typeof t.url!="undefined")t.data=t.url;var o={showField:"name",keyField:"id",data:[],params:function(){return{}},eAjaxSuccess:function(e){if(!e)return undefined;var t=typeof e.Data[r]!="undefined"?e.Data[r]:e.Data.list;if(t==null)t=[];var i;if(typeof e.Data[a]=="undefined"||e.Data[a]==null){i={limit:0,page:1,rows:0,pages:0}}else{i=e.Data[a]}return{list:t,pageSize:i.limit,pageNumber:i.page,totalRow:i.rows,totalPage:i.pages}},eSelect:function(e){},eClear:function(){}};if(!i)App.loader.defined(typeof $.fn.selectPage,"selectPage");$(e).selectPage($.extend({},o,t||{}))};App.editor.select2=function(){App.loader.defined(typeof $.fn.select2,"select2");App.loader.defined(typeof App.select2,"select2ex");return App.select2};App.editor.cascadeSelect=function(e,t,i){App.loader.defined(typeof CascadeSelect,"cascadeSelect",function(){CascadeSelect.init(e,t,i)})};App.editor.initForms=function(e,t){App.loader.defined(typeof initForms,"forms",function(){initForms(e,t)})};App.editor.fileUpload=function(e,t){App.loader.defined(typeof $.fn.fileupload,"fileUpload");if(typeof t.dataType=="undefined")t.dataType="json";$(e).fileupload(t).prop("disabled",!$.support.fileInput).parent().addClass($.support.fileInput?undefined:"disabled")};App.editor.cropImage=function(e,t,i,r,a,o){App.loader.defined(typeof $.fn.fileupload,"fileUpload");App.loader.defined(typeof $.fn.Jcrop,"jcrop");App.loader.defined(typeof cropImage,"cropImage");return cropImage(e,t,i,r,a,o)};App.editor.float=function(e,t,i,r,a){App.loader.defined(typeof $.fn.powerFloat,"powerFloat",function(){App.float(e,t,i,r,a)})};App.editor.fileInput=function(e,a,n,d){if(!e){e=""}else{e=App.utils.elemToId(e)+" "}App.loader.defined(typeof $.fn.powerFloat,"powerFloat");App.loader.defined(typeof $.fn.uploadPreviewer,"uploadPreviewer");$(e+'[data-toggle="finder"]').each(function(){$(this).on("click",function(e){var t=$(this).data("finder-url")||App.editor.browsingFileURL;if(!t)return;t=t.replace(/[\?&]multiple=1/,"");if(t.indexOf("?")>=0){t+="&"}else{t+="?"}t+="from=parent&client=fileInput&filetype=image";var o=this;App.editor.finderDialog(t,function(e){var t=e[0];var i=$(o).data("input");if(!i){i=$(o).parent(".input-group-btn").siblings("input")[0]}if(i)$(i).val(t);var r=$(o).data("preview-btn");if(!r){r=$(o).parent(".input-group-btn").siblings(".preview-btn")[0]}if(r){if(!$(r).data("attached-float")){App.float(App.utils.elemToId(r)+" a img");$(r).data("attached-float",true)}$(r).removeClass("hidden").children("a").attr("href",t).children("img").attr("src",t)}var a=$(o).data("preview-img");if(a){$(a).attr("src",t)}if(n)n(t)})})});$(e+'input[data-toggle="uploadPreviewer"]').each(function(){$(this).css("width","70px");var e=$(this).data("preview-container");var t=$(this).data("upload-url");var i=$(this).data("preview-btn");var r=$(this).uploadPreviewer($.extend({buttonText:'<i class="fa fa-cloud-upload"></i> '+App.t("上传"),previewTableContainer:e,url:t,previewTableShow:false},a||{}));$(this).data("uploadPreviewer",r);if(i&&!$(i).data("attached-float")){App.float(App.utils.elemToId(i)+" a img");$(i).data("attached-float",true)}$(this).on("file-preview:changed",function(o){$(o.target).data("uploadPreviewer").submit(function(e){if(e.Code!=1){if(d)d(e);return App.message({text:e.Info,type:"error"})}var t=e.Data.files[0];var i=$(o.target).data("input");if(!i){i=$(o.target).parents(".input-group-btn").prev("input")[0]}$(i).val(t);var r=$(o.target).data("preview-btn");if(!r){r=$(o.target).parents(".input-group-btn").siblings(".preview-btn")[0]}if(r){if(!$(r).data("attached-float")){App.float(App.utils.elemToId(r)+" a img");$(r).data("attached-float",true)}$(r).removeClass("hidden").children("a").attr("href",t).children("img").attr("src",t)}var a=$(o.target).data("preview-img");if(a){$(a).attr("src",t)}if(n)n(t);App.message({text:App.t("上传成功"),type:"success"})},function(){if(d)d()})})})};App.editor.codemirror=function(l,s,c){if($(l).length<1)return null;var e=function(){if($(l).data("codemirror"))return;var e={lineNumbers:true,lineWrapping:true,lineWrapping:true,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],autoCloseTags:true,autoCloseBrackets:true,showTrailingSpace:true,indentWithTabs:true,matchBrackets:true,styleActiveLine:true,styleSelectedText:true,highlightSelectionMatches:true,smartIndent:true,mode:"text/x-csrc",width:null,height:null,hintOptions:{completeSingle:false}};var t=$.extend(e,s||{});var i=$(l)[0].tagName.toUpperCase()=="TEXTAREA"?CodeMirror.fromTextArea($(l)[0],t):CodeMirror($(l)[0],t);var r=t.mode,a={"text/x-csrc":"clike","text/css":"css","text/x-mysql":"sql","text/x-mssql":"sql","text/x-markdown":"markdown","text/x-yaml":"yaml","text/x-toml":"toml","text/javascript":"javascript","application/javascript":"javascript","text/json":"javascript","text/html":"html","message/http":"http",null:"null"};if(c&&typeof c=="object"){a=$.extend(a,c);c=null}if(!c){if(t.mode in a){c=a[t.mode]}else{if(typeof CodeMirror.modeInfo!=="undefined"){for(var o=0;o<CodeMirror.modeInfo.length;o++){var n=CodeMirror.modeInfo[o];if(n.mime==t.mode||n.mode==t.mode){c=n.mode;r=n.mime;break}}}else{c="null"}}}if(t.width||t.height){if(!t.width)t.width="auto";if(!t.height)t.height="auto";i.setSize(t.width,t.height)}if(c){i.setOption("mode",r);if(typeof t.readOnly=="undefined"||!t.readOnly){var d="",p="";switch(c){case"css":case"html":case"javascript":case"sql":case"xml":d=c}switch(c){case"css":case"json":case"javascript":case"coffeescript":case"yaml":p=c}if(d&&(!CodeMirror.helpers.hasOwnProperty("hint")||!CodeMirror.helpers.hint.hasOwnProperty(d))){d="#editor/markdown/lib/codemirror/addon/hint/"+d+"-hint.js";if(c=="html"){App.loader.includes("#editor/markdown/lib/codemirror/addon/hint/xml-hint.js",true,function(){App.loader.includes(d,true)})}else{App.loader.includes(d,true)}}if(p&&(!CodeMirror.helpers.hasOwnProperty("lint")||!CodeMirror.helpers.lint.hasOwnProperty(p))){p="#editor/markdown/lib/codemirror/addon/lint/"+p+"-lint.js";App.loader.includes(["#editor/markdown/lib/codemirror/addon/lint/lint.css","#editor/markdown/lib/codemirror/addon/lint/lint.js"],true,function(){App.loader.includes(p,true)})}}}i.on("keypress",function(){if(typeof i.showHint=="function")i.showHint()});$(l).data("codemirror",i)};App.loader.defined(typeof CodeMirror,"codemirror",e,function(){CodeMirror.modeURL=ASSETS_URL+"/js/editor/markdown/lib/codemirror/mode/%N/%N.js"})};App.editor.dropzone=function(r,e,a,o,t){if($(r).length<1)return null;App.loader.defined(typeof $.fn.dropzone,"dropzone",null,function(){Dropzone.autoDiscover=false});var i=false;if(e&&typeof e.getSignedPutURL!="undefined"){var n=e.getSignedPutURL;delete e.getSignedPutURL;i=true;if(!e.url)e.url="/";e.method="put";e.sending=function(e,t){var i=t.send;t.send=function(){i.call(t,e)}};e.chunking=false;e.parallelUploads=1;e.parallelChunkUploads=false;e.uploadMultiple=false;if("watchXHRTimeout"in e)e.watchXHRTimeout=false;e.header="";e.autoProcessQueue=false;if(typeof n=="string"){var d=n;n=function(e,t,r){$.post(d,{name:e.name},function(e){if(e.Code!=1)return App.message({text:e.Info,type:"error"});t(e.URL)},"json").fail(function(e,t,i){r("Failed to get an S3 signed upload URL",t)})}}e.accept=function(t,i){n(t,function(e){t.uploadURL=e;i();setTimeout(function(){$(r).get(0).dropzone.processFile(t)})},i)}}App.loader.defined(typeof $.ui,"jqueryui");if(e.url){if(typeof e.url=="function"){var p=e.url;e.url=function(){var e=p();var t=e.indexOf("?")>=0?"&":"?";e+=t+"client=dropzone";return e}}else{var l=e.url.indexOf("?")>=0?"&":"?";e.url+=l+"client=dropzone"}}var s=App.getJQueryObject(r).dropzone($.extend({paramName:"file",maxFilesize:.5,acceptedFiles:"image/*",dictDefaultMessage:'<div class="dz-custom-message">\t\t<i class="fa fa-caret-right text-danger"></i> \t\t<span class="grey text-xs text-xs-minus">'+App.t("点击此处或拖动文件到这里开始上传")+'</span><br /> \t\t<i class="fa fa-cloud-upload text-primary fa-3x"></i>\t\t</div>',dictResponseError:App.t("上传文件出错!"),dictCancelUpload:App.t("取消"),dictRemoveFile:App.t("删除")},e||{}));var c=s[0].dropzone;c.on("success",function(e,t,i){if(t.error){if(typeof t.error.message!="undefined")t.error=t.error.message;if(o)o.call(this,e,t.error);return App.message({text:t.error,type:"error"})}if(a)a.apply(this,arguments);else $(r).trigger("dropzone.success",arguments)}).on("removedfile",function(e){if(t)t.apply(this,arguments);else $(r).trigger("dropzone.removedfile",arguments)}).on("error",function(e,t,i){if(o)o.apply(this,arguments);else $(r).trigger("dropzone.error",arguments)}).on("queuecomplete",function(){App.loading("hide")});if(i){c.on("processing",function(e){c.options.url=e.uploadURL;App.loading("show")})}else{c.on("processing",function(e){App.loading("show")})}$(r).data("dropzone",c);return c};App.editor.dateRangePicker=function(e,t){App.loader.defined(typeof App.daterangepicker,"dateRangePicker");return App.daterangepicker(e,t)};App.editor.dateRangePickerx=function(e,t,i,r){App.loader.defined(typeof App.daterangepicker,"dateRangePicker");return App.daterangepickerx(e,t,i,r)};App.editor.datePicker=function(e,t){App.loader.defined(typeof App.daterangepicker,"dateRangePicker");return App.datepicker(e,t)};App.editor.popup=function(e,t,i){if(e==null)e=".image-zoom";var r={type:"image",mainClass:"mfp-with-zoom",zoom:{enabled:true,duration:300,easing:"ease-in-out",opener:function(e){var t=$(e);return t}}};App.loader.defined(typeof $.fn.magnificPopup,"magnificPopup",function(){App.getJQueryObject(e).magnificPopup($.extend(r,t||{}));i&&i()})};App.editor.galleryPopup=function(e,t,i){var r={closeBtnInside:false,zoom:{opener:null},gallery:{enabled:true,navigateByImgClick:true}};App.editor.popup(e,$.extend(r,t||{}),i)};App.editor.inputmask=function(e,t){App.loader.defined(typeof $.fn.inputmask,"inputmask",function(){App.getJQueryObject(e).inputmask(t)})};App.editor.clipboard=function(e,t){App.loader.defined(typeof ClipboardJS,"clipboard",function(){attachCopy(e,t)})};