Commit 0afba386 authored by Mark Otto's avatar Mark Otto

Merge branch '1.3-wip' of github.com:twitter/bootstrap into 1.3-wip

parents b77e3e2f f8aaec52
...@@ -51,7 +51,7 @@ $(document).ready(function(){ ...@@ -51,7 +51,7 @@ $(document).ready(function(){
, trigger: 'manual' , trigger: 'manual'
, offset: 2 , offset: 2
}) })
.trigger('twipsy:show') .twipsy('show')
}) })
}) })
}); });
...@@ -1331,7 +1331,7 @@ ...@@ -1331,7 +1331,7 @@
<li><a href="#">Messages</a></li> <li><a href="#">Messages</a></li>
<li><a href="#">Settings</a></li> <li><a href="#">Settings</a></li>
<li><a href="#">Contact</a></li> <li><a href="#">Contact</a></li>
<li class="dropdown"> <li class="dropdown" data-dropdown>
<a href="#" class="dropdown-toggle">Dropdown</a> <a href="#" class="dropdown-toggle">Dropdown</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="#">Secondary link</a></li> <li><a href="#">Secondary link</a></li>
......
This diff is collapsed.
...@@ -51,30 +51,25 @@ ...@@ -51,30 +51,25 @@
/* ALERT CLASS DEFINITION /* ALERT CLASS DEFINITION
* ====================== */ * ====================== */
var Alert = function ( content ) { var Alert = function ( content, selector ) {
var that = this
this.$element = $(content) this.$element = $(content)
.bind('alert:hide', $.proxy(this.close, this)) .delegate(selector || '.close', 'click', this.close)
.delegate('.close', 'click', function (e) {
e.preventDefault()
that.close()
})
} }
Alert.prototype = { Alert.prototype = {
close: function () { close: function (e) {
var that = this var $element = $(this).parent('.alert-message')
this.$element.removeClass('in') e && e.preventDefault()
$element.removeClass('in')
function removeElement () { function removeElement () {
that.$element.remove() $element.remove()
that.$element = null
} }
$.support.transition && this.$element.hasClass('fade') ? $.support.transition && $element.hasClass('fade') ?
this.$element.bind(transitionEnd, removeElement) : $element.bind(transitionEnd, removeElement) :
removeElement() removeElement()
} }
...@@ -85,9 +80,25 @@ ...@@ -85,9 +80,25 @@
* ======================= */ * ======================= */
$.fn.alert = function ( options ) { $.fn.alert = function ( options ) {
if ( options === true ) {
return this.data('alert')
}
return this.each(function () { 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 ) })( jQuery || ender )
\ No newline at end of file
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
this.$element = $(element) this.$element = $(element)
this.options = options this.options = options
this.enabled = true this.enabled = true
this.fixTitle()
} }
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js /* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
...@@ -38,22 +39,13 @@ ...@@ -38,22 +39,13 @@
$tip[0].className = 'popover' $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') { 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') { } else if (typeof this.options.content == 'function') {
content = this.options.content.call(this.$element[0]) content = this.options.content.call(this.$element[0])
} }
...@@ -80,6 +72,6 @@ ...@@ -80,6 +72,6 @@
return this 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 ) })( jQuery || ender )
\ No newline at end of file
...@@ -282,9 +282,6 @@ ...@@ -282,9 +282,6 @@
this[binder](eventIn, enter)[binder](eventOut, leave) this[binder](eventIn, enter)[binder](eventOut, leave)
} }
this.bind(name + ':show', enter)
this.bind(name + ':hide', leave)
return this return this
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment