diff options
author | Robin McCorkell <rmccorkell@karoshi.org.uk> | 2015-03-15 19:47:22 +0000 |
---|---|---|
committer | Robin McCorkell <rmccorkell@karoshi.org.uk> | 2015-03-24 22:25:30 +0000 |
commit | c68fd6d5e3739ebc318a27838dbce13ba8df2b02 (patch) | |
tree | e7b89821bcae5cf231eb1c4101abc9e534bcc539 /apps/files_external/js | |
parent | 1db177b84102e1285359fe9effb91f015d8ff634 (diff) | |
download | nextcloud-server-c68fd6d5e3739ebc318a27838dbce13ba8df2b02.tar.gz nextcloud-server-c68fd6d5e3739ebc318a27838dbce13ba8df2b02.zip |
Use individual timers for separate config rows
Diffstat (limited to 'apps/files_external/js')
-rw-r--r-- | apps/files_external/js/settings.js | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 9e4d026980f..254bab30c56 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -412,7 +412,7 @@ MountConfigListView.prototype = { /** * Flag whether the list is about user storage configs (true) * or global storage configs (false) - * + * * @type bool */ _isPersonal: false, @@ -488,35 +488,12 @@ MountConfigListView.prototype = { _initEvents: function() { var self = this; - this.$el.on('paste', 'td input', function() { - var $me = $(this); - var $tr = $me.closest('tr'); - setTimeout(function() { - highlightInput($me); - self.saveStorageConfig($tr); - }, 20); - }); - - var timer; - - this.$el.on('keyup', 'td input', function() { - clearTimeout(timer); - var $tr = $(this).closest('tr'); - highlightInput($(this)); - if ($(this).val) { - timer = setTimeout(function() { - self.saveStorageConfig($tr); - }, 2000); - } - }); - - this.$el.on('change', 'td input:checkbox', function() { - self.saveStorageConfig($(this).closest('tr')); - }); - - this.$el.on('change', '.applicable', function() { - self.saveStorageConfig($(this).closest('tr')); - }); + var onChangeHandler = _.bind(this._onChange, this); + //this.$el.on('input', 'td input', onChangeHandler); + this.$el.on('keyup', 'td input', onChangeHandler); + this.$el.on('paste', 'td input', onChangeHandler); + this.$el.on('change', 'td input:checkbox', onChangeHandler); + this.$el.on('change', '.applicable', onChangeHandler); this.$el.on('click', '.status>span', function() { self.recheckStorageConfig($(this).closest('tr')); @@ -529,6 +506,20 @@ MountConfigListView.prototype = { this.$el.on('change', '.selectBackend', _.bind(this._onSelectBackend, this)); }, + _onChange: function(event) { + var self = this; + var $target = $(event.target); + highlightInput($target); + var $tr = $target.closest('tr'); + + var timer = $tr.data('save-timer'); + clearTimeout(timer); + timer = setTimeout(function() { + self.saveStorageConfig($tr); + }, 2000); + $tr.data('save-timer', timer); + }, + _onSelectBackend: function(event) { var $target = $(event.target); var $el = this.$el; |