function example(){var n=``+getTextByLanguage("锤子在线工具网")+``;saveConfig(n)}function format(){var t,n,i,r;editor!=null&&editor&&((t=$("#form").getWebControls(),n=editor.getValue(),n=ys.trim(n," "),ys.isNullOrEmpty(n))||(i=parseInt(t.indent),r=" ",i==1&&(r="\t"),n=html_beautify(n,{indent_inner_html:!1,indent_size:i,indent_char:r,wrap_line_length:300,brace_style:"expand",preserve_newlines:!1,max_preserve_newlines:5,indent_handlebars:!1,extra_liners:["/none"]}),editor.setValue(n),t.isWrap=="1",saveConfig(n)))}function uploadFile(n){var i=n.files[0],t=new FileReader;t.readAsText(i);ys.showLoading();t.onload=function(){ys.closeLoading();saveConfig(this.result)}}function compress(){var n=editor.getValue();n=n.replace(/[\t\n\r]/g,"").replace(//g,"").replace(/\s{2,}/g," ");saveConfig(n)}function download(){ys.downloadBlob(editor.getValue(),"html-format.html","text/html;charset=utf-8;")}function saveConfig(n){editor.setValue(n);updateWordCountForTextareaCodeMirror($("#txtInput"),n.length);var t=$("#form").getWebControls();t.input=n;config_html_format=ys.setConfig(nameOf(()=>config_html_format),JSON.stringify(t))}var config_html_format={input:""},codeMirrorTextAreaMap=[],editor=null;window.pageLoad=function(){$("#selectIndent").ysComboBox({data:[{Key:1,Value:getTextByLanguage("制表符缩进")},{Key:2,Value:getTextByLanguage("2个空格缩进")},{Key:4,Value:getTextByLanguage("4个空格缩进")},{Key:8,Value:getTextByLanguage("8个空格缩进")}],onChange:format,width:140});initShareLinkParam(nameOf(()=>config_html_format));config_html_format=ys.loadConfig("form",nameOf(()=>config_html_format),config_html_format);editor=CodeMirror.fromTextArea(document.getElementById("txtInput"),{lineNumbers:!0,matchBrackets:!0,mode:"text/html",foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],extraKeys:{F11:function(n){n.setOption("fullScreen",!n.getOption("fullScreen"))},Esc:function(n){n.getOption("fullScreen")&&n.setOption("fullScreen",!1)}}});editor.on("keyup",function(){var n=editor.getValue();updateWordCountForTextareaCodeMirror($("#txtInput"),n.length)});codeMirrorTextAreaMap.push({txtInput:editor});var n=$(window).height()-ys.getElementActualHeight("divUp")-adHeight-pagePadding;n=getEditorMinHeight(n);$(".CodeMirror").css("height",n);$(".CodeMirror-wrap").css("height",n);editor.setValue(config_html_format.input);uploadFileBind("btnUpload","inputFile",uploadFile)};