diff options
author | Maurício Meneghini Fauth <mauriciofauth@gmail.com> | 2018-05-12 08:17:51 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauriciofauth@gmail.com> | 2018-05-12 08:17:51 +0300 |
commit | d18076eb96179421081b39e37a1b465e1287753d (patch) | |
tree | 89df6a0d78ad8bd458ff12d22b3f271cfc944e12 /js | |
parent | 3bf83954a07d7eb4fd6372c2e48e054dfacf2a90 (diff) |
Replace .focus() with .on()
.focus() event shorthand is deprecated
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
Diffstat (limited to 'js')
-rw-r--r-- | js/console.js | 8 | ||||
-rw-r--r-- | js/designer/history.js | 4 | ||||
-rw-r--r-- | js/functions.js | 58 | ||||
-rw-r--r-- | js/keyhandler.js | 2 | ||||
-rw-r--r-- | js/makegrid.js | 10 | ||||
-rw-r--r-- | js/navigation.js | 2 | ||||
-rw-r--r-- | js/normalization.js | 6 | ||||
-rw-r--r-- | js/rte.js | 22 | ||||
-rw-r--r-- | js/server_databases.js | 2 | ||||
-rw-r--r-- | js/server_privileges.js | 6 | ||||
-rw-r--r-- | js/server_variables.js | 2 | ||||
-rw-r--r-- | js/sql.js | 2 | ||||
-rw-r--r-- | js/tbl_chart.js | 2 |
13 files changed, 63 insertions, 63 deletions
diff --git a/js/console.js b/js/console.js index a0fe38f24b..79dcbce208 100644 --- a/js/console.js +++ b/js/console.js @@ -135,7 +135,7 @@ var PMA_console = { PMA_console.$consoleContent.on('click', function (event) { if (event.target === this) { - PMA_consoleInput.focus(); + PMA_consoleInput.trigger('focus'); } }); @@ -292,7 +292,7 @@ var PMA_console = { 'fast', 'easeOutQuart', function () { $(window).trigger('resize'); if (inputFocus) { - PMA_consoleInput.focus(); + PMA_consoleInput.trigger('focus'); } }); }, @@ -664,7 +664,7 @@ var PMA_consoleInput = { * @return void */ focus: function () { - PMA_consoleInput._inputs.console.focus(); + PMA_consoleInput._inputs.console.trigger('focus'); }, /** * Used for blur input @@ -873,7 +873,7 @@ var PMA_consoleMessages = { }); $targetMessage.find('.action.edit').on('click', function () { PMA_consoleInput.setText($(this).parent().siblings('.query').text()); - PMA_consoleInput.focus(); + PMA_consoleInput.trigger('focus'); }); $targetMessage.find('.action.requery').on('click', function () { var query = $(this).parent().siblings('.query').text(); diff --git a/js/designer/history.js b/js/designer/history.js index 6aaefbe80b..5d0d965de0 100644 --- a/js/designer/history.js +++ b/js/designer/history.js @@ -821,10 +821,10 @@ function build_query (formtitle, fadin) { } if (vqb_editor) { vqb_editor.setValue(q_select); - vqb_editor.focus(); + vqb_editor.trigger('focus'); } else { $elm.val(q_select); - $elm.focus(); + $elm.trigger('focus'); } } diff --git a/js/functions.js b/js/functions.js index b4351e49b8..a42d3add1c 100644 --- a/js/functions.js +++ b/js/functions.js @@ -393,7 +393,7 @@ function PMA_sprintf () { */ function PMA_hideShowDefaultValue ($default_type) { if ($default_type.val() === 'USER_DEFINED') { - $default_type.siblings('.default_value').show().focus(); + $default_type.siblings('.default_value').show().trigger('focus'); } else { $default_type.siblings('.default_value').hide(); if ($default_type.val() === 'NULL') { @@ -731,7 +731,7 @@ function confirmQuery (theForm1, sqlQuery1) { return true; } else { // statement is rejected -> do not submit the form - window.focus(); + window.trigger('focus'); return false; } // end if (handle confirm box result) } // end if (display confirm box) @@ -777,9 +777,9 @@ function checkSqlQuery (theForm) { } if (codemirror_editor) { - codemirror_editor.focus(); + codemirror_editor.trigger('focus'); } else if (codemirror_inline_editor) { - codemirror_inline_editor.focus(); + codemirror_inline_editor.trigger('focus'); } return result; } // end of the 'checkSqlQuery()' function @@ -823,12 +823,12 @@ function checkFormElementInRange (theForm, theFieldName, message, min, max) { if (isNaN(val)) { theField.select(); alert(PMA_messages.strEnterValidNumber); - theField.focus(); + theField.trigger('focus'); return false; } else if (val < min || val > max) { theField.select(); alert(PMA_sprintf(message, val)); - theField.focus(); + theField.trigger('focus'); return false; } else { theField.value = val; @@ -860,7 +860,7 @@ function checkTableEditForm (theForm, fieldsCnt) { if (isNaN(val) && elm3.val() !== '') { elm2.select(); alert(PMA_messages.strEnterValidLength); - elm2.focus(); + elm2.trigger('focus'); return false; } } @@ -875,7 +875,7 @@ function checkTableEditForm (theForm, fieldsCnt) { if (atLeastOneField === 0) { var theField = theForm.elements.field_0_1; alert(PMA_messages.strFormEmpty); - theField.focus(); + theField.trigger('focus'); return false; } @@ -883,7 +883,7 @@ function checkTableEditForm (theForm, fieldsCnt) { var $input = $('input.textfield[name=\'table\']'); if ($input.val() === '') { alert(PMA_messages.strFormEmpty); - $input.focus(); + $input.trigger('focus'); return false; } @@ -1107,10 +1107,10 @@ function setSelectOptions (the_form, the_select, do_check) { function setQuery (query) { if (codemirror_editor) { codemirror_editor.setValue(query); - codemirror_editor.focus(); + codemirror_editor.trigger('focus'); } else if (document.sqlform) { document.sqlform.sql_query.value = query; - document.sqlform.sql_query.focus(); + document.sqlform.sql_query.trigger('focus'); } } @@ -1251,10 +1251,10 @@ function insertValueQuery () { /* CodeMirror support */ if (codemirror_editor) { codemirror_editor.replaceSelection(columnsList); - codemirror_editor.focus(); + codemirror_editor.trigger('focus'); // IE support } else if (document.selection) { - myQuery.focus(); + myQuery.trigger('focus'); var sel = document.selection.createRange(); sel.text = columnsList; // MOZILLA/NETSCAPE support @@ -1264,7 +1264,7 @@ function insertValueQuery () { var SqlString = document.sqlform.sql_query.value; myQuery.value = SqlString.substring(0, startPos) + columnsList + SqlString.substring(endPos, SqlString.length); - myQuery.focus(); + myQuery.trigger('focus'); } else { myQuery.value += columnsList; } @@ -2035,12 +2035,12 @@ function bindCodeMirrorToInlineEditor () { codemirror_inline_editor = PMA_getSQLEditor($inline_editor); codemirror_inline_editor.getWrapperElement().style.height = height; codemirror_inline_editor.refresh(); - codemirror_inline_editor.focus(); + codemirror_inline_editor.trigger('focus'); $(codemirror_inline_editor.getWrapperElement()) .on('keydown', catchKeypressesFromSqlInlineEdit); } else { $inline_editor - .focus() + .trigger('focus') .on('keydown', catchKeypressesFromSqlInlineEdit); } } @@ -3031,7 +3031,7 @@ function PMA_checkPassword ($the_form) { alert(alert_msg); $password.val(''); $password_repeat.val(''); - $password.focus(); + $password.trigger('focus'); return false; } return true; @@ -3053,7 +3053,7 @@ AJAX.registerOnload('functions.js', function () { } else if (this.value === 'hosttable') { hostname.val('').prop('required', false); } else if (this.value === 'userdefined') { - hostname.focus().select().prop('required', true); + hostname.trigger('focus').select().prop('required', true); } }); @@ -3069,7 +3069,7 @@ AJAX.registerOnload('functions.js', function () { $('#pma_username').val('').prop('required', false); $('#user_exists_warning').css('display', 'none'); } else if (this.value === 'userdefined') { - $('#pma_username').focus().select().prop('required', true); + $('#pma_username').trigger('focus').select().prop('required', true); } }); @@ -3086,7 +3086,7 @@ AJAX.registerOnload('functions.js', function () { $('#text_pma_pw').prop('required', false).val(''); } else if (this.value === 'userdefined') { $('#text_pma_pw2').prop('required', true); - $('#text_pma_pw').prop('required', true).focus().select(); + $('#text_pma_pw').prop('required', true).trigger('focus').select(); } else { $('#text_pma_pw2').prop('required', false); $('#text_pma_pw').prop('required', false); @@ -3183,7 +3183,7 @@ AJAX.registerOnload('functions.js', function () { $('fieldset#fieldset_change_password') .find('legend').remove().end() .find('table.noclick').unwrap().addClass('some-margin') - .find('input#text_pma_pw').focus(); + .find('input#text_pma_pw').trigger('focus'); $('#fieldset_change_password_footer').hide(); PMA_ajaxRemoveMessage($msgbox); $('#change_password_form').on('submit', function (e) { @@ -3462,7 +3462,7 @@ AJAX.registerOnload('functions.js', function () { buttons: buttonOptions, open: function () { // Focus the "Go" button after opening the dialog - $(this).closest('.ui-dialog').find('.ui-dialog-buttonpane button:first').focus(); + $(this).closest('.ui-dialog').find('.ui-dialog-buttonpane button:first').trigger('focus'); }, close: function () { $(this).remove(); @@ -3608,7 +3608,7 @@ AJAX.registerOnload('functions.js', function () { } return false; }); - $(this).closest('.ui-dialog').find('.ui-dialog-buttonpane button:first').focus(); + $(this).closest('.ui-dialog').find('.ui-dialog-buttonpane button:first').trigger('focus'); }, close: function () { $('#col_list').off('click', '.pick'); @@ -3700,7 +3700,7 @@ AJAX.registerOnload('functions.js', function () { if ($(this).find('option:selected').val() === '') { return true; } - $(this).closest('tr').find('input').focus(); + $(this).closest('tr').find('input').trigger('focus'); }; while (rows_to_add--) { @@ -3854,14 +3854,14 @@ function showIndexEditDialog ($outer) { if ($(this).find('option:selected').val() === '') { return true; } - $(this).closest('tr').find('input').focus(); + $(this).closest('tr').find('input').trigger('focus'); }); // Focus the slider, otherwise it looks nearly transparent $('a.ui-slider-handle').addClass('ui-state-focus'); // set focus on index name input, if empty var input = $outer.find('input#input_index_name'); if (! input.val()) { - input.focus(); + input.trigger('focus'); } } @@ -4324,11 +4324,11 @@ AJAX.registerOnload('functions.js', function () { if ($elm.length > 0) { if (typeof CodeMirror !== 'undefined') { codemirror_editor = PMA_getSQLEditor($elm); - codemirror_editor.focus(); + codemirror_editor.trigger('focus'); codemirror_editor.on('blur', updateQueryParameters); } else { // without codemirror - $elm.focus().on('blur', updateQueryParameters); + $elm.trigger('focus').on('blur', updateQueryParameters); } } PMA_highlightSQL($('body')); @@ -4578,7 +4578,7 @@ function PMA_createViewDialog ($this) { }); // Attach syntax highlighted editor codemirror_editor = PMA_getSQLEditor($dialog.find('textarea')); - $('input:visible[type=text]', $dialog).first().focus(); + $('input:visible[type=text]', $dialog).first().trigger('focus'); } else { PMA_ajaxShowMessage(data.error); } diff --git a/js/keyhandler.js b/js/keyhandler.js index a5e459fa1a..b68dadec1a 100644 --- a/js/keyhandler.js +++ b/js/keyhandler.js @@ -90,7 +90,7 @@ function onKeyDownArrowsHandler (e) { var lvalue = o.selectedIndex; var nOvalue = nO.selectedIndex; - nO.focus(); + nO.trigger('focus'); if (is_firefox) { var ffcheck = 0; diff --git a/js/makegrid.js b/js/makegrid.js index 59f0d2041d..ddff82cead 100644 --- a/js/makegrid.js +++ b/js/makegrid.js @@ -606,7 +606,7 @@ function PMA_makegrid (t, enableResize, enableReorder, enableVisib, enableGridEd $(g.cEdit).find('.edit_box').val(value); g.currentEditCell = cell; - $(g.cEdit).find('.edit_box').focus(); + $(g.cEdit).find('.edit_box').trigger('focus'); moveCursorToEnd($(g.cEdit).find('.edit_box')); $(g.cEdit).find('*').prop('disabled', false); } @@ -616,7 +616,7 @@ function PMA_makegrid (t, enableResize, enableReorder, enableVisib, enableGridEd var originalValue = input.val(); var originallength = originalValue.length; input.val(''); - input.blur().focus().val(originalValue); + input.blur().trigger('focus').val(originalValue); input[0].setSelectionRange(originallength, originallength); } }, @@ -1616,7 +1616,7 @@ function PMA_makegrid (t, enableResize, enableReorder, enableVisib, enableGridEd resizable: false, modal: true }) - .find('input').focus().select(); + .find('input').trigger('focus').select(); }); $(g.t).find('th.draggable a') .dblclick(function (e) { @@ -2032,7 +2032,7 @@ function PMA_makegrid (t, enableResize, enableReorder, enableVisib, enableGridEd $(g.cEditStd).on('keydown', 'input.edit_box, select', handleCtrlNavigation); - $(g.cEditStd).find('.edit_box').focus(function () { + $(g.cEditStd).find('.edit_box').on('focus', function () { g.showEditArea(); }); $(g.cEditStd).on('keydown', '.edit_box, select', function (e) { @@ -2051,7 +2051,7 @@ function PMA_makegrid (t, enableResize, enableReorder, enableVisib, enableGridEd $(g.cEditTextarea).on('keydown', 'textarea.edit_box, select', handleCtrlNavigation); - $(g.cEditTextarea).find('.edit_box').focus(function () { + $(g.cEditTextarea).find('.edit_box').on('focus', function () { g.showEditArea(); }); $(g.cEditTextarea).on('keydown', '.edit_box, select', function (e) { diff --git a/js/navigation.js b/js/navigation.js index 3168b25041..4829645cb5 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -1602,7 +1602,7 @@ PMA_fastFilter.filter.prototype.restore = function (focus) { this.$this.html(this.$clone.html()).children().show(); this.$this.data('fastFilter', this); if (focus) { - this.$this.find('li.fast_filter input.searchClause').focus(); + this.$this.find('li.fast_filter input.searchClause').trigger('focus'); } } this.searchClause = ''; diff --git a/js/normalization.js b/js/normalization.js index 41de567f29..7558808685 100644 --- a/js/normalization.js +++ b/js/normalization.js @@ -424,11 +424,11 @@ function moveRepeatingGroup (repeatingCols) { var newTable = $('input[name=repeatGroupTable]').val(); var newColumn = $('input[name=repeatGroupColumn]').val(); if (!newTable) { - $('input[name=repeatGroupTable]').focus(); + $('input[name=repeatGroupTable]').trigger('focus'); return false; } if (!newColumn) { - $('input[name=repeatGroupColumn]').focus(); + $('input[name=repeatGroupColumn]').trigger('focus'); return false; } datastring = { @@ -521,7 +521,7 @@ AJAX.registerOnload('normalization.js', function () { $('.tblFooters').on('click','#saveSplit', function () { central_column_list = []; if ($('#newCols #field_0_1').val() === '') { - $('#newCols #field_0_1').focus(); + $('#newCols #field_0_1').trigger('focus'); return false; } var argsep = PMA_commonParams.get('arg_separator'); @@ -77,16 +77,16 @@ RTE.COMMON = { // and the definition must be provided for an item $elm = $('table.rte_table').last().find('input[name=item_name]'); if ($elm.val() === '') { - $elm.focus(); + $elm.trigger('focus'); alert(PMA_messages.strFormEmpty); return false; } $elm = $('table.rte_table').find('textarea[name=item_definition]'); if ($elm.val() === '') { if (this.syntaxHiglighter !== null) { - this.syntaxHiglighter.focus(); + this.syntaxHiglighter.trigger('focus'); } else { - $('textarea[name=item_definition]').last().focus(); + $('textarea[name=item_definition]').last().trigger('focus'); } alert(PMA_messages.strFormEmpty); return false; @@ -344,7 +344,7 @@ RTE.COMMON = { if ($('#rteDialog').parents('.ui-dialog').height() > $(window).height()) { $('#rteDialog').dialog('option', 'height', $(window).height()); } - $(this).find('input[name=item_name]').focus(); + $(this).find('input[name=item_name]').trigger('focus'); $(this).find('input.datefield').each(function () { PMA_addDatepicker($(this).css('width', '95%'), 'date'); }); @@ -554,7 +554,7 @@ RTE.EVENT = { // The interval field must not be empty for recurring events $elm = this.$ajaxDialog.find('input[name=item_interval_value]'); if ($elm.val() === '') { - $elm.focus(); + $elm.trigger('focus'); alert(PMA_messages.strFormEmpty); return false; } @@ -562,7 +562,7 @@ RTE.EVENT = { // The execute_at field must not be empty for "once off" events $elm = this.$ajaxDialog.find('input[name=item_execute_at]'); if ($elm.val() === '') { - $elm.focus(); + $elm.trigger('focus'); alert(PMA_messages.strFormEmpty); return false; } @@ -672,7 +672,7 @@ RTE.ROUTINE = { inputname.substr(0, 15) === 'item_param_name' || inputname.substr(0, 15) === 'item_param_type') { if ($(this).val() === '') { - $(this).focus(); + $(this).trigger('focus'); isSuccess = false; return false; } @@ -694,7 +694,7 @@ RTE.ROUTINE = { if (($inputtyp.val() === 'ENUM' || $inputtyp.val() === 'SET' || $inputtyp.val().substr(0, 3) === 'VAR') && $inputlen.val() === '' ) { - $inputlen.focus(); + $inputlen.trigger('focus'); isSuccess = false; return false; } @@ -712,7 +712,7 @@ RTE.ROUTINE = { if (($returntyp.val() === 'ENUM' || $returntyp.val() === 'SET' || $returntyp.val().substr(0, 3) === 'VAR') && $returnlen.val() === '' ) { - $returnlen.focus(); + $returnlen.trigger('focus'); alert(PMA_messages.strFormEmpty); return false; } @@ -720,7 +720,7 @@ RTE.ROUTINE = { if ($('select[name=item_type]').find(':selected').val() === 'FUNCTION') { // A function must contain a RETURN statement in its definition if (this.$ajaxDialog.find('table.rte_table').find('textarea[name=item_definition]').val().toUpperCase().indexOf('RETURN') < 0) { - this.syntaxHiglighter.focus(); + this.syntaxHiglighter.trigger('focus'); alert(PMA_messages.MissingReturn); return false; } @@ -869,7 +869,7 @@ RTE.ROUTINE = { $(this).remove(); } }); - $ajaxDialog.find('input[name^=params]').first().focus(); + $ajaxDialog.find('input[name^=params]').first().trigger('focus'); /** * Attach the datepickers to the relevant form fields */ diff --git a/js/server_databases.js b/js/server_databases.js index 2285619b74..79b4431a67 100644 --- a/js/server_databases.js +++ b/js/server_databases.js @@ -102,7 +102,7 @@ AJAX.registerOnload('server_databases.js', function () { // TODO Remove this section when all browsers support HTML5 "required" property var newDbNameInput = $form.find('input[name=new_db]'); if (newDbNameInput.val() === '') { - newDbNameInput.focus(); + newDbNameInput.trigger('focus'); alert(PMA_messages.strFormEmpty); return; } diff --git a/js/server_privileges.js b/js/server_privileges.js index eef6f26405..123633258c 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -17,13 +17,13 @@ function checkAddUser (the_form) { if (the_form.elements.pred_hostname.value === 'userdefined' && the_form.elements.hostname.value === '') { alert(PMA_messages.strHostEmpty); - the_form.elements.hostname.focus(); + the_form.elements.hostname.trigger('focus'); return false; } if (the_form.elements.pred_username.value === 'userdefined' && the_form.elements.username.value === '') { alert(PMA_messages.strUserEmpty); - the_form.elements.username.focus(); + the_form.elements.username.trigger('focus'); return false; } @@ -466,7 +466,7 @@ AJAX.registerOnload('server_privileges.js', function () { $('html, body').animate({ scrollTop: 0 }, 'fast'); }; - $('input.autofocus').focus(); + $('input.autofocus').trigger('focus'); $(checkboxes_sel).trigger('change'); displayPasswordGenerateButton(); if ($('#edit_user_dialog').length > 0) { diff --git a/js/server_variables.js b/js/server_variables.js index eb82dc0e77..a0c2576994 100644 --- a/js/server_variables.js +++ b/js/server_variables.js @@ -92,7 +92,7 @@ AJAX.registerOnload('server_variables.js', function () { .data('content', $valueCell.html()) .html($editor) .find('input') - .focus() + .trigger('focus') .on('keydown', function (event) { // Keyboard shortcuts if (event.keyCode === 13) { // Enter key $mySaveLink.trigger('click'); @@ -743,7 +743,7 @@ AJAX.registerOnload('sql.js', function () { if (query.length === 0) { alert(PMA_messages.strFormEmpty); - $('#sqlquery').focus(); + $('#sqlquery').trigger('focus'); return false; } diff --git a/js/tbl_chart.js b/js/tbl_chart.js index 30688716aa..b3cc1f6cbc 100644 --- a/js/tbl_chart.js +++ b/js/tbl_chart.js @@ -309,7 +309,7 @@ AJAX.registerOnload('tbl_chart.js', function () { // handle changes in chart title $('input[name="chartTitle"]') - .focus(function () { + .on('focus', function () { temp_chart_title = $(this).val(); }) .on('keyup', function () { |