Diffstat (limited to 'frontend/gamma/js/Bootstrap/bootstrap-alert.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Bootstrap/bootstrap-alert.js | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-alert.js b/frontend/gamma/js/Bootstrap/bootstrap-alert.js new file mode 100644 index 0000000..63028f2 --- a/dev/null +++ b/frontend/gamma/js/Bootstrap/bootstrap-alert.js | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2013 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz, the online password manager. | ||
6 | For further information about its features and functionalities please | ||
7 | refer to http://www.clipperz.com. | ||
8 | |||
9 | * Clipperz is free software: you can redistribute it and/or modify it | ||
10 | under the terms of the GNU Affero General Public License as published | ||
11 | by the Free Software Foundation, either version 3 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | * Clipperz is distributed in the hope that it will be useful, but | ||
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | See the GNU Affero General Public License for more details. | ||
18 | |||
19 | * You should have received a copy of the GNU Affero General Public | ||
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | ||
21 | |||
22 | */ | ||
23 | |||
24 | /* ========================================================== | ||
25 | * bootstrap-alert.js v2.2.2 | ||
26 | * http://twitter.github.com/bootstrap/javascript.html#alerts | ||
27 | * ========================================================== | ||
28 | * Copyright 2012 Twitter, Inc. | ||
29 | * | ||
30 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
31 | * you may not use this file except in compliance with the License. | ||
32 | * You may obtain a copy of the License at | ||
33 | * | ||
34 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
35 | * | ||
36 | * Unless required by applicable law or agreed to in writing, software | ||
37 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
38 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
39 | * See the License for the specific language governing permissions and | ||
40 | * limitations under the License. | ||
41 | * ========================================================== */ | ||
42 | |||
43 | |||
44 | !function ($) { | ||
45 | |||
46 | "use strict"; // jshint ;_; | ||
47 | |||
48 | |||
49 | /* ALERT CLASS DEFINITION | ||
50 | * ====================== */ | ||
51 | |||
52 | var dismiss = '[data-dismiss="alert"]' | ||
53 | , Alert = function (el) { | ||
54 | $(el).on('click', dismiss, this.close) | ||
55 | } | ||
56 | |||
57 | Alert.prototype.close = function (e) { | ||
58 | var $this = $(this) | ||
59 | , selector = $this.attr('data-target') | ||
60 | , $parent | ||
61 | |||
62 | if (!selector) { | ||
63 | selector = $this.attr('href') | ||
64 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 | ||
65 | } | ||
66 | |||
67 | $parent = $(selector) | ||
68 | |||
69 | e && e.preventDefault() | ||
70 | |||
71 | $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) | ||
72 | |||
73 | $parent.trigger(e = $.Event('close')) | ||
74 | |||
75 | if (e.isDefaultPrevented()) return | ||
76 | |||
77 | $parent.removeClass('in') | ||
78 | |||
79 | function removeElement() { | ||
80 | $parent | ||
81 | .trigger('closed') | ||
82 | .remove() | ||
83 | } | ||
84 | |||
85 | $.support.transition && $parent.hasClass('fade') ? | ||
86 | $parent.on($.support.transition.end, removeElement) : | ||
87 | removeElement() | ||
88 | } | ||
89 | |||
90 | |||
91 | /* ALERT PLUGIN DEFINITION | ||
92 | * ======================= */ | ||
93 | |||
94 | var old = $.fn.alert | ||
95 | |||
96 | $.fn.alert = function (option) { | ||
97 | return this.each(function () { | ||
98 | var $this = $(this) | ||
99 | , data = $this.data('alert') | ||
100 | if (!data) $this.data('alert', (data = new Alert(this))) | ||
101 | if (typeof option == 'string') data[option].call($this) | ||
102 | }) | ||
103 | } | ||
104 | |||
105 | $.fn.alert.Constructor = Alert | ||
106 | |||
107 | |||
108 | /* ALERT NO CONFLICT | ||
109 | * ================= */ | ||
110 | |||
111 | $.fn.alert.noConflict = function () { | ||
112 | $.fn.alert = old | ||
113 | return this | ||
114 | } | ||
115 | |||
116 | |||
117 | /* ALERT DATA-API | ||
118 | * ============== */ | ||
119 | |||
120 | $(document).on('click.alert.data-api', dismiss, Alert.prototype.close) | ||
121 | |||
122 | }(window.jQuery); \ No newline at end of file | ||