Skip to content

Commit

Permalink
set default step to 4 spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
vkiryukhin committed Apr 12, 2012
1 parent 6f5e8ac commit f925964
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
10 changes: 3 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
11 changes: 6 additions & 5 deletions vkbeautify.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
(function() {

function createShiftArr(step) {

/*
var space = '';
switch(step) {
case 1: space = ' '; break;
Expand All @@ -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) {
Expand Down

0 comments on commit f925964

Please sign in to comment.