vendor/assets/javascripts/twitter/bootstrap/alerts.js in less-rails-bootstrap-1.3.3 vs vendor/assets/javascripts/twitter/bootstrap/alerts.js in less-rails-bootstrap-1.4
- old
+ new
@@ -1,7 +1,7 @@
/* ==========================================================
- * bootstrap-alerts.js v1.3.0
+ * bootstrap-alerts.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
* Copyright 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,10 +18,12 @@
* ========================================================== */
!function( $ ){
+ "use strict"
+
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
var transitionEnd
@@ -36,26 +38,27 @@
// set CSS transition event type
if ( $.support.transition ) {
transitionEnd = "TransitionEnd"
if ( $.browser.webkit ) {
- transitionEnd = "webkitTransitionEnd"
+ transitionEnd = "webkitTransitionEnd"
} else if ( $.browser.mozilla ) {
- transitionEnd = "transitionend"
+ transitionEnd = "transitionend"
} else if ( $.browser.opera ) {
- transitionEnd = "oTransitionEnd"
+ transitionEnd = "oTransitionEnd"
}
}
})
/* ALERT CLASS DEFINITION
* ====================== */
- var Alert = function ( content, selector ) {
+ var Alert = function ( content, options ) {
+ this.settings = $.extend({}, $.fn.alert.defaults, options)
this.$element = $(content)
- .delegate(selector || '.close', 'click', this.close)
+ .delegate(this.settings.selector, 'click', this.close)
}
Alert.prototype = {
close: function (e) {
@@ -90,15 +93,21 @@
if ( typeof options == 'string' ) {
return $this.data('alert')[options]()
}
- $(this).data('alert', new Alert( this ))
+ $(this).data('alert', new Alert( this, options ))
})
}
+ $.fn.alert.defaults = {
+ selector: '.close'
+ }
+
$(document).ready(function () {
- new Alert($('body'), '.alert-message[data-alert] .close')
+ new Alert($('body'), {
+ selector: '.alert-message[data-alert] .close'
+ })
})
}( window.jQuery || window.ender );
\ No newline at end of file