summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Bootstrap/bootstrap-button.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Bootstrap/bootstrap-button.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Bootstrap/bootstrap-button.js128
1 files changed, 0 insertions, 128 deletions
diff --git a/frontend/gamma/js/Bootstrap/bootstrap-button.js b/frontend/gamma/js/Bootstrap/bootstrap-button.js
deleted file mode 100644
index 2c1226e..0000000
--- a/frontend/gamma/js/Bootstrap/bootstrap-button.js
+++ b/dev/null
@@ -1,128 +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-button.js v2.2.2
26 * http://twitter.github.com/bootstrap/javascript.html#buttons
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 /* BUTTON PUBLIC CLASS DEFINITION
50 * ============================== */
51
52 var Button = function (element, options) {
53 this.$element = $(element)
54 this.options = $.extend({}, $.fn.button.defaults, options)
55 }
56
57 Button.prototype.setState = function (state) {
58 var d = 'disabled'
59 , $el = this.$element
60 , data = $el.data()
61 , val = $el.is('input') ? 'val' : 'html'
62
63 state = state + 'Text'
64 data.resetText || $el.data('resetText', $el[val]())
65
66 $el[val](data[state] || this.options[state])
67
68 // push to event loop to allow forms to submit
69 setTimeout(function () {
70 state == 'loadingText' ?
71 $el.addClass(d).attr(d, d) :
72 $el.removeClass(d).removeAttr(d)
73 }, 0)
74 }
75
76 Button.prototype.toggle = function () {
77 var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
78
79 $parent && $parent
80 .find('.active')
81 .removeClass('active')
82
83 this.$element.toggleClass('active')
84 }
85
86
87 /* BUTTON PLUGIN DEFINITION
88 * ======================== */
89
90 var old = $.fn.button
91
92 $.fn.button = function (option) {
93 return this.each(function () {
94 var $this = $(this)
95 , data = $this.data('button')
96 , options = typeof option == 'object' && option
97 if (!data) $this.data('button', (data = new Button(this, options)))
98 if (option == 'toggle') data.toggle()
99 else if (option) data.setState(option)
100 })
101 }
102
103 $.fn.button.defaults = {
104 loadingText: 'loading...'
105 }
106
107 $.fn.button.Constructor = Button
108
109
110 /* BUTTON NO CONFLICT
111 * ================== */
112
113 $.fn.button.noConflict = function () {
114 $.fn.button = old
115 return this
116 }
117
118
119 /* BUTTON DATA-API
120 * =============== */
121
122 $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) {
123 var $btn = $(e.target)
124 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
125 $btn.button('toggle')
126 })
127
128}(window.jQuery); \ No newline at end of file