diff options
Diffstat (limited to 'js/sql.js')
-rw-r--r-- | js/sql.js | 118 |
1 files changed, 59 insertions, 59 deletions
@@ -46,10 +46,10 @@ function getFieldName($this_field) var left_action_exist = !$('#table_results').find('th:first').hasClass('draggable'); // number of column span for checkbox and Actions var left_action_skip = left_action_exist ? $('#table_results').find('th:first').attr('colspan') - 1 : 0; - var field_name = $('#table_results').find('thead').find('th:eq('+ (this_field_index - left_action_skip) + ') a').text(); + var field_name = $('#table_results').find('thead').find('th:eq(' + (this_field_index - left_action_skip) + ') a').text(); // happens when just one row (headings contain no a) - if ("" == field_name) { - var $heading = $('#table_results').find('thead').find('th:eq('+ (this_field_index - left_action_skip) + ')').children('span'); + if (field_name === '') { + var $heading = $('#table_results').find('thead').find('th:eq(' + (this_field_index - left_action_skip) + ')').children('span'); // may contain column comment enclosed in a span - detach it temporarily to read the column name var $tempColComment = $heading.children().detach(); field_name = $heading.text(); @@ -65,7 +65,7 @@ function getFieldName($this_field) /** * Unbind all event handlers before tearing down a page */ -AJAX.registerTeardown('sql.js', function() { +AJAX.registerTeardown('sql.js', function () { $('a.delete_row.ajax').unbind('click'); $('#bookmarkQueryForm').die('submit'); $('input#bkm_label').unbind('keyup'); @@ -102,22 +102,22 @@ AJAX.registerTeardown('sql.js', function() { * @name document.ready * @memberOf jQuery */ -AJAX.registerOnload('sql.js', function() { +AJAX.registerOnload('sql.js', function () { // Delete row from SQL results $('a.delete_row.ajax').click(function (e) { e.preventDefault(); - var question = $.sprintf(PMA_messages['strDoYouReally'], $(this).closest('td').find('div').text()); + var question = $.sprintf(PMA_messages.strDoYouReally, $(this).closest('td').find('div').text()); var $link = $(this); $link.PMA_confirm(question, $link.attr('href'), function (url) { $msgbox = PMA_ajaxShowMessage(); - $.get(url, {'ajax_request':true, 'is_js_confirmed': true}, function (data) { + $.get(url, {'ajax_request': true, 'is_js_confirmed': true}, function (data) { if (data.success) { PMA_ajaxShowMessage(data.message); $link.closest('tr').remove(); } else { PMA_ajaxShowMessage(data.error, false); } - }) + }); }); }); @@ -135,7 +135,7 @@ AJAX.registerOnload('sql.js', function() { }); /* Hides the bookmarkoptions checkboxes when the bookmark label is empty */ - $('input#bkm_label').keyup(function() { + $('input#bkm_label').keyup(function () { $('input#id_bkm_all_users, input#id_bkm_replace') .parent() .toggle($(this).val().length > 0); @@ -146,7 +146,7 @@ AJAX.registerOnload('sql.js', function() { * triggered manually everytime the table of results is reloaded * @memberOf jQuery */ - $("#sqlqueryresults").live('makegrid', function() { + $("#sqlqueryresults").live('makegrid', function () { PMA_makegrid($('#table_results')[0]); }); @@ -159,24 +159,24 @@ AJAX.registerOnload('sql.js', function() { // do not add this link more than once if (! $('#sqlqueryform').find('a').is('#togglequerybox')) { $('<a id="togglequerybox"></a>') - .html(PMA_messages['strHideQueryBox']) + .html(PMA_messages.strHideQueryBox) .appendTo("#sqlqueryform") // initially hidden because at this point, nothing else // appears under the link .hide(); // Attach the toggling of the query box visibility to a click - $("#togglequerybox").bind('click', function() { + $("#togglequerybox").bind('click', function () { var $link = $(this); $link.siblings().slideToggle("fast"); - if ($link.text() == PMA_messages['strHideQueryBox']) { - $link.text(PMA_messages['strShowQueryBox']); + if ($link.text() == PMA_messages.strHideQueryBox) { + $link.text(PMA_messages.strShowQueryBox); // cheap trick to add a spacer between the menu tabs // and "Show query box"; feel free to improve! $('#togglequerybox_spacer').remove(); $link.before('<br id="togglequerybox_spacer" />'); } else { - $link.text(PMA_messages['strHideQueryBox']); + $link.text(PMA_messages.strHideQueryBox); } // avoid default click action return false; @@ -189,7 +189,7 @@ AJAX.registerOnload('sql.js', function() { * * @memberOf jQuery */ - $("#button_submit_query").live('click', function(event) { + $("#button_submit_query").live('click', function (event) { var $form = $(this).closest("form"); // the Go button related to query submission was clicked, // instead of the one related to Bookmarks, so empty the @@ -205,7 +205,7 @@ AJAX.registerOnload('sql.js', function() { * * @memberOf jQuery */ - $("input[name=bookmark_variable]").bind("keypress", function(event) { + $("input[name=bookmark_variable]").bind("keypress", function (event) { // force the 'Enter Key' to implicitly click the #button_submit_bookmark var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode)); if (keycode == 13) { // keycode for enter key @@ -218,9 +218,9 @@ AJAX.registerOnload('sql.js', function() { // section and hit enter, you expect it to do the // same action as the Go button in that section. $("#button_submit_bookmark").click(); - return false; + return false; } else { - return true; + return true; } }); @@ -231,7 +231,7 @@ AJAX.registerOnload('sql.js', function() { * @memberOf jQuery * @name sqlqueryform_submit */ - $("#sqlqueryform.ajax").live('submit', function(event) { + $("#sqlqueryform.ajax").live('submit', function (event) { event.preventDefault(); var $form = $(this); @@ -247,8 +247,8 @@ AJAX.registerOnload('sql.js', function() { PMA_prepareForAjaxRequest($form); - $.post($form.attr('action'), $form.serialize() , function(data) { - if (data.success == true) { + $.post($form.attr('action'), $form.serialize(), function (data) { + if (data.success === true) { // success happens if the query returns rows or not // // fade out previous messages, if any @@ -308,19 +308,19 @@ AJAX.registerOnload('sql.js', function() { }); PMA_reloadNavigation(); } - + $sqlqueryresults.show().trigger('makegrid'); $('#togglequerybox').show(); PMA_init_slider(); if (typeof data.action_bookmark == 'undefined') { - if ( $('#sqlqueryform input[name="retain_query_box"]').is(':checked') != true ) { + if ($('#sqlqueryform input[name="retain_query_box"]').is(':checked') !== true) { if ($("#togglequerybox").siblings(":visible").length > 0) { $("#togglequerybox").trigger('click'); } } } - } else if (data.success == false ) { + } else if (data.success === false) { // show an error message that stays on screen $('#sqlqueryform').before(data.error); $sqlqueryresults.hide(); @@ -334,7 +334,7 @@ AJAX.registerOnload('sql.js', function() { * @memberOf jQuery * @name paginate_dropdown_change */ - $("#pageselector").live('change', function(event) { + $("#pageselector").live('change', function (event) { var $form = $(this).parent("form"); $form.submit(); }); // end Paginate results with Page Selector @@ -344,12 +344,12 @@ AJAX.registerOnload('sql.js', function() { * @memberOf jQuery * @name displayOptionsForm_submit */ - $("#displayOptionsForm.ajax").live('submit', function(event) { + $("#displayOptionsForm.ajax").live('submit', function (event) { event.preventDefault(); $form = $(this); - $.post($form.attr('action'), $form.serialize() + '&ajax_request=true' , function(data) { + $.post($form.attr('action'), $form.serialize() + '&ajax_request=true', function (data) { $("#sqlqueryresults") .html(data.message) .trigger('makegrid'); @@ -360,7 +360,7 @@ AJAX.registerOnload('sql.js', function() { /** * Ajax Event for table row change * */ - $("#resultsForm.ajax .mult_submit[value=edit]").live('click', function(event){ + $("#resultsForm.ajax .mult_submit[value=edit]").live('click', function (event) { event.preventDefault(); /*Check whether atleast one row is selected for change*/ @@ -373,28 +373,28 @@ AJAX.registerOnload('sql.js', function() { */ var button_options = {}; // in the following function we need to use $(this) - button_options[PMA_messages['strCancel']] = function() { + button_options[PMA_messages.strCancel] = function () { $(this).dialog('close'); }; var button_options_error = {}; - button_options_error[PMA_messages['strOK']] = function() { + button_options_error[PMA_messages.strOK] = function () { $(this).dialog('close'); }; var $form = $("#resultsForm"); var $msgbox = PMA_ajaxShowMessage(); - $.get($form.attr('action'), $form.serialize()+"&ajax_request=true&submit_mult=row_edit", function(data) { + $.get($form.attr('action'), $form.serialize() + "&ajax_request=true&submit_mult=row_edit", function (data) { //in the case of an error, show the error message returned. - if (data.success != undefined && data.success == false) { + if (data.success !== undefined && data.success === false) { $div .append(data.error) .dialog({ - title: PMA_messages['strChangeTbl'], + title: PMA_messages.strChangeTbl, height: 230, width: 900, open: PMA_verifyColumnsProperties, - close: function(event, ui) { + close: function (event, ui) { $(this).remove(); }, buttons : button_options_error @@ -403,11 +403,11 @@ AJAX.registerOnload('sql.js', function() { $div .append(data.message) .dialog({ - title: PMA_messages['strChangeTbl'], + title: PMA_messages.strChangeTbl, height: 600, width: 900, open: PMA_verifyColumnsProperties, - close: function(event, ui) { + close: function (event, ui) { $(this).remove(); }, buttons : button_options @@ -421,14 +421,14 @@ AJAX.registerOnload('sql.js', function() { PMA_ajaxRemoveMessage($msgbox); }); // end $.get() } else { - PMA_ajaxShowMessage(PMA_messages['strNoRowSelected']); + PMA_ajaxShowMessage(PMA_messages.strNoRowSelected); } }); /** * Click action for "Go" button in ajax dialog insertForm -> insertRowTable */ - $("#insertForm .insertRowTable.ajax input[type=submit]").live('click', function(event) { + $("#insertForm .insertRowTable.ajax input[type=submit]").live('click', function (event) { event.preventDefault(); /** * @var the_form object referring to the insert form @@ -436,10 +436,10 @@ AJAX.registerOnload('sql.js', function() { var $form = $("#insertForm"); PMA_prepareForAjaxRequest($form); //User wants to submit the form - $.post($form.attr('action'), $form.serialize(), function(data) { - if (data.success == true) { + $.post($form.attr('action'), $form.serialize(), function (data) { + if (data.success === true) { PMA_ajaxShowMessage(data.message); - if ($("#pageselector").length != 0) { + if ($("#pageselector").length !== 0) { $("#pageselector").trigger('change'); } else { $("input[name=navig].ajax").trigger('click'); @@ -469,7 +469,7 @@ AJAX.registerOnload('sql.js', function() { * Click action for #buttonYes button in ajax dialog insertForm */ - $("#buttonYes.ajax").live('click', function(event){ + $("#buttonYes.ajax").live('click', function (event) { event.preventDefault(); /** * @var the_form object referring to the insert form @@ -480,8 +480,8 @@ AJAX.registerOnload('sql.js', function() { $("#result_query").remove(); PMA_prepareForAjaxRequest($form); //User wants to submit the form - $.post($form.attr('action'), $form.serialize() , function(data) { - if (data.success == true) { + $.post($form.attr('action'), $form.serialize(), function (data) { + if (data.success === true) { PMA_ajaxShowMessage(data.message); if (selected_submit_type == "showinsert") { $("#sqlqueryresults").prepend(data.sql_query); @@ -494,7 +494,7 @@ AJAX.registerOnload('sql.js', function() { $("#table_results tbody tr" + ", #table_results tbody tr td").removeClass("marked"); } else { - if ($("#pageselector").length != 0) { + if ($("#pageselector").length !== 0) { $("#pageselector").trigger('change'); } else { $("input[name=navig].ajax").trigger('click'); @@ -535,17 +535,17 @@ function PMA_changeClassForColumn($this_th, newclass, isAddClass) if (has_big_t) { th_index--; } - var $tds = $this_th.closest('table').find('tbody tr').find('td.data:eq('+th_index+')'); - if (isAddClass == undefined) { + var $tds = $this_th.closest('table').find('tbody tr').find('td.data:eq(' + th_index + ')'); + if (isAddClass === undefined) { $tds.toggleClass(newclass); } else { $tds.toggleClass(newclass, isAddClass); } } -AJAX.registerOnload('sql.js', function() { +AJAX.registerOnload('sql.js', function () { - $('a.browse_foreign').live('click', function(e) { + $('a.browse_foreign').live('click', function (e) { e.preventDefault(); window.open(this.href, 'foreigners', 'width=640,height=240,scrollbars=yes,resizable=yes'); $anchor = $(this); @@ -555,16 +555,16 @@ AJAX.registerOnload('sql.js', function() { /** * vertical column highlighting in horizontal mode when hovering over the column header */ - $('th.column_heading.pointer').live('hover', function(e) { + $('th.column_heading.pointer').live('hover', function (e) { PMA_changeClassForColumn($(this), 'hover', e.type == 'mouseenter'); - }); + }); /** * vertical column marking in horizontal mode when clicking the column header */ - $('th.column_heading.marker').live('click', function() { + $('th.column_heading.marker').live('click', function () { PMA_changeClassForColumn($(this), 'marked'); - }); + }); /** * create resizable table @@ -577,15 +577,15 @@ AJAX.registerOnload('sql.js', function() { */ function makeProfilingChart() { - if ($('#profilingchart').length == 0 - || $('#profilingchart').html().length != 0 + if ($('#profilingchart').length === 0 + || $('#profilingchart').html().length !== 0 ) { return; } - + var data = []; - $.each(jQuery.parseJSON($('#profilingChartData').html()),function(key,value) { - data.push([key,parseFloat(value)]); + $.each(jQuery.parseJSON($('#profilingChartData').html()), function (key, value) { + data.push([key, parseFloat(value)]); }); // Remove chart and data divs contents |