The branch, master has been updated via 7a40f19f8a00ea73df9d03d50d5e95c455420317 (commit) from a463231e0ff89ea8e433a266c72427dfc40d6965 (commit)
- Log ----------------------------------------------------------------- commit 7a40f19f8a00ea73df9d03d50d5e95c455420317 Author: Marc Delisle marc@infomarc.info Date: Tue Jul 19 12:02:56 2011 -0400
Streamline jQuery usage
-----------------------------------------------------------------------
Summary of changes: js/sql.js | 25 +++++++++++++------------ 1 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/js/sql.js b/js/sql.js index d16abb0..5c48578 100644 --- a/js/sql.js +++ b/js/sql.js @@ -241,7 +241,7 @@ $(document).ready(function() { $("#sqlqueryform.ajax").live('submit', function(event) { event.preventDefault();
- $form = $(this); + var $form = $(this); if (! checkSqlQuery($form[0])) { return false; } @@ -250,11 +250,12 @@ $(document).ready(function() { $('.error').remove();
var $msgbox = PMA_ajaxShowMessage(); + var $sqlqueryresults = $('#sqlqueryresults');
PMA_prepareForAjaxRequest($form);
- $.post($(this).attr('action'), $(this).serialize() , function(data) { - if(data.success == true) { + $.post($form.attr('action'), $form.serialize() , function(data) { + if (data.success == true) { // fade out previous messages, if any $('.success').fadeOut(); $('.sqlquery_message').fadeOut(); @@ -268,7 +269,7 @@ $(document).ready(function() { } else { $('#sqlqueryform').before(data.message); } - $('#sqlqueryresults').show(); + $sqlqueryresults.show(); // this happens if a USE command was typed if (typeof data.reload != 'undefined') { // Unbind the submit event before reloading. See bug #3295529 @@ -285,25 +286,25 @@ $(document).ready(function() { else if (data.success == false ) { // show an error message that stays on screen $('#sqlqueryform').before(data.error); - $('#sqlqueryresults').hide(); + $sqlqueryresults.hide(); } else { // real results are returned // fade out previous messages, if any $('.success').fadeOut(); $('.sqlquery_message').fadeOut(); - $received_data = $(data); - $zero_row_results = $received_data.find('textarea[name="sql_query"]'); + var $received_data = $(data); + var $zero_row_results = $received_data.find('textarea[name="sql_query"]'); // if zero rows are returned from the query execution if ($zero_row_results.length > 0) { $('#sqlquery').val($zero_row_results.val()); } else { - $('#sqlqueryresults').show(); - $("#sqlqueryresults").html(data); - $("#sqlqueryresults").trigger('appendAnchor'); - $("#sqlqueryresults").trigger('makegrid'); + $sqlqueryresults.show(); + $sqlqueryresults.html(data); + $sqlqueryresults.trigger('appendAnchor'); + $sqlqueryresults.trigger('makegrid'); $('#togglequerybox').show(); - if($("#togglequerybox").siblings(":visible").length > 0) { + if ($("#togglequerybox").siblings(":visible").length > 0) { $("#togglequerybox").trigger('click'); } PMA_init_slider();
hooks/post-receive