diff --git a/main.js b/main.js index 32f4e30..5624cb7 100644 --- a/main.js +++ b/main.js @@ -8,19 +8,15 @@ $(document).ready(function() function beatify() { var ta = document.getElementById('ta'); if($('#mode').html() == 'XML') { - //ta.value = vkbeautify.xml(ta.value); - ta.value = vkbeautify.xml(ta.value, 2); + ta.value = vkbeautify.xml(ta.value); } else if($('#mode').html() == 'JSON') { - //ta.value = vkbeautify.json(ta.value); - ta.value = vkbeautify.json(ta.value, 4); + ta.value = vkbeautify.json(ta.value); } else if($('#mode').html() == 'CSS') { - ta.value = vkbeautify.css(ta.value, 8); - //ta.value = vkbeautify.css(ta.value); + ta.value = vkbeautify.css(ta.value); } if($('#mode').html() == 'SQL') { - //ta.value = vkbeautify.sql(ta.value); ta.value = vkbeautify.sql(ta.value); } countChars(); diff --git a/vkbeautify.js b/vkbeautify.js index 63c71df..4f1ada1 100644 --- a/vkbeautify.js +++ b/vkbeautify.js @@ -37,7 +37,7 @@ (function() { function createShiftArr(step) { - +/* var space = ''; switch(step) { case 1: space = ' '; break; @@ -51,19 +51,20 @@ function createShiftArr(step) { case 9: space = ' '; break; case 10: space = ' '; break; case 11: space = ' '; break; - default: space = ' '; break; + case 12: space = ' '; break; + default: space = ' '; break; } - +*/ var shift = ['\n']; // array of shifts for(ix=0;ix<100;ix++){ - shift.push(shift[ix]+space); + shift.push(shift[ix]+step); } return shift; } function vkbeautify(){ this.step = ' '; // 4 spaces - this.shift = createShiftArr(4); + this.shift = createShiftArr(this.step); }; vkbeautify.prototype.xml = function(text,step) {