diff --git a/js/messages.php b/js/messages.php index d3c82d957..16e1a8368 100644 --- a/js/messages.php +++ b/js/messages.php @@ -81,7 +81,8 @@ $js_messages['strNo'] = __('No'); $js_messages['strSearching'] = __('Searching'); /* For sql.js */ -$js_messages['strToggleQueryBox'] = __('Toggle Query Box Visibility'); +$js_messages['strHideQueryBox'] = __('Hide query box'); +$js_messages['strShowQueryBox'] = __('Show query box'); $js_messages['strInlineEdit'] = __('Inline Edit'); /* For tbl_change.js */ diff --git a/js/sql.js b/js/sql.js index 285df0f0d..8979251e1 100644 --- a/js/sql.js +++ b/js/sql.js @@ -150,20 +150,28 @@ $(document).ready(function() { $("#sqlqueryresults").trigger('appendAnchor'); /** - * Append the Toggle Query Box message to the query input form + * Append the "Show/Hide query box" message to the query input form * * @memberOf jQuery * @name appendToggleSpan */ - // do not add this span more than once - if (! $('#sqlqueryform').find('span').is('#togglequerybox')) { - $('') - .html(PMA_messages['strToggleQueryBox']) + // do not add this link more than once + if (! $('#sqlqueryform').find('a').is('#togglequerybox')) { + $('') + .html(PMA_messages['strHideQueryBox']) .appendTo("#sqlqueryform"); // Attach the toggling of the query box visibility to a click $("#togglequerybox").bind('click', function() { - $(this).siblings().slideToggle("medium"); + var $link = $(this) + $link.siblings().slideToggle("medium"); + if ($link.text() == PMA_messages['strHideQueryBox']) { + $link.text(PMA_messages['strShowQueryBox']); + } else { + $link.text(PMA_messages['strHideQueryBox']); + } + // avoid default click action + return false; }) }