mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-16 18:44:01 +02:00
method invocation jqueryui style
This commit is contained in:
41
js/bootstrap-alerts.js
vendored
41
js/bootstrap-alerts.js
vendored
@@ -51,30 +51,25 @@
|
||||
/* ALERT CLASS DEFINITION
|
||||
* ====================== */
|
||||
|
||||
var Alert = function ( content ) {
|
||||
var that = this
|
||||
var Alert = function ( content, selector ) {
|
||||
this.$element = $(content)
|
||||
.bind('alert:hide', $.proxy(this.close, this))
|
||||
.delegate('.close', 'click', function (e) {
|
||||
e.preventDefault()
|
||||
that.close()
|
||||
})
|
||||
.delegate(selector || '.close', 'click', this.close)
|
||||
}
|
||||
|
||||
Alert.prototype = {
|
||||
|
||||
close: function () {
|
||||
var that = this
|
||||
close: function (e) {
|
||||
var $element = $(this).parent('.alert-message')
|
||||
|
||||
this.$element.removeClass('in')
|
||||
e && e.preventDefault()
|
||||
$element.removeClass('in')
|
||||
|
||||
function removeElement () {
|
||||
that.$element.remove()
|
||||
that.$element = null
|
||||
$element.remove()
|
||||
}
|
||||
|
||||
$.support.transition && this.$element.hasClass('fade') ?
|
||||
this.$element.bind(transitionEnd, removeElement) :
|
||||
$.support.transition && $element.hasClass('fade') ?
|
||||
$element.bind(transitionEnd, removeElement) :
|
||||
removeElement()
|
||||
}
|
||||
|
||||
@@ -85,9 +80,25 @@
|
||||
* ======================= */
|
||||
|
||||
$.fn.alert = function ( options ) {
|
||||
|
||||
if ( options === true ) {
|
||||
return this.data('alert')
|
||||
}
|
||||
|
||||
return this.each(function () {
|
||||
new Alert(this)
|
||||
var $this = $(this)
|
||||
|
||||
if ( typeof options == 'string' ) {
|
||||
return $this.data('alert')[options]()
|
||||
}
|
||||
|
||||
$(this).data('alert', new Alert( this ))
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
$(function () {
|
||||
new Alert($('body'), '.alert-message[data-alert] .close')
|
||||
})
|
||||
|
||||
})( jQuery || ender )
|
22
js/bootstrap-popover.js
vendored
22
js/bootstrap-popover.js
vendored
@@ -24,6 +24,7 @@
|
||||
this.$element = $(element)
|
||||
this.options = options
|
||||
this.enabled = true
|
||||
this.fixTitle()
|
||||
}
|
||||
|
||||
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
|
||||
@@ -38,22 +39,13 @@
|
||||
$tip[0].className = 'popover'
|
||||
}
|
||||
|
||||
, fixTitle: function () {}
|
||||
, getContent: function () {
|
||||
var contentvar
|
||||
, $e = this.$element
|
||||
, o = this.options
|
||||
|
||||
, getTitle: function () {
|
||||
var title
|
||||
if (typeof this.options.title == 'string') {
|
||||
title = this.$element.attr('data-title') || this.options.title
|
||||
} else if (typeof this.options.title == 'function') {
|
||||
title = this.options.title.call(this.$element[0])
|
||||
}
|
||||
return title
|
||||
}
|
||||
|
||||
, getContent: function () {content
|
||||
var content
|
||||
if (typeof this.options.content == 'string') {
|
||||
content = this.$element.attr('data-content') || this.options.content
|
||||
content = $e.attr(o.content)
|
||||
} else if (typeof this.options.content == 'function') {
|
||||
content = this.options.content.call(this.$element[0])
|
||||
}
|
||||
@@ -80,6 +72,6 @@
|
||||
return this
|
||||
}
|
||||
|
||||
$.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'content', placement: 'right'})
|
||||
$.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'})
|
||||
|
||||
})( jQuery || ender )
|
3
js/bootstrap-twipsy.js
vendored
3
js/bootstrap-twipsy.js
vendored
@@ -282,9 +282,6 @@
|
||||
this[binder](eventIn, enter)[binder](eventOut, leave)
|
||||
}
|
||||
|
||||
this.bind(name + ':show', enter)
|
||||
this.bind(name + ':hide', leave)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user