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,90 @@
1
+/* ===========================================================
2
+ * bootstrap-popover.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#popover
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
+  var Popover = function ( element, options ) {
26
+    this.$element = $(element)
27
+    this.options = options
28
+    this.enabled = true
29
+    this.fixTitle()
30
+  }
31
+
32
+  /* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
33
+     ========================================= */
34
+
35
+  Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {
36
+
37
+    setContent: function () {
38
+      var $tip = this.tip()
39
+      $tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
40
+      $tip.find('.content > *')[this.options.html ? 'html' : 'text'](this.getContent())
41
+      $tip[0].className = 'popover'
42
+    }
43
+
44
+  , hasContent: function () {
45
+      return this.getTitle() || this.getContent()
46
+    }
47
+
48
+  , getContent: function () {
49
+      var content
50
+       , $e = this.$element
51
+       , o = this.options
52
+
53
+      if (typeof this.options.content == 'string') {
54
+        content = $e.attr(this.options.content)
55
+      } else if (typeof this.options.content == 'function') {
56
+        content = this.options.content.call(this.$element[0])
57
+      }
58
+
59
+      return content
60
+    }
61
+
62
+  , tip: function() {
63
+      if (!this.$tip) {
64
+        this.$tip = $('<div class="popover" />')
65
+          .html(this.options.template)
66
+      }
67
+      return this.$tip
68
+    }
69
+
70
+  })
71
+
72
+
73
+ /* POPOVER PLUGIN DEFINITION
74
+  * ======================= */
75
+
76
+  $.fn.popover = function (options) {
77
+    if (typeof options == 'object') options = $.extend({}, $.fn.popover.defaults, options)
78
+    $.fn.twipsy.initWith.call(this, options, Popover, 'popover')
79
+    return this
80
+  }
81
+
82
+  $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
83
+    placement: 'right'
84
+  , content: 'data-content'
85
+  , template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
86
+  })
87
+
88
+  $.fn.twipsy.rejectAttrOptions.push( 'content' )
89
+
90
+}( window.jQuery || window.ender );