summaryrefslogtreecommitdiff
path: root/assets/js/bootstrap-alert.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js/bootstrap-alert.js')
-rwxr-xr-xassets/js/bootstrap-alert.js60
1 files changed, 28 insertions, 32 deletions
diff --git a/assets/js/bootstrap-alert.js b/assets/js/bootstrap-alert.js
index d17f44e1..fa0806ea 100755
--- a/assets/js/bootstrap-alert.js
+++ b/assets/js/bootstrap-alert.js
@@ -1,5 +1,5 @@
/* ==========================================================
- * bootstrap-alert.js v2.0.2
+ * bootstrap-alert.js v2.0.3
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
* Copyright 2012 Twitter, Inc.
@@ -18,61 +18,57 @@
* ========================================================== */
-!function( $ ){
+!function ($) {
+
+ "use strict"; // jshint ;_;
- "use strict"
/* ALERT CLASS DEFINITION
* ====================== */
var dismiss = '[data-dismiss="alert"]'
- , Alert = function ( el ) {
+ , Alert = function (el) {
$(el).on('click', dismiss, this.close)
}
- Alert.prototype = {
-
- constructor: Alert
+ Alert.prototype.close = function (e) {
+ var $this = $(this)
+ , selector = $this.attr('data-target')
+ , $parent
- , close: function ( e ) {
- var $this = $(this)
- , selector = $this.attr('data-target')
- , $parent
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ }
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
- }
+ $parent = $(selector)
- $parent = $(selector)
- $parent.trigger('close')
+ e && e.preventDefault()
- e && e.preventDefault()
+ $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
+ $parent.trigger(e = $.Event('close'))
- $parent
- .trigger('close')
- .removeClass('in')
+ if (e.isDefaultPrevented()) return
- function removeElement() {
- $parent
- .trigger('closed')
- .remove()
- }
+ $parent.removeClass('in')
- $.support.transition && $parent.hasClass('fade') ?
- $parent.on($.support.transition.end, removeElement) :
- removeElement()
+ function removeElement() {
+ $parent
+ .trigger('closed')
+ .remove()
}
+ $.support.transition && $parent.hasClass('fade') ?
+ $parent.on($.support.transition.end, removeElement) :
+ removeElement()
}
/* ALERT PLUGIN DEFINITION
* ======================= */
- $.fn.alert = function ( option ) {
+ $.fn.alert = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('alert')
@@ -91,4 +87,4 @@
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
})
-}( window.jQuery ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file