1 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 * Used in or for console
5 * @package phpMyAdmin-Console
13 * @var object, jQuery object, selector is '#pma_console>.content'
16 $consoleContent: null,
18 * @var object, jQuery object, selector is '#pma_console .content',
22 $consoleAllContents: null,
24 * @var object, jQuery object, selector is '#pma_console .toolbar'
27 $consoleToolbar: null,
29 * @var object, jQuery object, selector is '#pma_console .template'
32 $consoleTemplates: null,
34 * @var object, jQuery object, form for submit
39 * @var object, contain console config
44 * @var bool, if console element exist, it'll be true
49 * @var bool, make sure console events bind only once
54 * Used for console initialize, reinit is ok, just some variable assignment
58 initialize: function() {
60 if($('#pma_console').length === 0) {
64 PMA_console.isEnabled = true;
66 // Cookie var checks and init
67 if(! $.cookie('pma_console_height')) {
68 $.cookie('pma_console_height', 92);
70 if(! $.cookie('pma_console_mode')) {
71 $.cookie('pma_console_mode', 'info');
75 PMA_console.$consoleToolbar = $('#pma_console>.toolbar');
76 PMA_console.$consoleContent = $('#pma_console>.content');
77 PMA_console.$consoleAllContents = $('#pma_console .content');
78 PMA_console.$consoleTemplates = $('#pma_console>.templates');
80 // Generate a from for post
81 PMA_console.$requestForm = $('<form method="post" action="import.php">' +
82 '<input name="is_js_confirmed" value="0">' +
83 '<textarea name="sql_query"></textarea>' +
84 '<input name="console_message_id" value="0">' +
85 '<input name="db" value="">' +
86 '<input name="table" value="">' +
87 '<input name="token" value="' +
88 PMA_commonParams.get('token') +
92 PMA_console.$requestForm.bind('submit', AJAX.requestHandler);
94 // Event binds shouldn't run again
95 if(PMA_console.isInitialized === false) {
98 var tempConfig = JSON.parse($.cookie('pma_console_config'));
100 if(tempConfig.alwaysExpand === true) {
101 $('#pma_console_options input[name=always_expand]').prop('checked', true);
103 if(tempConfig.startHistory === true) {
104 $('#pma_console_options input[name=start_history]').prop('checked', true);
106 if(tempConfig.currentQuery === true) {
107 $('#pma_console_options input[name=current_query]').prop('checked', true);
110 $('#pma_console_options input[name=current_query]').prop('checked', true);
113 PMA_console.updateConfig();
115 PMA_consoleResizer.initialize();
116 PMA_consoleInput.initialize();
117 PMA_consoleMessages.initialize();
118 PMA_consoleBookmarks.initialize();
120 PMA_console.$consoleToolbar.children('.console_switch').click(PMA_console.toggle);
121 $(document).keydown(function(event) {
123 if(event.keyCode === 27) {
124 PMA_console.toggle();
128 $('#pma_console .toolbar').children().mousedown(function(event) {
129 event.preventDefault();
130 event.stopImmediatePropagation();
133 $('#pma_console .button.clear').click(function() {
134 PMA_consoleMessages.clear();
137 $('#pma_console .button.history').click(function() {
138 PMA_consoleMessages.showHistory();
141 $('#pma_console .button.options').click(function() {
142 PMA_console.showCard('#pma_console_options');
145 $('#pma_console .mid_layer').click(function() {
146 PMA_console.hideCard($(this).parent().children('.card'));
148 $('#pma_bookmarks .switch_button').click(function() {
149 PMA_console.hideCard($(this).closest('.card'));
152 $('#pma_console_options input[type=checkbox]').change(function() {
153 PMA_console.updateConfig();
156 $('#pma_console_options .button.default').click(function() {
157 $('#pma_console_options input[name=always_expand]').prop('checked', false);
158 $('#pma_console_options input[name=start_history]').prop('checked', false);
159 $('#pma_console_options input[name=current_query]').prop('checked', true);
160 PMA_console.updateConfig();
163 $(document).ajaxComplete(function (event, xhr) {
164 var data = $.parseJSON(xhr.responseText);
165 PMA_console.ajaxCallback(data);
168 PMA_console.isInitialized = true;
171 // Change console mode from cookie
172 switch($.cookie('pma_console_mode')) {
174 PMA_console.collapse();
176 /* jshint -W086 */// no break needed in default section
178 $.cookie('pma_console_mode', 'info');
184 PMA_console.show(true);
185 PMA_console.scrollBottom();
190 * Excute query and show results in console
194 execute: function(queryString, options) {
195 if(typeof(queryString) != 'string' || ! /[a-z]|[A-Z]/.test(queryString)){
198 PMA_console.$requestForm.children('textarea').val(queryString);
199 if(options && options.db) {
200 PMA_console.$requestForm.children('[name=db]').attr('value', options.db);
202 PMA_console.$requestForm.children('[name=table]').attr('value', options.table);
204 PMA_console.$requestForm.children('[name=table]').attr('value', '');
207 PMA_console.$requestForm.children('[name=db]').attr('value',
208 (PMA_commonParams.get('db').length > 0 ? PMA_commonParams.get('db') : ''));
210 PMA_console.$requestForm.find('[name=profiling]').remove();
211 if(options && options.profiling === true) {
212 PMA_console.$requestForm.append('<input name="profiling" value="on">');
214 if (! confirmQuery(PMA_console.$requestForm[0], PMA_console.$requestForm.children('textarea')[0])) {
217 PMA_console.$requestForm.children('[name=console_message_id]')
218 .attr('value', PMA_consoleMessages.appendQuery({sql_query: queryString}).message_id);
219 PMA_console.$requestForm.trigger('submit');
220 PMA_consoleInput.clear();
222 ajaxCallback: function(data) {
223 if(data && data.console_message_id) {
224 PMA_consoleMessages.updateQuery(data.console_message_id, data.success,
225 (data._reloadQuerywindow ? data._reloadQuerywindow : false));
226 } else if( data && data._reloadQuerywindow) {
227 if(data._reloadQuerywindow.sql_query.length > 0) {
228 PMA_consoleMessages.appendQuery(data._reloadQuerywindow, 'successed')
229 .$message.addClass(PMA_console.config.currentQuery ? '' : 'hide');
234 * Change console to collapse mode
238 collapse: function() {
239 $.cookie('pma_console_mode', 'collapse');
240 var pmaConsoleHeight = $.cookie('pma_console_height');
242 if(pmaConsoleHeight < 32) {
243 $.cookie('pma_console_height', 92);
245 PMA_console.$consoleToolbar.addClass('collapsed');
246 PMA_console.$consoleAllContents.height(pmaConsoleHeight);
247 PMA_console.$consoleContent.stop();
248 PMA_console.$consoleContent.animate({'margin-bottom': -1 * PMA_console.$consoleContent.outerHeight() + 'px'},
249 'fast', 'easeOutQuart', function() {
250 PMA_console.$consoleContent.css({display:'none'});
251 $(window).trigger('resize');
253 PMA_console.hideCard();
258 * @param bool inputFocus If true, focus the input line after show()
261 show: function(inputFocus) {
262 $.cookie('pma_console_mode', 'show');
264 var pmaConsoleHeight = $.cookie('pma_console_height');
266 if(pmaConsoleHeight < 32) {
267 $.cookie('pma_console_height', 32);
268 PMA_console.collapse();
271 PMA_console.$consoleContent.css({display:'block'});
272 if(PMA_console.$consoleToolbar.hasClass('collapsed')) {
273 PMA_console.$consoleToolbar.removeClass('collapsed');
275 PMA_console.$consoleAllContents.height(pmaConsoleHeight);
276 PMA_console.$consoleContent.stop();
277 PMA_console.$consoleContent.animate({'margin-bottom': 0},
278 'fast', 'easeOutQuart', function() {
279 $(window).trigger('resize');
282 PMA_consoleInput.focus();
286 * Change console to SQL information mode
287 * this mode shows current SQL query
288 * This mode is the default mode
293 // Under construction
294 PMA_console.collapse();
297 * Toggle console mode between collsapse/show
298 * Used for toggle buttons and shortcuts
303 switch($.cookie('pma_console_mode')) {
306 PMA_console.show(true);
309 PMA_console.collapse();
312 PMA_consoleInitialize();
316 * Scroll console to bottom
320 scrollBottom: function() {
321 PMA_console.$consoleContent.scrollTop(PMA_console.$consoleContent.prop("scrollHeight"));
326 * @param string cardSelector Selector, select string will be "#pma_console " + cardSelector
327 * this param also can be JQuery object, if you need.
331 showCard: function(cardSelector) {
333 if(typeof(cardSelector) !== 'string') {
334 if (cardSelector.length > 0) {
335 $card = cardSelector;
340 $card = $("#pma_console " + cardSelector);
342 if($card.length === 0) {
345 $card.parent().children('.mid_layer').show().fadeTo(0, 0.15);
346 $card.addClass('show');
347 PMA_consoleInput.blur();
348 if($card.parents('.card').length > 0) {
349 PMA_console.showCard($card.parents('.card'));
353 * Scroll console to bottom
355 * @param object $targetCard Target card JQuery object, if it's empty, function will hide all cards
358 hideCard: function($targetCard) {
360 $('#pma_console .mid_layer').fadeOut(140);
361 $('#pma_console .card').removeClass('show');
362 } else if($targetCard.length > 0) {
363 $targetCard.parent().find('.mid_layer').fadeOut(140);
364 $targetCard.find('.card').removeClass('show');
365 $targetCard.removeClass('show');
369 * Used for update console config
373 updateConfig: function() {
374 PMA_console.config = {
375 alwaysExpand: $('#pma_console_options input[name=always_expand]').prop('checked'),
376 startHistory: $('#pma_console_options input[name=start_history]').prop('checked'),
377 currentQuery: $('#pma_console_options input[name=current_query]').prop('checked')
379 $.cookie('pma_console_config', JSON.stringify(PMA_console.config));
381 isSelect: function (queryString) {
382 var reg_exp = /^SELECT\s+/i;
383 return reg_exp.test(queryString);
389 * Careful: this object UI logics highly related with functions under PMA_console
390 * Resizing min-height is 32, if small than it, console will collapse
392 var PMA_consoleResizer = {
397 * Mousedown event handler for bind to resizer
401 _mousedown: function(event) {
402 if($.cookie('pma_console_mode') !== 'show') {
405 PMA_consoleResizer._posY = event.pageY;
406 PMA_consoleResizer._height = PMA_console.$consoleContent.height();
407 $(document).mousemove(PMA_consoleResizer._mousemove);
408 $(document).mouseup(PMA_consoleResizer._mouseup);
409 // Disable text selection while resizing
410 $(document).bind('selectstart', function(){ return false; });
413 * Mousemove event handler for bind to resizer
417 _mousemove: function(event) {
418 PMA_consoleResizer._resultHeight = PMA_consoleResizer._height + (PMA_consoleResizer._posY -event.pageY);
419 // Content min-height is 32, if adjusting height small than it we'll move it out of the page
420 if(PMA_consoleResizer._resultHeight <= 32) {
421 PMA_console.$consoleAllContents.height(32);
422 PMA_console.$consoleContent.css('margin-bottom', PMA_consoleResizer._resultHeight - 32);
425 // Logic below makes viewable area always at bottom when adjusting height and content already at bottom
426 if(PMA_console.$consoleContent.scrollTop() + PMA_console.$consoleContent.innerHeight() + 16
427 >= PMA_console.$consoleContent.prop('scrollHeight')) {
428 PMA_console.$consoleAllContents.height(PMA_consoleResizer._resultHeight);
429 PMA_console.scrollBottom();
431 PMA_console.$consoleAllContents.height(PMA_consoleResizer._resultHeight);
436 * Mouseup event handler for bind to resizer
440 _mouseup: function() {
441 $.cookie('pma_console_height', PMA_consoleResizer._resultHeight);
443 $(document).unbind('mousemove');
444 $(document).unbind('mouseup');
445 $(document).unbind('selectstart');
448 * Used for console resizer initialize
452 initialize: function() {
453 $('#pma_console .toolbar').unbind('mousedown');
454 $('#pma_console .toolbar').mousedown(PMA_consoleResizer._mousedown);
460 * Console input object
462 var PMA_consoleInput = {
464 * @var array, contains Codemirror objects or input jQuery objects
469 * @var bool, if codemirror enabled
474 * Used for console input initialize
478 initialize: function() {
479 // _cm object can't be reinitialize
480 if(PMA_consoleInput._inputs !== null) {
483 if(typeof CodeMirror !== 'undefined') {
484 PMA_consoleInput._codemirror = true;
486 PMA_consoleInput._inputs = [];
487 if (PMA_consoleInput._codemirror) {
488 PMA_consoleInput._inputs.console = CodeMirror($('#pma_console .console_query_input')[0], {
492 extraKeys: {"Ctrl-Space": "autocomplete"},
493 hintOptions: {"completeSingle": false, "completeOnSingleClick": true},
495 PMA_consoleInput._inputs.console.on("inputRead", codemirrorAutocompleteOnInputRead);
496 if ($('#pma_bookmarks').length !== 0) {
497 PMA_consoleInput._inputs.bookmark = CodeMirror($('#pma_console .bookmark_add_input')[0], {
501 extraKeys: {"Ctrl-Space": "autocomplete"},
502 hintOptions: {"completeSingle": false, "completeOnSingleClick": true},
504 PMA_consoleInput._inputs.bookmark.on("inputRead", codemirrorAutocompleteOnInputRead);
507 PMA_consoleInput._inputs.console =
508 $('<textarea>').appendTo('#pma_console .console_query_input');
509 if ($('#pma_bookmarks').length !== 0) {
510 PMA_consoleInput._inputs.bookmark =
511 $('<textarea>').appendTo('#pma_console .bookmark_add_input');
514 $('#pma_console .console_query_input').keydown(PMA_consoleInput._keydown);
517 * Mousedown event handler for bind to input
518 * Shortcut is ESC key
522 _keydown: function(event) {
523 if(event.ctrlKey && event.keyCode === 13) {
524 PMA_consoleInput.execute();
528 * Used for send text to PMA_console.execute()
532 execute: function() {
533 if (PMA_consoleInput._codemirror) {
534 PMA_console.execute(PMA_consoleInput._inputs.console.getValue());
536 PMA_console.execute(PMA_consoleInput._inputs.console.val());
540 * Used for clear the input
542 * @param string target, default target is console input
545 clear: function(target) {
546 PMA_consoleInput.setText('', target);
549 * Used for set focus to input
554 PMA_consoleInput._inputs.console.focus();
557 * Used for blur input
562 if (PMA_consoleInput._codemirror) {
563 PMA_consoleInput._inputs.console.getInputField().blur();
565 PMA_consoleInput._inputs.console.blur();
569 * Used for set text in input
572 * @param string target
575 setText: function(text, target) {
576 if (PMA_consoleInput._codemirror) {
579 PMA_console.execute(PMA_consoleInput._inputs.bookmark.setValue(text));
583 PMA_console.execute(PMA_consoleInput._inputs.console.setValue(text));
588 PMA_console.execute(PMA_consoleInput._inputs.bookmark.val(text));
592 PMA_console.execute(PMA_consoleInput._inputs.console.val(text));
596 getText: function(target) {
597 if (PMA_consoleInput._codemirror) {
600 return PMA_consoleInput._inputs.bookmark.getValue();
603 return PMA_consoleInput._inputs.console.getValue();
608 return PMA_consoleInput._inputs.bookmark.val();
611 return PMA_consoleInput._inputs.console.val();
620 * Console messages, and message items management object
622 var PMA_consoleMessages = {
624 * Used for clear the messages
629 $('#pma_console .content .console_message_container .message:not(.welcome)').addClass('hide');
630 $('#pma_console .content .console_message_container .message.failed').remove();
631 $('#pma_console .content .console_message_container .message.expanded').find('.action.collapse').click();
634 * Used for show history messages
638 showHistory: function() {
639 $('#pma_console .content .console_message_container .message.hide').removeClass('hide');
642 * Used for log new message
644 * @param string msgString Message to show
645 * @param string msgType Message type
646 * @return object, {message_id, $message}
648 append: function(msgString, msgType) {
649 if(typeof(msgString) !== 'string') {
652 // Generate an ID for each message, we can find them later
653 var msgId = Math.round(Math.random()*(899999999999)+100000000000);
654 var now = new Date();
656 $('<div class="message '
657 + (PMA_console.config.alwaysExpand ? 'expanded' : 'collapsed')
658 +'" msgid="' + msgId + '"><div class="action_content"></div></div>');
661 $newMessage.append('<div class="query highlighted"></div>');
662 if(PMA_consoleInput._codemirror) {
663 CodeMirror.runMode(msgString,
664 'text/x-sql', $newMessage.children('.query')[0]);
666 $newMessage.children('.query').text(msgString);
668 $newMessage.children('.action_content')
669 .append(PMA_console.$consoleTemplates.children('.query_actions').html());
673 $newMessage.append('<div>' + msgString + '</div>');
675 PMA_consoleMessages._msgEventBinds($newMessage);
676 $newMessage.find('span.text.query_time span')
677 .text(now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds())
678 .parent().attr('title', now);
679 return {message_id: msgId,
680 $message: $newMessage.appendTo('#pma_console .content .console_message_container')};
683 * Used for log new query
685 * @param string queryData Struct should be
686 * {sql_query: "Query string", db: "Target DB", table: "Target Table"}
687 * @param string state Message state
688 * @return object, {message_id: string message id, $message: JQuery object}
690 appendQuery: function(queryData, state) {
691 var targetMessage = PMA_consoleMessages.append(queryData.sql_query, 'query');
692 if(! targetMessage) {
695 if(queryData.db && queryData.table) {
696 targetMessage.$message.attr('targetdb', queryData.db);
697 targetMessage.$message.attr('targettable', queryData.table);
698 targetMessage.$message.find('.text.targetdb span').text(queryData.db);
700 if(PMA_console.isSelect(queryData.sql_query)) {
701 targetMessage.$message.addClass('select');
705 targetMessage.$message.addClass('failed');
708 targetMessage.$message.addClass('successed');
712 targetMessage.$message.addClass('pending');
714 return targetMessage;
716 _msgEventBinds: function($targetMessage) {
717 // Leave unbinded elements, remove binded.
718 $targetMessage = $targetMessage.filter(':not(.binded)');
719 if($targetMessage.length === 0) {
722 $targetMessage.addClass('binded');
724 $targetMessage.find('.action.expand').click(function () {
725 $(this).closest('.message').removeClass('collapsed');
726 $(this).closest('.message').addClass('expanded');
728 $targetMessage.find('.action.collapse').click(function () {
729 $(this).closest('.message').addClass('collapsed');
730 $(this).closest('.message').removeClass('expanded');
732 $targetMessage.find('.action.edit').click(function () {
733 PMA_consoleInput.setText($(this).parent().siblings('.query').text());
734 PMA_consoleInput.focus();
736 $targetMessage.find('.action.requery').click(function () {
737 var query = $(this).parent().siblings('.query').text();
738 var $message = $(this).closest('.message');
739 if(confirm(PMA_messages.strConsoleRequeryConfirm + '\n'
740 + (query.length<100 ? query : query.slice(0, 100) + '...'))) {
741 PMA_console.execute(query, {db: $message.attr('targetdb'), table: $message.attr('targettable')});
744 $targetMessage.find('.action.bookmark').click(function () {
745 var query = $(this).parent().siblings('.query').text();
746 var $message = $(this).closest('.message');
747 PMA_consoleBookmarks.addBookmark(query, $message.attr('targetdb'));
748 PMA_console.showCard('#pma_bookmarks .card.add');
750 $targetMessage.find('.action.edit_bookmark').click(function () {
751 var query = $(this).parent().siblings('.query').text();
752 var $message = $(this).closest('.message');
753 var isShared = $message.find('span.bookmark_label').hasClass('shared');
754 var label = $message.find('span.bookmark_label').text();
755 PMA_consoleBookmarks.addBookmark(query, $message.attr('targetdb'), label, isShared);
756 PMA_console.showCard('#pma_bookmarks .card.add');
758 $targetMessage.find('.action.delete_bookmark').click(function () {
759 var $message = $(this).closest('.message');
760 if(confirm(PMA_messages.strConsoleDeleteBookmarkConfirm + '\n' + $message.find('.bookmark_label').text())) {
762 {token: PMA_commonParams.get('token'),
765 id_bookmark: $message.attr('bookmarkid')},
767 PMA_consoleBookmarks.refresh();
771 $targetMessage.find('.action.profiling').click(function () {
772 var $message = $(this).closest('.message');
773 PMA_console.execute($(this).parent().siblings('.query').text(),
774 {db: $message.attr('targetdb'),
775 table: $message.attr('targettable'),
778 $targetMessage.find('.action.explain').click(function () {
779 var $message = $(this).closest('.message');
780 PMA_console.execute('EXPLAIN ' + $(this).parent().siblings('.query').text(),
781 {db: $message.attr('targetdb'),
782 table: $message.attr('targettable')});
784 if(PMA_consoleInput._codemirror) {
785 $targetMessage.find('.query:not(.highlighted)').each(function(index, elem) {
786 CodeMirror.runMode($(elem).text(),
788 $(this).addClass('highlighted');
792 msgAppend: function(msgId, msgString, msgType) {
793 var $targetMessage = $('#pma_console .content .console_message_container .message[msgid=' + msgId +']');
794 if($targetMessage.length === 0 || isNaN(parseInt(msgId)) || typeof(msgString) !== 'string') {
797 $targetMessage.append('<div>' + msgString + '</div>');
799 updateQuery: function(msgId, isSuccessed, queryData) {
800 var $targetMessage = $('#pma_console .console_message_container .message[msgid=' + parseInt(msgId) +']');
801 if($targetMessage.length === 0 || isNaN(parseInt(msgId))) {
804 $targetMessage.removeClass('pending failed successed');
806 $targetMessage.addClass('successed');
808 $targetMessage.children('.query').text('');
809 $targetMessage.removeClass('select');
810 if(PMA_console.isSelect(queryData.sql_query)) {
811 $targetMessage.addClass('select');
813 if(PMA_consoleInput._codemirror) {
814 CodeMirror.runMode(queryData.sql_query, 'text/x-sql', $targetMessage.children('.query')[0]);
816 $targetMessage.children('.query').text(queryData.sql_query);
818 $targetMessage.attr('targetdb', queryData.db);
819 $targetMessage.attr('targettable', queryData.table);
820 $targetMessage.find('.text.targetdb span').text(queryData.db);
823 $targetMessage.addClass('failed');
827 * Used for console messages initialize
831 initialize: function() {
832 PMA_consoleMessages._msgEventBinds($('#pma_console .message:not(.binded)'));
833 if(PMA_console.config.startHistory) {
834 PMA_consoleMessages.showHistory();
841 * Console bookmarks card, and bookmarks items management object
843 var PMA_consoleBookmarks = {
845 addBookmark: function (queryString, targetDb, label, isShared, id) {
846 $('#pma_bookmarks .add [name=shared]').prop('checked', false);
847 $('#pma_bookmarks .add [name=label]').val('');
848 $('#pma_bookmarks .add [name=targetdb]').val('');
849 $('#pma_bookmarks .add [name=id_bookmark]').val('');
850 PMA_consoleInput.setText('', 'bookmark');
852 switch(arguments.length) {
854 $('#pma_bookmarks .add [name=shared]').prop('checked', isShared);
856 $('#pma_bookmarks .add [name=label]').val(label);
858 $('#pma_bookmarks .add [name=targetdb]').val(targetDb);
860 PMA_consoleInput.setText(queryString, 'bookmark');
865 refresh: function () {
866 $.get('import.php?console_bookmark_refresh=refresh&token=' + PMA_commonParams.get('token'),
867 {'ajax_request': true},
869 if(data.console_message_bookmark) {
870 $('#pma_bookmarks .content.bookmark').html(data.console_message_bookmark);
871 PMA_consoleMessages._msgEventBinds($('#pma_bookmarks .message:not(.binded)'));
876 * Used for console bookmarks initialize
877 * message events are already binded by PMA_consoleMsg._msgEventBinds
881 initialize: function() {
882 if($('#pma_bookmarks').length === 0) {
885 $('#pma_console .button.bookmarks').click(function() {
886 PMA_console.showCard('#pma_bookmarks');
888 $('#pma_bookmarks .button.add').click(function() {
889 PMA_console.showCard('#pma_bookmarks .card.add');
891 $('#pma_bookmarks .card.add [name=submit]').click(function () {
892 if ($('#pma_bookmarks .card.add [name=label]').val().length === 0
893 || PMA_consoleInput.getText('bookmark').length === 0)
895 alert(PMA_messages.strFormEmpty);
898 $(this).prop('disabled', true);
900 {token: PMA_commonParams.get('token'),
902 console_bookmark_add: 'true',
903 label: $('#pma_bookmarks .card.add [name=label]').val(),
904 db: $('#pma_bookmarks .card.add [name=targetdb]').val(),
905 bookmark_query: PMA_consoleInput.getText('bookmark'),
906 shared: $('#pma_bookmarks .card.add [name=shared]').prop('checked')},
908 PMA_consoleBookmarks.refresh();
909 $('#pma_bookmarks .card.add [name=submit]').prop('disabled', false);
910 PMA_console.hideCard($('#pma_bookmarks .card.add'));
913 $('#pma_console .button.refresh').click(function() {
914 PMA_consoleBookmarks.refresh();
920 * Executed on page load
923 PMA_console.initialize();