From 10acae9011b5b1cf35c6938bf27d6e235e1b2f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 16 Apr 2013 11:49:42 +0200 Subject: [PATCH] Whitespace fixes --- js/functions.js | 107 ++++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 54 deletions(-) diff --git a/js/functions.js b/js/functions.js index 375add9822..84750fb546 100644 --- a/js/functions.js +++ b/js/functions.js @@ -506,8 +506,7 @@ function checkTableEditForm(theForm, fieldsCnt) var atLeastOneField = 0; var i, elm, elm2, elm3, val, id; - for (i=0; i 1) { chaineAj += ", "; @@ -816,7 +815,7 @@ function insertValueQuery() sql_box_locked = true; var chaineAj = ""; var NbSelect = 0; - for (var i=0; i 1) { @@ -870,7 +869,7 @@ function refreshLayout() var $elm = $('#pdflayout'); var orientation = $('#orientation_opt').val(); var paper = 'A4'; - if ($('#paper_opt').length==1) { + if ($('#paper_opt').length == 1) { paper = $('#paper_opt').val(); } var posa = 'y'; @@ -1397,32 +1396,32 @@ AJAX.registerOnload('functions.js', function () { }); $("#export_type").change(function () { - if ($("#export_type").val()=='svg') { - $("#show_grid_opt").prop("disabled",true); - $("#orientation_opt").prop("disabled",true); - $("#with_doc").prop("disabled",true); + if ($("#export_type").val() == 'svg') { + $("#show_grid_opt").prop("disabled", true); + $("#orientation_opt").prop("disabled", true); + $("#with_doc").prop("disabled", true); $("#show_table_dim_opt").removeProp("disabled"); $("#all_tables_same_width").removeProp("disabled"); $("#paper_opt").removeProp("disabled"); $("#show_color_opt").removeProp("disabled"); //$(this).css("background-color","yellow"); - } else if ($("#export_type").val()=='dia') { - $("#show_grid_opt").prop("disabled",true); - $("#with_doc").prop("disabled",true); - $("#show_table_dim_opt").prop("disabled",true); - $("#all_tables_same_width").prop("disabled",true); + } else if ($("#export_type").val() == 'dia') { + $("#show_grid_opt").prop("disabled", true); + $("#with_doc").prop("disabled", true); + $("#show_table_dim_opt").prop("disabled", true); + $("#all_tables_same_width").prop("disabled", true); $("#paper_opt").removeProp("disabled"); $("#show_color_opt").removeProp("disabled"); $("#orientation_opt").removeProp("disabled"); - } else if ($("#export_type").val()=='eps') { - $("#show_grid_opt").prop("disabled",true); + } else if ($("#export_type").val() == 'eps') { + $("#show_grid_opt").prop("disabled", true); $("#orientation_opt").removeProp("disabled"); - $("#with_doc").prop("disabled",true); - $("#show_table_dim_opt").prop("disabled",true); - $("#all_tables_same_width").prop("disabled",true); - $("#paper_opt").prop("disabled",true); - $("#show_color_opt").prop("disabled",true); - } else if ($("#export_type").val()=='pdf') { + $("#with_doc").prop("disabled", true); + $("#show_table_dim_opt").prop("disabled", true); + $("#all_tables_same_width").prop("disabled", true); + $("#paper_opt").prop("disabled", true); + $("#show_color_opt").prop("disabled", true); + } else if ($("#export_type").val() == 'pdf') { $("#show_grid_opt").removeProp("disabled"); $("#orientation_opt").removeProp("disabled"); $("#with_doc").removeProp("disabled"); @@ -1741,14 +1740,14 @@ function PMA_SQLPrettyPrint(string) return string; } - var mode = CodeMirror.getMode({},"text/x-mysql"); + var mode = CodeMirror.getMode({}, "text/x-mysql"); var stream = new CodeMirror.StringStream(string); var state = mode.startState(); var token, tokens = []; var output = ''; var tabs = function (cnt) { var ret = ''; - for (var i=0; i<4*cnt; i++) { + for (var i = 0; i < 4 * cnt; i++) { ret += " "; } return ret; @@ -1756,17 +1755,17 @@ function PMA_SQLPrettyPrint(string) // "root-level" statements var statements = { - 'select': ['select', 'from','on','where','having','limit','order by','group by'], - 'update': ['update', 'set','where'], + 'select': ['select', 'from', 'on', 'where', 'having', 'limit', 'order by', 'group by'], + 'update': ['update', 'set', 'where'], 'insert into': ['insert into', 'values'] }; // don't put spaces before these tokens - var spaceExceptionsBefore = { ';':true, ',': true, '.': true, '(': true }; + var spaceExceptionsBefore = {';': true, ',': true, '.': true, '(': true}; // don't put spaces after these tokens - var spaceExceptionsAfter = { '.': true }; + var spaceExceptionsAfter = {'.': true}; // Populate tokens array - var str=''; + var str = ''; while (! stream.eol()) { stream.start = stream.pos; token = mode.token(stream, state); @@ -1799,9 +1798,9 @@ function PMA_SQLPrettyPrint(string) // New block => push to stack if (tokens[i][1] == '(') { - if (i < tokens.length - 1 && tokens[i+1][0] == 'statement-verb') { + if (i < tokens.length - 1 && tokens[i + 1][0] == 'statement-verb') { blockStack.unshift(newBlock = 'statement'); - } else if (i > 0 && tokens[i-1][0] == 'builtin') { + } else if (i > 0 && tokens[i - 1][0] == 'builtin') { blockStack.unshift(newBlock = 'function'); } else { blockStack.unshift(newBlock = 'generic'); @@ -1821,8 +1820,8 @@ function PMA_SQLPrettyPrint(string) // A subquery is starting if (i > 0 && newBlock == 'statement') { indentLevel++; - output += "\n" + tabs(indentLevel) + tokens[i][1] + ' ' + tokens[i+1][1].toUpperCase() + "\n" + tabs(indentLevel + 1); - currentStatement = tokens[i+1][1]; + output += "\n" + tabs(indentLevel) + tokens[i][1] + ' ' + tokens[i + 1][1].toUpperCase() + "\n" + tabs(indentLevel + 1); + currentStatement = tokens[i + 1][1]; i++; continue; } @@ -1846,8 +1845,8 @@ function PMA_SQLPrettyPrint(string) // Normal indentatin and spaces for everything else else { if (! spaceExceptionsBefore[tokens[i][1]] - && ! (i > 0 && spaceExceptionsAfter[tokens[i-1][1]]) - && output.charAt(output.length -1) != ' ' ) { + && ! (i > 0 && spaceExceptionsAfter[tokens[i - 1][1]]) + && output.charAt(output.length - 1) != ' ' ) { output += " "; } if (tokens[i][0] == 'keyword') { @@ -1859,14 +1858,14 @@ function PMA_SQLPrettyPrint(string) // split columns in select and 'update set' clauses, but only inside statements blocks if (( lastStatementPart == 'select' || lastStatementPart == 'where' || lastStatementPart == 'set') - && tokens[i][1]==',' && blockStack[0] == 'statement') { + && tokens[i][1] == ',' && blockStack[0] == 'statement') { output += "\n" + tabs(indentLevel + 1); } // split conditions in where clauses, but only inside statements blocks if (lastStatementPart == 'where' - && (tokens[i][1]=='and' || tokens[i][1]=='or' || tokens[i][1]=='xor')) { + && (tokens[i][1] == 'and' || tokens[i][1] == 'or' || tokens[i][1] == 'xor')) { if (blockStack[0] == 'statement') { output += "\n" + tabs(indentLevel + 1); @@ -1921,7 +1920,7 @@ jQuery.fn.PMA_confirm = function (question, url, callbackFn) { $(this).dialog("close"); }; - $('
', {'id':'confirm_dialog'}) + $('
', {'id': 'confirm_dialog'}) .prepend(question) .dialog({ buttons: button_options, @@ -2150,7 +2149,7 @@ AJAX.registerOnload('functions.js', function () { event.preventDefault(); var $form = $(this); PMA_prepareForAjaxRequest($form); - $.post($form.attr('action'), $form.serialize()+"&submit_copy=Go", function (data) { + $.post($form.attr('action'), $form.serialize() + "&submit_copy=Go", function (data) { if (data.success === true) { if ($form.find("input[name='switch_to_new']").prop('checked')) { PMA_commonParams.set( @@ -2184,7 +2183,7 @@ AJAX.registerOnload('functions.js', function () { var db = $form.find('select[name=target_db]').val(); var tbl = $form.find('input[name=new_name]').val(); PMA_prepareForAjaxRequest($form); - $.post($form.attr('action'), $form.serialize()+"&submit_move=1", function (data) { + $.post($form.attr('action'), $form.serialize() + "&submit_move=1", function (data) { if (data.success === true) { PMA_commonParams.set('db', db); PMA_commonParams.set('table', tbl); @@ -2395,7 +2394,7 @@ AJAX.registerOnload('functions.js', function () { var $msgbox = PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']); $the_form.append(''); - $.post($the_form.attr('action'), $the_form.serialize() + '&change_pw='+ this_value, function (data) { + $.post($the_form.attr('action'), $the_form.serialize() + '&change_pw=' + this_value, function (data) { if (data.success === true) { $("#page_content").prepend(data.message); $("#change_password_dialog").hide().remove(); @@ -2560,9 +2559,9 @@ AJAX.registerOnload('functions.js', function () { var values = []; var in_string = false; var curr, next, buffer = ''; - for (var i=0; i" + "" @@ -2643,7 +2642,7 @@ AJAX.registerOnload('functions.js', function () { }; // Show the dialog var width = parseInt( - (parseInt($('html').css('font-size'), 10)/13)*340, + (parseInt($('html').css('font-size'), 10) / 13) * 340, 10 ); if (! width) { @@ -2715,7 +2714,7 @@ AJAX.registerOnload('functions.js', function () { */ function checkIndexName(form_id) { - if ($("#"+form_id).length === 0) { + if ($("#" + form_id).length === 0) { return false; } @@ -2794,7 +2793,7 @@ function indexEditorDialog(url, title, callback_success, callback_failure) var $form = $("#index_frm"); PMA_prepareForAjaxRequest($form); //User wants to submit the form - $.post($form.attr('action'), $form.serialize()+"&do_save_data=1", function (data) { + $.post($form.attr('action'), $form.serialize() + "&do_save_data=1", function (data) { if ($("#sqlqueryresults").length !== 0) { $("#sqlqueryresults").remove(); } @@ -2926,7 +2925,7 @@ $(function () { // Initialise the menu resize plugin $('#topmenu').menuResizer(PMA_mainMenuResizerCallback); // register resize event - $(window).resize(function (){ + $(window).resize(function () { $('#topmenu').menuResizer('resize'); }); }); @@ -2969,7 +2968,7 @@ var toggleButton = function ($obj) { */ var h = $obj.height(); $('img', $obj).height(h); - $('table', $obj).css('bottom', h-1); + $('table', $obj).css('bottom', h - 1); /** * var on Width of the "ON" part of the toggle switch * var off Width of the "OFF" part of the toggle switch @@ -3188,7 +3187,7 @@ AJAX.registerOnload('functions.js', function () { $('a.formLinkSubmit').live('click', function (e) { if ($(this).attr('href').indexOf('=') != -1) { - var data = $(this).attr('href').substr($(this).attr('href').indexOf('#')+1).split('=', 2); + var data = $(this).attr('href').substr($(this).attr('href').indexOf('#') + 1).split('=', 2); $(this).parents('form').append(''); } $(this).parents('form').submit(); @@ -3221,7 +3220,7 @@ function PMA_init_slider() } var $wrapper = $('