From 1c3660d2137c5176ac80210ab84f1811d2dc91a6 Mon Sep 17 00:00:00 2001 From: Piyush Vijay Date: Fri, 20 Jul 2018 17:46:49 +0530 Subject: [PATCH] Comment code in js/functions.js to disable tirggering of codemirror loading from js/functions.js Signed-Off-By: Piyush Vijay --- js/functions.js | 139 ------------------------------------------------ 1 file changed, 139 deletions(-) diff --git a/js/functions.js b/js/functions.js index acf352bb15..a3a33c546c 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1808,121 +1808,6 @@ function getJSConfirmCommonParam (elem, params) { return params; } -/** - * Unbind all event handlers before tearing down a page - */ -AJAX.registerTeardown('functions.js', function () { - $(document).off('click', 'a.inline_edit_sql'); - $(document).off('click', 'input#sql_query_edit_save'); - $(document).off('click', 'input#sql_query_edit_discard'); - $('input.sqlbutton').off('click'); - if (codemirror_editor) { - codemirror_editor.off('blur'); - } else { - $(document).off('blur', '#sqlquery'); - } - $(document).off('change', '#parameterized'); - $(document).off('click', 'input.sqlbutton'); - $('#sqlquery').off('keydown'); - $('#sql_query_edit').off('keydown'); - - if (codemirror_inline_editor) { - // Copy the sql query to the text area to preserve it. - $('#sql_query_edit').text(codemirror_inline_editor.getValue()); - $(codemirror_inline_editor.getWrapperElement()).off('keydown'); - codemirror_inline_editor.toTextArea(); - codemirror_inline_editor = false; - } - if (codemirror_editor) { - $(codemirror_editor.getWrapperElement()).off('keydown'); - } -}); - -/** - * Jquery Coding for inline editing SQL_QUERY - */ -AJAX.registerOnload('functions.js', function () { - // If we are coming back to the page by clicking forward button - // of the browser, bind the code mirror to inline query editor. - bindCodeMirrorToInlineEditor(); - $(document).on('click', 'a.inline_edit_sql', function () { - if ($('#sql_query_edit').length) { - // An inline query editor is already open, - // we don't want another copy of it - return false; - } - - var $form = $(this).prev('form'); - var sql_query = $form.find('input[name=\'sql_query\']').val().trim(); - var $inner_sql = $(this).parent().prev().find('code.sql'); - var old_text = $inner_sql.html(); - - var new_content = '\n'; - new_content += getForeignKeyCheckboxLoader(); - new_content += '\n'; - new_content += '\n'; - var $editor_area = $('div#inline_editor'); - if ($editor_area.length === 0) { - $editor_area = $('
'); - $editor_area.insertBefore($inner_sql); - } - $editor_area.html(new_content); - loadForeignKeyCheckbox(); - $inner_sql.hide(); - - bindCodeMirrorToInlineEditor(); - return false; - }); - - $(document).on('click', 'input#sql_query_edit_save', function () { - // hide already existing success message - var sql_query; - if (codemirror_inline_editor) { - codemirror_inline_editor.save(); - sql_query = codemirror_inline_editor.getValue(); - } else { - sql_query = $(this).parent().find('#sql_query_edit').val(); - } - var fk_check = $(this).parent().find('#fk_checks').is(':checked'); - - var $form = $('a.inline_edit_sql').prev('form'); - var $fake_form = $('
', { action: 'import.php', method: 'post' }) - .append($form.find('input[name=server], input[name=db], input[name=table], input[name=token]').clone()) - .append($('', { type: 'hidden', name: 'show_query', value: 1 })) - .append($('', { type: 'hidden', name: 'is_js_confirmed', value: 0 })) - .append($('', { type: 'hidden', name: 'sql_query', value: sql_query })) - .append($('', { type: 'hidden', name: 'fk_checks', value: fk_check ? 1 : 0 })); - if (! checkSqlQuery($fake_form[0])) { - return false; - } - $('.success').hide(); - $fake_form.appendTo($('body')).submit(); - }); - - $(document).on('click', 'input#sql_query_edit_discard', function () { - var $divEditor = $('div#inline_editor_outer'); - $divEditor.siblings('code.sql').show(); - $divEditor.remove(); - }); - - $(document).on('click', 'input.sqlbutton', function (evt) { - insertQuery(evt.target.id); - PMA_handleSimulateQueryButton(); - return false; - }); - - $(document).on('change', '#parameterized', updateQueryParameters); - - var $inputUsername = $('#input_username'); - if ($inputUsername) { - if ($inputUsername.val() === '') { - $inputUsername.trigger('focus'); - } else { - $('#input_password').trigger('focus'); - } - } -}); - /** * "inputRead" event handler for CodeMirror SQL query editors for autocompletion */ @@ -4316,30 +4201,6 @@ function PMA_slidingMessage (msg, $obj) { return true; } // end PMA_slidingMessage() -/** - * Attach CodeMirror2 editor to SQL edit area. - */ -AJAX.registerOnload('functions.js', function () { - var $elm = $('#sqlquery'); - if ($elm.length > 0) { - if (typeof CodeMirror !== 'undefined') { - codemirror_editor = PMA_getSQLEditor($elm); - codemirror_editor.focus(); - codemirror_editor.on('blur', updateQueryParameters); - } else { - // without codemirror - $elm.focus().on('blur', updateQueryParameters); - } - } - PMA_highlightSQL($('body')); -}); -AJAX.registerTeardown('functions.js', function () { - if (codemirror_editor) { - $('#sqlquery').text(codemirror_editor.getValue()); - codemirror_editor.toTextArea(); - codemirror_editor = false; - } -}); AJAX.registerOnload('functions.js', function () { // initializes all lock-page elements lock-id and // val-hash data property