Mercurial > odfcast
annotate static/js/bootstrap.js @ 17:75d5d18e7d52
Add bootstrap for css formating
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 29 Sep 2014 14:17:41 +0200 |
parents | |
children |
rev | line source |
---|---|
17
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1 /*! |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2 * Bootstrap v3.2.0 (http://getbootstrap.com) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
3 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
5 */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
6 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
7 if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
8 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
9 /* ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
10 * Bootstrap: transition.js v3.2.0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
11 * http://getbootstrap.com/javascript/#transitions |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
12 * ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
13 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
14 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
15 * ======================================================================== */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
16 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
17 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
18 +function ($) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
19 'use strict'; |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
20 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
21 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
22 // ============================================================ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
23 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
24 function transitionEnd() { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
25 var el = document.createElement('bootstrap') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
26 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
27 var transEndEventNames = { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
28 WebkitTransition : 'webkitTransitionEnd', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
29 MozTransition : 'transitionend', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
30 OTransition : 'oTransitionEnd otransitionend', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
31 transition : 'transitionend' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
32 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
33 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
34 for (var name in transEndEventNames) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
35 if (el.style[name] !== undefined) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
36 return { end: transEndEventNames[name] } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
37 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
38 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
39 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
40 return false // explicit for ie8 ( ._.) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
41 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
42 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
43 // http://blog.alexmaccaw.com/css-transitions |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
44 $.fn.emulateTransitionEnd = function (duration) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
45 var called = false |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
46 var $el = this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
47 $(this).one('bsTransitionEnd', function () { called = true }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
48 var callback = function () { if (!called) $($el).trigger($.support.transition.end) } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
49 setTimeout(callback, duration) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
50 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
51 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
52 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
53 $(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
54 $.support.transition = transitionEnd() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
55 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
56 if (!$.support.transition) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
57 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
58 $.event.special.bsTransitionEnd = { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
59 bindType: $.support.transition.end, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
60 delegateType: $.support.transition.end, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
61 handle: function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
62 if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
63 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
64 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
65 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
66 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
67 }(jQuery); |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
68 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
69 /* ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
70 * Bootstrap: alert.js v3.2.0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
71 * http://getbootstrap.com/javascript/#alerts |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
72 * ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
73 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
74 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
75 * ======================================================================== */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
76 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
77 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
78 +function ($) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
79 'use strict'; |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
80 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
81 // ALERT CLASS DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
82 // ====================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
83 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
84 var dismiss = '[data-dismiss="alert"]' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
85 var Alert = function (el) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
86 $(el).on('click', dismiss, this.close) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
87 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
88 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
89 Alert.VERSION = '3.2.0' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
90 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
91 Alert.prototype.close = function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
92 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
93 var selector = $this.attr('data-target') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
94 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
95 if (!selector) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
96 selector = $this.attr('href') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
97 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
98 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
99 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
100 var $parent = $(selector) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
101 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
102 if (e) e.preventDefault() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
103 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
104 if (!$parent.length) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
105 $parent = $this.hasClass('alert') ? $this : $this.parent() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
106 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
107 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
108 $parent.trigger(e = $.Event('close.bs.alert')) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
109 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
110 if (e.isDefaultPrevented()) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
111 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
112 $parent.removeClass('in') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
113 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
114 function removeElement() { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
115 // detach from parent, fire event then clean up data |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
116 $parent.detach().trigger('closed.bs.alert').remove() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
117 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
118 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
119 $.support.transition && $parent.hasClass('fade') ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
120 $parent |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
121 .one('bsTransitionEnd', removeElement) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
122 .emulateTransitionEnd(150) : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
123 removeElement() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
124 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
125 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
126 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
127 // ALERT PLUGIN DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
128 // ======================= |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
129 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
130 function Plugin(option) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
131 return this.each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
132 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
133 var data = $this.data('bs.alert') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
134 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
135 if (!data) $this.data('bs.alert', (data = new Alert(this))) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
136 if (typeof option == 'string') data[option].call($this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
137 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
138 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
139 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
140 var old = $.fn.alert |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
141 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
142 $.fn.alert = Plugin |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
143 $.fn.alert.Constructor = Alert |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
144 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
145 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
146 // ALERT NO CONFLICT |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
147 // ================= |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
148 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
149 $.fn.alert.noConflict = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
150 $.fn.alert = old |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
151 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
152 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
153 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
154 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
155 // ALERT DATA-API |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
156 // ============== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
157 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
158 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
159 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
160 }(jQuery); |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
161 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
162 /* ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
163 * Bootstrap: button.js v3.2.0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
164 * http://getbootstrap.com/javascript/#buttons |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
165 * ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
166 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
167 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
168 * ======================================================================== */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
169 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
170 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
171 +function ($) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
172 'use strict'; |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
173 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
174 // BUTTON PUBLIC CLASS DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
175 // ============================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
176 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
177 var Button = function (element, options) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
178 this.$element = $(element) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
179 this.options = $.extend({}, Button.DEFAULTS, options) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
180 this.isLoading = false |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
181 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
182 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
183 Button.VERSION = '3.2.0' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
184 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
185 Button.DEFAULTS = { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
186 loadingText: 'loading...' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
187 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
188 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
189 Button.prototype.setState = function (state) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
190 var d = 'disabled' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
191 var $el = this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
192 var val = $el.is('input') ? 'val' : 'html' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
193 var data = $el.data() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
194 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
195 state = state + 'Text' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
196 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
197 if (data.resetText == null) $el.data('resetText', $el[val]()) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
198 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
199 $el[val](data[state] == null ? this.options[state] : data[state]) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
200 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
201 // push to event loop to allow forms to submit |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
202 setTimeout($.proxy(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
203 if (state == 'loadingText') { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
204 this.isLoading = true |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
205 $el.addClass(d).attr(d, d) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
206 } else if (this.isLoading) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
207 this.isLoading = false |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
208 $el.removeClass(d).removeAttr(d) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
209 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
210 }, this), 0) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
211 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
212 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
213 Button.prototype.toggle = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
214 var changed = true |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
215 var $parent = this.$element.closest('[data-toggle="buttons"]') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
216 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
217 if ($parent.length) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
218 var $input = this.$element.find('input') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
219 if ($input.prop('type') == 'radio') { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
220 if ($input.prop('checked') && this.$element.hasClass('active')) changed = false |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
221 else $parent.find('.active').removeClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
222 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
223 if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
224 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
225 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
226 if (changed) this.$element.toggleClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
227 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
228 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
229 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
230 // BUTTON PLUGIN DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
231 // ======================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
232 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
233 function Plugin(option) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
234 return this.each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
235 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
236 var data = $this.data('bs.button') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
237 var options = typeof option == 'object' && option |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
238 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
239 if (!data) $this.data('bs.button', (data = new Button(this, options))) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
240 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
241 if (option == 'toggle') data.toggle() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
242 else if (option) data.setState(option) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
243 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
244 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
245 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
246 var old = $.fn.button |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
247 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
248 $.fn.button = Plugin |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
249 $.fn.button.Constructor = Button |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
250 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
251 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
252 // BUTTON NO CONFLICT |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
253 // ================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
254 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
255 $.fn.button.noConflict = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
256 $.fn.button = old |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
257 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
258 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
259 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
260 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
261 // BUTTON DATA-API |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
262 // =============== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
263 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
264 $(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
265 var $btn = $(e.target) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
266 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
267 Plugin.call($btn, 'toggle') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
268 e.preventDefault() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
269 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
270 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
271 }(jQuery); |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
272 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
273 /* ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
274 * Bootstrap: carousel.js v3.2.0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
275 * http://getbootstrap.com/javascript/#carousel |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
276 * ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
277 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
278 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
279 * ======================================================================== */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
280 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
281 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
282 +function ($) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
283 'use strict'; |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
284 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
285 // CAROUSEL CLASS DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
286 // ========================= |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
287 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
288 var Carousel = function (element, options) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
289 this.$element = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
290 this.$indicators = this.$element.find('.carousel-indicators') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
291 this.options = options |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
292 this.paused = |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
293 this.sliding = |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
294 this.interval = |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
295 this.$active = |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
296 this.$items = null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
297 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
298 this.options.pause == 'hover' && this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
299 .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
300 .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
301 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
302 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
303 Carousel.VERSION = '3.2.0' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
304 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
305 Carousel.DEFAULTS = { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
306 interval: 5000, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
307 pause: 'hover', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
308 wrap: true |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
309 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
310 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
311 Carousel.prototype.keydown = function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
312 switch (e.which) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
313 case 37: this.prev(); break |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
314 case 39: this.next(); break |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
315 default: return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
316 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
317 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
318 e.preventDefault() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
319 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
320 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
321 Carousel.prototype.cycle = function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
322 e || (this.paused = false) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
323 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
324 this.interval && clearInterval(this.interval) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
325 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
326 this.options.interval |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
327 && !this.paused |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
328 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
329 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
330 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
331 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
332 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
333 Carousel.prototype.getItemIndex = function (item) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
334 this.$items = item.parent().children('.item') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
335 return this.$items.index(item || this.$active) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
336 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
337 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
338 Carousel.prototype.to = function (pos) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
339 var that = this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
340 var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
341 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
342 if (pos > (this.$items.length - 1) || pos < 0) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
343 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
344 if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
345 if (activeIndex == pos) return this.pause().cycle() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
346 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
347 return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
348 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
349 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
350 Carousel.prototype.pause = function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
351 e || (this.paused = true) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
352 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
353 if (this.$element.find('.next, .prev').length && $.support.transition) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
354 this.$element.trigger($.support.transition.end) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
355 this.cycle(true) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
356 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
357 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
358 this.interval = clearInterval(this.interval) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
359 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
360 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
361 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
362 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
363 Carousel.prototype.next = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
364 if (this.sliding) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
365 return this.slide('next') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
366 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
367 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
368 Carousel.prototype.prev = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
369 if (this.sliding) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
370 return this.slide('prev') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
371 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
372 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
373 Carousel.prototype.slide = function (type, next) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
374 var $active = this.$element.find('.item.active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
375 var $next = next || $active[type]() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
376 var isCycling = this.interval |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
377 var direction = type == 'next' ? 'left' : 'right' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
378 var fallback = type == 'next' ? 'first' : 'last' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
379 var that = this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
380 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
381 if (!$next.length) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
382 if (!this.options.wrap) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
383 $next = this.$element.find('.item')[fallback]() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
384 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
385 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
386 if ($next.hasClass('active')) return (this.sliding = false) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
387 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
388 var relatedTarget = $next[0] |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
389 var slideEvent = $.Event('slide.bs.carousel', { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
390 relatedTarget: relatedTarget, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
391 direction: direction |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
392 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
393 this.$element.trigger(slideEvent) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
394 if (slideEvent.isDefaultPrevented()) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
395 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
396 this.sliding = true |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
397 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
398 isCycling && this.pause() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
399 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
400 if (this.$indicators.length) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
401 this.$indicators.find('.active').removeClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
402 var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
403 $nextIndicator && $nextIndicator.addClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
404 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
405 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
406 var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
407 if ($.support.transition && this.$element.hasClass('slide')) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
408 $next.addClass(type) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
409 $next[0].offsetWidth // force reflow |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
410 $active.addClass(direction) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
411 $next.addClass(direction) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
412 $active |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
413 .one('bsTransitionEnd', function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
414 $next.removeClass([type, direction].join(' ')).addClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
415 $active.removeClass(['active', direction].join(' ')) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
416 that.sliding = false |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
417 setTimeout(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
418 that.$element.trigger(slidEvent) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
419 }, 0) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
420 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
421 .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
422 } else { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
423 $active.removeClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
424 $next.addClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
425 this.sliding = false |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
426 this.$element.trigger(slidEvent) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
427 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
428 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
429 isCycling && this.cycle() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
430 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
431 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
432 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
433 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
434 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
435 // CAROUSEL PLUGIN DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
436 // ========================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
437 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
438 function Plugin(option) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
439 return this.each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
440 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
441 var data = $this.data('bs.carousel') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
442 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
443 var action = typeof option == 'string' ? option : options.slide |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
444 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
445 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
446 if (typeof option == 'number') data.to(option) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
447 else if (action) data[action]() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
448 else if (options.interval) data.pause().cycle() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
449 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
450 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
451 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
452 var old = $.fn.carousel |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
453 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
454 $.fn.carousel = Plugin |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
455 $.fn.carousel.Constructor = Carousel |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
456 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
457 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
458 // CAROUSEL NO CONFLICT |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
459 // ==================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
460 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
461 $.fn.carousel.noConflict = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
462 $.fn.carousel = old |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
463 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
464 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
465 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
466 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
467 // CAROUSEL DATA-API |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
468 // ================= |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
469 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
470 $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
471 var href |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
472 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
473 var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
474 if (!$target.hasClass('carousel')) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
475 var options = $.extend({}, $target.data(), $this.data()) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
476 var slideIndex = $this.attr('data-slide-to') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
477 if (slideIndex) options.interval = false |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
478 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
479 Plugin.call($target, options) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
480 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
481 if (slideIndex) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
482 $target.data('bs.carousel').to(slideIndex) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
483 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
484 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
485 e.preventDefault() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
486 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
487 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
488 $(window).on('load', function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
489 $('[data-ride="carousel"]').each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
490 var $carousel = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
491 Plugin.call($carousel, $carousel.data()) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
492 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
493 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
494 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
495 }(jQuery); |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
496 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
497 /* ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
498 * Bootstrap: collapse.js v3.2.0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
499 * http://getbootstrap.com/javascript/#collapse |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
500 * ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
501 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
502 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
503 * ======================================================================== */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
504 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
505 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
506 +function ($) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
507 'use strict'; |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
508 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
509 // COLLAPSE PUBLIC CLASS DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
510 // ================================ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
511 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
512 var Collapse = function (element, options) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
513 this.$element = $(element) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
514 this.options = $.extend({}, Collapse.DEFAULTS, options) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
515 this.transitioning = null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
516 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
517 if (this.options.parent) this.$parent = $(this.options.parent) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
518 if (this.options.toggle) this.toggle() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
519 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
520 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
521 Collapse.VERSION = '3.2.0' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
522 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
523 Collapse.DEFAULTS = { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
524 toggle: true |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
525 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
526 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
527 Collapse.prototype.dimension = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
528 var hasWidth = this.$element.hasClass('width') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
529 return hasWidth ? 'width' : 'height' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
530 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
531 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
532 Collapse.prototype.show = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
533 if (this.transitioning || this.$element.hasClass('in')) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
534 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
535 var startEvent = $.Event('show.bs.collapse') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
536 this.$element.trigger(startEvent) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
537 if (startEvent.isDefaultPrevented()) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
538 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
539 var actives = this.$parent && this.$parent.find('> .panel > .in') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
540 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
541 if (actives && actives.length) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
542 var hasData = actives.data('bs.collapse') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
543 if (hasData && hasData.transitioning) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
544 Plugin.call(actives, 'hide') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
545 hasData || actives.data('bs.collapse', null) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
546 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
547 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
548 var dimension = this.dimension() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
549 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
550 this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
551 .removeClass('collapse') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
552 .addClass('collapsing')[dimension](0) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
553 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
554 this.transitioning = 1 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
555 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
556 var complete = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
557 this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
558 .removeClass('collapsing') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
559 .addClass('collapse in')[dimension]('') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
560 this.transitioning = 0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
561 this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
562 .trigger('shown.bs.collapse') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
563 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
564 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
565 if (!$.support.transition) return complete.call(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
566 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
567 var scrollSize = $.camelCase(['scroll', dimension].join('-')) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
568 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
569 this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
570 .one('bsTransitionEnd', $.proxy(complete, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
571 .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize]) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
572 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
573 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
574 Collapse.prototype.hide = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
575 if (this.transitioning || !this.$element.hasClass('in')) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
576 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
577 var startEvent = $.Event('hide.bs.collapse') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
578 this.$element.trigger(startEvent) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
579 if (startEvent.isDefaultPrevented()) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
580 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
581 var dimension = this.dimension() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
582 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
583 this.$element[dimension](this.$element[dimension]())[0].offsetHeight |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
584 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
585 this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
586 .addClass('collapsing') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
587 .removeClass('collapse') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
588 .removeClass('in') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
589 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
590 this.transitioning = 1 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
591 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
592 var complete = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
593 this.transitioning = 0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
594 this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
595 .trigger('hidden.bs.collapse') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
596 .removeClass('collapsing') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
597 .addClass('collapse') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
598 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
599 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
600 if (!$.support.transition) return complete.call(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
601 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
602 this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
603 [dimension](0) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
604 .one('bsTransitionEnd', $.proxy(complete, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
605 .emulateTransitionEnd(350) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
606 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
607 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
608 Collapse.prototype.toggle = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
609 this[this.$element.hasClass('in') ? 'hide' : 'show']() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
610 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
611 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
612 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
613 // COLLAPSE PLUGIN DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
614 // ========================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
615 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
616 function Plugin(option) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
617 return this.each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
618 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
619 var data = $this.data('bs.collapse') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
620 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
621 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
622 if (!data && options.toggle && option == 'show') option = !option |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
623 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
624 if (typeof option == 'string') data[option]() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
625 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
626 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
627 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
628 var old = $.fn.collapse |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
629 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
630 $.fn.collapse = Plugin |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
631 $.fn.collapse.Constructor = Collapse |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
632 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
633 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
634 // COLLAPSE NO CONFLICT |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
635 // ==================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
636 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
637 $.fn.collapse.noConflict = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
638 $.fn.collapse = old |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
639 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
640 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
641 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
642 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
643 // COLLAPSE DATA-API |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
644 // ================= |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
645 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
646 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
647 var href |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
648 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
649 var target = $this.attr('data-target') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
650 || e.preventDefault() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
651 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
652 var $target = $(target) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
653 var data = $target.data('bs.collapse') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
654 var option = data ? 'toggle' : $this.data() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
655 var parent = $this.attr('data-parent') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
656 var $parent = parent && $(parent) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
657 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
658 if (!data || !data.transitioning) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
659 if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
660 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
661 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
662 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
663 Plugin.call($target, option) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
664 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
665 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
666 }(jQuery); |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
667 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
668 /* ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
669 * Bootstrap: dropdown.js v3.2.0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
670 * http://getbootstrap.com/javascript/#dropdowns |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
671 * ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
672 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
673 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
674 * ======================================================================== */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
675 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
676 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
677 +function ($) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
678 'use strict'; |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
679 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
680 // DROPDOWN CLASS DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
681 // ========================= |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
682 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
683 var backdrop = '.dropdown-backdrop' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
684 var toggle = '[data-toggle="dropdown"]' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
685 var Dropdown = function (element) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
686 $(element).on('click.bs.dropdown', this.toggle) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
687 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
688 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
689 Dropdown.VERSION = '3.2.0' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
690 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
691 Dropdown.prototype.toggle = function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
692 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
693 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
694 if ($this.is('.disabled, :disabled')) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
695 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
696 var $parent = getParent($this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
697 var isActive = $parent.hasClass('open') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
698 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
699 clearMenus() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
700 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
701 if (!isActive) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
702 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
703 // if mobile we use a backdrop because click events don't delegate |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
704 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
705 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
706 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
707 var relatedTarget = { relatedTarget: this } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
708 $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
709 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
710 if (e.isDefaultPrevented()) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
711 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
712 $this.trigger('focus') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
713 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
714 $parent |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
715 .toggleClass('open') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
716 .trigger('shown.bs.dropdown', relatedTarget) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
717 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
718 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
719 return false |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
720 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
721 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
722 Dropdown.prototype.keydown = function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
723 if (!/(38|40|27)/.test(e.keyCode)) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
724 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
725 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
726 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
727 e.preventDefault() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
728 e.stopPropagation() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
729 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
730 if ($this.is('.disabled, :disabled')) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
731 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
732 var $parent = getParent($this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
733 var isActive = $parent.hasClass('open') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
734 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
735 if (!isActive || (isActive && e.keyCode == 27)) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
736 if (e.which == 27) $parent.find(toggle).trigger('focus') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
737 return $this.trigger('click') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
738 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
739 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
740 var desc = ' li:not(.divider):visible a' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
741 var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
742 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
743 if (!$items.length) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
744 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
745 var index = $items.index($items.filter(':focus')) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
746 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
747 if (e.keyCode == 38 && index > 0) index-- // up |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
748 if (e.keyCode == 40 && index < $items.length - 1) index++ // down |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
749 if (!~index) index = 0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
750 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
751 $items.eq(index).trigger('focus') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
752 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
753 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
754 function clearMenus(e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
755 if (e && e.which === 3) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
756 $(backdrop).remove() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
757 $(toggle).each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
758 var $parent = getParent($(this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
759 var relatedTarget = { relatedTarget: this } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
760 if (!$parent.hasClass('open')) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
761 $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
762 if (e.isDefaultPrevented()) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
763 $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
764 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
765 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
766 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
767 function getParent($this) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
768 var selector = $this.attr('data-target') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
769 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
770 if (!selector) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
771 selector = $this.attr('href') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
772 selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
773 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
774 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
775 var $parent = selector && $(selector) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
776 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
777 return $parent && $parent.length ? $parent : $this.parent() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
778 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
779 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
780 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
781 // DROPDOWN PLUGIN DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
782 // ========================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
783 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
784 function Plugin(option) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
785 return this.each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
786 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
787 var data = $this.data('bs.dropdown') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
788 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
789 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
790 if (typeof option == 'string') data[option].call($this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
791 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
792 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
793 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
794 var old = $.fn.dropdown |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
795 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
796 $.fn.dropdown = Plugin |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
797 $.fn.dropdown.Constructor = Dropdown |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
798 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
799 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
800 // DROPDOWN NO CONFLICT |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
801 // ==================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
802 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
803 $.fn.dropdown.noConflict = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
804 $.fn.dropdown = old |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
805 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
806 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
807 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
808 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
809 // APPLY TO STANDARD DROPDOWN ELEMENTS |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
810 // =================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
811 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
812 $(document) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
813 .on('click.bs.dropdown.data-api', clearMenus) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
814 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
815 .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
816 .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
817 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
818 }(jQuery); |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
819 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
820 /* ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
821 * Bootstrap: modal.js v3.2.0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
822 * http://getbootstrap.com/javascript/#modals |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
823 * ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
824 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
825 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
826 * ======================================================================== */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
827 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
828 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
829 +function ($) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
830 'use strict'; |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
831 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
832 // MODAL CLASS DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
833 // ====================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
834 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
835 var Modal = function (element, options) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
836 this.options = options |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
837 this.$body = $(document.body) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
838 this.$element = $(element) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
839 this.$backdrop = |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
840 this.isShown = null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
841 this.scrollbarWidth = 0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
842 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
843 if (this.options.remote) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
844 this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
845 .find('.modal-content') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
846 .load(this.options.remote, $.proxy(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
847 this.$element.trigger('loaded.bs.modal') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
848 }, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
849 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
850 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
851 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
852 Modal.VERSION = '3.2.0' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
853 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
854 Modal.DEFAULTS = { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
855 backdrop: true, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
856 keyboard: true, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
857 show: true |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
858 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
859 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
860 Modal.prototype.toggle = function (_relatedTarget) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
861 return this.isShown ? this.hide() : this.show(_relatedTarget) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
862 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
863 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
864 Modal.prototype.show = function (_relatedTarget) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
865 var that = this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
866 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
867 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
868 this.$element.trigger(e) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
869 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
870 if (this.isShown || e.isDefaultPrevented()) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
871 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
872 this.isShown = true |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
873 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
874 this.checkScrollbar() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
875 this.$body.addClass('modal-open') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
876 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
877 this.setScrollbar() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
878 this.escape() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
879 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
880 this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
881 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
882 this.backdrop(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
883 var transition = $.support.transition && that.$element.hasClass('fade') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
884 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
885 if (!that.$element.parent().length) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
886 that.$element.appendTo(that.$body) // don't move modals dom position |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
887 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
888 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
889 that.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
890 .show() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
891 .scrollTop(0) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
892 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
893 if (transition) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
894 that.$element[0].offsetWidth // force reflow |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
895 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
896 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
897 that.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
898 .addClass('in') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
899 .attr('aria-hidden', false) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
900 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
901 that.enforceFocus() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
902 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
903 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
904 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
905 transition ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
906 that.$element.find('.modal-dialog') // wait for modal to slide in |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
907 .one('bsTransitionEnd', function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
908 that.$element.trigger('focus').trigger(e) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
909 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
910 .emulateTransitionEnd(300) : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
911 that.$element.trigger('focus').trigger(e) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
912 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
913 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
914 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
915 Modal.prototype.hide = function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
916 if (e) e.preventDefault() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
917 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
918 e = $.Event('hide.bs.modal') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
919 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
920 this.$element.trigger(e) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
921 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
922 if (!this.isShown || e.isDefaultPrevented()) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
923 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
924 this.isShown = false |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
925 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
926 this.$body.removeClass('modal-open') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
927 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
928 this.resetScrollbar() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
929 this.escape() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
930 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
931 $(document).off('focusin.bs.modal') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
932 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
933 this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
934 .removeClass('in') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
935 .attr('aria-hidden', true) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
936 .off('click.dismiss.bs.modal') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
937 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
938 $.support.transition && this.$element.hasClass('fade') ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
939 this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
940 .one('bsTransitionEnd', $.proxy(this.hideModal, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
941 .emulateTransitionEnd(300) : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
942 this.hideModal() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
943 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
944 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
945 Modal.prototype.enforceFocus = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
946 $(document) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
947 .off('focusin.bs.modal') // guard against infinite focus loop |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
948 .on('focusin.bs.modal', $.proxy(function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
949 if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
950 this.$element.trigger('focus') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
951 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
952 }, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
953 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
954 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
955 Modal.prototype.escape = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
956 if (this.isShown && this.options.keyboard) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
957 this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
958 e.which == 27 && this.hide() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
959 }, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
960 } else if (!this.isShown) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
961 this.$element.off('keyup.dismiss.bs.modal') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
962 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
963 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
964 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
965 Modal.prototype.hideModal = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
966 var that = this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
967 this.$element.hide() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
968 this.backdrop(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
969 that.$element.trigger('hidden.bs.modal') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
970 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
971 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
972 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
973 Modal.prototype.removeBackdrop = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
974 this.$backdrop && this.$backdrop.remove() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
975 this.$backdrop = null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
976 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
977 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
978 Modal.prototype.backdrop = function (callback) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
979 var that = this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
980 var animate = this.$element.hasClass('fade') ? 'fade' : '' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
981 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
982 if (this.isShown && this.options.backdrop) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
983 var doAnimate = $.support.transition && animate |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
984 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
985 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
986 .appendTo(this.$body) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
987 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
988 this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
989 if (e.target !== e.currentTarget) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
990 this.options.backdrop == 'static' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
991 ? this.$element[0].focus.call(this.$element[0]) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
992 : this.hide.call(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
993 }, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
994 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
995 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
996 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
997 this.$backdrop.addClass('in') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
998 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
999 if (!callback) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1000 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1001 doAnimate ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1002 this.$backdrop |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1003 .one('bsTransitionEnd', callback) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1004 .emulateTransitionEnd(150) : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1005 callback() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1006 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1007 } else if (!this.isShown && this.$backdrop) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1008 this.$backdrop.removeClass('in') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1009 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1010 var callbackRemove = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1011 that.removeBackdrop() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1012 callback && callback() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1013 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1014 $.support.transition && this.$element.hasClass('fade') ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1015 this.$backdrop |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1016 .one('bsTransitionEnd', callbackRemove) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1017 .emulateTransitionEnd(150) : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1018 callbackRemove() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1019 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1020 } else if (callback) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1021 callback() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1022 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1023 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1024 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1025 Modal.prototype.checkScrollbar = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1026 if (document.body.clientWidth >= window.innerWidth) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1027 this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1028 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1029 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1030 Modal.prototype.setScrollbar = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1031 var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1032 if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1033 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1034 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1035 Modal.prototype.resetScrollbar = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1036 this.$body.css('padding-right', '') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1037 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1038 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1039 Modal.prototype.measureScrollbar = function () { // thx walsh |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1040 var scrollDiv = document.createElement('div') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1041 scrollDiv.className = 'modal-scrollbar-measure' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1042 this.$body.append(scrollDiv) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1043 var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1044 this.$body[0].removeChild(scrollDiv) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1045 return scrollbarWidth |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1046 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1047 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1048 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1049 // MODAL PLUGIN DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1050 // ======================= |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1051 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1052 function Plugin(option, _relatedTarget) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1053 return this.each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1054 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1055 var data = $this.data('bs.modal') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1056 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1057 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1058 if (!data) $this.data('bs.modal', (data = new Modal(this, options))) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1059 if (typeof option == 'string') data[option](_relatedTarget) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1060 else if (options.show) data.show(_relatedTarget) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1061 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1062 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1063 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1064 var old = $.fn.modal |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1065 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1066 $.fn.modal = Plugin |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1067 $.fn.modal.Constructor = Modal |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1068 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1069 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1070 // MODAL NO CONFLICT |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1071 // ================= |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1072 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1073 $.fn.modal.noConflict = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1074 $.fn.modal = old |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1075 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1076 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1077 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1078 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1079 // MODAL DATA-API |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1080 // ============== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1081 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1082 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1083 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1084 var href = $this.attr('href') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1085 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1086 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1087 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1088 if ($this.is('a')) e.preventDefault() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1089 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1090 $target.one('show.bs.modal', function (showEvent) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1091 if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1092 $target.one('hidden.bs.modal', function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1093 $this.is(':visible') && $this.trigger('focus') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1094 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1095 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1096 Plugin.call($target, option, this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1097 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1098 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1099 }(jQuery); |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1100 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1101 /* ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1102 * Bootstrap: tooltip.js v3.2.0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1103 * http://getbootstrap.com/javascript/#tooltip |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1104 * Inspired by the original jQuery.tipsy by Jason Frame |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1105 * ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1106 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1107 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1108 * ======================================================================== */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1109 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1110 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1111 +function ($) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1112 'use strict'; |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1113 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1114 // TOOLTIP PUBLIC CLASS DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1115 // =============================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1116 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1117 var Tooltip = function (element, options) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1118 this.type = |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1119 this.options = |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1120 this.enabled = |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1121 this.timeout = |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1122 this.hoverState = |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1123 this.$element = null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1124 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1125 this.init('tooltip', element, options) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1126 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1127 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1128 Tooltip.VERSION = '3.2.0' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1129 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1130 Tooltip.DEFAULTS = { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1131 animation: true, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1132 placement: 'top', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1133 selector: false, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1134 template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1135 trigger: 'hover focus', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1136 title: '', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1137 delay: 0, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1138 html: false, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1139 container: false, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1140 viewport: { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1141 selector: 'body', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1142 padding: 0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1143 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1144 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1145 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1146 Tooltip.prototype.init = function (type, element, options) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1147 this.enabled = true |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1148 this.type = type |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1149 this.$element = $(element) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1150 this.options = this.getOptions(options) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1151 this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1152 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1153 var triggers = this.options.trigger.split(' ') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1154 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1155 for (var i = triggers.length; i--;) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1156 var trigger = triggers[i] |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1157 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1158 if (trigger == 'click') { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1159 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1160 } else if (trigger != 'manual') { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1161 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1162 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1163 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1164 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1165 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1166 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1167 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1168 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1169 this.options.selector ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1170 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1171 this.fixTitle() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1172 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1173 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1174 Tooltip.prototype.getDefaults = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1175 return Tooltip.DEFAULTS |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1176 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1177 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1178 Tooltip.prototype.getOptions = function (options) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1179 options = $.extend({}, this.getDefaults(), this.$element.data(), options) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1180 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1181 if (options.delay && typeof options.delay == 'number') { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1182 options.delay = { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1183 show: options.delay, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1184 hide: options.delay |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1185 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1186 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1187 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1188 return options |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1189 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1190 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1191 Tooltip.prototype.getDelegateOptions = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1192 var options = {} |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1193 var defaults = this.getDefaults() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1194 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1195 this._options && $.each(this._options, function (key, value) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1196 if (defaults[key] != value) options[key] = value |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1197 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1198 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1199 return options |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1200 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1201 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1202 Tooltip.prototype.enter = function (obj) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1203 var self = obj instanceof this.constructor ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1204 obj : $(obj.currentTarget).data('bs.' + this.type) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1205 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1206 if (!self) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1207 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1208 $(obj.currentTarget).data('bs.' + this.type, self) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1209 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1210 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1211 clearTimeout(self.timeout) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1212 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1213 self.hoverState = 'in' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1214 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1215 if (!self.options.delay || !self.options.delay.show) return self.show() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1216 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1217 self.timeout = setTimeout(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1218 if (self.hoverState == 'in') self.show() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1219 }, self.options.delay.show) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1220 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1221 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1222 Tooltip.prototype.leave = function (obj) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1223 var self = obj instanceof this.constructor ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1224 obj : $(obj.currentTarget).data('bs.' + this.type) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1225 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1226 if (!self) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1227 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1228 $(obj.currentTarget).data('bs.' + this.type, self) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1229 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1230 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1231 clearTimeout(self.timeout) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1232 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1233 self.hoverState = 'out' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1234 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1235 if (!self.options.delay || !self.options.delay.hide) return self.hide() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1236 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1237 self.timeout = setTimeout(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1238 if (self.hoverState == 'out') self.hide() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1239 }, self.options.delay.hide) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1240 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1241 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1242 Tooltip.prototype.show = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1243 var e = $.Event('show.bs.' + this.type) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1244 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1245 if (this.hasContent() && this.enabled) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1246 this.$element.trigger(e) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1247 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1248 var inDom = $.contains(document.documentElement, this.$element[0]) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1249 if (e.isDefaultPrevented() || !inDom) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1250 var that = this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1251 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1252 var $tip = this.tip() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1253 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1254 var tipId = this.getUID(this.type) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1255 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1256 this.setContent() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1257 $tip.attr('id', tipId) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1258 this.$element.attr('aria-describedby', tipId) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1259 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1260 if (this.options.animation) $tip.addClass('fade') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1261 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1262 var placement = typeof this.options.placement == 'function' ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1263 this.options.placement.call(this, $tip[0], this.$element[0]) : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1264 this.options.placement |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1265 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1266 var autoToken = /\s?auto?\s?/i |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1267 var autoPlace = autoToken.test(placement) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1268 if (autoPlace) placement = placement.replace(autoToken, '') || 'top' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1269 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1270 $tip |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1271 .detach() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1272 .css({ top: 0, left: 0, display: 'block' }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1273 .addClass(placement) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1274 .data('bs.' + this.type, this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1275 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1276 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1277 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1278 var pos = this.getPosition() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1279 var actualWidth = $tip[0].offsetWidth |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1280 var actualHeight = $tip[0].offsetHeight |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1281 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1282 if (autoPlace) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1283 var orgPlacement = placement |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1284 var $parent = this.$element.parent() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1285 var parentDim = this.getPosition($parent) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1286 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1287 placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1288 placement == 'top' && pos.top - parentDim.scroll - actualHeight < 0 ? 'bottom' : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1289 placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1290 placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1291 placement |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1292 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1293 $tip |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1294 .removeClass(orgPlacement) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1295 .addClass(placement) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1296 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1297 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1298 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1299 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1300 this.applyPlacement(calculatedOffset, placement) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1301 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1302 var complete = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1303 that.$element.trigger('shown.bs.' + that.type) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1304 that.hoverState = null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1305 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1306 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1307 $.support.transition && this.$tip.hasClass('fade') ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1308 $tip |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1309 .one('bsTransitionEnd', complete) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1310 .emulateTransitionEnd(150) : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1311 complete() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1312 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1313 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1314 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1315 Tooltip.prototype.applyPlacement = function (offset, placement) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1316 var $tip = this.tip() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1317 var width = $tip[0].offsetWidth |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1318 var height = $tip[0].offsetHeight |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1319 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1320 // manually read margins because getBoundingClientRect includes difference |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1321 var marginTop = parseInt($tip.css('margin-top'), 10) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1322 var marginLeft = parseInt($tip.css('margin-left'), 10) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1323 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1324 // we must check for NaN for ie 8/9 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1325 if (isNaN(marginTop)) marginTop = 0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1326 if (isNaN(marginLeft)) marginLeft = 0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1327 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1328 offset.top = offset.top + marginTop |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1329 offset.left = offset.left + marginLeft |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1330 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1331 // $.fn.offset doesn't round pixel values |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1332 // so we use setOffset directly with our own function B-0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1333 $.offset.setOffset($tip[0], $.extend({ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1334 using: function (props) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1335 $tip.css({ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1336 top: Math.round(props.top), |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1337 left: Math.round(props.left) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1338 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1339 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1340 }, offset), 0) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1341 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1342 $tip.addClass('in') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1343 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1344 // check to see if placing tip in new offset caused the tip to resize itself |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1345 var actualWidth = $tip[0].offsetWidth |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1346 var actualHeight = $tip[0].offsetHeight |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1347 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1348 if (placement == 'top' && actualHeight != height) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1349 offset.top = offset.top + height - actualHeight |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1350 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1351 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1352 var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1353 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1354 if (delta.left) offset.left += delta.left |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1355 else offset.top += delta.top |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1356 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1357 var arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1358 var arrowPosition = delta.left ? 'left' : 'top' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1359 var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1360 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1361 $tip.offset(offset) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1362 this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1363 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1364 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1365 Tooltip.prototype.replaceArrow = function (delta, dimension, position) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1366 this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1367 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1368 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1369 Tooltip.prototype.setContent = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1370 var $tip = this.tip() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1371 var title = this.getTitle() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1372 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1373 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1374 $tip.removeClass('fade in top bottom left right') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1375 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1376 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1377 Tooltip.prototype.hide = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1378 var that = this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1379 var $tip = this.tip() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1380 var e = $.Event('hide.bs.' + this.type) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1381 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1382 this.$element.removeAttr('aria-describedby') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1383 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1384 function complete() { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1385 if (that.hoverState != 'in') $tip.detach() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1386 that.$element.trigger('hidden.bs.' + that.type) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1387 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1388 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1389 this.$element.trigger(e) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1390 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1391 if (e.isDefaultPrevented()) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1392 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1393 $tip.removeClass('in') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1394 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1395 $.support.transition && this.$tip.hasClass('fade') ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1396 $tip |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1397 .one('bsTransitionEnd', complete) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1398 .emulateTransitionEnd(150) : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1399 complete() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1400 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1401 this.hoverState = null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1402 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1403 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1404 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1405 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1406 Tooltip.prototype.fixTitle = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1407 var $e = this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1408 if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1409 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1410 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1411 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1412 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1413 Tooltip.prototype.hasContent = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1414 return this.getTitle() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1415 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1416 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1417 Tooltip.prototype.getPosition = function ($element) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1418 $element = $element || this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1419 var el = $element[0] |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1420 var isBody = el.tagName == 'BODY' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1421 return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1422 scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(), |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1423 width: isBody ? $(window).width() : $element.outerWidth(), |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1424 height: isBody ? $(window).height() : $element.outerHeight() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1425 }, isBody ? { top: 0, left: 0 } : $element.offset()) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1426 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1427 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1428 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1429 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1430 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1431 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1432 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1433 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1434 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1435 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1436 Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1437 var delta = { top: 0, left: 0 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1438 if (!this.$viewport) return delta |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1439 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1440 var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1441 var viewportDimensions = this.getPosition(this.$viewport) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1442 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1443 if (/right|left/.test(placement)) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1444 var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1445 var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1446 if (topEdgeOffset < viewportDimensions.top) { // top overflow |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1447 delta.top = viewportDimensions.top - topEdgeOffset |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1448 } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1449 delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1450 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1451 } else { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1452 var leftEdgeOffset = pos.left - viewportPadding |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1453 var rightEdgeOffset = pos.left + viewportPadding + actualWidth |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1454 if (leftEdgeOffset < viewportDimensions.left) { // left overflow |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1455 delta.left = viewportDimensions.left - leftEdgeOffset |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1456 } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1457 delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1458 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1459 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1460 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1461 return delta |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1462 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1463 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1464 Tooltip.prototype.getTitle = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1465 var title |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1466 var $e = this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1467 var o = this.options |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1468 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1469 title = $e.attr('data-original-title') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1470 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1471 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1472 return title |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1473 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1474 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1475 Tooltip.prototype.getUID = function (prefix) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1476 do prefix += ~~(Math.random() * 1000000) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1477 while (document.getElementById(prefix)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1478 return prefix |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1479 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1480 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1481 Tooltip.prototype.tip = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1482 return (this.$tip = this.$tip || $(this.options.template)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1483 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1484 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1485 Tooltip.prototype.arrow = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1486 return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1487 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1488 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1489 Tooltip.prototype.validate = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1490 if (!this.$element[0].parentNode) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1491 this.hide() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1492 this.$element = null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1493 this.options = null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1494 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1495 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1496 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1497 Tooltip.prototype.enable = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1498 this.enabled = true |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1499 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1500 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1501 Tooltip.prototype.disable = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1502 this.enabled = false |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1503 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1504 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1505 Tooltip.prototype.toggleEnabled = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1506 this.enabled = !this.enabled |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1507 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1508 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1509 Tooltip.prototype.toggle = function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1510 var self = this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1511 if (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1512 self = $(e.currentTarget).data('bs.' + this.type) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1513 if (!self) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1514 self = new this.constructor(e.currentTarget, this.getDelegateOptions()) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1515 $(e.currentTarget).data('bs.' + this.type, self) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1516 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1517 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1518 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1519 self.tip().hasClass('in') ? self.leave(self) : self.enter(self) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1520 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1521 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1522 Tooltip.prototype.destroy = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1523 clearTimeout(this.timeout) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1524 this.hide().$element.off('.' + this.type).removeData('bs.' + this.type) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1525 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1526 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1527 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1528 // TOOLTIP PLUGIN DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1529 // ========================= |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1530 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1531 function Plugin(option) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1532 return this.each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1533 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1534 var data = $this.data('bs.tooltip') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1535 var options = typeof option == 'object' && option |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1536 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1537 if (!data && option == 'destroy') return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1538 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1539 if (typeof option == 'string') data[option]() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1540 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1541 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1542 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1543 var old = $.fn.tooltip |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1544 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1545 $.fn.tooltip = Plugin |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1546 $.fn.tooltip.Constructor = Tooltip |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1547 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1548 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1549 // TOOLTIP NO CONFLICT |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1550 // =================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1551 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1552 $.fn.tooltip.noConflict = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1553 $.fn.tooltip = old |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1554 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1555 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1556 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1557 }(jQuery); |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1558 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1559 /* ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1560 * Bootstrap: popover.js v3.2.0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1561 * http://getbootstrap.com/javascript/#popovers |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1562 * ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1563 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1564 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1565 * ======================================================================== */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1566 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1567 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1568 +function ($) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1569 'use strict'; |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1570 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1571 // POPOVER PUBLIC CLASS DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1572 // =============================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1573 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1574 var Popover = function (element, options) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1575 this.init('popover', element, options) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1576 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1577 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1578 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1579 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1580 Popover.VERSION = '3.2.0' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1581 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1582 Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1583 placement: 'right', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1584 trigger: 'click', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1585 content: '', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1586 template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1587 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1588 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1589 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1590 // NOTE: POPOVER EXTENDS tooltip.js |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1591 // ================================ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1592 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1593 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1594 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1595 Popover.prototype.constructor = Popover |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1596 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1597 Popover.prototype.getDefaults = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1598 return Popover.DEFAULTS |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1599 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1600 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1601 Popover.prototype.setContent = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1602 var $tip = this.tip() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1603 var title = this.getTitle() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1604 var content = this.getContent() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1605 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1606 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1607 $tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1608 this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1609 ](content) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1610 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1611 $tip.removeClass('fade top bottom left right in') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1612 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1613 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1614 // this manually by checking the contents. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1615 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1616 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1617 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1618 Popover.prototype.hasContent = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1619 return this.getTitle() || this.getContent() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1620 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1621 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1622 Popover.prototype.getContent = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1623 var $e = this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1624 var o = this.options |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1625 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1626 return $e.attr('data-content') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1627 || (typeof o.content == 'function' ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1628 o.content.call($e[0]) : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1629 o.content) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1630 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1631 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1632 Popover.prototype.arrow = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1633 return (this.$arrow = this.$arrow || this.tip().find('.arrow')) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1634 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1635 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1636 Popover.prototype.tip = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1637 if (!this.$tip) this.$tip = $(this.options.template) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1638 return this.$tip |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1639 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1640 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1641 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1642 // POPOVER PLUGIN DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1643 // ========================= |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1644 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1645 function Plugin(option) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1646 return this.each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1647 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1648 var data = $this.data('bs.popover') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1649 var options = typeof option == 'object' && option |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1650 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1651 if (!data && option == 'destroy') return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1652 if (!data) $this.data('bs.popover', (data = new Popover(this, options))) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1653 if (typeof option == 'string') data[option]() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1654 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1655 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1656 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1657 var old = $.fn.popover |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1658 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1659 $.fn.popover = Plugin |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1660 $.fn.popover.Constructor = Popover |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1661 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1662 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1663 // POPOVER NO CONFLICT |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1664 // =================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1665 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1666 $.fn.popover.noConflict = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1667 $.fn.popover = old |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1668 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1669 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1670 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1671 }(jQuery); |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1672 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1673 /* ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1674 * Bootstrap: scrollspy.js v3.2.0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1675 * http://getbootstrap.com/javascript/#scrollspy |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1676 * ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1677 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1678 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1679 * ======================================================================== */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1680 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1681 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1682 +function ($) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1683 'use strict'; |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1684 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1685 // SCROLLSPY CLASS DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1686 // ========================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1687 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1688 function ScrollSpy(element, options) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1689 var process = $.proxy(this.process, this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1690 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1691 this.$body = $('body') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1692 this.$scrollElement = $(element).is('body') ? $(window) : $(element) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1693 this.options = $.extend({}, ScrollSpy.DEFAULTS, options) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1694 this.selector = (this.options.target || '') + ' .nav li > a' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1695 this.offsets = [] |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1696 this.targets = [] |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1697 this.activeTarget = null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1698 this.scrollHeight = 0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1699 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1700 this.$scrollElement.on('scroll.bs.scrollspy', process) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1701 this.refresh() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1702 this.process() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1703 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1704 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1705 ScrollSpy.VERSION = '3.2.0' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1706 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1707 ScrollSpy.DEFAULTS = { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1708 offset: 10 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1709 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1710 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1711 ScrollSpy.prototype.getScrollHeight = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1712 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1713 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1714 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1715 ScrollSpy.prototype.refresh = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1716 var offsetMethod = 'offset' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1717 var offsetBase = 0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1718 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1719 if (!$.isWindow(this.$scrollElement[0])) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1720 offsetMethod = 'position' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1721 offsetBase = this.$scrollElement.scrollTop() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1722 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1723 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1724 this.offsets = [] |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1725 this.targets = [] |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1726 this.scrollHeight = this.getScrollHeight() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1727 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1728 var self = this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1729 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1730 this.$body |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1731 .find(this.selector) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1732 .map(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1733 var $el = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1734 var href = $el.data('target') || $el.attr('href') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1735 var $href = /^#./.test(href) && $(href) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1736 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1737 return ($href |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1738 && $href.length |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1739 && $href.is(':visible') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1740 && [[$href[offsetMethod]().top + offsetBase, href]]) || null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1741 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1742 .sort(function (a, b) { return a[0] - b[0] }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1743 .each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1744 self.offsets.push(this[0]) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1745 self.targets.push(this[1]) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1746 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1747 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1748 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1749 ScrollSpy.prototype.process = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1750 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1751 var scrollHeight = this.getScrollHeight() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1752 var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1753 var offsets = this.offsets |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1754 var targets = this.targets |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1755 var activeTarget = this.activeTarget |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1756 var i |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1757 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1758 if (this.scrollHeight != scrollHeight) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1759 this.refresh() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1760 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1761 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1762 if (scrollTop >= maxScroll) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1763 return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1764 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1765 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1766 if (activeTarget && scrollTop <= offsets[0]) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1767 return activeTarget != (i = targets[0]) && this.activate(i) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1768 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1769 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1770 for (i = offsets.length; i--;) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1771 activeTarget != targets[i] |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1772 && scrollTop >= offsets[i] |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1773 && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1774 && this.activate(targets[i]) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1775 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1776 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1777 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1778 ScrollSpy.prototype.activate = function (target) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1779 this.activeTarget = target |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1780 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1781 $(this.selector) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1782 .parentsUntil(this.options.target, '.active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1783 .removeClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1784 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1785 var selector = this.selector + |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1786 '[data-target="' + target + '"],' + |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1787 this.selector + '[href="' + target + '"]' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1788 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1789 var active = $(selector) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1790 .parents('li') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1791 .addClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1792 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1793 if (active.parent('.dropdown-menu').length) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1794 active = active |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1795 .closest('li.dropdown') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1796 .addClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1797 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1798 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1799 active.trigger('activate.bs.scrollspy') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1800 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1801 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1802 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1803 // SCROLLSPY PLUGIN DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1804 // =========================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1805 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1806 function Plugin(option) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1807 return this.each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1808 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1809 var data = $this.data('bs.scrollspy') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1810 var options = typeof option == 'object' && option |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1811 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1812 if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1813 if (typeof option == 'string') data[option]() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1814 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1815 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1816 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1817 var old = $.fn.scrollspy |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1818 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1819 $.fn.scrollspy = Plugin |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1820 $.fn.scrollspy.Constructor = ScrollSpy |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1821 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1822 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1823 // SCROLLSPY NO CONFLICT |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1824 // ===================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1825 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1826 $.fn.scrollspy.noConflict = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1827 $.fn.scrollspy = old |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1828 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1829 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1830 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1831 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1832 // SCROLLSPY DATA-API |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1833 // ================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1834 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1835 $(window).on('load.bs.scrollspy.data-api', function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1836 $('[data-spy="scroll"]').each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1837 var $spy = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1838 Plugin.call($spy, $spy.data()) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1839 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1840 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1841 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1842 }(jQuery); |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1843 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1844 /* ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1845 * Bootstrap: tab.js v3.2.0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1846 * http://getbootstrap.com/javascript/#tabs |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1847 * ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1848 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1849 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1850 * ======================================================================== */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1851 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1852 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1853 +function ($) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1854 'use strict'; |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1855 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1856 // TAB CLASS DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1857 // ==================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1858 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1859 var Tab = function (element) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1860 this.element = $(element) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1861 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1862 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1863 Tab.VERSION = '3.2.0' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1864 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1865 Tab.prototype.show = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1866 var $this = this.element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1867 var $ul = $this.closest('ul:not(.dropdown-menu)') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1868 var selector = $this.data('target') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1869 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1870 if (!selector) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1871 selector = $this.attr('href') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1872 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1873 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1874 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1875 if ($this.parent('li').hasClass('active')) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1876 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1877 var previous = $ul.find('.active:last a')[0] |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1878 var e = $.Event('show.bs.tab', { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1879 relatedTarget: previous |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1880 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1881 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1882 $this.trigger(e) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1883 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1884 if (e.isDefaultPrevented()) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1885 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1886 var $target = $(selector) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1887 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1888 this.activate($this.closest('li'), $ul) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1889 this.activate($target, $target.parent(), function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1890 $this.trigger({ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1891 type: 'shown.bs.tab', |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1892 relatedTarget: previous |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1893 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1894 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1895 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1896 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1897 Tab.prototype.activate = function (element, container, callback) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1898 var $active = container.find('> .active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1899 var transition = callback |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1900 && $.support.transition |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1901 && $active.hasClass('fade') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1902 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1903 function next() { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1904 $active |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1905 .removeClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1906 .find('> .dropdown-menu > .active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1907 .removeClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1908 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1909 element.addClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1910 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1911 if (transition) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1912 element[0].offsetWidth // reflow for transition |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1913 element.addClass('in') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1914 } else { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1915 element.removeClass('fade') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1916 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1917 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1918 if (element.parent('.dropdown-menu')) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1919 element.closest('li.dropdown').addClass('active') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1920 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1921 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1922 callback && callback() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1923 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1924 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1925 transition ? |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1926 $active |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1927 .one('bsTransitionEnd', next) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1928 .emulateTransitionEnd(150) : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1929 next() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1930 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1931 $active.removeClass('in') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1932 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1933 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1934 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1935 // TAB PLUGIN DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1936 // ===================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1937 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1938 function Plugin(option) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1939 return this.each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1940 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1941 var data = $this.data('bs.tab') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1942 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1943 if (!data) $this.data('bs.tab', (data = new Tab(this))) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1944 if (typeof option == 'string') data[option]() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1945 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1946 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1947 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1948 var old = $.fn.tab |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1949 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1950 $.fn.tab = Plugin |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1951 $.fn.tab.Constructor = Tab |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1952 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1953 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1954 // TAB NO CONFLICT |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1955 // =============== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1956 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1957 $.fn.tab.noConflict = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1958 $.fn.tab = old |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1959 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1960 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1961 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1962 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1963 // TAB DATA-API |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1964 // ============ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1965 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1966 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1967 e.preventDefault() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1968 Plugin.call($(this), 'show') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1969 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1970 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1971 }(jQuery); |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1972 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1973 /* ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1974 * Bootstrap: affix.js v3.2.0 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1975 * http://getbootstrap.com/javascript/#affix |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1976 * ======================================================================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1977 * Copyright 2011-2014 Twitter, Inc. |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1978 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1979 * ======================================================================== */ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1980 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1981 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1982 +function ($) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1983 'use strict'; |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1984 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1985 // AFFIX CLASS DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1986 // ====================== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1987 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1988 var Affix = function (element, options) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1989 this.options = $.extend({}, Affix.DEFAULTS, options) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1990 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1991 this.$target = $(this.options.target) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1992 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1993 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1994 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1995 this.$element = $(element) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1996 this.affixed = |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1997 this.unpin = |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1998 this.pinnedOffset = null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1999 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2000 this.checkPosition() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2001 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2002 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2003 Affix.VERSION = '3.2.0' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2004 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2005 Affix.RESET = 'affix affix-top affix-bottom' |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2006 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2007 Affix.DEFAULTS = { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2008 offset: 0, |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2009 target: window |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2010 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2011 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2012 Affix.prototype.getPinnedOffset = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2013 if (this.pinnedOffset) return this.pinnedOffset |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2014 this.$element.removeClass(Affix.RESET).addClass('affix') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2015 var scrollTop = this.$target.scrollTop() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2016 var position = this.$element.offset() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2017 return (this.pinnedOffset = position.top - scrollTop) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2018 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2019 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2020 Affix.prototype.checkPositionWithEventLoop = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2021 setTimeout($.proxy(this.checkPosition, this), 1) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2022 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2023 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2024 Affix.prototype.checkPosition = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2025 if (!this.$element.is(':visible')) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2026 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2027 var scrollHeight = $(document).height() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2028 var scrollTop = this.$target.scrollTop() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2029 var position = this.$element.offset() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2030 var offset = this.options.offset |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2031 var offsetTop = offset.top |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2032 var offsetBottom = offset.bottom |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2033 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2034 if (typeof offset != 'object') offsetBottom = offsetTop = offset |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2035 if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2036 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2037 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2038 var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2039 offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2040 offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2041 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2042 if (this.affixed === affix) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2043 if (this.unpin != null) this.$element.css('top', '') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2044 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2045 var affixType = 'affix' + (affix ? '-' + affix : '') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2046 var e = $.Event(affixType + '.bs.affix') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2047 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2048 this.$element.trigger(e) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2049 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2050 if (e.isDefaultPrevented()) return |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2051 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2052 this.affixed = affix |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2053 this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2054 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2055 this.$element |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2056 .removeClass(Affix.RESET) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2057 .addClass(affixType) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2058 .trigger($.Event(affixType.replace('affix', 'affixed'))) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2059 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2060 if (affix == 'bottom') { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2061 this.$element.offset({ |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2062 top: scrollHeight - this.$element.height() - offsetBottom |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2063 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2064 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2065 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2066 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2067 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2068 // AFFIX PLUGIN DEFINITION |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2069 // ======================= |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2070 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2071 function Plugin(option) { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2072 return this.each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2073 var $this = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2074 var data = $this.data('bs.affix') |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2075 var options = typeof option == 'object' && option |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2076 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2077 if (!data) $this.data('bs.affix', (data = new Affix(this, options))) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2078 if (typeof option == 'string') data[option]() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2079 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2080 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2081 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2082 var old = $.fn.affix |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2083 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2084 $.fn.affix = Plugin |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2085 $.fn.affix.Constructor = Affix |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2086 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2087 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2088 // AFFIX NO CONFLICT |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2089 // ================= |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2090 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2091 $.fn.affix.noConflict = function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2092 $.fn.affix = old |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2093 return this |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2094 } |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2095 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2096 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2097 // AFFIX DATA-API |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2098 // ============== |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2099 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2100 $(window).on('load', function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2101 $('[data-spy="affix"]').each(function () { |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2102 var $spy = $(this) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2103 var data = $spy.data() |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2104 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2105 data.offset = data.offset || {} |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2106 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2107 if (data.offsetBottom) data.offset.bottom = data.offsetBottom |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2108 if (data.offsetTop) data.offset.top = data.offsetTop |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2109 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2110 Plugin.call($spy, data) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2111 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2112 }) |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2113 |
75d5d18e7d52
Add bootstrap for css formating
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2114 }(jQuery); |