Vous êtes connecté en tant que anonymous Se Deconnecter
Browse code

final procedural project

ER authored on 13/04/2012 10:17:34
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,64 @@
1
+/* ============================================================
2
+ * bootstrap-buttons.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#buttons
4
+ * ============================================================
5
+ * Copyright 2011 Twitter, Inc.
6
+ *
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
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
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
+ * ============================================================ */
19
+
20
+!function( $ ){
21
+
22
+  "use strict"
23
+
24
+  function setState(el, state) {
25
+    var d = 'disabled'
26
+      , $el = $(el)
27
+      , data = $el.data()
28
+
29
+    state = state + 'Text'
30
+    data.resetText || $el.data('resetText', $el.html())
31
+
32
+    $el.html( data[state] || $.fn.button.defaults[state] )
33
+
34
+    setTimeout(function () {
35
+      state == 'loadingText' ?
36
+        $el.addClass(d).attr(d, d) :
37
+        $el.removeClass(d).removeAttr(d)
38
+    }, 0)
39
+  }
40
+
41
+  function toggle(el) {
42
+    $(el).toggleClass('active')
43
+  }
44
+
45
+  $.fn.button = function(options) {
46
+    return this.each(function () {
47
+      if (options == 'toggle') {
48
+        return toggle(this)
49
+      }
50
+      options && setState(this, options)
51
+    })
52
+  }
53
+
54
+  $.fn.button.defaults = {
55
+    loadingText: 'loading...'
56
+  }
57
+
58
+  $(function () {
59
+    $('body').delegate('.btn[data-toggle]', 'click', function () {
60
+      $(this).button('toggle')
61
+    })
62
+  })
63
+
64
+}( window.jQuery || window.ender );
0 65
\ No newline at end of file