summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Bootstrap/bootstrap-modal.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Bootstrap/bootstrap-modal.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Bootstrap/bootstrap-modal.js268
1 files changed, 0 insertions, 268 deletions
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-modal.js b/frontend/gamma/js/Bootstrap/bootstrap-modal.js
deleted file mode 100644
index fd7e337..0000000
--- a/frontend/gamma/js/Bootstrap/bootstrap-modal.js
+++ b/dev/null
@@ -1,268 +0,0 @@
1/*
2
3Copyright 2008-2013 Clipperz Srl
4
5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please
7refer 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-modal.js v2.2.2
26 * http://twitter.github.com/bootstrap/javascript.html#modals
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 /* MODAL CLASS DEFINITION
50 * ====================== */
51
52 var Modal = function (element, options) {
53 this.options = options
54 this.$element = $(element)
55 .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
56 this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
57 }
58
59 Modal.prototype = {
60
61 constructor: Modal
62
63 , toggle: function () {
64 return this[!this.isShown ? 'show' : 'hide']()
65 }
66
67 , show: function () {
68 var that = this
69 , e = $.Event('show')
70
71 this.$element.trigger(e)
72
73 if (this.isShown || e.isDefaultPrevented()) return
74
75 this.isShown = true
76
77 this.escape()
78
79 this.backdrop(function () {
80 var transition = $.support.transition && that.$element.hasClass('fade')
81
82 if (!that.$element.parent().length) {
83 that.$element.appendTo(document.body) //don't move modals dom position
84 }
85
86 that.$element
87 .show()
88
89 if (transition) {
90 that.$element[0].offsetWidth // force reflow
91 }
92
93 that.$element
94 .addClass('in')
95 .attr('aria-hidden', false)
96
97 that.enforceFocus()
98
99 transition ?
100 that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
101 that.$element.focus().trigger('shown')
102
103 })
104 }
105
106 , hide: function (e) {
107 e && e.preventDefault()
108
109 var that = this
110
111 e = $.Event('hide')
112
113 this.$element.trigger(e)
114
115 if (!this.isShown || e.isDefaultPrevented()) return
116
117 this.isShown = false
118
119 this.escape()
120
121 $(document).off('focusin.modal')
122
123 this.$element
124 .removeClass('in')
125 .attr('aria-hidden', true)
126
127 $.support.transition && this.$element.hasClass('fade') ?
128 this.hideWithTransition() :
129 this.hideModal()
130 }
131
132 , enforceFocus: function () {
133 var that = this
134 $(document).on('focusin.modal', function (e) {
135 if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
136 that.$element.focus()
137 }
138 })
139 }
140
141 , escape: function () {
142 var that = this
143 if (this.isShown && this.options.keyboard) {
144 this.$element.on('keyup.dismiss.modal', function ( e ) {
145 e.which == 27 && that.hide()
146 })
147 } else if (!this.isShown) {
148 this.$element.off('keyup.dismiss.modal')
149 }
150 }
151
152 , hideWithTransition: function () {
153 var that = this
154 , timeout = setTimeout(function () {
155 that.$element.off($.support.transition.end)
156 that.hideModal()
157 }, 500)
158
159 this.$element.one($.support.transition.end, function () {
160 clearTimeout(timeout)
161 that.hideModal()
162 })
163 }
164
165 , hideModal: function (that) {
166 this.$element
167 .hide()
168 .trigger('hidden')
169
170 this.backdrop()
171 }
172
173 , removeBackdrop: function () {
174 this.$backdrop.remove()
175 this.$backdrop = null
176 }
177
178 , backdrop: function (callback) {
179 var that = this
180 , animate = this.$element.hasClass('fade') ? 'fade' : ''
181
182 if (this.isShown && this.options.backdrop) {
183 var doAnimate = $.support.transition && animate
184
185 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
186 .appendTo(document.body)
187
188 this.$backdrop.click(
189 this.options.backdrop == 'static' ?
190 $.proxy(this.$element[0].focus, this.$element[0])
191 : $.proxy(this.hide, this)
192 )
193
194 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
195
196 this.$backdrop.addClass('in')
197
198 doAnimate ?
199 this.$backdrop.one($.support.transition.end, callback) :
200 callback()
201
202 } else if (!this.isShown && this.$backdrop) {
203 this.$backdrop.removeClass('in')
204
205 $.support.transition && this.$element.hasClass('fade')?
206 this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) :
207 this.removeBackdrop()
208
209 } else if (callback) {
210 callback()
211 }
212 }
213 }
214
215
216 /* MODAL PLUGIN DEFINITION
217 * ======================= */
218
219 var old = $.fn.modal
220
221 $.fn.modal = function (option) {
222 return this.each(function () {
223 var $this = $(this)
224 , data = $this.data('modal')
225 , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
226 if (!data) $this.data('modal', (data = new Modal(this, options)))
227 if (typeof option == 'string') data[option]()
228 else if (options.show) data.show()
229 })
230 }
231
232 $.fn.modal.defaults = {
233 backdrop: true
234 , keyboard: true
235 , show: true
236 }
237
238 $.fn.modal.Constructor = Modal
239
240
241 /* MODAL NO CONFLICT
242 * ================= */
243
244 $.fn.modal.noConflict = function () {
245 $.fn.modal = old
246 return this
247 }
248
249
250 /* MODAL DATA-API
251 * ============== */
252
253 $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
254 var $this = $(this)
255 , href = $this.attr('href')
256 , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
257 , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
258
259 e.preventDefault()
260
261 $target
262 .modal(option)
263 .one('hide', function () {
264 $this.focus()
265 })
266 })
267
268}(window.jQuery);