diff options
author | Jacob Thornton <jacobthornton@gmail.com> | 2011-09-10 23:49:21 +0400 |
---|---|---|
committer | Jacob Thornton <jacobthornton@gmail.com> | 2011-09-10 23:49:21 +0400 |
commit | 48aa209348c47df65f4edb0d8a36ccaac357eb0a (patch) | |
tree | 7dfef7b52a39319c75d6d0fd657b9f9c8f0dfeed /js/bootstrap-modal.js | |
parent | 79d5f907130a030963b802647e3ed3bcb6300a46 (diff) |
more tests, more js goodness
Diffstat (limited to 'js/bootstrap-modal.js')
-rw-r--r-- | js/bootstrap-modal.js | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index 4b4f05ae36..54cbad4b11 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -40,10 +40,10 @@ } this.$element = $(content) - .bind('modal:open', $.proxy(this.open, this)) - .bind('modal:close', $.proxy(this.close, this)) + .bind('modal:show', $.proxy(this.show, this)) + .bind('modal:hide', $.proxy(this.hide, this)) .bind('modal:toggle', $.proxy(this.toggle, this)) - .delegate('.close', 'click', $.proxy(this.close, this)) + .delegate('.close', 'click', $.proxy(this.hide, this)) return this } @@ -51,12 +51,12 @@ Modal.prototype = { toggle: function () { - return this[!this.isOpen ? 'open' : 'close']() + return this[!this.isShown ? 'show' : 'hide']() } - , open: function () { + , show: function () { var that = this - this.isOpen = true + this.isShown = true _.escape.call(this) _.backdrop.call(this) @@ -73,12 +73,12 @@ return this } - , close: function (e) { + , hide: function (e) { e && e.preventDefault() var that = this - this.isOpen = false + this.isShown = false _.escape.call(this) _.backdrop.call(this) @@ -108,11 +108,11 @@ backdrop: function () { var that = this , animate = this.$element.hasClass('fade') ? 'fade' : '' - if ( this.isOpen && this.settings.backdrop ) { + if ( this.isShown && this.settings.backdrop ) { this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') - .click(function () { that.close() }) + .click($.proxy(this.hide, this)) .appendTo(document.body) - } else if ( !this.isOpen && this.$backdrop ) { + } else if ( !this.isShown && this.$backdrop ) { this.$backdrop.removeClass('in') function removeElement() { @@ -128,13 +128,13 @@ , escape: function () { var that = this - if ( this.isOpen && this.settings.closeOnEscape ) { + if ( this.isShown && this.settings.closeOnEscape ) { $('body').bind('keyup.modal.escape', function ( e ) { if ( e.which == 27 ) { - that.close() + that.hide() } }) - } else if ( !this.isOpen ) { + } else if ( !this.isShown ) { $('body').unbind('keyup.modal.escape') } } @@ -156,7 +156,7 @@ $.fn.modal.defaults = { backdrop: false - , closeOnEscape: false + , hideOnEscape: false } })( jQuery || ender )
\ No newline at end of file |