Skip to content

Commit

Permalink
Update javascripts to Bootstrap master
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-mcdonald committed Dec 2, 2011
1 parent 80ab1a2 commit f9129ee
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.
15 changes: 13 additions & 2 deletions vendor/assets/javascripts/bootstrap-alerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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')
Expand Down Expand Up @@ -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 ))
Expand Down
10 changes: 6 additions & 4 deletions vendor/assets/javascripts/bootstrap-buttons.js
Original file line number Diff line number Diff line change
@@ -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.
*
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 6 additions & 2 deletions vendor/assets/javascripts/bootstrap-popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand All @@ -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
}

Expand All @@ -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 );
21 changes: 16 additions & 5 deletions vendor/assets/javascripts/bootstrap-twipsy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -194,6 +191,10 @@
this.enabled = !this.enabled
}

, toggle: function () {
this[this.tip().hasClass('in') ? 'hide' : 'show']()
}

}


Expand Down Expand Up @@ -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.