diff options
author | fat <jacobthornton@gmail.com> | 2013-05-17 04:44:50 +0400 |
---|---|---|
committer | fat <jacobthornton@gmail.com> | 2013-05-17 04:44:50 +0400 |
commit | a72d0d6e3a5f2691eaa7e036a7b081d021097159 (patch) | |
tree | ca0c1037f00dad04ed1d19bcded06762bbfd2cc5 /docs/assets/js/bootstrap.js | |
parent | 19de2e86035746b4cda13d4e3860bc549b4f4841 (diff) |
fix tests
Diffstat (limited to 'docs/assets/js/bootstrap.js')
-rw-r--r-- | docs/assets/js/bootstrap.js | 1226 |
1 files changed, 592 insertions, 634 deletions
diff --git a/docs/assets/js/bootstrap.js b/docs/assets/js/bootstrap.js index 77ed438b8e..a8501d592d 100644 --- a/docs/assets/js/bootstrap.js +++ b/docs/assets/js/bootstrap.js @@ -18,34 +18,31 @@ * ========================================================== */ -!function ($) { - - "use strict"; - +!function ($) { "use strict"; - /* CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) - * ======================================================= */ + // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) + // ============================================================ function transitionEnd() { - var el = document.createElement('bootstrap'); + var el = document.createElement('bootstrap') var transEndEventNames = { - 'WebkitTransition' : 'webkitTransitionEnd' - , 'MozTransition' : 'transitionend' - , 'OTransition' : 'oTransitionEnd otransitionend' - , 'transition' : 'transitionend' - }; + 'WebkitTransition' : 'webkitTransitionEnd' + , 'MozTransition' : 'transitionend' + , 'OTransition' : 'oTransitionEnd otransitionend' + , 'transition' : 'transitionend' + } for (var name in transEndEventNames) { if (el.style[name] !== undefined) { - return { end: transEndEventNames[name] }; + return { end: transEndEventNames[name] } } } } $(function () { - $.support.transition = transitionEnd(); - }); + $.support.transition = transitionEnd() + }) }(window.jQuery); /* ========================================================== @@ -95,7 +92,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 @@ -129,8 +126,8 @@ $.fn.alert.Constructor = Alert - /* ALERT NO CONFLICT - * ================= */ + // ALERT NO CONFLICT + // ================= $.fn.alert.noConflict = function () { $.fn.alert = old @@ -139,7 +136,7 @@ // ALERT DATA-API - // ============== */ + // ============== $(document).on('click.bs-alert.bs-data-api', dismiss, Alert.prototype.close) @@ -362,7 +359,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 @@ -410,11 +407,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() @@ -432,6 +429,7 @@ return this } + // CAROUSEL DATA-API // ================= @@ -509,7 +507,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]) } @@ -518,7 +516,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) } @@ -626,7 +624,6 @@ !function ($) { "use strict"; - // DROPDOWN CLASS DEFINITION // ========================= @@ -766,207 +763,198 @@ * ========================================================= */ -!function ($) { - - "use strict"; // jshint ;_; - +!function ($) { "use strict"; - /* 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 = $('<div class="modal-backdrop ' + animate + '" />') - .appendTo(document.body) + this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') + .appendTo(document.body) - this.$backdrop.click( - this.options.backdrop == 'static' ? - $.proxy(this.$element[0].focus, this.$element[0]) - : $.proxy(this.hide, this) - ) + this.$backdrop.click( + this.options.backdrop == 'static' ? + $.proxy(this.$element[0].focus, this.$element[0]) + : $.proxy(this.hide, this) + ) - if (doAnimate) this.$backdrop[0].offsetWidth // force reflow + if (doAnimate) this.$backdrop[0].offsetWidth // force reflow - this.$backdrop.addClass('in') + this.$backdrop.addClass('in') - if (!callback) return + if (!callback) return - doAnimate ? - this.$backdrop.one($.support.transition.end, callback) : - callback() + doAnimate ? + this.$backdrop.one($.support.transition.end, callback) : + callback() - } else if (!this.isShown && this.$backdrop) { - this.$backdrop.removeClass('in') + } else if (!this.isShown && this.$backdrop) { + this.$backdrop.removeClass('in') - $.support.transition && this.$element.hasClass('fade')? - this.$backdrop.one($.support.transition.end, callback) : - callback() + $.support.transition && this.$element.hasClass('fade')? + this.$backdrop.one($.support.transition.end, callback) : + callback() - } else if (callback) { - callback() - } - } + } else if (callback) { + callback() + } } - /* MODAL PLUGIN DEFINITION - * ======================= */ + // MODAL PLUGIN DEFINITION + // ======================= var old = $.fn.modal $.fn.modal = function (option) { return this.each(function () { - var $this = $(this) - , data = $this.data('modal') - , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option) - if (!data) $this.data('modal', (data = new Modal(this, options))) + var $this = $(this) + var data = $this.data('bs-modal') + var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) + + if (!data) $this.data('bs-modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option]() else if (options.show) data.show() }) } - $.fn.modal.defaults = { - backdrop: true - , keyboard: true - , show: true - } - $.fn.modal.Constructor = Modal - /* MODAL NO CONFLICT - * ================= */ + // MODAL NO CONFLICT + // ================= $.fn.modal.noConflict = function () { $.fn.modal = old @@ -974,14 +962,14 @@ } - /* MODAL DATA-API - * ============== */ + // MODAL DATA-API + // ============== $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) { - var $this = $(this) - , href = $this.attr('href') - , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 - , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data()) + var $this = $(this) + var href = $this.attr('href') + var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 + var option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data()) e.preventDefault() @@ -993,8 +981,8 @@ }) var $body = $(document.body) - .on('shown', '.modal', function () { $body.addClass('modal-open') }) - .on('hidden', '.modal', function () { $body.removeClass('modal-open') }) + .on('bs:modal:shown', '.modal', function () { $body.addClass('modal-open') }) + .on('bs:modal:hidden', '.modal', function () { $body.removeClass('modal-open') }) }(window.jQuery); /* =========================================================== @@ -1018,339 +1006,331 @@ * ========================================================== */ -!function ($) { - - "use strict"; // jshint ;_; - +!function ($) { "use strict"; - /* TOOLTIP PUBLIC CLASS DEFINITION - * =============================== */ + // TOOLTIP PUBLIC CLASS DEFINITION + // =============================== var Tooltip = function (element, options) { + this.type = + this.options = + this.enabled = + this.timeout = + this.hoverState = + this.$element = null + this.init('tooltip', element, options) } - Tooltip.prototype = { + Tooltip.DEFAULTS = { + animation: true + , placement: 'top' + , selector: false + , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' + , trigger: 'hover focus' + , title: '' + , delay: 0 + , html: false + , container: false + } - constructor: Tooltip + Tooltip.prototype.init = function (type, element, options) { + this.type = type + this.options = this.getOptions(options) + this.enabled = true + this.$element = $(element) - , init: function (type, element, options) { - var eventIn - , eventOut - , triggers - , trigger - , i + var triggers = this.options.trigger.split(' ') - this.type = type - this.$element = $(element) - this.options = this.getOptions(options) - this.enabled = true + for (var i = triggers.length; i--;) { + var trigger = triggers[i] - triggers = this.options.trigger.split(' ') + if (trigger == 'click') { + this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) + } else if (trigger != 'manual') { + var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus' + var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur' - for (i = triggers.length; i--;) { - trigger = triggers[i] - if (trigger == 'click') { - this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) - } else if (trigger != 'manual') { - eventIn = trigger == 'hover' ? 'mouseenter' : 'focus' - eventOut = trigger == 'hover' ? 'mouseleave' : 'blur' - this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) - this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) - } + this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) + this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) } - - this.options.selector ? - (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : - this.fixTitle() } - , getOptions: function (options) { - options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options) + this.options.selector ? + (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : + this.fixTitle() + } - if (options.delay && typeof options.delay == 'number') { - options.delay = { - show: options.delay - , hide: options.delay - } - } + Tooltip.prototype.getDefaults = function () { + return Tooltip.DEFAULTS + } - return options + Tooltip.prototype.getOptions = function (options) { + options = $.extend({}, this.getDefaults(), this.$element.data(), options) + + if (options.delay && typeof options.delay == 'number') { + options.delay = { + show: options.delay + , hide: options.delay + } } - , enter: function (e) { - var defaults = $.fn[this.type].defaults - , options = {} - , self + return options + } - this._options && $.each(this._options, function (key, value) { - if (defaults[key] != value) options[key] = value - }, this) + Tooltip.prototype.enter = function (e) { + var defaults = $.fn[this.type].defaults + var options = {} - self = $(e.currentTarget)[this.type](options).data(this.type) + this._options && $.each(this._options, function (key, value) { + if (defaults[key] != value) options[key] = value + }, this) - if (!self.options.delay || !self.options.delay.show) return self.show() + var self = $(e.currentTarget)[this.type](options).data(this.type) - clearTimeout(this.timeout) - self.hoverState = 'in' - this.timeout = setTimeout(function() { - if (self.hoverState == 'in') self.show() - }, self.options.delay.show) - } + if (!self.options.delay || !self.options.delay.show) return self.show() - , leave: function (e) { - var self = $(e.currentTarget)[this.type](this._options).data(this.type) + clearTimeout(this.timeout) - if (this.timeout) clearTimeout(this.timeout) - if (!self.options.delay || !self.options.delay.hide) return self.hide() + self.hoverState = 'in' + this.timeout = setTimeout(function() { + if (self.hoverState == 'in') self.show() + }, self.options.delay.show) + } - self.hoverState = 'out' - this.timeout = setTimeout(function() { - if (self.hoverState == 'out') self.hide() - }, self.options.delay.hide) - } + Tooltip.prototype.leave = function (e) { + var self = $(e.currentTarget)[this.type](this._options).data(this.type) - , show: function () { - var $tip - , pos - , actualWidth - , actualHeight - , placement - , tp - , e = $.Event('show') + if (this.timeout) clearTimeout(this.timeout) + if (!self.options.delay || !self.options.delay.hide) return self.hide() - if (this.hasContent() && this.enabled) { - this.$element.trigger(e) - if (e.isDefaultPrevented()) return - $tip = this.tip() - this.setContent() + self.hoverState = 'out' + this.timeout = setTimeout(function() { + if (self.hoverState == 'out') self.hide() + }, self.options.delay.hide) + } - if (this.options.animation) { - $tip.addClass('fade') - } + Tooltip.prototype.show = function () { + var e = $.Event('bs:'+ this.type + ':show') - placement = typeof this.options.placement == 'function' ? - this.options.placement.call(this, $tip[0], this.$element[0]) : - this.options.placement + if (this.hasContent() && this.enabled) { + this.$element.trigger(e) - $tip - .detach() - .css({ top: 0, left: 0, display: 'block' }) + if (e.isDefaultPrevented()) return - this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) + var $tip = this.tip() - pos = this.getPosition() + this.setContent() - actualWidth = $tip[0].offsetWidth - actualHeight = $tip[0].offsetHeight + if (this.options.animation) $tip.addClass('fade') - switch (placement) { - case 'bottom': - tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} - break - case 'top': - tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} - break - case 'left': - tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} - break - case 'right': - tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} - break - } - - this.applyPlacement(tp, placement) - this.$element.trigger('shown') + var placement = typeof this.options.placement == 'function' ? + this.options.placement.call(this, $tip[0], this.$element[0]) : + this.options.placement + + $tip + .detach() + .css({ top: 0, left: 0, display: 'block' }) + + this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) + + var tp + var pos = this.getPosition() + var actualWidth = $tip[0].offsetWidth + var actualHeight = $tip[0].offsetHeight + + switch (placement) { + case 'bottom': + tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} + break + case 'top': + tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} + break + case 'left': + tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} + break + case 'right': + tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} + break } + + this.applyPlacement(tp, placement) + this.$element.trigger('shown') } + } - , applyPlacement: function(offset, placement){ - var $tip = this.tip() - , width = $tip[0].offsetWidth - , height = $tip[0].offsetHeight - , actualWidth - , actualHeight - , delta - , replace + Tooltip.prototype.applyPlacement = function(offset, placement) { + var replace + var $tip = this.tip() + var width = $tip[0].offsetWidth + var height = $tip[0].offsetHeight - $tip - .offset(offset) - .addClass(placement) - .addClass('in') + $tip + .offset(offset) + .addClass(placement) + .addClass('in') - actualWidth = $tip[0].offsetWidth - actualHeight = $tip[0].offsetHeight + var actualWidth = $tip[0].offsetWidth + var actualHeight = $tip[0].offsetHeight - if (placement == 'top' && actualHeight != height) { - offset.top = offset.top + height - actualHeight - replace = true - } + if (placement == 'top' && actualHeight != height) { + replace = true + offset.top = offset.top + height - actualHeight + } - if (placement == 'bottom' || placement == 'top') { - delta = 0 + if (placement == 'bottom' || placement == 'top') { + var delta = 0 - if (offset.left < 0){ - delta = offset.left * -2 - offset.left = 0 - $tip.offset(offset) - actualWidth = $tip[0].offsetWidth - actualHeight = $tip[0].offsetHeight - } + if (offset.left < 0){ + delta = offset.left * -2 + offset.left = 0 - this.replaceArrow(delta - width + actualWidth, actualWidth, 'left') - } else { - this.replaceArrow(actualHeight - height, actualHeight, 'top') + $tip.offset(offset) + + actualWidth = $tip[0].offsetWidth + actualHeight = $tip[0].offsetHeight } - if (replace) $tip.offset(offset) + this.replaceArrow(delta - width + actualWidth, actualWidth, 'left') + } else { + this.replaceArrow(actualHeight - height, actualHeight, 'top') } - , replaceArrow: function(delta, dimension, position){ - this - .arrow() - .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') - } + if (replace) $tip.offset(offset) + } - , setContent: function () { - var $tip = this.tip() - , title = this.getTitle() + Tooltip.prototype.replaceArrow = function(delta, dimension, position) { + this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') + } - $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) - $tip.removeClass('fade in top bottom left right') - } + Tooltip.prototype.setContent = function () { + var $tip = this.tip() + var title = this.getTitle() - , hide: function () { - var that = this - , $tip = this.tip() - , e = $.Event('hide') + $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) + $tip.removeClass('fade in top bottom left right') + } - this.$element.trigger(e) - if (e.isDefaultPrevented()) return + Tooltip.prototype.hide = function () { + var that = this + var $tip = this.tip() + var e = $.Event('bs:' + this.type + ':hide') - $tip.removeClass('in') + this.$element.trigger(e) - function removeWithAnimation() { - var timeout = setTimeout(function () { - $tip.off($.support.transition.end).detach() - }, 500) + if (e.isDefaultPrevented()) return - $tip.one($.support.transition.end, function () { - clearTimeout(timeout) - $tip.detach() - }) - } + $tip.removeClass('in') - $.support.transition && this.$tip.hasClass('fade') ? - removeWithAnimation() : + function removeWithAnimation() { + var timeout = setTimeout(function () { + $tip.off($.support.transition.end).detach() + }, 500) + + $tip.one($.support.transition.end, function () { + clearTimeout(timeout) $tip.detach() + }) + } - this.$element.trigger('hidden') + $.support.transition && this.$tip.hasClass('fade') ? + removeWithAnimation() : + $tip.detach() - return this - } + this.$element.trigger('hidden') - , fixTitle: function () { - var $e = this.$element - if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { - $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') - } - } + return this + } - , hasContent: function () { - return this.getTitle() + Tooltip.prototype.fixTitle = function () { + var $e = this.$element + if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { + $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') } + } - , getPosition: function () { - var el = this.$element[0] - return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : { - width: el.offsetWidth - , height: el.offsetHeight - }, this.$element.offset()) - } + Tooltip.prototype.hasContent = function () { + return this.getTitle() + } - , getTitle: function () { - var title - , $e = this.$element - , o = this.options + Tooltip.prototype.getPosition = function () { + var el = this.$element[0] + return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : { + width: el.offsetWidth + , height: el.offsetHeight + }, this.$element.offset()) + } - title = $e.attr('data-original-title') - || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) + Tooltip.prototype.getTitle = function () { + var title + var $e = this.$element + var o = this.options - return title - } + title = $e.attr('data-original-title') + || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) - , tip: function () { - return this.$tip = this.$tip || $(this.options.template) - } + return title + } - , arrow: function(){ - return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow") - } + Tooltip.prototype.tip = function () { + return this.$tip = this.$tip || $(this.options.template) + } - , validate: function () { - if (!this.$element[0].parentNode) { - this.hide() - this.$element = null - this.options = null - } - } + Tooltip.prototype.arrow =function(){ + return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow") + } - , enable: function () { - this.enabled = true + Tooltip.prototype.validate = function () { + if (!this.$element[0].parentNode) { + this.hide() + this.$element = null + this.options = null } + } - , disable: function () { - this.enabled = false - } + Tooltip.prototype.enable = function () { + this.enabled = true + } - , toggleEnabled: function () { - this.enabled = !this.enabled - } + Tooltip.prototype.disable = function () { + this.enabled = false + } - , toggle: function (e) { - var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this - self.tip().hasClass('in') ? self.hide() : self.show() - } + Tooltip.prototype.toggleEnabled = function () { + this.enabled = !this.enabled + } - , destroy: function () { - this.hide().$element.off('.' + this.type).removeData(this.type) - } + Tooltip.prototype.toggle = function (e) { + var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this + self.tip().hasClass('in') ? self.hide() : self.show() + } + Tooltip.prototype.destroy = function () { + this.hide().$element.off('.' + this.type).removeData(this.type) } - /* TOOLTIP PLUGIN DEFINITION - * ========================= */ + // TOOLTIP PLUGIN DEFINITION + // ========================= var old = $.fn.tooltip - $.fn.tooltip = function ( option ) { + $.fn.tooltip = function (option) { return this.each(function () { - var $this = $(this) - , data = $this.data('tooltip') - , options = typeof option == 'object' && option - if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) + var $this = $(this) + var data = $this.data('bs-tooltip') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs-tooltip', (data = new Tooltip(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.tooltip.Constructor = Tooltip - $.fn.tooltip.defaults = { - animation: true - , placement: 'top' - , selector: false - , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' - , trigger: 'hover focus' - , title: '' - , delay: 0 - , html: false - , container: false - } - - /* TOOLTIP NO CONFLICT - * =================== */ + // TOOLTIP NO CONFLICT + // =================== $.fn.tooltip.noConflict = function () { $.fn.tooltip = old @@ -1378,93 +1358,88 @@ * =========================================================== */ -!function ($) { - - "use strict"; // jshint ;_; - +!function ($) { "use strict"; - /* POPOVER PUBLIC CLASS DEFINITION - * =============================== */ + // POPOVER PUBLIC CLASS DEFINITION + // =============================== var Popover = function (element, options) { this.init('popover', element, options) } + Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, { + placement: 'right' + , trigger: 'click' + , content: '' + , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' + }) - /* NOTE: POPOVER EXTENDS tooltip.js - ========================================== */ - Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, { + // NOTE: POPOVER EXTENDS tooltip.js + // ================================ - constructor: Popover + Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) - , setContent: function () { - var $tip = this.tip() - , title = this.getTitle() - , content = this.getContent() + Popover.prototype.constructor = Popover - $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) - $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content) + Popover.prototype.getDefaults = function () { + return Popover.DEFAULTS + } - $tip.removeClass('fade top bottom left right in') - } + Popover.prototype.setContent = function () { + var $tip = this.tip() + var title = this.getTitle() + var content = this.getContent() - , hasContent: function () { - return this.getTitle() || this.getContent() - } + $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) + $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content) - , getContent: function () { - var content - , $e = this.$element - , o = this.options + $tip.removeClass('fade top bottom left right in') + } - content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) - || $e.attr('data-content') + Popover.prototype.hasContent = function () { + return this.getTitle() || this.getContent() + } - return content - } + Popover.prototype.getContent = function () { + var content = typeof this.options.content == 'function' ? + this.options.content.call(this.$element[0]) : + this.options.content - , tip: function () { - if (!this.$tip) { - this.$tip = $(this.options.template) - } - return this.$tip - } + return content || this.$element.attr('data-content') + } - , destroy: function () { - this.hide().$element.off('.' + this.type).removeData(this.type) - } + Popover.prototype.tip = function () { + if (!this.$tip) this.$tip = $(this.options.template) + return this.$tip + } - }) + Popover.prototype.destroy = function () { + this.hide().$element.off('.' + this.type).removeData(this.type) + } - /* POPOVER PLUGIN DEFINITION - * ======================= */ + // POPOVER PLUGIN DEFINITION + // ========================= var old = $.fn.popover $.fn.popover = function (option) { return this.each(function () { - var $this = $(this) - , data = $this.data('popover') - , options = typeof option == 'object' && option - if (!data) $this.data('popover', (data = new Popover(this, options))) + var $this = $(this) + var data = $this.data('bs-popover') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs-popover', (data = new Popover(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.popover.Constructor = Popover - $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, { - placement: 'right' - , trigger: 'click' - , content: '' - , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' - }) - - /* POPOVER NO CONFLICT - * =================== */ + // POPOVER NO CONFLICT + // =================== $.fn.popover.noConflict = function () { $.fn.popover = old @@ -1492,130 +1467,124 @@ * ============================================================== */ -!function ($) { - - "use strict"; // jshint ;_; - +!function ($) { "use strict"; - /* SCROLLSPY CLASS DEFINITION - * ========================== */ + // SCROLLSPY CLASS DEFINITION + // ========================== function ScrollSpy(element, options) { - var process = $.proxy(this.process, this) - , $element = $(element).is('body') ? $(window) : $(element) - , href - this.options = $.extend({}, $.fn.scrollspy.defaults, options) + var href + var process = $.proxy(this.process, this) + var $element = $(element).is('body') ? $(window) : $(element) + + this.$body = $('body') this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process) - this.selector = (this.options.target + this.options = $.extend({}, ScrollSpy.DEFAULTS, options) + this.selector = (this.options.target || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 || '') + ' .nav li > a' - this.$body = $('body') + this.offsets = $([]) + this.targets = $([]) + this.activeTarget = null + this.refresh() this.process() } - ScrollSpy.prototype = { - - constructor: ScrollSpy - - , refresh: function () { - var self = this - , $targets - - this.offsets = $([]) - this.targets = $([]) - - $targets = this.$body - .find(this.selector) - .map(function () { - var $el = $(this) - , href = $el.data('target') || $el.attr('href') - , $href = /^#\w/.test(href) && $(href) - return ( $href - && $href.length - && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]] ) || null - }) - .sort(function (a, b) { return a[0] - b[0] }) - .each(function () { - self.offsets.push(this[0]) - self.targets.push(this[1]) - }) - } + ScrollSpy.DEFAULTS = { + offset: 10 + } - , process: function () { - var scrollTop = this.$scrollElement.scrollTop() + this.options.offset - , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight - , maxScroll = scrollHeight - this.$scrollElement.height() - , offsets = this.offsets - , targets = this.targets - , activeTarget = this.activeTarget - , i - - if (scrollTop >= maxScroll) { - return activeTarget != (i = targets.last()[0]) - && this.activate ( i ) - } - - for (i = offsets.length; i--;) { - activeTarget != targets[i] - && scrollTop >= offsets[i] - && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) - && this.activate( targets[i] ) - } - } + ScrollSpy.prototype.refresh = function () { + this.offsets = $([]) + this.targets = $([]) - , activate: function (target) { - var active - , selector + var self = this + var $targets = this.$body + .find(this.selector) + .map(function () { + var $el = $(this) + var href = $el.data('target') || $el.attr('href') + var $href = /^#\w/.test(href) && $(href) - this.activeTarget = target + return ($href + && $href.length + && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null + }) + .sort(function (a, b) { return a[0] - b[0] }) + .each(function () { + self.offsets.push(this[0]) + self.targets.push(this[1]) + }) + } + + ScrollSpy.prototype.process = function () { + var scrollTop = this.$scrollElement.scrollTop() + this.options.offset + var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight + var maxScroll = scrollHeight - this.$scrollElement.height() + var offsets = this.offsets + var targets = this.targets + var activeTarget = this.activeTarget + var i + + if (scrollTop >= maxScroll) { + return activeTarget != (i = targets.last()[0]) && this.activate(i) + } - $(this.selector) - .parents('.active') - .removeClass('active') + for (i = offsets.length; i--;) { + activeTarget != targets[i] + && scrollTop >= offsets[i] + && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) + && this.activate( targets[i] ) + } + } - selector = this.selector - + '[data-target="' + target + '"],' - + this.selector + '[href="' + target + '"]' + ScrollSpy.prototype.activate = function (target) { + this.activeTarget = target - active = $(selector) - .parents('li') - .addClass('active') + $(this.selector) + .parents('.active') + .removeClass('active') - if (active.parent('.dropdown-menu').length) { - active = active.closest('li.dropdown').addClass('active') - } + var selector = this.selector + + '[data-target="' + target + '"],' + + this.selector + '[href="' + target + '"]' - active.trigger('activate') - } + var active = $(selector) + .parents('li') + .addClass('active') + if (active.parent('.dropdown-menu').length) { + active = active + .closest('li.dropdown') + .addClass('active') + } + + active.trigger('activate') } - /* SCROLLSPY PLUGIN DEFINITION - * =========================== */ + // SCROLLSPY PLUGIN DEFINITION + // =========================== var old = $.fn.scrollspy $.fn.scrollspy = function (option) { return this.each(function () { - var $this = $(this) - , data = $this.data('scrollspy') - , options = typeof option == 'object' && option - if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) + var $this = $(this) + var data = $this.data('bs-scrollspy') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs-scrollspy', (data = new ScrollSpy(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.scrollspy.Constructor = ScrollSpy - $.fn.scrollspy.defaults = { - offset: 10 - } - - /* SCROLLSPY NO CONFLICT - * ===================== */ + // SCROLLSPY NO CONFLICT + // ===================== $.fn.scrollspy.noConflict = function () { $.fn.scrollspy = old @@ -1623,8 +1592,8 @@ } - /* SCROLLSPY DATA-API - * ================== */ + // SCROLLSPY DATA-API + // ================== $(window).on('load', function () { $('[data-spy="scroll"]').each(function () { @@ -1654,105 +1623,94 @@ * ======================================================== */ -!function ($) { - - "use strict"; // jshint ;_; - +!function ($) { "use strict"; - /* TAB CLASS DEFINITION - * ==================== */ + // TAB CLASS DEFINITION + // ==================== var Tab = function (element) { this.element = $(element) } - Tab.prototype = { - - constructor: Tab - - , show: function () { - var $this = this.element - , $ul = $this.closest('ul:not(.dropdown-menu)') - , selector = $this.attr('data-target') - , previous - , $target - , e - - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 - } + Tab.prototype.show = function () { + var $this = this.element + var $ul = $this.closest('ul:not(.dropdown-menu)') + var selector = $this.attr('data-target') - if ( $this.parent('li').hasClass('active') ) return + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 + } - previous = $ul.find('.active:last a')[0] + if ($this.parent('li').hasClass('active')) return - e = $.Event('show', { - relatedTarget: previous - }) + var previous = $ul.find('.active:last a')[0] + var e = $.Event('bs:tab:show', { + relatedTarget: previous + }) - $this.trigger(e) + $this.trigger(e) - if (e.isDefaultPrevented()) return + if (e.isDefaultPrevented()) return - $target = $(selector) + var $target = $(selector) - this.activate($this.parent('li'), $ul) - this.activate($target, $target.parent(), function () { - $this.trigger({ - type: 'shown' - , relatedTarget: previous - }) + this.activate($this.parent('li'), $ul) + this.activate($target, $target.parent(), function () { + $this.trigger({ + type: 'bs:tab:shown' + , relatedTarget: previous }) - } - - , activate: function ( element, container, callback) { - var $active = container.find('> .active') - , transition = callback - && $.support.transition - && $active.hasClass('fade') - - function next() { - $active - .removeClass('active') - .find('> .dropdown-menu > .active') - .removeClass('active') + }) + } - element.addClass('active') + Tab.prototype.activate = function (element, container, callback) { + var $active = container.find('> .active') + var transition = callback + && $.support.transition + && $active.hasClass('fade') - if (transition) { - element[0].offsetWidth // reflow for transition - element.addClass('in') - } else { - element.removeClass('fade') - } + function next() { + $active + .removeClass('active') + .find('> .dropdown-menu > .active') + .removeClass('active') - if ( element.parent('.dropdown-menu') ) { - element.closest('li.dropdown').addClass('active') - } + element.addClass('active') - callback && callback() + if (transition) { + element[0].offsetWidth // reflow for transition + element.addClass('in') + } else { + element.removeClass('fade') } - transition ? - $active.one($.support.transition.end, next) : - next() + if (element.parent('.dropdown-menu')) { + element.closest('li.dropdown').addClass('active') + } - $active.removeClass('in') + callback && callback() } + + transition ? + $active.one($.support.transition.end, next) : + next() + + $active.removeClass('in') } - /* TAB PLUGIN DEFINITION - * ===================== */ + // TAB PLUGIN DEFINITION + // ===================== var old = $.fn.tab $.fn.tab = function ( option ) { return this.each(function () { var $this = $(this) - , data = $this.data('tab') - if (!data) $this.data('tab', (data = new Tab(this))) + var data = $this.data('bs-tab') + + if (!data) $this.data('bs-tab', (data = new Tab(this))) if (typeof option == 'string') data[option]() }) } @@ -1760,8 +1718,8 @@ $.fn.tab.Constructor = Tab - /* TAB NO CONFLICT - * =============== */ + // TAB NO CONFLICT + // =============== $.fn.tab.noConflict = function () { $.fn.tab = old @@ -1769,8 +1727,8 @@ } - /* TAB DATA-API - * ============ */ + // TAB DATA-API + // ============ $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { e.preventDefault() |