1
/* ==========================================================
2
* bootstrap-alerts.js v1.4.0
3
* http://twitter.github.com/bootstrap/javascript.html#alerts
4
* ==========================================================
5
* Copyright 2011 Twitter, Inc.
7
* Licensed under the Apache License, Version 2.0 (the "License");
8
* you may not use this file except in compliance with the License.
9
* You may obtain a copy of the License at
11
* http://www.apache.org/licenses/LICENSE-2.0
13
* Unless required by applicable law or agreed to in writing, software
14
* distributed under the License is distributed on an "AS IS" BASIS,
15
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
* See the License for the specific language governing permissions and
17
* limitations under the License.
18
* ========================================================== */
25
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
26
* ======================================================= */
30
$(document).ready(function () {
32
$.support.transition = (function () {
33
var thisBody = document.body || document.documentElement
34
, thisStyle = thisBody.style
35
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
39
// set CSS transition event type
40
if ( $.support.transition ) {
41
transitionEnd = "TransitionEnd"
42
if ( $.browser.webkit ) {
43
transitionEnd = "webkitTransitionEnd"
44
} else if ( $.browser.mozilla ) {
45
transitionEnd = "transitionend"
46
} else if ( $.browser.opera ) {
47
transitionEnd = "oTransitionEnd"
53
/* ALERT CLASS DEFINITION
54
* ====================== */
56
var Alert = function ( content, options ) {
57
if (options == 'close') return this.close.call(content)
58
this.settings = $.extend({}, $.fn.alert.defaults, options)
59
this.$element = $(content)
60
.delegate(this.settings.selector, 'click', this.close)
66
var $element = $(this)
67
, className = 'alert-message'
69
$element = $element.hasClass(className) ? $element : $element.parent()
71
e && e.preventDefault()
72
$element.removeClass('in')
74
function removeElement () {
78
$.support.transition && $element.hasClass('fade') ?
79
$element.bind(transitionEnd, removeElement) :
86
/* ALERT PLUGIN DEFINITION
87
* ======================= */
89
$.fn.alert = function ( options ) {
91
if ( options === true ) {
92
return this.data('alert')
95
return this.each(function () {
99
if ( typeof options == 'string' ) {
101
data = $this.data('alert')
103
if (typeof data == 'object') {
104
return data[options].call( $this )
109
$(this).data('alert', new Alert( this, options ))
114
$.fn.alert.defaults = {
118
$(document).ready(function () {
119
new Alert($('body'), {
120
selector: '.alert-message[data-alert] .close'
124
}( window.jQuery || window.ender );
b'\\ No newline at end of file'