From abc49c729bdc54c8a66174ad802c83e577f8d80f Mon Sep 17 00:00:00 2001 From: fat Date: Thu, 16 May 2013 20:42:31 -0700 Subject: [PATCH] update js docs --- docs/assets/js/bootstrap.js | 100 ++++++++++++++++---------------- docs/assets/js/bootstrap.min.js | 2 +- docs/javascript.html | 38 +++++++----- 3 files changed, 75 insertions(+), 65 deletions(-) diff --git a/docs/assets/js/bootstrap.js b/docs/assets/js/bootstrap.js index 4d7eae2674..351502491d 100644 --- a/docs/assets/js/bootstrap.js +++ b/docs/assets/js/bootstrap.js @@ -92,14 +92,14 @@ $parent = $this.hasClass('alert') ? $this : $this.parent() } - $parent.trigger(e = $.Event('bs:alert:close')) + $parent.trigger(e = $.Event('close.bs.alert')) if (e.isDefaultPrevented()) return $parent.removeClass('in') function removeElement() { - $parent.trigger('bs-closed').remove() + $parent.trigger('closed.bs.alert').remove() } $.support.transition && $parent.hasClass('fade') ? @@ -116,9 +116,9 @@ $.fn.alert = function (option) { return this.each(function () { var $this = $(this) - var data = $this.data('bs-alert') + var data = $this.data('bs.alert') - if (!data) $this.data('bs-alert', (data = new Alert(this))) + if (!data) $this.data('bs.alert', (data = new Alert(this))) if (typeof option == 'string') data[option].call($this) }) } @@ -138,7 +138,7 @@ // ALERT DATA-API // ============== - $(document).on('click.bs-alert.bs-data-api', dismiss, Alert.prototype.close) + $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) }(window.jQuery); /* ============================================================ @@ -217,7 +217,7 @@ var data = $this.data('button') var options = typeof option == 'object' && option - if (!data) $this.data('bs-button', (data = new Button(this, options))) + if (!data) $this.data('bs.button', (data = new Button(this, options))) if (option == 'toggle') data.toggle() else if (option) data.setState(option) @@ -239,7 +239,7 @@ // BUTTON DATA-API // =============== - $(document).on('click.bs-button.bs-data-api', '[data-toggle^=button]', function (e) { + $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) { var $btn = $(e.target) if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') $btn.button('toggle') @@ -359,7 +359,7 @@ $next = $next.length ? $next : this.$element.find('.item')[fallback]() - var e = $.Event('bs:carousel:slide', { relatedTarget: $next[0], direction: direction }) + var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction }) if ($next.hasClass('active')) return @@ -407,11 +407,11 @@ $.fn.carousel = function (option) { return this.each(function () { var $this = $(this) - var data = $this.data('bs-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('bs-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() @@ -507,7 +507,7 @@ } this.$element[dimension](0) - this.transition('addClass', $.Event('bs:collapse:show'), 'bs:collapse:shown') + this.transition('addClass', $.Event('show.bs.collapse'), 'shown.bs.collapse') if ($.support.transition) this.$element[dimension](this.$element[0][scroll]) } @@ -516,7 +516,7 @@ if (this.transitioning || !this.$element.hasClass('in')) return var dimension = this.dimension() this.reset(this.$element[dimension]()) - this.transition('removeClass', $.Event('bs:collapse:hide'), 'hidden') + this.transition('removeClass', $.Event('hide.bs.collapse'), 'hidden') this.$element[dimension](0) } @@ -536,7 +536,7 @@ Collapse.prototype.transition = function (method, startEvent, completeEvent) { var that = this var complete = function () { - if (startEvent.type == 'bs:collapse:show') that.reset() + if (startEvent.type == 'show') that.reset() that.transitioning = 0 that.$element.trigger(completeEvent) } @@ -793,7 +793,7 @@ Modal.prototype.show = function () { var that = this - var e = $.Event('bs:modal:show') + var e = $.Event('show.bs.modal') this.$element.trigger(e) @@ -823,8 +823,8 @@ that.enforceFocus() transition ? - that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('bs:modal:shown') }) : - that.$element.focus().trigger('bs:modal:shown') + that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown.bs.modal') }) : + that.$element.focus().trigger('shown.bs.modal') }) } @@ -832,7 +832,7 @@ Modal.prototype.hide = function (e) { if (e) e.preventDefault() - e = $.Event('bs:modal:hide') + e = $.Event('hide.bs.modal') this.$element.trigger(e) @@ -842,7 +842,7 @@ this.escape() - $(document).off('focusin.modal') + $(document).off('focusin.bs.modal') this.$element .removeClass('in') @@ -854,7 +854,7 @@ } Modal.prototype.enforceFocus = function () { - $(document).on('focusin.modal', function (e) { + $(document).on('focusin.bs.modal', function (e) { if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { this.$element.focus() } @@ -863,11 +863,11 @@ Modal.prototype.escape = function () { if (this.isShown && this.options.keyboard) { - this.$element.on('keyup.dismiss.modal', function ( e ) { + this.$element.on('keyup.dismiss.bs.modal', function ( e ) { e.which == 27 && this.hide() }, this) } else if (!this.isShown) { - this.$element.off('keyup.dismiss.modal') + this.$element.off('keyup.dismiss.bs.modal') } } @@ -889,7 +889,7 @@ this.$element.hide() this.backdrop(function () { that.removeBackdrop() - that.$element.trigger('bs:modal:hidden') + that.$element.trigger('hidden.bs.modal') }) } @@ -945,10 +945,10 @@ $.fn.modal = function (option) { return this.each(function () { var $this = $(this) - var data = $this.data('bs-modal') + 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 (!data) $this.data('bs.modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option]() else if (options.show) data.show() }) @@ -969,7 +969,7 @@ // MODAL DATA-API // ============== - $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) { + $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this) var href = $this.attr('href') var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 @@ -985,8 +985,8 @@ }) var $body = $(document.body) - .on('bs:modal:shown', '.modal', function () { $body.addClass('modal-open') }) - .on('bs:modal: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); /* =========================================================== @@ -1090,7 +1090,7 @@ if (defaults[key] != value) options[key] = value }, this) - var self = $(e.currentTarget)[this.type](options).data('bs-' + this.type) + var self = $(e.currentTarget)[this.type](options).data('bs.' + this.type) if (!self.options.delay || !self.options.delay.show) return self.show() @@ -1103,7 +1103,7 @@ } Tooltip.prototype.leave = function (e) { - var self = $(e.currentTarget)[this.type](this._options).data('bs-' + this.type) + var self = $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) if (this.timeout) clearTimeout(this.timeout) if (!self.options.delay || !self.options.delay.hide) return self.hide() @@ -1115,7 +1115,7 @@ } Tooltip.prototype.show = function () { - var e = $.Event('bs:'+ this.type + ':show') + var e = $.Event('show.bs.'+ this.type) if (this.hasContent() && this.enabled) { this.$element.trigger(e) @@ -1159,7 +1159,7 @@ } this.applyPlacement(tp, placement) - this.$element.trigger('bs:' + this.type + ':shown') + this.$element.trigger('shown.bs.' + this.type) } } @@ -1218,7 +1218,7 @@ Tooltip.prototype.hide = function () { var that = this var $tip = this.tip() - var e = $.Event('bs:' + this.type + ':hide') + var e = $.Event('hide.bs.' + this.type) this.$element.trigger(e) @@ -1241,7 +1241,7 @@ removeWithAnimation() : $tip.detach() - this.$element.trigger('bs:' + this.type + ':hidden') + this.$element.trigger('hidden.bs.' + this.type) return this } @@ -1305,12 +1305,12 @@ } Tooltip.prototype.toggle = function (e) { - var self = e ? $(e.currentTarget)[this.type](this._options).data('bs-' + this.type) : this + var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this self.tip().hasClass('in') ? self.hide() : self.show() } Tooltip.prototype.destroy = function () { - this.hide().$element.off('.' + this.type).removeData('bs-' + this.type) + this.hide().$element.off('.' + this.type).removeData('bs.' + this.type) } @@ -1322,10 +1322,10 @@ $.fn.tooltip = function (option) { return this.each(function () { var $this = $(this) - var data = $this.data('bs-tooltip') + var data = $this.data('bs.tooltip') var options = typeof option == 'object' && option - if (!data) $this.data('bs-tooltip', (data = new Tooltip(this, options))) + if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) if (typeof option == 'string') data[option]() }) } @@ -1431,10 +1431,10 @@ $.fn.popover = function (option) { return this.each(function () { var $this = $(this) - var data = $this.data('bs-popover') + var data = $this.data('bs.popover') var options = typeof option == 'object' && option - if (!data) $this.data('bs-popover', (data = new Popover(this, options))) + if (!data) $this.data('bs.popover', (data = new Popover(this, options))) if (typeof option == 'string') data[option]() }) } @@ -1576,10 +1576,10 @@ $.fn.scrollspy = function (option) { return this.each(function () { var $this = $(this) - var data = $this.data('bs-scrollspy') + var data = $this.data('bs.scrollspy') var options = typeof option == 'object' && option - if (!data) $this.data('bs-scrollspy', (data = new ScrollSpy(this, options))) + if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) if (typeof option == 'string') data[option]() }) } @@ -1649,7 +1649,7 @@ if ($this.parent('li').hasClass('active')) return var previous = $ul.find('.active:last a')[0] - var e = $.Event('bs:tab:show', { + var e = $.Event('show.bs.tab', { relatedTarget: previous }) @@ -1662,7 +1662,7 @@ this.activate($this.parent('li'), $ul) this.activate($target, $target.parent(), function () { $this.trigger({ - type: 'bs:tab:shown' + type: 'shown.bs.tab' , relatedTarget: previous }) }) @@ -1712,9 +1712,9 @@ $.fn.tab = function ( option ) { return this.each(function () { var $this = $(this) - var data = $this.data('bs-tab') + var data = $this.data('bs.tab') - if (!data) $this.data('bs-tab', (data = new Tab(this))) + if (!data) $this.data('bs.tab', (data = new Tab(this))) if (typeof option == 'string') data[option]() }) } @@ -1734,7 +1734,7 @@ // TAB DATA-API // ============ - $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { + $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { e.preventDefault() $(this).tab('show') }) @@ -1768,8 +1768,8 @@ var Affix = function (element, options) { this.options = $.extend({}, Affix.DEFAULTS, options) this.$window = $(window) - .on('scroll.bs-affix.bs-data-api', $.proxy(this.checkPosition, this)) - .on('click.bs-affix.bs-data-api', $.proxy(this.checkPositionWithEventLoop, this)) + .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) + .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) this.$element = $(element) this.affixed = @@ -1822,10 +1822,10 @@ $.fn.affix = function (option) { return this.each(function () { var $this = $(this) - var data = $this.data('bs-affix') + var data = $this.data('bs.affix') var options = typeof option == 'object' && option - if (!data) $this.data('bs-affix', (data = new Affix(this, options))) + if (!data) $this.data('bs.affix', (data = new Affix(this, options))) if (typeof option == 'string') data[option]() }) } diff --git a/docs/assets/js/bootstrap.min.js b/docs/assets/js/bootstrap.min.js index 1f5f4cfad9..789dcca8d3 100644 --- a/docs/assets/js/bootstrap.min.js +++ b/docs/assets/js/bootstrap.min.js @@ -3,4 +3,4 @@ * Copyright 2012 Twitter, Inc. * http://www.apache.org/licenses/LICENSE-2.0.txt */ -!function(e){"use strict";function t(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in t)if(e.style[n]!==undefined)return{end:t[n]}}e(function(){e.support.transition=t()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function s(){i.trigger("bs-closed").remove()}var n=e(this),r=n.attr("data-target");r||(r=n.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));var i=e(r);t&&t.preventDefault(),i.length||(i=n.hasClass("alert")?n:n.parent()),i.trigger(t=e.Event("bs:alert:close"));if(t.isDefaultPrevented())return;i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.on(e.support.transition.end,s):s()};var r=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var r=e(this),i=r.data("bs-alert");i||r.data("bs-alert",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=r,this},e(document).on("click.bs-alert.bs-data-api",t,n.prototype.close)}(window.jQuery),!function(e){"use strict";var t=function(n,r){this.$element=e(n),this.options=e.extend({},t.DEFAULTS,r)};t.DEFAULTS={loadingText:"loading..."},t.prototype.setState=function(e){var t="disabled",n=this.$element,r=n.is("input")?"val":"html",i=n.data();e+="Text",i.resetText||n.data("resetText",n[r]()),n[r](i[e]||this.options[e]),setTimeout(function(){e=="loadingText"?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=function(n){return this.each(function(){var r=e(this),i=r.data("button"),s=typeof n=="object"&&n;i||r.data("bs-button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.bs-button.bs-data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.paused=this.sliding=this.interval=this.$active=this.$items=null,this.options.pause=="hover"&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.DEFAULTS={interval:5e3,pause:"hover"},t.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},t.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},t.prototype.to=function(t){var n=this,r=this.getActiveIndex();if(t>this.$items.length-1||t<0)return;return this.sliding?this.$element.one("slid",function(){n.to(t)}):r==t?this.pause().cycle():this.slide(t>r?"next":"prev",e(this.$items[t]))},t.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},t.prototype.next=function(){if(this.sliding)return;return this.slide("next")},t.prototype.prev=function(){if(this.sliding)return;return this.slide("prev")},t.prototype.slide=function(t,n){var r=this.$element.find(".item.active"),i=n||r[t](),s=this.interval,o=t=="next"?"left":"right",u=t=="next"?"first":"last",a=this;this.sliding=!0,s&&this.pause(),i=i.length?i:this.$element.find(".item")[u]();var f=e.Event("bs:carousel:slide",{relatedTarget:i[0],direction:o});if(i.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var t=e(a.$indicators.children()[a.getActiveIndex()]);t&&t.addClass("active")}));if(e.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(f);if(f.isDefaultPrevented())return;i.addClass(t),i[0].offsetWidth,r.addClass(o),i.addClass(o),this.$element.one(e.support.transition.end,function(){i.removeClass([t,o].join(" ")).addClass("active"),r.removeClass(["active",o].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger("slid")},0)})}else{this.$element.trigger(f);if(f.isDefaultPrevented())return;r.removeClass("active"),i.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this};var n=e.fn.carousel;e.fn.carousel=function(n){return this.each(function(){var r=e(this),i=r.data("bs-carousel"),s=e.extend({},t.DEFAULTS,typeof n=="object"&&n),o=typeof n=="string"?n:s.slide;i||r.data("bs-carousel",i=new t(this,s)),typeof n=="number"?i.to(n):o?i[o]():s.interval&&i.pause().cycle()})},e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=n,this},e(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=e.extend({},i.data(),n.data()),o;i.carousel(s),(o=n.attr("data-slide-to"))&&i.data("bs-carousel").pause().to(o).cycle(),t.preventDefault()})}(window.jQuery),!function(e){"use strict";var t=function(n,r){this.$element=e(n),this.options=e.extend({},t.DEFAULTS,r),this.transitioning=null,this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.DEFAULTS={toggle:!0},t.prototype.dimension=function(){var e=this.$element.hasClass("width");return e?"width":"height"},t.prototype.show=function(){if(this.transitioning||this.$element.hasClass("in"))return;var t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),r=this.$parent&&this.$parent.find("> .accordion-group > .in");if(r&&r.length){var i=r.data("collapse");if(i&&i.transitioning)return;r.collapse("hide"),i||r.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("bs:collapse:show"),"bs:collapse:shown"),e.support.transition&&this.$element[t](this.$element[0][n])},t.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass("in"))return;var t=this.dimension();this.reset(this.$element[t]()),this.transition("removeClass",e.Event("bs:collapse:hide"),"hidden"),this.$element[t](0)},t.prototype.reset=function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[e!==null?"addClass":"removeClass"]("collapse"),this},t.prototype.transition=function(t,n,r){var i=this,s=function(){n.type=="bs:collapse:show"&&i.reset(),i.transitioning=0,i.$element.trigger(r)};this.$element.trigger(n);if(n.isDefaultPrevented())return;this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,s):s()},t.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var n=e.fn.collapse;e.fn.collapse=function(n){return this.each(function(){var r=e(this),i=r.data("collapse"),s=e.extend({},t.DEFAULTS,r.data(),typeof n=="object"&&n);i||r.data("collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=n,this},e(document).on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n=e(this),r,i=n.attr("data-target")||t.preventDefault()||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),s=e(i).data("collapse")?"toggle":n.data();n[e(i).hasClass("in")?"addClass":"removeClass"]("collapsed"),e(i).collapse(s)})}(window.jQuery),!function(e){"use strict";function i(){e(t).remove(),e(n).each(function(){s(e(this)).removeClass("open")})}function s(t){var n=t.attr("data-target");n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,""));var r=n&&e(n);return r&&r.length?r:t.parent()}var t=".dropdown-backdrop",n="[data-toggle=dropdown]",r=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};r.prototype.toggle=function(t){var n=e(this);if(n.is(".disabled, :disabled"))return;var r=s(n),o=r.hasClass("open");return i(),o||("ontouchstart"in document.documentElement&&e('