From: fat Date: Fri, 17 May 2013 00:18:15 +0000 (-0700) Subject: straight trash wang X-Git-Tag: v3.0.0-rc1~353 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=149ecd21bf7c56df897088d09ca309eb43a7dd9d;p=thirdparty%2Fbootstrap.git straight trash wang --- diff --git a/js/alert.js b/js/alert.js index 9df950245c..b841b4f5aa 100644 --- a/js/alert.js +++ b/js/alert.js @@ -45,7 +45,7 @@ $parent = $this.hasClass('alert') ? $this : $this.parent() } - $parent.trigger(e = $.Event('bs-close')) + $parent.trigger(e = $.Event('bs:alert:close')) if (e.isDefaultPrevented()) return @@ -79,8 +79,8 @@ $.fn.alert.Constructor = Alert - /* ALERT NO CONFLICT - * ================= */ + // ALERT NO CONFLICT + // ================= $.fn.alert.noConflict = function () { $.fn.alert = old @@ -89,7 +89,7 @@ // ALERT DATA-API - // ============== */ + // ============== $(document).on('click.bs-alert.bs-data-api', dismiss, Alert.prototype.close) diff --git a/js/carousel.js b/js/carousel.js index b647ee9f15..33b34af087 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -111,7 +111,7 @@ $next = $next.length ? $next : this.$element.find('.item')[fallback]() - var e = $.Event('slide', { relatedTarget: $next[0], direction: direction }) + var e = $.Event('bs:carousel:slide', { relatedTarget: $next[0], direction: direction }) if ($next.hasClass('active')) return @@ -159,11 +159,11 @@ $.fn.carousel = function (option) { return this.each(function () { var $this = $(this) - var data = $this.data('carousel') + var data = $this.data('bs-carousel') var options = $.extend({}, Carousel.DEFAULTS, typeof option == 'object' && option) var action = typeof option == 'string' ? option : options.slide - if (!data) $this.data('carousel', (data = new Carousel(this, options))) + if (!data) $this.data('bs-carousel', (data = new Carousel(this, options))) if (typeof option == 'number') data.to(option) else if (action) data[action]() else if (options.interval) data.pause().cycle() @@ -181,6 +181,7 @@ return this } + // CAROUSEL DATA-API // ================= diff --git a/js/collapse.js b/js/collapse.js index 457996d120..c9db1767f6 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -56,7 +56,7 @@ } this.$element[dimension](0) - this.transition('addClass', $.Event('show'), 'shown') + this.transition('addClass', $.Event('bs:collapse:show'), 'shown') if ($.support.transition) this.$element[dimension](this.$element[0][scroll]) } @@ -65,7 +65,7 @@ if (this.transitioning || !this.$element.hasClass('in')) return var dimension = this.dimension() this.reset(this.$element[dimension]()) - this.transition('removeClass', $.Event('hide'), 'hidden') + this.transition('removeClass', $.Event('bs:collapse:hide'), 'hidden') this.$element[dimension](0) } diff --git a/js/dropdown.js b/js/dropdown.js index c3ad78895b..c76162b1cc 100644 --- a/js/dropdown.js +++ b/js/dropdown.js @@ -20,7 +20,6 @@ !function ($) { "use strict"; - // DROPDOWN CLASS DEFINITION // ========================= diff --git a/js/modal.js b/js/modal.js index 9c88188129..7acd3930a2 100644 --- a/js/modal.js +++ b/js/modal.js @@ -18,207 +18,198 @@ * ========================================================= */ -!function ($) { +!function ($) { "use strict"; - "use strict"; // jshint ;_; - - - /* MODAL CLASS DEFINITION - * ====================== */ + // MODAL CLASS DEFINITION + // ====================== var Modal = function (element, options) { - this.options = options - this.$element = $(element) - .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) - this.options.remote && this.$element.find('.modal-body').load(this.options.remote) - } + this.options = options + this.$element = $(element).delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) + this.$backdrop = + this.isShown = null - Modal.prototype = { + if (this.options.remote) this.$element.find('.modal-body').load(this.options.remote) + } - constructor: Modal + Modal.DEFAULTS = { + backdrop: true + , keyboard: true + , show: true + } - , toggle: function () { - return this[!this.isShown ? 'show' : 'hide']() - } + Modal.prototype.toggle = function () { + return this[!this.isShown ? 'show' : 'hide']() + } - , show: function () { - var that = this - , e = $.Event('show') + Modal.prototype.show = function () { + var that = this + var e = $.Event('bs:modal:show') - this.$element.trigger(e) + this.$element.trigger(e) - if (this.isShown || e.isDefaultPrevented()) return + if (this.isShown || e.isDefaultPrevented()) return - this.isShown = true + this.isShown = true - this.escape() + this.escape() - this.backdrop(function () { - var transition = $.support.transition && that.$element.hasClass('fade') + this.backdrop(function () { + var transition = $.support.transition && that.$element.hasClass('fade') - if (!that.$element.parent().length) { - that.$element.appendTo(document.body) //don't move modals dom position - } + if (!that.$element.parent().length) { + that.$element.appendTo(document.body) //don't move modals dom position + } - that.$element.show() + that.$element.show() - if (transition) { - that.$element[0].offsetWidth // force reflow - } + if (transition) { + that.$element[0].offsetWidth // force reflow + } - that.$element - .addClass('in') - .attr('aria-hidden', false) + that.$element + .addClass('in') + .attr('aria-hidden', false) - that.enforceFocus() + that.enforceFocus() - transition ? - that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) : - that.$element.focus().trigger('shown') + transition ? + that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('bs:modal:shown') }) : + that.$element.focus().trigger('bs:modal:shown') - }) - } + }) + } - , hide: function (e) { - e && e.preventDefault() + Modal.prototype.show = function (e) { + if (e) e.preventDefault() - var that = this + e = $.Event('bs:modal:hide') - e = $.Event('hide') + this.$element.trigger(e) - this.$element.trigger(e) + if (!this.isShown || e.isDefaultPrevented()) return - if (!this.isShown || e.isDefaultPrevented()) return + this.isShown = false - this.isShown = false + this.escape() - this.escape() + $(document).off('focusin.modal') - $(document).off('focusin.modal') + this.$element + .removeClass('in') + .attr('aria-hidden', true) - this.$element - .removeClass('in') - .attr('aria-hidden', true) + $.support.transition && this.$element.hasClass('fade') ? + this.hideWithTransition() : + this.hideModal() + } - $.support.transition && this.$element.hasClass('fade') ? - this.hideWithTransition() : - this.hideModal() + Modal.prototype.enforceFocus = function () { + $(document).on('focusin.modal', function (e) { + if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { + this.$element.focus() } + }, this) + } - , enforceFocus: function () { - var that = this - $(document).on('focusin.modal', function (e) { - if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { - that.$element.focus() - } - }) - } + Modal.prototype.escape = function () { + if (this.isShown && this.options.keyboard) { + this.$element.on('keyup.dismiss.modal', function ( e ) { + e.which == 27 && this.hide() + }, this) + } else if (!this.isShown) { + this.$element.off('keyup.dismiss.modal') + } + } - , escape: function () { - var that = this - if (this.isShown && this.options.keyboard) { - this.$element.on('keyup.dismiss.modal', function ( e ) { - e.which == 27 && that.hide() - }) - } else if (!this.isShown) { - this.$element.off('keyup.dismiss.modal') - } - } + Modal.prototype.hideWithTransition = function () { + var that = this + var timeout = setTimeout(function () { + that.$element.off($.support.transition.end) + that.hideModal() + }, 500) - , hideWithTransition: function () { - var that = this - , timeout = setTimeout(function () { - that.$element.off($.support.transition.end) - that.hideModal() - }, 500) - - this.$element.one($.support.transition.end, function () { - clearTimeout(timeout) - that.hideModal() - }) - } + this.$element.one($.support.transition.end, function () { + clearTimeout(timeout) + that.hideModal() + }) + } - , hideModal: function () { - var that = this - this.$element.hide() - this.backdrop(function () { - that.removeBackdrop() - that.$element.trigger('hidden') - }) - } + Modal.prototype.hideModal = function () { + var that = this + this.$element.hide() + this.backdrop(function () { + that.removeBackdrop() + that.$element.trigger('bs:modal:hidden') + }) + } - , removeBackdrop: function () { - this.$backdrop && this.$backdrop.remove() - this.$backdrop = null - } + Modal.prototype.removeBackdrop: function () { + this.$backdrop && this.$backdrop.remove() + this.$backdrop = null + } - , backdrop: function (callback) { - var that = this - , animate = this.$element.hasClass('fade') ? 'fade' : '' + Modal.prototype.backdrop: function (callback) { + var that = this + var animate = this.$element.hasClass('fade') ? 'fade' : '' - if (this.isShown && this.options.backdrop) { - var doAnimate = $.support.transition && animate + if (this.isShown && this.options.backdrop) { + var doAnimate = $.support.transition && animate - this.$backdrop = $('