1111import log from './utils/log.js' ;
1212import util from './utils/util.js' ;
1313import http from "./utils/http.js" ;
14+ import array from "./utils/array.js" ;
15+ import string from "./utils/string.js" ;
1416
1517// ECMAScript6指定元素添加事件
1618// document.querySelector("#id").addEventListener("click", getKey);
@@ -319,7 +321,7 @@ window.beautifyCode = function beautifyCode() {
319321 */
320322function onlineBeautifier ( code ) {
321323 $ . ajax ( {
322- url : "/beautifier- nginx-conf " ,
324+ url : "/nginx-format-py " ,
323325 type : "POST" ,
324326 data : { code : code } ,
325327 contentType : "application/x-www-form-urlencoded; charset=UTF-8" ,
@@ -380,13 +382,13 @@ function activateBeautifierListener(contents, indentCode, indentation) {
380382 cleanLines = join_opening_bracket ( cleanLines ) ;
381383 }
382384 // 执行最后的缩进
383- cleanLines = trimSpace ( perform_indentation ( cleanLines , indentCode ) ) ;
385+ cleanLines = array . trimSpace ( perform_indentation ( cleanLines , indentCode ) ) ;
384386
385387 // 将所有线条组合在一起
386388 let outputContents = cleanLines . join ( "\n" ) ;
387389
388390 if ( "indentWay2" == indentation ) {
389- outputContents = replaceBlank ( outputContents ) ;
391+ outputContents = string . replaceBlank ( outputContents ) ;
390392 }
391393 // console.log(outputContents)
392394 // 将所有内容保存到文件中。
@@ -404,7 +406,9 @@ function activateBeautifierListener(contents, indentCode, indentation) {
404406 * @date 2019/6/13 20:14
405407 */
406408function beautifySuccess ( contents ) {
407- let html = "<pre style='background: black;color:#66FF66;width: 100%;height: 100%;margin: 0px;padding: 10px;'>" + contents + "</pre>" ;
409+ let html = `<pre style='background: black;color:#66FF66;width: 100%;height: 100%;margin: 0px;padding: 10px;'>
410+ ${ contents }
411+ </pre>` ;
408412 let area_width = "60%" ;
409413 if ( window . innerWidth <= 419 ) {
410414 area_width = "95%" ;
0 commit comments