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,124 @@
1
+/* ==========================================================
2
+ * bootstrap-alerts.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#alerts
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
+
21
+!function( $ ){
22
+
23
+  "use strict"
24
+
25
+  /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
26
+   * ======================================================= */
27
+
28
+   var transitionEnd
29
+
30
+   $(document).ready(function () {
31
+
32
+     $.support.transition = (function () {
33
+       var thisBody = document.body || document.documentElement
34
+         , thisStyle = thisBody.style
35
+         , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
36
+       return support
37
+     })()
38
+
39
+     // set CSS transition event type
40
+     if ( $.support.transition ) {
41
+       transitionEnd = "TransitionEnd"
42
+       if ( $.browser.webkit ) {
43
+        transitionEnd = "webkitTransitionEnd"
44
+       } else if ( $.browser.mozilla ) {
45
+        transitionEnd = "transitionend"
46
+       } else if ( $.browser.opera ) {
47
+        transitionEnd = "oTransitionEnd"
48
+       }
49
+     }
50
+
51
+   })
52
+
53
+ /* ALERT CLASS DEFINITION
54
+  * ====================== */
55
+
56
+  var Alert = function ( content, options ) {
57
+    if (options == 'close') return this.close.call(content)
58
+    this.settings = $.extend({}, $.fn.alert.defaults, options)
59
+    this.$element = $(content)
60
+      .delegate(this.settings.selector, 'click', this.close)
61
+  }
62
+
63
+  Alert.prototype = {
64
+
65
+    close: function (e) {
66
+      var $element = $(this)
67
+        , className = 'alert-message'
68
+
69
+      $element = $element.hasClass(className) ? $element : $element.parent()
70
+
71
+      e && e.preventDefault()
72
+      $element.removeClass('in')
73
+
74
+      function removeElement () {
75
+        $element.remove()
76
+      }
77
+
78
+      $.support.transition && $element.hasClass('fade') ?
79
+        $element.bind(transitionEnd, removeElement) :
80
+        removeElement()
81
+    }
82
+
83
+  }
84
+
85
+
86
+ /* ALERT PLUGIN DEFINITION
87
+  * ======================= */
88
+
89
+  $.fn.alert = function ( options ) {
90
+
91
+    if ( options === true ) {
92
+      return this.data('alert')
93
+    }
94
+
95
+    return this.each(function () {
96
+      var $this = $(this)
97
+        , data
98
+
99
+      if ( typeof options == 'string' ) {
100
+
101
+        data = $this.data('alert')
102
+
103
+        if (typeof data == 'object') {
104
+          return data[options].call( $this )
105
+        }
106
+
107
+      }
108
+
109
+      $(this).data('alert', new Alert( this, options ))
110
+
111
+    })
112
+  }
113
+
114
+  $.fn.alert.defaults = {
115
+    selector: '.close'
116
+  }
117
+
118
+  $(document).ready(function () {
119
+    new Alert($('body'), {
120
+      selector: '.alert-message[data-alert] .close'
121
+    })
122
+  })
123
+
124
+}( window.jQuery || window.ender );
0 125
\ No newline at end of file