mirror of
https://github.com/twbs/bootstrap-sass.git
synced 2022-11-09 12:27:02 -05:00
Update javascripts to Bootstrap master
This commit is contained in:
parent
80ab1a233e
commit
f9129ee848
4 changed files with 41 additions and 13 deletions
15
vendor/assets/javascripts/bootstrap-alerts.js
vendored
15
vendor/assets/javascripts/bootstrap-alerts.js
vendored
|
@ -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 ))
|
||||
|
|
10
vendor/assets/javascripts/bootstrap-buttons.js
vendored
10
vendor/assets/javascripts/bootstrap-buttons.js
vendored
|
@ -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) {
|
||||
|
|
|
@ -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 );
|
||||
|
|
21
vendor/assets/javascripts/bootstrap-twipsy.js
vendored
21
vendor/assets/javascripts/bootstrap-twipsy.js
vendored
|
@ -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 );
|
||||
|
|
Loading…
Add table
Reference in a new issue