From 3b862bd70bc1804f28e557dc8dd1cbde71f67f34 Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Tue, 10 Jul 2018 10:59:53 +0100 Subject: [PATCH] More jQuery 3 updates. --- web/pgadmin/browser/static/js/wizard.js | 2 +- .../misc/file_manager/static/js/utility.js | 6 +- web/pgadmin/settings/static/js/settings.js | 2 +- web/pgadmin/static/js/keyboard_shortcuts.js | 4 +- .../js/selection/xcell_selection_model.js | 2 +- web/pgadmin/static/js/slickgrid/editors.js | 62 +++++++++---------- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/web/pgadmin/browser/static/js/wizard.js b/web/pgadmin/browser/static/js/wizard.js index ef59b0017..adbe9183c 100644 --- a/web/pgadmin/browser/static/js/wizard.js +++ b/web/pgadmin/browser/static/js/wizard.js @@ -230,7 +230,7 @@ define([ finishWizard: function() { this.onFinish(); this.remove(); // Remove view from DOM - this.unbind(); // Unbind all local event bindings + this.off(); // Unbind all local event bindings delete this.$el; // Delete the jQuery wrapped object variable delete this.el; // Delete the variable reference to this node return true; diff --git a/web/pgadmin/misc/file_manager/static/js/utility.js b/web/pgadmin/misc/file_manager/static/js/utility.js index 14a5226ab..33444cc5e 100644 --- a/web/pgadmin/misc/file_manager/static/js/utility.js +++ b/web/pgadmin/misc/file_manager/static/js/utility.js @@ -1355,7 +1355,7 @@ define([ self.data_cap = cap; - $('.storage_dialog #uploader .input-path').keyup(function(e) { + $('.storage_dialog #uploader .input-path').on('keyup',function(e) { if (e.keyCode == 13) { e.stopPropagation(); var path = $(this).val(); @@ -1567,7 +1567,7 @@ define([ $file_element.find('p input').toggle().val(lg.new_folder).select(); // rename folder/file on pressing enter key - $('.file_manager').bind().on('keyup', function(e) { + $('.file_manager').on('keyup', function(e) { if (e.keyCode == 13) { e.stopPropagation(); $file_element.find('p input').trigger('blur'); @@ -1608,7 +1608,7 @@ define([ $file_element_list.find('p input').toggle().val(lg.new_folder).select(); // rename folder/file on pressing enter key - $('.file_manager').bind().on('keyup', function(e) { + $('.file_manager').on('keyup', function(e) { if (e.keyCode == 13) { e.stopPropagation(); $file_element_list.find('p input').trigger('blur'); diff --git a/web/pgadmin/settings/static/js/settings.js b/web/pgadmin/settings/static/js/settings.js index bcb9df77a..8c361fb8c 100644 --- a/web/pgadmin/settings/static/js/settings.js +++ b/web/pgadmin/settings/static/js/settings.js @@ -36,7 +36,7 @@ define('pgadmin.settings', [ }) .done(function() { // Prevent saving layout on server for next page reload. - $(window).unbind('unload'); + $(window).off('unload'); window.onbeforeunload = null; // Now reload page location.reload(true); diff --git a/web/pgadmin/static/js/keyboard_shortcuts.js b/web/pgadmin/static/js/keyboard_shortcuts.js index 57d8a3032..232f67fd6 100644 --- a/web/pgadmin/static/js/keyboard_shortcuts.js +++ b/web/pgadmin/static/js/keyboard_shortcuts.js @@ -247,7 +247,7 @@ function keyboardShortcutsQueryTool( isDivider = false; } } - currLi.find('a:first').focus(); + currLi.find('a:first').trigger('focus'); } } else if(keyCode === LEFT_KEY || keyCode === RIGHT_KEY) { /*Apply only for dropdown*/ @@ -269,7 +269,7 @@ function keyboardShortcutsQueryTool( currLi = currLiMenu.closest('.dropdown-submenu'); } } - currLi.find('a:first').focus(); + currLi.find('a:first').trigger('focus'); } } diff --git a/web/pgadmin/static/js/selection/xcell_selection_model.js b/web/pgadmin/static/js/selection/xcell_selection_model.js index 36ce964cc..dc4c9ccf2 100644 --- a/web/pgadmin/static/js/selection/xcell_selection_model.js +++ b/web/pgadmin/static/js/selection/xcell_selection_model.js @@ -41,7 +41,7 @@ define([ grid.registerPlugin(_selector); _selector.onCellRangeSelected.subscribe(handleCellRangeSelected); _selector.onBeforeCellRangeSelected.subscribe(handleBeforeCellRangeSelected); - $(window.parent).mouseup(handleWindowMouseUp); + $(window.parent).on('mouseup',handleWindowMouseUp); } function destroy() { diff --git a/web/pgadmin/static/js/slickgrid/editors.js b/web/pgadmin/static/js/slickgrid/editors.js index 7652bf3b5..3d7916bb8 100644 --- a/web/pgadmin/static/js/slickgrid/editors.js +++ b/web/pgadmin/static/js/slickgrid/editors.js @@ -138,10 +138,10 @@ $buttons.find('button:first').on('click', this.save); $buttons.find('button:last').on('click', this.cancel); - $input.bind('keydown', this.handleKeyDown); + $input.on('keydown', this.handleKeyDown); scope.position(args.position); - $input.focus().select(); + $input.trigger('focus').trigger('select'); }; this.handleKeyDown = function(e) { @@ -188,7 +188,7 @@ }; this.focus = function() { - $input.focus(); + $input.trigger('focus'); }; // When text editor opens @@ -210,11 +210,11 @@ $input.val(defaultValue = '\\"\\"'); } else { $input.val(defaultValue = item[args.column.field]); - $input.select(); + $input.trigger('select'); } } else { $input.val(defaultValue = item[args.column.field]); - $input.select(); + $input.trigger('select'); } }; @@ -295,10 +295,10 @@ $buttons.find('button:first').on('click', this.save); $buttons.find('button:last').on('click', this.cancel); - $input.bind('keydown', this.handleKeyDown); + $input.on('keydown', this.handleKeyDown); scope.position(args.position); - $input.focus().select(); + $input.trigger('focus').trigger('select'); }; this.handleKeyDown = function(e) { @@ -345,7 +345,7 @@ }; this.focus = function() { - $input.focus(); + $input.trigger('focus'); }; this.loadValue = function(item) { @@ -364,7 +364,7 @@ data = '[' + temp.join() + ']'; } $input.val(data); - $input.select(); + $input.trigger('select'); }; this.serializeValue = function() { @@ -417,10 +417,10 @@ $buttons = getButtons(false).appendTo($wrapper); $buttons.find('button:first').on('click', this.cancel); - $input.bind('keydown', this.handleKeyDown); + $input.on('keydown', this.handleKeyDown); scope.position(args.position); - $input.focus().select(); + $input.trigger('focus').trigger('select'); }; this.handleKeyDown = function(e) { @@ -465,12 +465,12 @@ }; this.focus = function() { - $input.focus(); + $input.trigger('focus'); }; this.loadValue = function(item) { $input.val(defaultValue = item[args.column.field]); - $input.select(); + $input.trigger('select'); }; this.serializeValue = function() { @@ -516,10 +516,10 @@ $buttons = getButtons(false).appendTo($wrapper); $buttons.find('button:first').on('click', this.cancel); - $input.bind('keydown', this.handleKeyDown); + $input.on('keydown', this.handleKeyDown); scope.position(args.position); - $input.focus().select(); + $input.trigger('focus').trigger('select'); }; this.handleKeyDown = function(e) { @@ -564,7 +564,7 @@ }; this.focus = function() { - $input.focus(); + $input.trigger('focus'); }; this.loadValue = function(item) { @@ -583,7 +583,7 @@ data = '[' + temp.join() + ']'; } $input.val(data); - $input.select(); + $input.trigger('select'); }; this.serializeValue = function() { @@ -622,13 +622,13 @@ this.init = function() { $input = $('') .appendTo(args.container) - .bind('keydown.nav', function(e) { + .on('keydown.nav', function(e) { if (e.keyCode === $.ui.keyCode.LEFT || e.keyCode === $.ui.keyCode.RIGHT) { e.stopImmediatePropagation(); } }) - .focus() - .select(); + .trigger('focus') + .trigger('select'); }; this.destroy = function() { @@ -636,7 +636,7 @@ }; this.focus = function() { - $input.focus(); + $input.trigger('focus'); }; this.getValue = function() { @@ -653,7 +653,7 @@ defaultValue = value; $input.val(defaultValue); $input[0].defaultValue = defaultValue; - $input.select(); + $input.trigger('select'); }; this.serializeValue = function() { @@ -692,7 +692,7 @@ this.init = function() { $select = $(''); $select.appendTo(args.container); - $select.focus(); + $select.trigger('focus'); }; this.destroy = function() { @@ -700,7 +700,7 @@ }; this.focus = function() { - $select.focus(); + $select.trigger('focus'); }; this.loadValue = function(item) { @@ -755,14 +755,14 @@ this.init = function() { $input = $(''); - $input.bind('keydown.nav', function(e) { + $input.on('keydown.nav', function(e) { if (e.keyCode === $.ui.keyCode.LEFT || e.keyCode === $.ui.keyCode.RIGHT) { e.stopImmediatePropagation(); } }); $input.appendTo(args.container); - $input.focus().select(); + $input.trigger('focus').trigger('select'); }; this.destroy = function() { @@ -770,7 +770,7 @@ }; this.focus = function() { - $input.focus(); + $input.trigger('focus'); }; this.loadValue = function(item) { @@ -783,7 +783,7 @@ } $input[0].defaultValue = defaultValue; - $input.select(); + $input.trigger('select'); }; this.serializeValue = function() { @@ -888,10 +888,10 @@ this.init = function() { $select = $('
'); $select.appendTo(args.container); - $select.focus(); + $select.trigger('focus'); // The following code is taken from https://css-tricks.com/indeterminate-checkboxes/ - $select.bind('click', function() { + $select.on('click', function() { el = $(this); var states = ['unchecked', 'partial', 'checked']; var curState = el.find('.check').data('state'); @@ -908,7 +908,7 @@ }; this.focus = function() { - $select.focus(); + $select.trigger('focus'); }; this.loadValue = function(item) {