Permalink
Browse files

update to v1.4

  • Loading branch information...
xdite committed Nov 28, 2011
1 parent 9044d58 commit 7fe2d48ef0b01de7b16aa927465d83c768e3769e
@@ -1,5 +1,5 @@
/* ==========================================================
- * bootstrap-alerts.js v1.3.0
+ * bootstrap-alerts.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
* Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
!function( $ ){
+ "use strict"
+
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
@@ -38,11 +40,11 @@
if ( $.support.transition ) {
transitionEnd = "TransitionEnd"
if ( $.browser.webkit ) {
- transitionEnd = "webkitTransitionEnd"
+ transitionEnd = "webkitTransitionEnd"
} else if ( $.browser.mozilla ) {
- transitionEnd = "transitionend"
+ transitionEnd = "transitionend"
} else if ( $.browser.opera ) {
- transitionEnd = "oTransitionEnd"
+ transitionEnd = "oTransitionEnd"
}
}
@@ -1,5 +1,5 @@
/* ============================================================
- * bootstrap-dropdown.js v1.3.0
+ * bootstrap-dropdown.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#dropdown
* ============================================================
* Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
!function( $ ){
+ "use strict"
+
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
@@ -1,5 +1,5 @@
/* =========================================================
- * bootstrap-modal.js v1.3.0
+ * bootstrap-modal.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#modal
* =========================================================
* Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
!function( $ ){
+ "use strict"
+
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
@@ -87,8 +89,7 @@
that.$element[0].offsetWidth // force reflow
}
- that.$element
- .addClass('in')
+ that.$element.addClass('in')
transition ?
that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
@@ -115,17 +116,9 @@
.trigger('hide')
.removeClass('in')
- function removeElement () {
- that.$element
- .hide()
- .trigger('hidden')
-
- backdrop.call(that)
- }
-
$.support.transition && this.$element.hasClass('fade') ?
- this.$element.one(transitionEnd, removeElement) :
- removeElement()
+ hideWithTransition.call(this) :
+ hideModal.call(this)
return this
}
@@ -136,6 +129,28 @@
/* MODAL PRIVATE METHODS
* ===================== */
+ function hideWithTransition() {
+ // firefox drops transitionEnd events :{o
+ var that = this
+ , timeout = setTimeout(function () {
+ that.$element.unbind(transitionEnd)
+ hideModal.call(that)
+ }, 500)
+
+ this.$element.one(transitionEnd, function () {
+ clearTimeout(timeout)
+ hideModal.call(that)
+ })
+ }
+
+ function hideModal (that) {
+ this.$element
+ .hide()
+ .trigger('hidden')
+
+ backdrop.call(this)
+ }
+
function backdrop ( callback ) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
@@ -162,19 +177,20 @@
} else if ( !this.isShown && this.$backdrop ) {
this.$backdrop.removeClass('in')
- function removeElement() {
- that.$backdrop.remove()
- that.$backdrop = null
- }
-
$.support.transition && this.$element.hasClass('fade')?
- this.$backdrop.one(transitionEnd, removeElement) :
- removeElement()
+ this.$backdrop.one(transitionEnd, $.proxy(removeBackdrop, this)) :
+ removeBackdrop.call(this)
+
} else if ( callback ) {
callback()
}
}
+ function removeBackdrop() {
+ this.$backdrop.remove()
+ this.$backdrop = null
+ }
+
function escape() {
var that = this
if ( this.isShown && this.settings.keyboard ) {
@@ -1,5 +1,5 @@
/* ===========================================================
- * bootstrap-popover.js v1.3.0
+ * bootstrap-popover.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#popover
* ===========================================================
* Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
!function( $ ) {
+ "use strict"
+
var Popover = function ( element, options ) {
this.$element = $(element)
this.options = options
@@ -39,23 +41,28 @@
$tip[0].className = 'popover'
}
+ , hasContent: function () {
+ return this.getTitle() || this.getContent()
+ }
+
, getContent: function () {
var content
, $e = this.$element
, o = this.options
if (typeof this.options.content == 'string') {
- content = $e.attr(o.content)
+ content = $e.attr(this.options.content)
} else if (typeof this.options.content == 'function') {
content = this.options.content.call(this.$element[0])
}
+
return content
}
, tip: function() {
if (!this.$tip) {
this.$tip = $('<div class="popover" />')
- .html('<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>')
+ .html(this.options.template)
}
return this.$tip
}
@@ -72,6 +79,12 @@
return this
}
- $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'})
+ $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
+ placement: 'right'
+ , content: 'data-content'
+ , template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
+ })
+
+ $.fn.twipsy.rejectAttrOptions.push( 'content' )
}( window.jQuery || window.ender );
@@ -1,5 +1,5 @@
/* =============================================================
- * bootstrap-scrollspy.js v1.3.0
+ * bootstrap-scrollspy.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
* =============================================================
* Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
!function ( $ ) {
+ "use strict"
+
var $window = $(window)
function ScrollSpy( topbar, selector ) {
@@ -1,5 +1,5 @@
/* ========================================================
- * bootstrap-tabs.js v1.3.0
+ * bootstrap-tabs.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#tabs
* ========================================================
* Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
!function( $ ){
+ "use strict"
+
function activate ( element, container ) {
container
.find('> .active')
@@ -39,6 +41,7 @@
, $ul = $this.closest('ul:not(.dropdown-menu)')
, href = $this.attr('href')
, previous
+ , $href
if ( /^#\w+/.test(href) ) {
e.preventDefault()
@@ -1,5 +1,5 @@
/* ==========================================================
- * bootstrap-twipsy.js v1.3.0
+ * bootstrap-twipsy.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#twipsy
* Adapted from the original jQuery.tipsy by Jason Frame
* ==========================================================
@@ -21,6 +21,8 @@
!function( $ ) {
+ "use strict"
+
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
@@ -70,7 +72,7 @@
, $tip
, tp
- if (this.getTitle() && this.enabled) {
+ if (this.hasContent() && this.enabled) {
$tip = this.tip()
this.setContent()
@@ -143,6 +145,10 @@
}
}
+ , hasContent: function () {
+ return this.getTitle()
+ }
+
, getTitle: function() {
var title
, $e = this.$element
@@ -162,10 +168,7 @@
}
, tip: function() {
- if (!this.$tip) {
- this.$tip = $('<div class="twipsy" />').html('<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>')
- }
- return this.$tip
+ return this.$tip = this.$tip || $('<div class="twipsy" />').html(this.options.template)
}
, validate: function() {
@@ -188,6 +191,10 @@
this.enabled = !this.enabled
}
+ , toggle: function () {
+ this[this.tip().hasClass('in') ? 'hide' : 'show']()
+ }
+
}
@@ -294,10 +301,21 @@
, offset: 0
, title: 'title'
, trigger: 'hover'
+ , template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
}
+ $.fn.twipsy.rejectAttrOptions = [ 'title' ]
+
$.fn.twipsy.elementOptions = function(ele, options) {
- return $.metadata ? $.extend({}, options, $(ele).metadata()) : options
+ var data = $(ele).data()
+ , rejects = $.fn.twipsy.rejectAttrOptions
+ , i = rejects.length
+
+ while (i--) {
+ delete data[rejects[i]]
+ }
+
+ return $.extend({}, options, data)
}
}( window.jQuery || window.ender );

0 comments on commit 7fe2d48

Please sign in to comment.