Permalink
Browse files

Update javascripts to Bootstrap master

  • Loading branch information...
1 parent 80ab1a2 commit f9129ee84867edf8b94c400c9837f64153b86abe @thomas-mcdonald thomas-mcdonald committed Dec 2, 2011
View
15 vendor/assets/javascripts/bootstrap-alerts.js
@@ -54,6 +54,7 @@
* ====================== */
var Alert = function ( content, options ) {
+ if (options == 'close') return this.close.call(content)
this.settings = $.extend({}, $.fn.alert.defaults, options)
this.$element = $(content)
.delegate(this.settings.selector, 'click', this.close)
@@ -62,7 +63,10 @@
Alert.prototype = {
close: function (e) {
- var $element = $(this).parent('.alert-message')
+ var $element = $(this)
+ , className = 'alert-message'
+
+ $element = $element.hasClass(className) ? $element : $element.parent()
e && e.preventDefault()
$element.removeClass('in')
@@ -90,9 +94,16 @@
return this.each(function () {
var $this = $(this)
+ , data
if ( typeof options == 'string' ) {
- return $this.data('alert')[options]()
+
+ data = $this.data('alert')
+
+ if (typeof data == 'object') {
+ return data[options].call( $this )
+ }
+
}
$(this).data('alert', new Alert( this, options ))
View
10 vendor/assets/javascripts/bootstrap-buttons.js
@@ -1,6 +1,6 @@
/* ============================================================
* bootstrap-buttons.js v1.4.0
- * http://twitter.github.com/bootstrap/javascript.html#dropdown
+ * http://twitter.github.com/bootstrap/javascript.html#buttons
* ============================================================
* Copyright 2011 Twitter, Inc.
*
@@ -31,9 +31,11 @@
$el.html( data[state] || $.fn.button.defaults[state] )
- state == 'loadingText' ?
- $el.addClass(d).attr(d, d) :
- $el.removeClass(d).removeAttr(d)
+ setTimeout(function () {
+ state == 'loadingText' ?
+ $el.addClass(d).attr(d, d) :
+ $el.removeClass(d).removeAttr(d)
+ }, 0)
}
function toggle(el) {
View
8 vendor/assets/javascripts/bootstrap-popover.js
@@ -37,7 +37,7 @@
setContent: function () {
var $tip = this.tip()
$tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
- $tip.find('.content p')[this.options.html ? 'html' : 'text'](this.getContent())
+ $tip.find('.content > *')[this.options.html ? 'html' : 'text'](this.getContent())
$tip[0].className = 'popover'
}
@@ -51,10 +51,11 @@
, o = this.options
if (typeof this.options.content == 'string') {
- content = this.options.content
+ content = $e.attr(this.options.content)
} else if (typeof this.options.content == 'function') {
content = this.options.content.call(this.$element[0])
}
+
return content
}
@@ -80,7 +81,10 @@
$.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 );
View
21 vendor/assets/javascripts/bootstrap-twipsy.js
@@ -168,10 +168,7 @@
}
, tip: function() {
- if (!this.$tip) {
- this.$tip = $('<div class="twipsy" />').html(this.options.template)
- }
- return this.$tip
+ return this.$tip = this.$tip || $('<div class="twipsy" />').html(this.options.template)
}
, validate: function() {
@@ -194,6 +191,10 @@
this.enabled = !this.enabled
}
+ , toggle: function () {
+ this[this.tip().hasClass('in') ? 'hide' : 'show']()
+ }
+
}
@@ -303,8 +304,18 @@
, template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
}
+ $.fn.twipsy.rejectAttrOptions = [ 'title' ]
+
$.fn.twipsy.elementOptions = function(ele, options) {
- return $.extend({}, options, $(ele).data())
+ 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 f9129ee

Please sign in to comment.