aboutsummaryrefslogtreecommitdiff
path: root/docs/assets/js/bootstrap-alert.js
diff options
context:
space:
mode:
authorfat <[email protected]>2013-05-16 11:06:30 -0700
committerfat <[email protected]>2013-05-16 11:06:30 -0700
commit14651035deda4d02a1ca02c6088c34f770f897f6 (patch)
tree34002a1d364bb2618ab2526d5f0f9bd5c823bf47 /docs/assets/js/bootstrap-alert.js
parent509f2244da757a60d3548a7d34d63080dc01ee19 (diff)
downloadbootstrap-14651035deda4d02a1ca02c6088c34f770f897f6.tar.xz
bootstrap-14651035deda4d02a1ca02c6088c34f770f897f6.zip
a bunch javascript junk
Diffstat (limited to 'docs/assets/js/bootstrap-alert.js')
-rw-r--r--docs/assets/js/bootstrap-alert.js55
1 files changed, 26 insertions, 29 deletions
diff --git a/docs/assets/js/bootstrap-alert.js b/docs/assets/js/bootstrap-alert.js
index 7a9f62e2d..7acee7f8f 100644
--- a/docs/assets/js/bootstrap-alert.js
+++ b/docs/assets/js/bootstrap-alert.js
@@ -1,8 +1,8 @@
/* ==========================================================
- * bootstrap-alert.js v3.0.0
+ * alert.js v3.0.0
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
- * Copyright 2012 Twitter, Inc.
+ * Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,45 +18,41 @@
* ========================================================== */
-!function ($) {
+!function ($) { "use strict";
- "use strict"; // jshint ;_;
-
-
- /* ALERT CLASS DEFINITION
- * ====================== */
+ // ALERT CLASS DEFINITION
+ // ======================
var dismiss = '[data-dismiss="alert"]'
- , Alert = function (el) {
- $(el).on('click', dismiss, this.close)
- }
+ var Alert = function (el) {
+ $(el).on('click', dismiss, this.close)
+ }
Alert.prototype.close = function (e) {
- var $this = $(this)
- , selector = $this.attr('data-target')
- , $parent
+ var $this = $(this)
+ var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
- $parent = $(selector)
+ var $parent = $(selector)
- e && e.preventDefault()
+ if (e) e.preventDefault()
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
+ if (!$parent.length) {
+ $parent = $this.hasClass('alert') ? $this : $this.parent()
+ }
- $parent.trigger(e = $.Event('close'))
+ $parent.trigger(e = $.Event('bs-close'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
- $parent
- .trigger('closed')
- .remove()
+ $parent.trigger('bs-closed').remove()
}
$.support.transition && $parent.hasClass('fade') ?
@@ -65,16 +61,17 @@
}
- /* ALERT PLUGIN DEFINITION
- * ======================= */
+ // ALERT PLUGIN DEFINITION
+ // =======================
var old = $.fn.alert
$.fn.alert = function (option) {
return this.each(function () {
var $this = $(this)
- , data = $this.data('alert')
- if (!data) $this.data('alert', (data = new Alert(this)))
+ var data = $this.data('bs-alert')
+
+ if (!data) $this.data('bs-alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
@@ -91,9 +88,9 @@
}
- /* ALERT DATA-API
- * ============== */
+ // ALERT DATA-API
+ // ============== */
- $(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
+ $(document).on('click.bs-alert.bs-data-api', dismiss, Alert.prototype.close)
}(window.jQuery);