Repository: couchdb-fauxton Updated Branches: refs/heads/master 5bd29916a -> b030b218a
Fix coding style Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/c6e6a438 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/c6e6a438 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/c6e6a438 Branch: refs/heads/master Commit: c6e6a438f9bd29434215c93f0552db8192fecf75 Parents: 5bd2991 Author: Robert Kowalski <[email protected]> Authored: Thu Feb 12 19:13:40 2015 +0100 Committer: Robert Kowalski <[email protected]> Committed: Tue Feb 17 13:46:30 2015 +0100 ---------------------------------------------------------------------- app/addons/fauxton/components.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c6e6a438/app/addons/fauxton/components.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js index 9ec992a..73b28f6 100644 --- a/app/addons/fauxton/components.js +++ b/app/addons/fauxton/components.js @@ -807,31 +807,29 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { this.removeIncorrectAnnotations(); } - var that = this; this.editor.getSession().on('change', function () { - that.setHeightToLineCount(); - that.edited = true; - }); + this.setHeightToLineCount(); + this.edited = true; + }.bind(this)); - $(window).on('beforeunload.editor_'+this.editorId, function() { - if (that.edited) { + $(window).on('beforeunload.editor_' + this.editorId, function () { + if (this.edited) { return 'Your changes have not been saved. Click cancel to return to the document.'; } - }); + }.bind(this)); - FauxtonAPI.beforeUnload("editor_"+this.editorId, function (deferred) { - if (that.edited) { + FauxtonAPI.beforeUnload('editor_' + this.editorId, function (deferred) { + if (this.edited) { return 'Your changes have not been saved. Click cancel to return to the document.'; } - }); + }.bind(this)); }, cleanup: function () { - $(window).off('beforeunload.editor_'+this.editorId); + $(window).off('beforeunload.editor_' + this.editorId); $(window).off('resize.editor', this.onPageResize); - FauxtonAPI.removeBeforeUnload("editor_"+this.editorId); + FauxtonAPI.removeBeforeUnload('editor_' + this.editorId); this.editor.destroy(); - this.stopListening(FauxtonAPI.Events, FauxtonAPI.constants.EVENTS.NAVBAR_SIZE_CHANGED); }, // we need to track the possible available height of the editor to tell it how large it can grow vertically
