indvd00m@0
|
1 |
/* ==========================================================
|
indvd00m@0
|
2 |
* bootstrap-alert.js v2.3.1
|
indvd00m@0
|
3 |
* http://twitter.github.com/bootstrap/javascript.html#alerts
|
indvd00m@0
|
4 |
* ==========================================================
|
indvd00m@0
|
5 |
* Copyright 2012 Twitter, Inc.
|
indvd00m@0
|
6 |
*
|
indvd00m@0
|
7 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
indvd00m@0
|
8 |
* you may not use this file except in compliance with the License.
|
indvd00m@0
|
9 |
* You may obtain a copy of the License at
|
indvd00m@0
|
10 |
*
|
indvd00m@0
|
11 |
* http://www.apache.org/licenses/LICENSE-2.0
|
indvd00m@0
|
12 |
*
|
indvd00m@0
|
13 |
* Unless required by applicable law or agreed to in writing, software
|
indvd00m@0
|
14 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
indvd00m@0
|
15 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
indvd00m@0
|
16 |
* See the License for the specific language governing permissions and
|
indvd00m@0
|
17 |
* limitations under the License.
|
indvd00m@0
|
18 |
* ========================================================== */
|
indvd00m@0
|
19 |
|
indvd00m@0
|
20 |
|
indvd00m@0
|
21 |
!function ($) {
|
indvd00m@0
|
22 |
|
indvd00m@0
|
23 |
"use strict"; // jshint ;_;
|
indvd00m@0
|
24 |
|
indvd00m@0
|
25 |
|
indvd00m@0
|
26 |
/* ALERT CLASS DEFINITION
|
indvd00m@0
|
27 |
* ====================== */
|
indvd00m@0
|
28 |
|
indvd00m@0
|
29 |
var dismiss = '[data-dismiss="alert"]'
|
indvd00m@0
|
30 |
, Alert = function (el) {
|
indvd00m@0
|
31 |
$(el).on('click', dismiss, this.close)
|
indvd00m@0
|
32 |
}
|
indvd00m@0
|
33 |
|
indvd00m@0
|
34 |
Alert.prototype.close = function (e) {
|
indvd00m@0
|
35 |
var $this = $(this)
|
indvd00m@0
|
36 |
, selector = $this.attr('data-target')
|
indvd00m@0
|
37 |
, $parent
|
indvd00m@0
|
38 |
|
indvd00m@0
|
39 |
if (!selector) {
|
indvd00m@0
|
40 |
selector = $this.attr('href')
|
indvd00m@0
|
41 |
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
indvd00m@0
|
42 |
}
|
indvd00m@0
|
43 |
|
indvd00m@0
|
44 |
$parent = $(selector)
|
indvd00m@0
|
45 |
|
indvd00m@0
|
46 |
e && e.preventDefault()
|
indvd00m@0
|
47 |
|
indvd00m@0
|
48 |
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
|
indvd00m@0
|
49 |
|
indvd00m@0
|
50 |
$parent.trigger(e = $.Event('close'))
|
indvd00m@0
|
51 |
|
indvd00m@0
|
52 |
if (e.isDefaultPrevented()) return
|
indvd00m@0
|
53 |
|
indvd00m@0
|
54 |
$parent.removeClass('in')
|
indvd00m@0
|
55 |
|
indvd00m@0
|
56 |
function removeElement() {
|
indvd00m@0
|
57 |
$parent
|
indvd00m@0
|
58 |
.trigger('closed')
|
indvd00m@0
|
59 |
.remove()
|
indvd00m@0
|
60 |
}
|
indvd00m@0
|
61 |
|
indvd00m@0
|
62 |
$.support.transition && $parent.hasClass('fade') ?
|
indvd00m@0
|
63 |
$parent.on($.support.transition.end, removeElement) :
|
indvd00m@0
|
64 |
removeElement()
|
indvd00m@0
|
65 |
}
|
indvd00m@0
|
66 |
|
indvd00m@0
|
67 |
|
indvd00m@0
|
68 |
/* ALERT PLUGIN DEFINITION
|
indvd00m@0
|
69 |
* ======================= */
|
indvd00m@0
|
70 |
|
indvd00m@0
|
71 |
var old = $.fn.alert
|
indvd00m@0
|
72 |
|
indvd00m@0
|
73 |
$.fn.alert = function (option) {
|
indvd00m@0
|
74 |
return this.each(function () {
|
indvd00m@0
|
75 |
var $this = $(this)
|
indvd00m@0
|
76 |
, data = $this.data('alert')
|
indvd00m@0
|
77 |
if (!data) $this.data('alert', (data = new Alert(this)))
|
indvd00m@0
|
78 |
if (typeof option == 'string') data[option].call($this)
|
indvd00m@0
|
79 |
})
|
indvd00m@0
|
80 |
}
|
indvd00m@0
|
81 |
|
indvd00m@0
|
82 |
$.fn.alert.Constructor = Alert
|
indvd00m@0
|
83 |
|
indvd00m@0
|
84 |
|
indvd00m@0
|
85 |
/* ALERT NO CONFLICT
|
indvd00m@0
|
86 |
* ================= */
|
indvd00m@0
|
87 |
|
indvd00m@0
|
88 |
$.fn.alert.noConflict = function () {
|
indvd00m@0
|
89 |
$.fn.alert = old
|
indvd00m@0
|
90 |
return this
|
indvd00m@0
|
91 |
}
|
indvd00m@0
|
92 |
|
indvd00m@0
|
93 |
|
indvd00m@0
|
94 |
/* ALERT DATA-API
|
indvd00m@0
|
95 |
* ============== */
|
indvd00m@0
|
96 |
|
indvd00m@0
|
97 |
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
|
indvd00m@0
|
98 |
|
indvd00m@0
|
99 |
}(window.jQuery); |