Merge lp:~openerp-dev/openerp-web/trunk-graphview-ged into lp:openerp-web
- trunk-graphview-ged
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~openerp-dev/openerp-web/trunk-graphview-ged |
Merge into: | lp:openerp-web |
Diff against target: |
54324 lines (+27858/-26037) 67 files modified
addons/web/static/src/js/data.js (+1/-1) addons/web_graph/__openerp__.py (+5/-32) addons/web_graph/static/lib/bootstrap/bootstrap.js (+1992/-0) addons/web_graph/static/lib/dropdown.js (+0/-92) addons/web_graph/static/lib/flotr2/LICENSE (+0/-19) addons/web_graph/static/lib/flotr2/Makefile (+0/-40) addons/web_graph/static/lib/flotr2/README.md (+0/-89) addons/web_graph/static/lib/flotr2/dev/notes.txt (+0/-86) addons/web_graph/static/lib/flotr2/flotr2.examples.min.js (+0/-2) addons/web_graph/static/lib/flotr2/flotr2.examples.types.js (+0/-1425) addons/web_graph/static/lib/flotr2/flotr2.ie.min.js (+0/-33) addons/web_graph/static/lib/flotr2/flotr2.js (+0/-6865) addons/web_graph/static/lib/flotr2/flotr2.min.js (+0/-27) addons/web_graph/static/lib/flotr2/js/Axis.js (+0/-303) addons/web_graph/static/lib/flotr2/js/Color.js (+0/-163) addons/web_graph/static/lib/flotr2/js/DOM.js (+0/-88) addons/web_graph/static/lib/flotr2/js/Date.js (+0/-207) addons/web_graph/static/lib/flotr2/js/DefaultOptions.js (+0/-98) addons/web_graph/static/lib/flotr2/js/EventAdapter.js (+0/-52) addons/web_graph/static/lib/flotr2/js/Flotr.js (+0/-250) addons/web_graph/static/lib/flotr2/js/Graph.js (+0/-745) addons/web_graph/static/lib/flotr2/js/Series.js (+0/-74) addons/web_graph/static/lib/flotr2/js/Text.js (+0/-88) addons/web_graph/static/lib/flotr2/js/plugins/crosshair.js (+0/-84) addons/web_graph/static/lib/flotr2/js/plugins/download.js (+0/-51) addons/web_graph/static/lib/flotr2/js/plugins/grid.js (+0/-208) addons/web_graph/static/lib/flotr2/js/plugins/handles.js (+0/-199) addons/web_graph/static/lib/flotr2/js/plugins/hit.js (+0/-337) addons/web_graph/static/lib/flotr2/js/plugins/labels.js (+0/-227) addons/web_graph/static/lib/flotr2/js/plugins/legend.js (+0/-179) addons/web_graph/static/lib/flotr2/js/plugins/selection.js (+0/-278) addons/web_graph/static/lib/flotr2/js/plugins/spreadsheet.js (+0/-296) addons/web_graph/static/lib/flotr2/js/plugins/titles.js (+0/-177) addons/web_graph/static/lib/flotr2/js/types/bars.js (+0/-274) addons/web_graph/static/lib/flotr2/js/types/bubbles.js (+0/-119) addons/web_graph/static/lib/flotr2/js/types/candles.js (+0/-127) addons/web_graph/static/lib/flotr2/js/types/gantt.js (+0/-229) addons/web_graph/static/lib/flotr2/js/types/lines.js (+0/-275) addons/web_graph/static/lib/flotr2/js/types/markers.js (+0/-140) addons/web_graph/static/lib/flotr2/js/types/pie.js (+0/-210) addons/web_graph/static/lib/flotr2/js/types/points.js (+0/-66) addons/web_graph/static/lib/flotr2/js/types/radar.js (+0/-60) addons/web_graph/static/lib/flotr2/js/types/timeline.js (+0/-90) addons/web_graph/static/lib/flotr2/lib/base64.js (+0/-113) addons/web_graph/static/lib/flotr2/lib/bean-min.js (+0/-10) addons/web_graph/static/lib/flotr2/lib/bean.js (+0/-501) addons/web_graph/static/lib/flotr2/lib/canvas2image.js (+0/-198) addons/web_graph/static/lib/flotr2/lib/canvastext.js (+0/-429) addons/web_graph/static/lib/flotr2/lib/excanvas.js (+0/-1425) addons/web_graph/static/lib/flotr2/lib/imagediff.js (+0/-343) addons/web_graph/static/lib/flotr2/lib/jasmine/MIT.LICENSE (+0/-20) addons/web_graph/static/lib/flotr2/lib/jasmine/jasmine-html.js (+0/-190) addons/web_graph/static/lib/flotr2/lib/jasmine/jasmine.css (+0/-166) addons/web_graph/static/lib/flotr2/lib/jasmine/jasmine.js (+0/-2476) addons/web_graph/static/lib/flotr2/lib/prototype.js (+0/-4320) addons/web_graph/static/lib/flotr2/lib/underscore-min.js (+0/-27) addons/web_graph/static/lib/flotr2/lib/underscore.js (+0/-839) addons/web_graph/static/lib/flotr2/lib/yepnope.js (+0/-1) addons/web_graph/static/lib/nvd3/d3.v3.js (+8436/-0) addons/web_graph/static/lib/nvd3/nv.d3.js (+14303/-0) addons/web_graph/static/src/css/bootstrap.css (+1560/-0) addons/web_graph/static/src/css/flotr2.css (+0/-69) addons/web_graph/static/src/css/graph.css (+57/-76) addons/web_graph/static/src/css/nv.d3.css (+769/-0) addons/web_graph/static/src/fonts/glyphicons-halflings-regular.svg (+229/-0) addons/web_graph/static/src/js/graph.js (+460/-393) addons/web_graph/static/src/xml/web_graph.xml (+46/-36) |
To merge this branch: | bzr merge lp:~openerp-dev/openerp-web/trunk-graphview-ged |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP R&D Web Team | Pending | ||
Review via email:
|
Commit message
Description of the change
- 3906. By Géry Debongnie
-
[REF] very small code improvements in addon web_graph
- 3907. By Géry Debongnie
-
[FIX] fixes a bug in method subgroup, in data.js (web client). it was getting the wrong context
- 3908. By Géry Debongnie
-
[IMP] first pass at supporting multiples groupings, in x coordinates (addon web_graph)
- 3909. By Géry Debongnie
-
[ADD] add bootstrap library to web_graph addon. (customized minimalist version)
- 3910. By Géry Debongnie
-
[FIX] better handling of default groupings in web_graph addon
- 3911. By Géry Debongnie
-
[IMP] improves bar chart display in web_graph addon
- 3912. By Géry Debongnie
-
[IMP] slightly improve look when displaying charts in addon web_graph
- 3913. By Géry Debongnie
-
[FIX] add bootstrap.js file to module import (web_graph)
- 3914. By Géry Debongnie
-
[IMP] add button dropdown to chart view interface (module web_graph)
- 3915. By Géry Debongnie
-
[IMP] add button dropdown to select measure (module web_graph)
- 3916. By Géry Debongnie
-
[IMP] add row and columns buttons in graph view (addon web_graph)
- 3917. By Géry Debongnie
-
[IMP] add important fields to row and columns buttons in graph view (addon web_graph)
- 3918. By Géry Debongnie
-
[IMP] add clear columns and clear rows field to row and columns buttons in graph view (addon web_graph)
- 3919. By Géry Debongnie
-
[IMP] correct code to detect fields to display in row and col buttons in graph view (addon web_graph)
- 3920. By Géry Debongnie
-
[IMP] properly handles the case when there are no groupbys defined (graph view, addon web_graph)
- 3921. By Géry Debongnie
-
[IMP] work in progress. implementing multidimensional table view in graph view (module web_graph)
- 3922. By Géry Debongnie
-
[IMP] work in progress. implementing multidimensional table view in graph view (module web_graph)
- 3923. By Géry Debongnie
-
[IMP] implement the headers rendering in table view (in graph_view) (addon web_graph)
Unmerged revisions
- 3923. By Géry Debongnie
-
[IMP] implement the headers rendering in table view (in graph_view) (addon web_graph)
- 3922. By Géry Debongnie
-
[IMP] work in progress. implementing multidimensional table view in graph view (module web_graph)
- 3921. By Géry Debongnie
-
[IMP] work in progress. implementing multidimensional table view in graph view (module web_graph)
- 3920. By Géry Debongnie
-
[IMP] properly handles the case when there are no groupbys defined (graph view, addon web_graph)
- 3919. By Géry Debongnie
-
[IMP] correct code to detect fields to display in row and col buttons in graph view (addon web_graph)
- 3918. By Géry Debongnie
-
[IMP] add clear columns and clear rows field to row and columns buttons in graph view (addon web_graph)
- 3917. By Géry Debongnie
-
[IMP] add important fields to row and columns buttons in graph view (addon web_graph)
- 3916. By Géry Debongnie
-
[IMP] add row and columns buttons in graph view (addon web_graph)
- 3915. By Géry Debongnie
-
[IMP] add button dropdown to select measure (module web_graph)
- 3914. By Géry Debongnie
-
[IMP] add button dropdown to chart view interface (module web_graph)
Preview Diff
1 | === modified file 'addons/web/static/src/js/data.js' | |||
2 | --- addons/web/static/src/js/data.js 2013-09-10 12:52:23 +0000 | |||
3 | +++ addons/web/static/src/js/data.js 2013-11-07 14:49:39 +0000 | |||
4 | @@ -249,7 +249,7 @@ | |||
5 | 249 | return this.attributes[key]; | 249 | return this.attributes[key]; |
6 | 250 | }, | 250 | }, |
7 | 251 | subgroups: function () { | 251 | subgroups: function () { |
9 | 252 | return this.model.query().group_by(this.model.context().group_by); | 252 | return this.model.query().group_by(this.model._context.group_by); |
10 | 253 | }, | 253 | }, |
11 | 254 | query: function () { | 254 | query: function () { |
12 | 255 | return this.model.query.apply(this.model, arguments); | 255 | return this.model.query.apply(this.model, arguments); |
13 | 256 | 256 | ||
14 | === modified file 'addons/web_graph/__openerp__.py' | |||
15 | --- addons/web_graph/__openerp__.py 2012-08-22 13:03:36 +0000 | |||
16 | +++ addons/web_graph/__openerp__.py 2013-11-07 14:49:39 +0000 | |||
17 | @@ -15,38 +15,10 @@ | |||
18 | 15 | 'version': '3.0', | 15 | 'version': '3.0', |
19 | 16 | 'depends': ['web'], | 16 | 'depends': ['web'], |
20 | 17 | 'js': [ | 17 | 'js': [ |
53 | 18 | 'static/lib/dropdown.js', | 18 | 'static/lib/nvd3/d3.v3.js', |
54 | 19 | 'static/lib/flotr2/lib/bean.js', | 19 | 'static/lib/nvd3/nv.d3.js', |
55 | 20 | 'static/lib/flotr2/js/Flotr.js', | 20 | 'static/src/js/graph.js', |
56 | 21 | 'static/lib/flotr2/js/DefaultOptions.js', | 21 | 'static/lib/bootstrap/bootstrap.js', |
25 | 22 | 'static/lib/flotr2/js/Color.js', | ||
26 | 23 | 'static/lib/flotr2/js/Date.js', | ||
27 | 24 | 'static/lib/flotr2/js/DOM.js', | ||
28 | 25 | 'static/lib/flotr2/js/EventAdapter.js', | ||
29 | 26 | 'static/lib/flotr2/js/Text.js', | ||
30 | 27 | 'static/lib/flotr2/js/Graph.js', | ||
31 | 28 | 'static/lib/flotr2/js/Axis.js', | ||
32 | 29 | 'static/lib/flotr2/js/Series.js', | ||
33 | 30 | 'static/lib/flotr2/js/types/lines.js', | ||
34 | 31 | 'static/lib/flotr2/js/types/bars.js', | ||
35 | 32 | 'static/lib/flotr2/js/types/bubbles.js', | ||
36 | 33 | 'static/lib/flotr2/js/types/candles.js', | ||
37 | 34 | 'static/lib/flotr2/js/types/gantt.js', | ||
38 | 35 | 'static/lib/flotr2/js/types/markers.js', | ||
39 | 36 | 'static/lib/flotr2/js/types/pie.js', | ||
40 | 37 | 'static/lib/flotr2/js/types/points.js', | ||
41 | 38 | 'static/lib/flotr2/js/types/radar.js', | ||
42 | 39 | 'static/lib/flotr2/js/types/timeline.js', | ||
43 | 40 | 'static/lib/flotr2/js/plugins/crosshair.js', | ||
44 | 41 | 'static/lib/flotr2/js/plugins/download.js', | ||
45 | 42 | 'static/lib/flotr2/js/plugins/grid.js', | ||
46 | 43 | 'static/lib/flotr2/js/plugins/hit.js', | ||
47 | 44 | 'static/lib/flotr2/js/plugins/selection.js', | ||
48 | 45 | 'static/lib/flotr2/js/plugins/labels.js', | ||
49 | 46 | 'static/lib/flotr2/js/plugins/legend.js', | ||
50 | 47 | 'static/lib/flotr2/js/plugins/spreadsheet.js', | ||
51 | 48 | 'static/lib/flotr2/js/plugins/titles.js', | ||
52 | 49 | 'static/src/js/graph.js' | ||
57 | 50 | ], | 22 | ], |
58 | 51 | 'css': [ | 23 | 'css': [ |
59 | 52 | 'static/src/css/*.css', | 24 | 'static/src/css/*.css', |
60 | @@ -56,3 +28,4 @@ | |||
61 | 56 | ], | 28 | ], |
62 | 57 | 'auto_install': True | 29 | 'auto_install': True |
63 | 58 | } | 30 | } |
64 | 31 | |||
65 | 59 | 32 | ||
66 | === added directory 'addons/web_graph/static/lib/bootstrap' | |||
67 | === added file 'addons/web_graph/static/lib/bootstrap/bootstrap.js' | |||
68 | --- addons/web_graph/static/lib/bootstrap/bootstrap.js 1970-01-01 00:00:00 +0000 | |||
69 | +++ addons/web_graph/static/lib/bootstrap/bootstrap.js 2013-11-07 14:49:39 +0000 | |||
70 | @@ -0,0 +1,1992 @@ | |||
71 | 1 | /* ======================================================================== | ||
72 | 2 | * Bootstrap: alert.js v3.0.0 | ||
73 | 3 | * http://getbootstrap.com/javascript/#alerts | ||
74 | 4 | * ======================================================================== | ||
75 | 5 | * Copyright 2013 Twitter, Inc. | ||
76 | 6 | * | ||
77 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
78 | 8 | * you may not use this file except in compliance with the License. | ||
79 | 9 | * You may obtain a copy of the License at | ||
80 | 10 | * | ||
81 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
82 | 12 | * | ||
83 | 13 | * Unless required by applicable law or agreed to in writing, software | ||
84 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
85 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
86 | 16 | * See the License for the specific language governing permissions and | ||
87 | 17 | * limitations under the License. | ||
88 | 18 | * ======================================================================== */ | ||
89 | 19 | |||
90 | 20 | |||
91 | 21 | +function ($) { "use strict"; | ||
92 | 22 | |||
93 | 23 | // ALERT CLASS DEFINITION | ||
94 | 24 | // ====================== | ||
95 | 25 | |||
96 | 26 | var dismiss = '[data-dismiss="alert"]' | ||
97 | 27 | var Alert = function (el) { | ||
98 | 28 | $(el).on('click', dismiss, this.close) | ||
99 | 29 | } | ||
100 | 30 | |||
101 | 31 | Alert.prototype.close = function (e) { | ||
102 | 32 | var $this = $(this) | ||
103 | 33 | var selector = $this.attr('data-target') | ||
104 | 34 | |||
105 | 35 | if (!selector) { | ||
106 | 36 | selector = $this.attr('href') | ||
107 | 37 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 | ||
108 | 38 | } | ||
109 | 39 | |||
110 | 40 | var $parent = $(selector) | ||
111 | 41 | |||
112 | 42 | if (e) e.preventDefault() | ||
113 | 43 | |||
114 | 44 | if (!$parent.length) { | ||
115 | 45 | $parent = $this.hasClass('alert') ? $this : $this.parent() | ||
116 | 46 | } | ||
117 | 47 | |||
118 | 48 | $parent.trigger(e = $.Event('close.bs.alert')) | ||
119 | 49 | |||
120 | 50 | if (e.isDefaultPrevented()) return | ||
121 | 51 | |||
122 | 52 | $parent.removeClass('in') | ||
123 | 53 | |||
124 | 54 | function removeElement() { | ||
125 | 55 | $parent.trigger('closed.bs.alert').remove() | ||
126 | 56 | } | ||
127 | 57 | |||
128 | 58 | $.support.transition && $parent.hasClass('fade') ? | ||
129 | 59 | $parent | ||
130 | 60 | .one($.support.transition.end, removeElement) | ||
131 | 61 | .emulateTransitionEnd(150) : | ||
132 | 62 | removeElement() | ||
133 | 63 | } | ||
134 | 64 | |||
135 | 65 | |||
136 | 66 | // ALERT PLUGIN DEFINITION | ||
137 | 67 | // ======================= | ||
138 | 68 | |||
139 | 69 | var old = $.fn.alert | ||
140 | 70 | |||
141 | 71 | $.fn.alert = function (option) { | ||
142 | 72 | return this.each(function () { | ||
143 | 73 | var $this = $(this) | ||
144 | 74 | var data = $this.data('bs.alert') | ||
145 | 75 | |||
146 | 76 | if (!data) $this.data('bs.alert', (data = new Alert(this))) | ||
147 | 77 | if (typeof option == 'string') data[option].call($this) | ||
148 | 78 | }) | ||
149 | 79 | } | ||
150 | 80 | |||
151 | 81 | $.fn.alert.Constructor = Alert | ||
152 | 82 | |||
153 | 83 | |||
154 | 84 | // ALERT NO CONFLICT | ||
155 | 85 | // ================= | ||
156 | 86 | |||
157 | 87 | $.fn.alert.noConflict = function () { | ||
158 | 88 | $.fn.alert = old | ||
159 | 89 | return this | ||
160 | 90 | } | ||
161 | 91 | |||
162 | 92 | |||
163 | 93 | // ALERT DATA-API | ||
164 | 94 | // ============== | ||
165 | 95 | |||
166 | 96 | $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) | ||
167 | 97 | |||
168 | 98 | }(window.jQuery); | ||
169 | 99 | |||
170 | 100 | /* ======================================================================== | ||
171 | 101 | * Bootstrap: button.js v3.0.0 | ||
172 | 102 | * http://getbootstrap.com/javascript/#buttons | ||
173 | 103 | * ======================================================================== | ||
174 | 104 | * Copyright 2013 Twitter, Inc. | ||
175 | 105 | * | ||
176 | 106 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
177 | 107 | * you may not use this file except in compliance with the License. | ||
178 | 108 | * You may obtain a copy of the License at | ||
179 | 109 | * | ||
180 | 110 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
181 | 111 | * | ||
182 | 112 | * Unless required by applicable law or agreed to in writing, software | ||
183 | 113 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
184 | 114 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
185 | 115 | * See the License for the specific language governing permissions and | ||
186 | 116 | * limitations under the License. | ||
187 | 117 | * ======================================================================== */ | ||
188 | 118 | |||
189 | 119 | |||
190 | 120 | +function ($) { "use strict"; | ||
191 | 121 | |||
192 | 122 | // BUTTON PUBLIC CLASS DEFINITION | ||
193 | 123 | // ============================== | ||
194 | 124 | |||
195 | 125 | var Button = function (element, options) { | ||
196 | 126 | this.$element = $(element) | ||
197 | 127 | this.options = $.extend({}, Button.DEFAULTS, options) | ||
198 | 128 | } | ||
199 | 129 | |||
200 | 130 | Button.DEFAULTS = { | ||
201 | 131 | loadingText: 'loading...' | ||
202 | 132 | } | ||
203 | 133 | |||
204 | 134 | Button.prototype.setState = function (state) { | ||
205 | 135 | var d = 'disabled' | ||
206 | 136 | var $el = this.$element | ||
207 | 137 | var val = $el.is('input') ? 'val' : 'html' | ||
208 | 138 | var data = $el.data() | ||
209 | 139 | |||
210 | 140 | state = state + 'Text' | ||
211 | 141 | |||
212 | 142 | if (!data.resetText) $el.data('resetText', $el[val]()) | ||
213 | 143 | |||
214 | 144 | $el[val](data[state] || this.options[state]) | ||
215 | 145 | |||
216 | 146 | // push to event loop to allow forms to submit | ||
217 | 147 | setTimeout(function () { | ||
218 | 148 | state == 'loadingText' ? | ||
219 | 149 | $el.addClass(d).attr(d, d) : | ||
220 | 150 | $el.removeClass(d).removeAttr(d); | ||
221 | 151 | }, 0) | ||
222 | 152 | } | ||
223 | 153 | |||
224 | 154 | Button.prototype.toggle = function () { | ||
225 | 155 | var $parent = this.$element.closest('[data-toggle="buttons"]') | ||
226 | 156 | |||
227 | 157 | if ($parent.length) { | ||
228 | 158 | var $input = this.$element.find('input') | ||
229 | 159 | .prop('checked', !this.$element.hasClass('active')) | ||
230 | 160 | .trigger('change') | ||
231 | 161 | if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active') | ||
232 | 162 | } | ||
233 | 163 | |||
234 | 164 | this.$element.toggleClass('active') | ||
235 | 165 | } | ||
236 | 166 | |||
237 | 167 | |||
238 | 168 | // BUTTON PLUGIN DEFINITION | ||
239 | 169 | // ======================== | ||
240 | 170 | |||
241 | 171 | var old = $.fn.button | ||
242 | 172 | |||
243 | 173 | $.fn.button = function (option) { | ||
244 | 174 | return this.each(function () { | ||
245 | 175 | var $this = $(this) | ||
246 | 176 | var data = $this.data('bs.button') | ||
247 | 177 | var options = typeof option == 'object' && option | ||
248 | 178 | |||
249 | 179 | if (!data) $this.data('bs.button', (data = new Button(this, options))) | ||
250 | 180 | |||
251 | 181 | if (option == 'toggle') data.toggle() | ||
252 | 182 | else if (option) data.setState(option) | ||
253 | 183 | }) | ||
254 | 184 | } | ||
255 | 185 | |||
256 | 186 | $.fn.button.Constructor = Button | ||
257 | 187 | |||
258 | 188 | |||
259 | 189 | // BUTTON NO CONFLICT | ||
260 | 190 | // ================== | ||
261 | 191 | |||
262 | 192 | $.fn.button.noConflict = function () { | ||
263 | 193 | $.fn.button = old | ||
264 | 194 | return this | ||
265 | 195 | } | ||
266 | 196 | |||
267 | 197 | |||
268 | 198 | // BUTTON DATA-API | ||
269 | 199 | // =============== | ||
270 | 200 | |||
271 | 201 | $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) { | ||
272 | 202 | var $btn = $(e.target) | ||
273 | 203 | if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') | ||
274 | 204 | $btn.button('toggle') | ||
275 | 205 | e.preventDefault() | ||
276 | 206 | }) | ||
277 | 207 | |||
278 | 208 | }(window.jQuery); | ||
279 | 209 | |||
280 | 210 | /* ======================================================================== | ||
281 | 211 | * Bootstrap: carousel.js v3.0.0 | ||
282 | 212 | * http://getbootstrap.com/javascript/#carousel | ||
283 | 213 | * ======================================================================== | ||
284 | 214 | * Copyright 2013 Twitter, Inc. | ||
285 | 215 | * | ||
286 | 216 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
287 | 217 | * you may not use this file except in compliance with the License. | ||
288 | 218 | * You may obtain a copy of the License at | ||
289 | 219 | * | ||
290 | 220 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
291 | 221 | * | ||
292 | 222 | * Unless required by applicable law or agreed to in writing, software | ||
293 | 223 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
294 | 224 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
295 | 225 | * See the License for the specific language governing permissions and | ||
296 | 226 | * limitations under the License. | ||
297 | 227 | * ======================================================================== */ | ||
298 | 228 | |||
299 | 229 | |||
300 | 230 | +function ($) { "use strict"; | ||
301 | 231 | |||
302 | 232 | // CAROUSEL CLASS DEFINITION | ||
303 | 233 | // ========================= | ||
304 | 234 | |||
305 | 235 | var Carousel = function (element, options) { | ||
306 | 236 | this.$element = $(element) | ||
307 | 237 | this.$indicators = this.$element.find('.carousel-indicators') | ||
308 | 238 | this.options = options | ||
309 | 239 | this.paused = | ||
310 | 240 | this.sliding = | ||
311 | 241 | this.interval = | ||
312 | 242 | this.$active = | ||
313 | 243 | this.$items = null | ||
314 | 244 | |||
315 | 245 | this.options.pause == 'hover' && this.$element | ||
316 | 246 | .on('mouseenter', $.proxy(this.pause, this)) | ||
317 | 247 | .on('mouseleave', $.proxy(this.cycle, this)) | ||
318 | 248 | } | ||
319 | 249 | |||
320 | 250 | Carousel.DEFAULTS = { | ||
321 | 251 | interval: 5000 | ||
322 | 252 | , pause: 'hover' | ||
323 | 253 | , wrap: true | ||
324 | 254 | } | ||
325 | 255 | |||
326 | 256 | Carousel.prototype.cycle = function (e) { | ||
327 | 257 | e || (this.paused = false) | ||
328 | 258 | |||
329 | 259 | this.interval && clearInterval(this.interval) | ||
330 | 260 | |||
331 | 261 | this.options.interval | ||
332 | 262 | && !this.paused | ||
333 | 263 | && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) | ||
334 | 264 | |||
335 | 265 | return this | ||
336 | 266 | } | ||
337 | 267 | |||
338 | 268 | Carousel.prototype.getActiveIndex = function () { | ||
339 | 269 | this.$active = this.$element.find('.item.active') | ||
340 | 270 | this.$items = this.$active.parent().children() | ||
341 | 271 | |||
342 | 272 | return this.$items.index(this.$active) | ||
343 | 273 | } | ||
344 | 274 | |||
345 | 275 | Carousel.prototype.to = function (pos) { | ||
346 | 276 | var that = this | ||
347 | 277 | var activeIndex = this.getActiveIndex() | ||
348 | 278 | |||
349 | 279 | if (pos > (this.$items.length - 1) || pos < 0) return | ||
350 | 280 | |||
351 | 281 | if (this.sliding) return this.$element.one('slid', function () { that.to(pos) }) | ||
352 | 282 | if (activeIndex == pos) return this.pause().cycle() | ||
353 | 283 | |||
354 | 284 | return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) | ||
355 | 285 | } | ||
356 | 286 | |||
357 | 287 | Carousel.prototype.pause = function (e) { | ||
358 | 288 | e || (this.paused = true) | ||
359 | 289 | |||
360 | 290 | if (this.$element.find('.next, .prev').length && $.support.transition.end) { | ||
361 | 291 | this.$element.trigger($.support.transition.end) | ||
362 | 292 | this.cycle(true) | ||
363 | 293 | } | ||
364 | 294 | |||
365 | 295 | this.interval = clearInterval(this.interval) | ||
366 | 296 | |||
367 | 297 | return this | ||
368 | 298 | } | ||
369 | 299 | |||
370 | 300 | Carousel.prototype.next = function () { | ||
371 | 301 | if (this.sliding) return | ||
372 | 302 | return this.slide('next') | ||
373 | 303 | } | ||
374 | 304 | |||
375 | 305 | Carousel.prototype.prev = function () { | ||
376 | 306 | if (this.sliding) return | ||
377 | 307 | return this.slide('prev') | ||
378 | 308 | } | ||
379 | 309 | |||
380 | 310 | Carousel.prototype.slide = function (type, next) { | ||
381 | 311 | var $active = this.$element.find('.item.active') | ||
382 | 312 | var $next = next || $active[type]() | ||
383 | 313 | var isCycling = this.interval | ||
384 | 314 | var direction = type == 'next' ? 'left' : 'right' | ||
385 | 315 | var fallback = type == 'next' ? 'first' : 'last' | ||
386 | 316 | var that = this | ||
387 | 317 | |||
388 | 318 | if (!$next.length) { | ||
389 | 319 | if (!this.options.wrap) return | ||
390 | 320 | $next = this.$element.find('.item')[fallback]() | ||
391 | 321 | } | ||
392 | 322 | |||
393 | 323 | this.sliding = true | ||
394 | 324 | |||
395 | 325 | isCycling && this.pause() | ||
396 | 326 | |||
397 | 327 | var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction }) | ||
398 | 328 | |||
399 | 329 | if ($next.hasClass('active')) return | ||
400 | 330 | |||
401 | 331 | if (this.$indicators.length) { | ||
402 | 332 | this.$indicators.find('.active').removeClass('active') | ||
403 | 333 | this.$element.one('slid', function () { | ||
404 | 334 | var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) | ||
405 | 335 | $nextIndicator && $nextIndicator.addClass('active') | ||
406 | 336 | }) | ||
407 | 337 | } | ||
408 | 338 | |||
409 | 339 | if ($.support.transition && this.$element.hasClass('slide')) { | ||
410 | 340 | this.$element.trigger(e) | ||
411 | 341 | if (e.isDefaultPrevented()) return | ||
412 | 342 | $next.addClass(type) | ||
413 | 343 | $next[0].offsetWidth // force reflow | ||
414 | 344 | $active.addClass(direction) | ||
415 | 345 | $next.addClass(direction) | ||
416 | 346 | $active | ||
417 | 347 | .one($.support.transition.end, function () { | ||
418 | 348 | $next.removeClass([type, direction].join(' ')).addClass('active') | ||
419 | 349 | $active.removeClass(['active', direction].join(' ')) | ||
420 | 350 | that.sliding = false | ||
421 | 351 | setTimeout(function () { that.$element.trigger('slid') }, 0) | ||
422 | 352 | }) | ||
423 | 353 | .emulateTransitionEnd(600) | ||
424 | 354 | } else { | ||
425 | 355 | this.$element.trigger(e) | ||
426 | 356 | if (e.isDefaultPrevented()) return | ||
427 | 357 | $active.removeClass('active') | ||
428 | 358 | $next.addClass('active') | ||
429 | 359 | this.sliding = false | ||
430 | 360 | this.$element.trigger('slid') | ||
431 | 361 | } | ||
432 | 362 | |||
433 | 363 | isCycling && this.cycle() | ||
434 | 364 | |||
435 | 365 | return this | ||
436 | 366 | } | ||
437 | 367 | |||
438 | 368 | |||
439 | 369 | // CAROUSEL PLUGIN DEFINITION | ||
440 | 370 | // ========================== | ||
441 | 371 | |||
442 | 372 | var old = $.fn.carousel | ||
443 | 373 | |||
444 | 374 | $.fn.carousel = function (option) { | ||
445 | 375 | return this.each(function () { | ||
446 | 376 | var $this = $(this) | ||
447 | 377 | var data = $this.data('bs.carousel') | ||
448 | 378 | var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) | ||
449 | 379 | var action = typeof option == 'string' ? option : options.slide | ||
450 | 380 | |||
451 | 381 | if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) | ||
452 | 382 | if (typeof option == 'number') data.to(option) | ||
453 | 383 | else if (action) data[action]() | ||
454 | 384 | else if (options.interval) data.pause().cycle() | ||
455 | 385 | }) | ||
456 | 386 | } | ||
457 | 387 | |||
458 | 388 | $.fn.carousel.Constructor = Carousel | ||
459 | 389 | |||
460 | 390 | |||
461 | 391 | // CAROUSEL NO CONFLICT | ||
462 | 392 | // ==================== | ||
463 | 393 | |||
464 | 394 | $.fn.carousel.noConflict = function () { | ||
465 | 395 | $.fn.carousel = old | ||
466 | 396 | return this | ||
467 | 397 | } | ||
468 | 398 | |||
469 | 399 | |||
470 | 400 | // CAROUSEL DATA-API | ||
471 | 401 | // ================= | ||
472 | 402 | |||
473 | 403 | $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { | ||
474 | 404 | var $this = $(this), href | ||
475 | 405 | var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 | ||
476 | 406 | var options = $.extend({}, $target.data(), $this.data()) | ||
477 | 407 | var slideIndex = $this.attr('data-slide-to') | ||
478 | 408 | if (slideIndex) options.interval = false | ||
479 | 409 | |||
480 | 410 | $target.carousel(options) | ||
481 | 411 | |||
482 | 412 | if (slideIndex = $this.attr('data-slide-to')) { | ||
483 | 413 | $target.data('bs.carousel').to(slideIndex) | ||
484 | 414 | } | ||
485 | 415 | |||
486 | 416 | e.preventDefault() | ||
487 | 417 | }) | ||
488 | 418 | |||
489 | 419 | $(window).on('load', function () { | ||
490 | 420 | $('[data-ride="carousel"]').each(function () { | ||
491 | 421 | var $carousel = $(this) | ||
492 | 422 | $carousel.carousel($carousel.data()) | ||
493 | 423 | }) | ||
494 | 424 | }) | ||
495 | 425 | |||
496 | 426 | }(window.jQuery); | ||
497 | 427 | |||
498 | 428 | /* ======================================================================== | ||
499 | 429 | * Bootstrap: dropdown.js v3.0.0 | ||
500 | 430 | * http://getbootstrap.com/javascript/#dropdowns | ||
501 | 431 | * ======================================================================== | ||
502 | 432 | * Copyright 2013 Twitter, Inc. | ||
503 | 433 | * | ||
504 | 434 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
505 | 435 | * you may not use this file except in compliance with the License. | ||
506 | 436 | * You may obtain a copy of the License at | ||
507 | 437 | * | ||
508 | 438 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
509 | 439 | * | ||
510 | 440 | * Unless required by applicable law or agreed to in writing, software | ||
511 | 441 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
512 | 442 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
513 | 443 | * See the License for the specific language governing permissions and | ||
514 | 444 | * limitations under the License. | ||
515 | 445 | * ======================================================================== */ | ||
516 | 446 | |||
517 | 447 | |||
518 | 448 | +function ($) { "use strict"; | ||
519 | 449 | |||
520 | 450 | // DROPDOWN CLASS DEFINITION | ||
521 | 451 | // ========================= | ||
522 | 452 | |||
523 | 453 | var backdrop = '.dropdown-backdrop' | ||
524 | 454 | var toggle = '[data-toggle=dropdown]' | ||
525 | 455 | var Dropdown = function (element) { | ||
526 | 456 | var $el = $(element).on('click.bs.dropdown', this.toggle) | ||
527 | 457 | } | ||
528 | 458 | |||
529 | 459 | Dropdown.prototype.toggle = function (e) { | ||
530 | 460 | var $this = $(this) | ||
531 | 461 | |||
532 | 462 | if ($this.is('.disabled, :disabled')) return | ||
533 | 463 | |||
534 | 464 | var $parent = getParent($this) | ||
535 | 465 | var isActive = $parent.hasClass('open') | ||
536 | 466 | |||
537 | 467 | clearMenus() | ||
538 | 468 | |||
539 | 469 | if (!isActive) { | ||
540 | 470 | if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { | ||
541 | 471 | // if mobile we we use a backdrop because click events don't delegate | ||
542 | 472 | $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus) | ||
543 | 473 | } | ||
544 | 474 | |||
545 | 475 | $parent.trigger(e = $.Event('show.bs.dropdown')) | ||
546 | 476 | |||
547 | 477 | if (e.isDefaultPrevented()) return | ||
548 | 478 | |||
549 | 479 | $parent | ||
550 | 480 | .toggleClass('open') | ||
551 | 481 | .trigger('shown.bs.dropdown') | ||
552 | 482 | |||
553 | 483 | $this.focus() | ||
554 | 484 | } | ||
555 | 485 | |||
556 | 486 | return false | ||
557 | 487 | } | ||
558 | 488 | |||
559 | 489 | Dropdown.prototype.keydown = function (e) { | ||
560 | 490 | if (!/(38|40|27)/.test(e.keyCode)) return | ||
561 | 491 | |||
562 | 492 | var $this = $(this) | ||
563 | 493 | |||
564 | 494 | e.preventDefault() | ||
565 | 495 | e.stopPropagation() | ||
566 | 496 | |||
567 | 497 | if ($this.is('.disabled, :disabled')) return | ||
568 | 498 | |||
569 | 499 | var $parent = getParent($this) | ||
570 | 500 | var isActive = $parent.hasClass('open') | ||
571 | 501 | |||
572 | 502 | if (!isActive || (isActive && e.keyCode == 27)) { | ||
573 | 503 | if (e.which == 27) $parent.find(toggle).focus() | ||
574 | 504 | return $this.click() | ||
575 | 505 | } | ||
576 | 506 | |||
577 | 507 | var $items = $('[role=menu] li:not(.divider):visible a', $parent) | ||
578 | 508 | |||
579 | 509 | if (!$items.length) return | ||
580 | 510 | |||
581 | 511 | var index = $items.index($items.filter(':focus')) | ||
582 | 512 | |||
583 | 513 | if (e.keyCode == 38 && index > 0) index-- // up | ||
584 | 514 | if (e.keyCode == 40 && index < $items.length - 1) index++ // down | ||
585 | 515 | if (!~index) index=0 | ||
586 | 516 | |||
587 | 517 | $items.eq(index).focus() | ||
588 | 518 | } | ||
589 | 519 | |||
590 | 520 | function clearMenus() { | ||
591 | 521 | $(backdrop).remove() | ||
592 | 522 | $(toggle).each(function (e) { | ||
593 | 523 | var $parent = getParent($(this)) | ||
594 | 524 | if (!$parent.hasClass('open')) return | ||
595 | 525 | $parent.trigger(e = $.Event('hide.bs.dropdown')) | ||
596 | 526 | if (e.isDefaultPrevented()) return | ||
597 | 527 | $parent.removeClass('open').trigger('hidden.bs.dropdown') | ||
598 | 528 | }) | ||
599 | 529 | } | ||
600 | 530 | |||
601 | 531 | function getParent($this) { | ||
602 | 532 | var selector = $this.attr('data-target') | ||
603 | 533 | |||
604 | 534 | if (!selector) { | ||
605 | 535 | selector = $this.attr('href') | ||
606 | 536 | selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 | ||
607 | 537 | } | ||
608 | 538 | |||
609 | 539 | var $parent = selector && $(selector) | ||
610 | 540 | |||
611 | 541 | return $parent && $parent.length ? $parent : $this.parent() | ||
612 | 542 | } | ||
613 | 543 | |||
614 | 544 | |||
615 | 545 | // DROPDOWN PLUGIN DEFINITION | ||
616 | 546 | // ========================== | ||
617 | 547 | |||
618 | 548 | var old = $.fn.dropdown | ||
619 | 549 | |||
620 | 550 | $.fn.dropdown = function (option) { | ||
621 | 551 | return this.each(function () { | ||
622 | 552 | var $this = $(this) | ||
623 | 553 | var data = $this.data('dropdown') | ||
624 | 554 | |||
625 | 555 | if (!data) $this.data('dropdown', (data = new Dropdown(this))) | ||
626 | 556 | if (typeof option == 'string') data[option].call($this) | ||
627 | 557 | }) | ||
628 | 558 | } | ||
629 | 559 | |||
630 | 560 | $.fn.dropdown.Constructor = Dropdown | ||
631 | 561 | |||
632 | 562 | |||
633 | 563 | // DROPDOWN NO CONFLICT | ||
634 | 564 | // ==================== | ||
635 | 565 | |||
636 | 566 | $.fn.dropdown.noConflict = function () { | ||
637 | 567 | $.fn.dropdown = old | ||
638 | 568 | return this | ||
639 | 569 | } | ||
640 | 570 | |||
641 | 571 | |||
642 | 572 | // APPLY TO STANDARD DROPDOWN ELEMENTS | ||
643 | 573 | // =================================== | ||
644 | 574 | |||
645 | 575 | $(document) | ||
646 | 576 | .on('click.bs.dropdown.data-api', clearMenus) | ||
647 | 577 | .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) | ||
648 | 578 | .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle) | ||
649 | 579 | .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) | ||
650 | 580 | |||
651 | 581 | }(window.jQuery); | ||
652 | 582 | |||
653 | 583 | /* ======================================================================== | ||
654 | 584 | * Bootstrap: modal.js v3.0.0 | ||
655 | 585 | * http://getbootstrap.com/javascript/#modals | ||
656 | 586 | * ======================================================================== | ||
657 | 587 | * Copyright 2013 Twitter, Inc. | ||
658 | 588 | * | ||
659 | 589 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
660 | 590 | * you may not use this file except in compliance with the License. | ||
661 | 591 | * You may obtain a copy of the License at | ||
662 | 592 | * | ||
663 | 593 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
664 | 594 | * | ||
665 | 595 | * Unless required by applicable law or agreed to in writing, software | ||
666 | 596 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
667 | 597 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
668 | 598 | * See the License for the specific language governing permissions and | ||
669 | 599 | * limitations under the License. | ||
670 | 600 | * ======================================================================== */ | ||
671 | 601 | |||
672 | 602 | |||
673 | 603 | +function ($) { "use strict"; | ||
674 | 604 | |||
675 | 605 | // MODAL CLASS DEFINITION | ||
676 | 606 | // ====================== | ||
677 | 607 | |||
678 | 608 | var Modal = function (element, options) { | ||
679 | 609 | this.options = options | ||
680 | 610 | this.$element = $(element) | ||
681 | 611 | this.$backdrop = | ||
682 | 612 | this.isShown = null | ||
683 | 613 | |||
684 | 614 | if (this.options.remote) this.$element.load(this.options.remote) | ||
685 | 615 | } | ||
686 | 616 | |||
687 | 617 | Modal.DEFAULTS = { | ||
688 | 618 | backdrop: true | ||
689 | 619 | , keyboard: true | ||
690 | 620 | , show: true | ||
691 | 621 | } | ||
692 | 622 | |||
693 | 623 | Modal.prototype.toggle = function (_relatedTarget) { | ||
694 | 624 | return this[!this.isShown ? 'show' : 'hide'](_relatedTarget) | ||
695 | 625 | } | ||
696 | 626 | |||
697 | 627 | Modal.prototype.show = function (_relatedTarget) { | ||
698 | 628 | var that = this | ||
699 | 629 | var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) | ||
700 | 630 | |||
701 | 631 | this.$element.trigger(e) | ||
702 | 632 | |||
703 | 633 | if (this.isShown || e.isDefaultPrevented()) return | ||
704 | 634 | |||
705 | 635 | this.isShown = true | ||
706 | 636 | |||
707 | 637 | this.escape() | ||
708 | 638 | |||
709 | 639 | this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) | ||
710 | 640 | |||
711 | 641 | this.backdrop(function () { | ||
712 | 642 | var transition = $.support.transition && that.$element.hasClass('fade') | ||
713 | 643 | |||
714 | 644 | if (!that.$element.parent().length) { | ||
715 | 645 | that.$element.appendTo(document.body) // don't move modals dom position | ||
716 | 646 | } | ||
717 | 647 | |||
718 | 648 | that.$element.show() | ||
719 | 649 | |||
720 | 650 | if (transition) { | ||
721 | 651 | that.$element[0].offsetWidth // force reflow | ||
722 | 652 | } | ||
723 | 653 | |||
724 | 654 | that.$element | ||
725 | 655 | .addClass('in') | ||
726 | 656 | .attr('aria-hidden', false) | ||
727 | 657 | |||
728 | 658 | that.enforceFocus() | ||
729 | 659 | |||
730 | 660 | var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) | ||
731 | 661 | |||
732 | 662 | transition ? | ||
733 | 663 | that.$element.find('.modal-dialog') // wait for modal to slide in | ||
734 | 664 | .one($.support.transition.end, function () { | ||
735 | 665 | that.$element.focus().trigger(e) | ||
736 | 666 | }) | ||
737 | 667 | .emulateTransitionEnd(300) : | ||
738 | 668 | that.$element.focus().trigger(e) | ||
739 | 669 | }) | ||
740 | 670 | } | ||
741 | 671 | |||
742 | 672 | Modal.prototype.hide = function (e) { | ||
743 | 673 | if (e) e.preventDefault() | ||
744 | 674 | |||
745 | 675 | e = $.Event('hide.bs.modal') | ||
746 | 676 | |||
747 | 677 | this.$element.trigger(e) | ||
748 | 678 | |||
749 | 679 | if (!this.isShown || e.isDefaultPrevented()) return | ||
750 | 680 | |||
751 | 681 | this.isShown = false | ||
752 | 682 | |||
753 | 683 | this.escape() | ||
754 | 684 | |||
755 | 685 | $(document).off('focusin.bs.modal') | ||
756 | 686 | |||
757 | 687 | this.$element | ||
758 | 688 | .removeClass('in') | ||
759 | 689 | .attr('aria-hidden', true) | ||
760 | 690 | .off('click.dismiss.modal') | ||
761 | 691 | |||
762 | 692 | $.support.transition && this.$element.hasClass('fade') ? | ||
763 | 693 | this.$element | ||
764 | 694 | .one($.support.transition.end, $.proxy(this.hideModal, this)) | ||
765 | 695 | .emulateTransitionEnd(300) : | ||
766 | 696 | this.hideModal() | ||
767 | 697 | } | ||
768 | 698 | |||
769 | 699 | Modal.prototype.enforceFocus = function () { | ||
770 | 700 | $(document) | ||
771 | 701 | .off('focusin.bs.modal') // guard against infinite focus loop | ||
772 | 702 | .on('focusin.bs.modal', $.proxy(function (e) { | ||
773 | 703 | if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { | ||
774 | 704 | this.$element.focus() | ||
775 | 705 | } | ||
776 | 706 | }, this)) | ||
777 | 707 | } | ||
778 | 708 | |||
779 | 709 | Modal.prototype.escape = function () { | ||
780 | 710 | if (this.isShown && this.options.keyboard) { | ||
781 | 711 | this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) { | ||
782 | 712 | e.which == 27 && this.hide() | ||
783 | 713 | }, this)) | ||
784 | 714 | } else if (!this.isShown) { | ||
785 | 715 | this.$element.off('keyup.dismiss.bs.modal') | ||
786 | 716 | } | ||
787 | 717 | } | ||
788 | 718 | |||
789 | 719 | Modal.prototype.hideModal = function () { | ||
790 | 720 | var that = this | ||
791 | 721 | this.$element.hide() | ||
792 | 722 | this.backdrop(function () { | ||
793 | 723 | that.removeBackdrop() | ||
794 | 724 | that.$element.trigger('hidden.bs.modal') | ||
795 | 725 | }) | ||
796 | 726 | } | ||
797 | 727 | |||
798 | 728 | Modal.prototype.removeBackdrop = function () { | ||
799 | 729 | this.$backdrop && this.$backdrop.remove() | ||
800 | 730 | this.$backdrop = null | ||
801 | 731 | } | ||
802 | 732 | |||
803 | 733 | Modal.prototype.backdrop = function (callback) { | ||
804 | 734 | var that = this | ||
805 | 735 | var animate = this.$element.hasClass('fade') ? 'fade' : '' | ||
806 | 736 | |||
807 | 737 | if (this.isShown && this.options.backdrop) { | ||
808 | 738 | var doAnimate = $.support.transition && animate | ||
809 | 739 | |||
810 | 740 | this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') | ||
811 | 741 | .appendTo(document.body) | ||
812 | 742 | |||
813 | 743 | this.$element.on('click.dismiss.modal', $.proxy(function (e) { | ||
814 | 744 | if (e.target !== e.currentTarget) return | ||
815 | 745 | this.options.backdrop == 'static' | ||
816 | 746 | ? this.$element[0].focus.call(this.$element[0]) | ||
817 | 747 | : this.hide.call(this) | ||
818 | 748 | }, this)) | ||
819 | 749 | |||
820 | 750 | if (doAnimate) this.$backdrop[0].offsetWidth // force reflow | ||
821 | 751 | |||
822 | 752 | this.$backdrop.addClass('in') | ||
823 | 753 | |||
824 | 754 | if (!callback) return | ||
825 | 755 | |||
826 | 756 | doAnimate ? | ||
827 | 757 | this.$backdrop | ||
828 | 758 | .one($.support.transition.end, callback) | ||
829 | 759 | .emulateTransitionEnd(150) : | ||
830 | 760 | callback() | ||
831 | 761 | |||
832 | 762 | } else if (!this.isShown && this.$backdrop) { | ||
833 | 763 | this.$backdrop.removeClass('in') | ||
834 | 764 | |||
835 | 765 | $.support.transition && this.$element.hasClass('fade')? | ||
836 | 766 | this.$backdrop | ||
837 | 767 | .one($.support.transition.end, callback) | ||
838 | 768 | .emulateTransitionEnd(150) : | ||
839 | 769 | callback() | ||
840 | 770 | |||
841 | 771 | } else if (callback) { | ||
842 | 772 | callback() | ||
843 | 773 | } | ||
844 | 774 | } | ||
845 | 775 | |||
846 | 776 | |||
847 | 777 | // MODAL PLUGIN DEFINITION | ||
848 | 778 | // ======================= | ||
849 | 779 | |||
850 | 780 | var old = $.fn.modal | ||
851 | 781 | |||
852 | 782 | $.fn.modal = function (option, _relatedTarget) { | ||
853 | 783 | return this.each(function () { | ||
854 | 784 | var $this = $(this) | ||
855 | 785 | var data = $this.data('bs.modal') | ||
856 | 786 | var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) | ||
857 | 787 | |||
858 | 788 | if (!data) $this.data('bs.modal', (data = new Modal(this, options))) | ||
859 | 789 | if (typeof option == 'string') data[option](_relatedTarget) | ||
860 | 790 | else if (options.show) data.show(_relatedTarget) | ||
861 | 791 | }) | ||
862 | 792 | } | ||
863 | 793 | |||
864 | 794 | $.fn.modal.Constructor = Modal | ||
865 | 795 | |||
866 | 796 | |||
867 | 797 | // MODAL NO CONFLICT | ||
868 | 798 | // ================= | ||
869 | 799 | |||
870 | 800 | $.fn.modal.noConflict = function () { | ||
871 | 801 | $.fn.modal = old | ||
872 | 802 | return this | ||
873 | 803 | } | ||
874 | 804 | |||
875 | 805 | |||
876 | 806 | // MODAL DATA-API | ||
877 | 807 | // ============== | ||
878 | 808 | |||
879 | 809 | $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { | ||
880 | 810 | var $this = $(this) | ||
881 | 811 | var href = $this.attr('href') | ||
882 | 812 | var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 | ||
883 | 813 | var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) | ||
884 | 814 | |||
885 | 815 | e.preventDefault() | ||
886 | 816 | |||
887 | 817 | $target | ||
888 | 818 | .modal(option, this) | ||
889 | 819 | .one('hide', function () { | ||
890 | 820 | $this.is(':visible') && $this.focus() | ||
891 | 821 | }) | ||
892 | 822 | }) | ||
893 | 823 | |||
894 | 824 | $(document) | ||
895 | 825 | .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') }) | ||
896 | 826 | .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') }) | ||
897 | 827 | |||
898 | 828 | }(window.jQuery); | ||
899 | 829 | |||
900 | 830 | /* ======================================================================== | ||
901 | 831 | * Bootstrap: tooltip.js v3.0.0 | ||
902 | 832 | * http://getbootstrap.com/javascript/#tooltip | ||
903 | 833 | * Inspired by the original jQuery.tipsy by Jason Frame | ||
904 | 834 | * ======================================================================== | ||
905 | 835 | * Copyright 2013 Twitter, Inc. | ||
906 | 836 | * | ||
907 | 837 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
908 | 838 | * you may not use this file except in compliance with the License. | ||
909 | 839 | * You may obtain a copy of the License at | ||
910 | 840 | * | ||
911 | 841 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
912 | 842 | * | ||
913 | 843 | * Unless required by applicable law or agreed to in writing, software | ||
914 | 844 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
915 | 845 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
916 | 846 | * See the License for the specific language governing permissions and | ||
917 | 847 | * limitations under the License. | ||
918 | 848 | * ======================================================================== */ | ||
919 | 849 | |||
920 | 850 | |||
921 | 851 | +function ($) { "use strict"; | ||
922 | 852 | |||
923 | 853 | // TOOLTIP PUBLIC CLASS DEFINITION | ||
924 | 854 | // =============================== | ||
925 | 855 | |||
926 | 856 | var Tooltip = function (element, options) { | ||
927 | 857 | this.type = | ||
928 | 858 | this.options = | ||
929 | 859 | this.enabled = | ||
930 | 860 | this.timeout = | ||
931 | 861 | this.hoverState = | ||
932 | 862 | this.$element = null | ||
933 | 863 | |||
934 | 864 | this.init('tooltip', element, options) | ||
935 | 865 | } | ||
936 | 866 | |||
937 | 867 | Tooltip.DEFAULTS = { | ||
938 | 868 | animation: true | ||
939 | 869 | , placement: 'top' | ||
940 | 870 | , selector: false | ||
941 | 871 | , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' | ||
942 | 872 | , trigger: 'hover focus' | ||
943 | 873 | , title: '' | ||
944 | 874 | , delay: 0 | ||
945 | 875 | , html: false | ||
946 | 876 | , container: false | ||
947 | 877 | } | ||
948 | 878 | |||
949 | 879 | Tooltip.prototype.init = function (type, element, options) { | ||
950 | 880 | this.enabled = true | ||
951 | 881 | this.type = type | ||
952 | 882 | this.$element = $(element) | ||
953 | 883 | this.options = this.getOptions(options) | ||
954 | 884 | |||
955 | 885 | var triggers = this.options.trigger.split(' ') | ||
956 | 886 | |||
957 | 887 | for (var i = triggers.length; i--;) { | ||
958 | 888 | var trigger = triggers[i] | ||
959 | 889 | |||
960 | 890 | if (trigger == 'click') { | ||
961 | 891 | this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) | ||
962 | 892 | } else if (trigger != 'manual') { | ||
963 | 893 | var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus' | ||
964 | 894 | var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur' | ||
965 | 895 | |||
966 | 896 | this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) | ||
967 | 897 | this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) | ||
968 | 898 | } | ||
969 | 899 | } | ||
970 | 900 | |||
971 | 901 | this.options.selector ? | ||
972 | 902 | (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : | ||
973 | 903 | this.fixTitle() | ||
974 | 904 | } | ||
975 | 905 | |||
976 | 906 | Tooltip.prototype.getDefaults = function () { | ||
977 | 907 | return Tooltip.DEFAULTS | ||
978 | 908 | } | ||
979 | 909 | |||
980 | 910 | Tooltip.prototype.getOptions = function (options) { | ||
981 | 911 | options = $.extend({}, this.getDefaults(), this.$element.data(), options) | ||
982 | 912 | |||
983 | 913 | if (options.delay && typeof options.delay == 'number') { | ||
984 | 914 | options.delay = { | ||
985 | 915 | show: options.delay | ||
986 | 916 | , hide: options.delay | ||
987 | 917 | } | ||
988 | 918 | } | ||
989 | 919 | |||
990 | 920 | return options | ||
991 | 921 | } | ||
992 | 922 | |||
993 | 923 | Tooltip.prototype.getDelegateOptions = function () { | ||
994 | 924 | var options = {} | ||
995 | 925 | var defaults = this.getDefaults() | ||
996 | 926 | |||
997 | 927 | this._options && $.each(this._options, function (key, value) { | ||
998 | 928 | if (defaults[key] != value) options[key] = value | ||
999 | 929 | }) | ||
1000 | 930 | |||
1001 | 931 | return options | ||
1002 | 932 | } | ||
1003 | 933 | |||
1004 | 934 | Tooltip.prototype.enter = function (obj) { | ||
1005 | 935 | var self = obj instanceof this.constructor ? | ||
1006 | 936 | obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) | ||
1007 | 937 | |||
1008 | 938 | clearTimeout(self.timeout) | ||
1009 | 939 | |||
1010 | 940 | self.hoverState = 'in' | ||
1011 | 941 | |||
1012 | 942 | if (!self.options.delay || !self.options.delay.show) return self.show() | ||
1013 | 943 | |||
1014 | 944 | self.timeout = setTimeout(function () { | ||
1015 | 945 | if (self.hoverState == 'in') self.show() | ||
1016 | 946 | }, self.options.delay.show) | ||
1017 | 947 | } | ||
1018 | 948 | |||
1019 | 949 | Tooltip.prototype.leave = function (obj) { | ||
1020 | 950 | var self = obj instanceof this.constructor ? | ||
1021 | 951 | obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) | ||
1022 | 952 | |||
1023 | 953 | clearTimeout(self.timeout) | ||
1024 | 954 | |||
1025 | 955 | self.hoverState = 'out' | ||
1026 | 956 | |||
1027 | 957 | if (!self.options.delay || !self.options.delay.hide) return self.hide() | ||
1028 | 958 | |||
1029 | 959 | self.timeout = setTimeout(function () { | ||
1030 | 960 | if (self.hoverState == 'out') self.hide() | ||
1031 | 961 | }, self.options.delay.hide) | ||
1032 | 962 | } | ||
1033 | 963 | |||
1034 | 964 | Tooltip.prototype.show = function () { | ||
1035 | 965 | var e = $.Event('show.bs.'+ this.type) | ||
1036 | 966 | |||
1037 | 967 | if (this.hasContent() && this.enabled) { | ||
1038 | 968 | this.$element.trigger(e) | ||
1039 | 969 | |||
1040 | 970 | if (e.isDefaultPrevented()) return | ||
1041 | 971 | |||
1042 | 972 | var $tip = this.tip() | ||
1043 | 973 | |||
1044 | 974 | this.setContent() | ||
1045 | 975 | |||
1046 | 976 | if (this.options.animation) $tip.addClass('fade') | ||
1047 | 977 | |||
1048 | 978 | var placement = typeof this.options.placement == 'function' ? | ||
1049 | 979 | this.options.placement.call(this, $tip[0], this.$element[0]) : | ||
1050 | 980 | this.options.placement | ||
1051 | 981 | |||
1052 | 982 | var autoToken = /\s?auto?\s?/i | ||
1053 | 983 | var autoPlace = autoToken.test(placement) | ||
1054 | 984 | if (autoPlace) placement = placement.replace(autoToken, '') || 'top' | ||
1055 | 985 | |||
1056 | 986 | $tip | ||
1057 | 987 | .detach() | ||
1058 | 988 | .css({ top: 0, left: 0, display: 'block' }) | ||
1059 | 989 | .addClass(placement) | ||
1060 | 990 | |||
1061 | 991 | this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) | ||
1062 | 992 | |||
1063 | 993 | var pos = this.getPosition() | ||
1064 | 994 | var actualWidth = $tip[0].offsetWidth | ||
1065 | 995 | var actualHeight = $tip[0].offsetHeight | ||
1066 | 996 | |||
1067 | 997 | if (autoPlace) { | ||
1068 | 998 | var $parent = this.$element.parent() | ||
1069 | 999 | |||
1070 | 1000 | var orgPlacement = placement | ||
1071 | 1001 | var docScroll = document.documentElement.scrollTop || document.body.scrollTop | ||
1072 | 1002 | var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth() | ||
1073 | 1003 | var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight() | ||
1074 | 1004 | var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left | ||
1075 | 1005 | |||
1076 | 1006 | placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' : | ||
1077 | 1007 | placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' : | ||
1078 | 1008 | placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' : | ||
1079 | 1009 | placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' : | ||
1080 | 1010 | placement | ||
1081 | 1011 | |||
1082 | 1012 | $tip | ||
1083 | 1013 | .removeClass(orgPlacement) | ||
1084 | 1014 | .addClass(placement) | ||
1085 | 1015 | } | ||
1086 | 1016 | |||
1087 | 1017 | var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) | ||
1088 | 1018 | |||
1089 | 1019 | this.applyPlacement(calculatedOffset, placement) | ||
1090 | 1020 | this.$element.trigger('shown.bs.' + this.type) | ||
1091 | 1021 | } | ||
1092 | 1022 | } | ||
1093 | 1023 | |||
1094 | 1024 | Tooltip.prototype.applyPlacement = function(offset, placement) { | ||
1095 | 1025 | var replace | ||
1096 | 1026 | var $tip = this.tip() | ||
1097 | 1027 | var width = $tip[0].offsetWidth | ||
1098 | 1028 | var height = $tip[0].offsetHeight | ||
1099 | 1029 | |||
1100 | 1030 | // manually read margins because getBoundingClientRect includes difference | ||
1101 | 1031 | var marginTop = parseInt($tip.css('margin-top'), 10) | ||
1102 | 1032 | var marginLeft = parseInt($tip.css('margin-left'), 10) | ||
1103 | 1033 | |||
1104 | 1034 | // we must check for NaN for ie 8/9 | ||
1105 | 1035 | if (isNaN(marginTop)) marginTop = 0 | ||
1106 | 1036 | if (isNaN(marginLeft)) marginLeft = 0 | ||
1107 | 1037 | |||
1108 | 1038 | offset.top = offset.top + marginTop | ||
1109 | 1039 | offset.left = offset.left + marginLeft | ||
1110 | 1040 | |||
1111 | 1041 | $tip | ||
1112 | 1042 | .offset(offset) | ||
1113 | 1043 | .addClass('in') | ||
1114 | 1044 | |||
1115 | 1045 | // check to see if placing tip in new offset caused the tip to resize itself | ||
1116 | 1046 | var actualWidth = $tip[0].offsetWidth | ||
1117 | 1047 | var actualHeight = $tip[0].offsetHeight | ||
1118 | 1048 | |||
1119 | 1049 | if (placement == 'top' && actualHeight != height) { | ||
1120 | 1050 | replace = true | ||
1121 | 1051 | offset.top = offset.top + height - actualHeight | ||
1122 | 1052 | } | ||
1123 | 1053 | |||
1124 | 1054 | if (/bottom|top/.test(placement)) { | ||
1125 | 1055 | var delta = 0 | ||
1126 | 1056 | |||
1127 | 1057 | if (offset.left < 0) { | ||
1128 | 1058 | delta = offset.left * -2 | ||
1129 | 1059 | offset.left = 0 | ||
1130 | 1060 | |||
1131 | 1061 | $tip.offset(offset) | ||
1132 | 1062 | |||
1133 | 1063 | actualWidth = $tip[0].offsetWidth | ||
1134 | 1064 | actualHeight = $tip[0].offsetHeight | ||
1135 | 1065 | } | ||
1136 | 1066 | |||
1137 | 1067 | this.replaceArrow(delta - width + actualWidth, actualWidth, 'left') | ||
1138 | 1068 | } else { | ||
1139 | 1069 | this.replaceArrow(actualHeight - height, actualHeight, 'top') | ||
1140 | 1070 | } | ||
1141 | 1071 | |||
1142 | 1072 | if (replace) $tip.offset(offset) | ||
1143 | 1073 | } | ||
1144 | 1074 | |||
1145 | 1075 | Tooltip.prototype.replaceArrow = function(delta, dimension, position) { | ||
1146 | 1076 | this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') | ||
1147 | 1077 | } | ||
1148 | 1078 | |||
1149 | 1079 | Tooltip.prototype.setContent = function () { | ||
1150 | 1080 | var $tip = this.tip() | ||
1151 | 1081 | var title = this.getTitle() | ||
1152 | 1082 | |||
1153 | 1083 | $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) | ||
1154 | 1084 | $tip.removeClass('fade in top bottom left right') | ||
1155 | 1085 | } | ||
1156 | 1086 | |||
1157 | 1087 | Tooltip.prototype.hide = function () { | ||
1158 | 1088 | var that = this | ||
1159 | 1089 | var $tip = this.tip() | ||
1160 | 1090 | var e = $.Event('hide.bs.' + this.type) | ||
1161 | 1091 | |||
1162 | 1092 | function complete() { | ||
1163 | 1093 | if (that.hoverState != 'in') $tip.detach() | ||
1164 | 1094 | } | ||
1165 | 1095 | |||
1166 | 1096 | this.$element.trigger(e) | ||
1167 | 1097 | |||
1168 | 1098 | if (e.isDefaultPrevented()) return | ||
1169 | 1099 | |||
1170 | 1100 | $tip.removeClass('in') | ||
1171 | 1101 | |||
1172 | 1102 | $.support.transition && this.$tip.hasClass('fade') ? | ||
1173 | 1103 | $tip | ||
1174 | 1104 | .one($.support.transition.end, complete) | ||
1175 | 1105 | .emulateTransitionEnd(150) : | ||
1176 | 1106 | complete() | ||
1177 | 1107 | |||
1178 | 1108 | this.$element.trigger('hidden.bs.' + this.type) | ||
1179 | 1109 | |||
1180 | 1110 | return this | ||
1181 | 1111 | } | ||
1182 | 1112 | |||
1183 | 1113 | Tooltip.prototype.fixTitle = function () { | ||
1184 | 1114 | var $e = this.$element | ||
1185 | 1115 | if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { | ||
1186 | 1116 | $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') | ||
1187 | 1117 | } | ||
1188 | 1118 | } | ||
1189 | 1119 | |||
1190 | 1120 | Tooltip.prototype.hasContent = function () { | ||
1191 | 1121 | return this.getTitle() | ||
1192 | 1122 | } | ||
1193 | 1123 | |||
1194 | 1124 | Tooltip.prototype.getPosition = function () { | ||
1195 | 1125 | var el = this.$element[0] | ||
1196 | 1126 | return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : { | ||
1197 | 1127 | width: el.offsetWidth | ||
1198 | 1128 | , height: el.offsetHeight | ||
1199 | 1129 | }, this.$element.offset()) | ||
1200 | 1130 | } | ||
1201 | 1131 | |||
1202 | 1132 | Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { | ||
1203 | 1133 | return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : | ||
1204 | 1134 | placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : | ||
1205 | 1135 | placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : | ||
1206 | 1136 | /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } | ||
1207 | 1137 | } | ||
1208 | 1138 | |||
1209 | 1139 | Tooltip.prototype.getTitle = function () { | ||
1210 | 1140 | var title | ||
1211 | 1141 | var $e = this.$element | ||
1212 | 1142 | var o = this.options | ||
1213 | 1143 | |||
1214 | 1144 | title = $e.attr('data-original-title') | ||
1215 | 1145 | || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) | ||
1216 | 1146 | |||
1217 | 1147 | return title | ||
1218 | 1148 | } | ||
1219 | 1149 | |||
1220 | 1150 | Tooltip.prototype.tip = function () { | ||
1221 | 1151 | return this.$tip = this.$tip || $(this.options.template) | ||
1222 | 1152 | } | ||
1223 | 1153 | |||
1224 | 1154 | Tooltip.prototype.arrow = function () { | ||
1225 | 1155 | return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow') | ||
1226 | 1156 | } | ||
1227 | 1157 | |||
1228 | 1158 | Tooltip.prototype.validate = function () { | ||
1229 | 1159 | if (!this.$element[0].parentNode) { | ||
1230 | 1160 | this.hide() | ||
1231 | 1161 | this.$element = null | ||
1232 | 1162 | this.options = null | ||
1233 | 1163 | } | ||
1234 | 1164 | } | ||
1235 | 1165 | |||
1236 | 1166 | Tooltip.prototype.enable = function () { | ||
1237 | 1167 | this.enabled = true | ||
1238 | 1168 | } | ||
1239 | 1169 | |||
1240 | 1170 | Tooltip.prototype.disable = function () { | ||
1241 | 1171 | this.enabled = false | ||
1242 | 1172 | } | ||
1243 | 1173 | |||
1244 | 1174 | Tooltip.prototype.toggleEnabled = function () { | ||
1245 | 1175 | this.enabled = !this.enabled | ||
1246 | 1176 | } | ||
1247 | 1177 | |||
1248 | 1178 | Tooltip.prototype.toggle = function (e) { | ||
1249 | 1179 | var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this | ||
1250 | 1180 | self.tip().hasClass('in') ? self.leave(self) : self.enter(self) | ||
1251 | 1181 | } | ||
1252 | 1182 | |||
1253 | 1183 | Tooltip.prototype.destroy = function () { | ||
1254 | 1184 | this.hide().$element.off('.' + this.type).removeData('bs.' + this.type) | ||
1255 | 1185 | } | ||
1256 | 1186 | |||
1257 | 1187 | |||
1258 | 1188 | // TOOLTIP PLUGIN DEFINITION | ||
1259 | 1189 | // ========================= | ||
1260 | 1190 | |||
1261 | 1191 | var old = $.fn.tooltip | ||
1262 | 1192 | |||
1263 | 1193 | $.fn.tooltip = function (option) { | ||
1264 | 1194 | return this.each(function () { | ||
1265 | 1195 | var $this = $(this) | ||
1266 | 1196 | var data = $this.data('bs.tooltip') | ||
1267 | 1197 | var options = typeof option == 'object' && option | ||
1268 | 1198 | |||
1269 | 1199 | if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) | ||
1270 | 1200 | if (typeof option == 'string') data[option]() | ||
1271 | 1201 | }) | ||
1272 | 1202 | } | ||
1273 | 1203 | |||
1274 | 1204 | $.fn.tooltip.Constructor = Tooltip | ||
1275 | 1205 | |||
1276 | 1206 | |||
1277 | 1207 | // TOOLTIP NO CONFLICT | ||
1278 | 1208 | // =================== | ||
1279 | 1209 | |||
1280 | 1210 | $.fn.tooltip.noConflict = function () { | ||
1281 | 1211 | $.fn.tooltip = old | ||
1282 | 1212 | return this | ||
1283 | 1213 | } | ||
1284 | 1214 | |||
1285 | 1215 | }(window.jQuery); | ||
1286 | 1216 | |||
1287 | 1217 | /* ======================================================================== | ||
1288 | 1218 | * Bootstrap: popover.js v3.0.0 | ||
1289 | 1219 | * http://getbootstrap.com/javascript/#popovers | ||
1290 | 1220 | * ======================================================================== | ||
1291 | 1221 | * Copyright 2013 Twitter, Inc. | ||
1292 | 1222 | * | ||
1293 | 1223 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
1294 | 1224 | * you may not use this file except in compliance with the License. | ||
1295 | 1225 | * You may obtain a copy of the License at | ||
1296 | 1226 | * | ||
1297 | 1227 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
1298 | 1228 | * | ||
1299 | 1229 | * Unless required by applicable law or agreed to in writing, software | ||
1300 | 1230 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
1301 | 1231 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
1302 | 1232 | * See the License for the specific language governing permissions and | ||
1303 | 1233 | * limitations under the License. | ||
1304 | 1234 | * ======================================================================== */ | ||
1305 | 1235 | |||
1306 | 1236 | |||
1307 | 1237 | +function ($) { "use strict"; | ||
1308 | 1238 | |||
1309 | 1239 | // POPOVER PUBLIC CLASS DEFINITION | ||
1310 | 1240 | // =============================== | ||
1311 | 1241 | |||
1312 | 1242 | var Popover = function (element, options) { | ||
1313 | 1243 | this.init('popover', element, options) | ||
1314 | 1244 | } | ||
1315 | 1245 | |||
1316 | 1246 | if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') | ||
1317 | 1247 | |||
1318 | 1248 | Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, { | ||
1319 | 1249 | placement: 'right' | ||
1320 | 1250 | , trigger: 'click' | ||
1321 | 1251 | , content: '' | ||
1322 | 1252 | , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' | ||
1323 | 1253 | }) | ||
1324 | 1254 | |||
1325 | 1255 | |||
1326 | 1256 | // NOTE: POPOVER EXTENDS tooltip.js | ||
1327 | 1257 | // ================================ | ||
1328 | 1258 | |||
1329 | 1259 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) | ||
1330 | 1260 | |||
1331 | 1261 | Popover.prototype.constructor = Popover | ||
1332 | 1262 | |||
1333 | 1263 | Popover.prototype.getDefaults = function () { | ||
1334 | 1264 | return Popover.DEFAULTS | ||
1335 | 1265 | } | ||
1336 | 1266 | |||
1337 | 1267 | Popover.prototype.setContent = function () { | ||
1338 | 1268 | var $tip = this.tip() | ||
1339 | 1269 | var title = this.getTitle() | ||
1340 | 1270 | var content = this.getContent() | ||
1341 | 1271 | |||
1342 | 1272 | $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) | ||
1343 | 1273 | $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content) | ||
1344 | 1274 | |||
1345 | 1275 | $tip.removeClass('fade top bottom left right in') | ||
1346 | 1276 | |||
1347 | 1277 | // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do | ||
1348 | 1278 | // this manually by checking the contents. | ||
1349 | 1279 | if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() | ||
1350 | 1280 | } | ||
1351 | 1281 | |||
1352 | 1282 | Popover.prototype.hasContent = function () { | ||
1353 | 1283 | return this.getTitle() || this.getContent() | ||
1354 | 1284 | } | ||
1355 | 1285 | |||
1356 | 1286 | Popover.prototype.getContent = function () { | ||
1357 | 1287 | var $e = this.$element | ||
1358 | 1288 | var o = this.options | ||
1359 | 1289 | |||
1360 | 1290 | return $e.attr('data-content') | ||
1361 | 1291 | || (typeof o.content == 'function' ? | ||
1362 | 1292 | o.content.call($e[0]) : | ||
1363 | 1293 | o.content) | ||
1364 | 1294 | } | ||
1365 | 1295 | |||
1366 | 1296 | Popover.prototype.arrow = function () { | ||
1367 | 1297 | return this.$arrow = this.$arrow || this.tip().find('.arrow') | ||
1368 | 1298 | } | ||
1369 | 1299 | |||
1370 | 1300 | Popover.prototype.tip = function () { | ||
1371 | 1301 | if (!this.$tip) this.$tip = $(this.options.template) | ||
1372 | 1302 | return this.$tip | ||
1373 | 1303 | } | ||
1374 | 1304 | |||
1375 | 1305 | |||
1376 | 1306 | // POPOVER PLUGIN DEFINITION | ||
1377 | 1307 | // ========================= | ||
1378 | 1308 | |||
1379 | 1309 | var old = $.fn.popover | ||
1380 | 1310 | |||
1381 | 1311 | $.fn.popover = function (option) { | ||
1382 | 1312 | return this.each(function () { | ||
1383 | 1313 | var $this = $(this) | ||
1384 | 1314 | var data = $this.data('bs.popover') | ||
1385 | 1315 | var options = typeof option == 'object' && option | ||
1386 | 1316 | |||
1387 | 1317 | if (!data) $this.data('bs.popover', (data = new Popover(this, options))) | ||
1388 | 1318 | if (typeof option == 'string') data[option]() | ||
1389 | 1319 | }) | ||
1390 | 1320 | } | ||
1391 | 1321 | |||
1392 | 1322 | $.fn.popover.Constructor = Popover | ||
1393 | 1323 | |||
1394 | 1324 | |||
1395 | 1325 | // POPOVER NO CONFLICT | ||
1396 | 1326 | // =================== | ||
1397 | 1327 | |||
1398 | 1328 | $.fn.popover.noConflict = function () { | ||
1399 | 1329 | $.fn.popover = old | ||
1400 | 1330 | return this | ||
1401 | 1331 | } | ||
1402 | 1332 | |||
1403 | 1333 | }(window.jQuery); | ||
1404 | 1334 | |||
1405 | 1335 | /* ======================================================================== | ||
1406 | 1336 | * Bootstrap: tab.js v3.0.0 | ||
1407 | 1337 | * http://getbootstrap.com/javascript/#tabs | ||
1408 | 1338 | * ======================================================================== | ||
1409 | 1339 | * Copyright 2013 Twitter, Inc. | ||
1410 | 1340 | * | ||
1411 | 1341 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
1412 | 1342 | * you may not use this file except in compliance with the License. | ||
1413 | 1343 | * You may obtain a copy of the License at | ||
1414 | 1344 | * | ||
1415 | 1345 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
1416 | 1346 | * | ||
1417 | 1347 | * Unless required by applicable law or agreed to in writing, software | ||
1418 | 1348 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
1419 | 1349 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
1420 | 1350 | * See the License for the specific language governing permissions and | ||
1421 | 1351 | * limitations under the License. | ||
1422 | 1352 | * ======================================================================== */ | ||
1423 | 1353 | |||
1424 | 1354 | |||
1425 | 1355 | +function ($) { "use strict"; | ||
1426 | 1356 | |||
1427 | 1357 | // TAB CLASS DEFINITION | ||
1428 | 1358 | // ==================== | ||
1429 | 1359 | |||
1430 | 1360 | var Tab = function (element) { | ||
1431 | 1361 | this.element = $(element) | ||
1432 | 1362 | } | ||
1433 | 1363 | |||
1434 | 1364 | Tab.prototype.show = function () { | ||
1435 | 1365 | var $this = this.element | ||
1436 | 1366 | var $ul = $this.closest('ul:not(.dropdown-menu)') | ||
1437 | 1367 | var selector = $this.data('target') | ||
1438 | 1368 | |||
1439 | 1369 | if (!selector) { | ||
1440 | 1370 | selector = $this.attr('href') | ||
1441 | 1371 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 | ||
1442 | 1372 | } | ||
1443 | 1373 | |||
1444 | 1374 | if ($this.parent('li').hasClass('active')) return | ||
1445 | 1375 | |||
1446 | 1376 | var previous = $ul.find('.active:last a')[0] | ||
1447 | 1377 | var e = $.Event('show.bs.tab', { | ||
1448 | 1378 | relatedTarget: previous | ||
1449 | 1379 | }) | ||
1450 | 1380 | |||
1451 | 1381 | $this.trigger(e) | ||
1452 | 1382 | |||
1453 | 1383 | if (e.isDefaultPrevented()) return | ||
1454 | 1384 | |||
1455 | 1385 | var $target = $(selector) | ||
1456 | 1386 | |||
1457 | 1387 | this.activate($this.parent('li'), $ul) | ||
1458 | 1388 | this.activate($target, $target.parent(), function () { | ||
1459 | 1389 | $this.trigger({ | ||
1460 | 1390 | type: 'shown.bs.tab' | ||
1461 | 1391 | , relatedTarget: previous | ||
1462 | 1392 | }) | ||
1463 | 1393 | }) | ||
1464 | 1394 | } | ||
1465 | 1395 | |||
1466 | 1396 | Tab.prototype.activate = function (element, container, callback) { | ||
1467 | 1397 | var $active = container.find('> .active') | ||
1468 | 1398 | var transition = callback | ||
1469 | 1399 | && $.support.transition | ||
1470 | 1400 | && $active.hasClass('fade') | ||
1471 | 1401 | |||
1472 | 1402 | function next() { | ||
1473 | 1403 | $active | ||
1474 | 1404 | .removeClass('active') | ||
1475 | 1405 | .find('> .dropdown-menu > .active') | ||
1476 | 1406 | .removeClass('active') | ||
1477 | 1407 | |||
1478 | 1408 | element.addClass('active') | ||
1479 | 1409 | |||
1480 | 1410 | if (transition) { | ||
1481 | 1411 | element[0].offsetWidth // reflow for transition | ||
1482 | 1412 | element.addClass('in') | ||
1483 | 1413 | } else { | ||
1484 | 1414 | element.removeClass('fade') | ||
1485 | 1415 | } | ||
1486 | 1416 | |||
1487 | 1417 | if (element.parent('.dropdown-menu')) { | ||
1488 | 1418 | element.closest('li.dropdown').addClass('active') | ||
1489 | 1419 | } | ||
1490 | 1420 | |||
1491 | 1421 | callback && callback() | ||
1492 | 1422 | } | ||
1493 | 1423 | |||
1494 | 1424 | transition ? | ||
1495 | 1425 | $active | ||
1496 | 1426 | .one($.support.transition.end, next) | ||
1497 | 1427 | .emulateTransitionEnd(150) : | ||
1498 | 1428 | next() | ||
1499 | 1429 | |||
1500 | 1430 | $active.removeClass('in') | ||
1501 | 1431 | } | ||
1502 | 1432 | |||
1503 | 1433 | |||
1504 | 1434 | // TAB PLUGIN DEFINITION | ||
1505 | 1435 | // ===================== | ||
1506 | 1436 | |||
1507 | 1437 | var old = $.fn.tab | ||
1508 | 1438 | |||
1509 | 1439 | $.fn.tab = function ( option ) { | ||
1510 | 1440 | return this.each(function () { | ||
1511 | 1441 | var $this = $(this) | ||
1512 | 1442 | var data = $this.data('bs.tab') | ||
1513 | 1443 | |||
1514 | 1444 | if (!data) $this.data('bs.tab', (data = new Tab(this))) | ||
1515 | 1445 | if (typeof option == 'string') data[option]() | ||
1516 | 1446 | }) | ||
1517 | 1447 | } | ||
1518 | 1448 | |||
1519 | 1449 | $.fn.tab.Constructor = Tab | ||
1520 | 1450 | |||
1521 | 1451 | |||
1522 | 1452 | // TAB NO CONFLICT | ||
1523 | 1453 | // =============== | ||
1524 | 1454 | |||
1525 | 1455 | $.fn.tab.noConflict = function () { | ||
1526 | 1456 | $.fn.tab = old | ||
1527 | 1457 | return this | ||
1528 | 1458 | } | ||
1529 | 1459 | |||
1530 | 1460 | |||
1531 | 1461 | // TAB DATA-API | ||
1532 | 1462 | // ============ | ||
1533 | 1463 | |||
1534 | 1464 | $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { | ||
1535 | 1465 | e.preventDefault() | ||
1536 | 1466 | $(this).tab('show') | ||
1537 | 1467 | }) | ||
1538 | 1468 | |||
1539 | 1469 | }(window.jQuery); | ||
1540 | 1470 | |||
1541 | 1471 | /* ======================================================================== | ||
1542 | 1472 | * Bootstrap: affix.js v3.0.0 | ||
1543 | 1473 | * http://getbootstrap.com/javascript/#affix | ||
1544 | 1474 | * ======================================================================== | ||
1545 | 1475 | * Copyright 2013 Twitter, Inc. | ||
1546 | 1476 | * | ||
1547 | 1477 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
1548 | 1478 | * you may not use this file except in compliance with the License. | ||
1549 | 1479 | * You may obtain a copy of the License at | ||
1550 | 1480 | * | ||
1551 | 1481 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
1552 | 1482 | * | ||
1553 | 1483 | * Unless required by applicable law or agreed to in writing, software | ||
1554 | 1484 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
1555 | 1485 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
1556 | 1486 | * See the License for the specific language governing permissions and | ||
1557 | 1487 | * limitations under the License. | ||
1558 | 1488 | * ======================================================================== */ | ||
1559 | 1489 | |||
1560 | 1490 | |||
1561 | 1491 | +function ($) { "use strict"; | ||
1562 | 1492 | |||
1563 | 1493 | // AFFIX CLASS DEFINITION | ||
1564 | 1494 | // ====================== | ||
1565 | 1495 | |||
1566 | 1496 | var Affix = function (element, options) { | ||
1567 | 1497 | this.options = $.extend({}, Affix.DEFAULTS, options) | ||
1568 | 1498 | this.$window = $(window) | ||
1569 | 1499 | .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) | ||
1570 | 1500 | .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) | ||
1571 | 1501 | |||
1572 | 1502 | this.$element = $(element) | ||
1573 | 1503 | this.affixed = | ||
1574 | 1504 | this.unpin = null | ||
1575 | 1505 | |||
1576 | 1506 | this.checkPosition() | ||
1577 | 1507 | } | ||
1578 | 1508 | |||
1579 | 1509 | Affix.RESET = 'affix affix-top affix-bottom' | ||
1580 | 1510 | |||
1581 | 1511 | Affix.DEFAULTS = { | ||
1582 | 1512 | offset: 0 | ||
1583 | 1513 | } | ||
1584 | 1514 | |||
1585 | 1515 | Affix.prototype.checkPositionWithEventLoop = function () { | ||
1586 | 1516 | setTimeout($.proxy(this.checkPosition, this), 1) | ||
1587 | 1517 | } | ||
1588 | 1518 | |||
1589 | 1519 | Affix.prototype.checkPosition = function () { | ||
1590 | 1520 | if (!this.$element.is(':visible')) return | ||
1591 | 1521 | |||
1592 | 1522 | var scrollHeight = $(document).height() | ||
1593 | 1523 | var scrollTop = this.$window.scrollTop() | ||
1594 | 1524 | var position = this.$element.offset() | ||
1595 | 1525 | var offset = this.options.offset | ||
1596 | 1526 | var offsetTop = offset.top | ||
1597 | 1527 | var offsetBottom = offset.bottom | ||
1598 | 1528 | |||
1599 | 1529 | if (typeof offset != 'object') offsetBottom = offsetTop = offset | ||
1600 | 1530 | if (typeof offsetTop == 'function') offsetTop = offset.top() | ||
1601 | 1531 | if (typeof offsetBottom == 'function') offsetBottom = offset.bottom() | ||
1602 | 1532 | |||
1603 | 1533 | var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : | ||
1604 | 1534 | offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : | ||
1605 | 1535 | offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false | ||
1606 | 1536 | |||
1607 | 1537 | if (this.affixed === affix) return | ||
1608 | 1538 | if (this.unpin) this.$element.css('top', '') | ||
1609 | 1539 | |||
1610 | 1540 | this.affixed = affix | ||
1611 | 1541 | this.unpin = affix == 'bottom' ? position.top - scrollTop : null | ||
1612 | 1542 | |||
1613 | 1543 | this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : '')) | ||
1614 | 1544 | |||
1615 | 1545 | if (affix == 'bottom') { | ||
1616 | 1546 | this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() }) | ||
1617 | 1547 | } | ||
1618 | 1548 | } | ||
1619 | 1549 | |||
1620 | 1550 | |||
1621 | 1551 | // AFFIX PLUGIN DEFINITION | ||
1622 | 1552 | // ======================= | ||
1623 | 1553 | |||
1624 | 1554 | var old = $.fn.affix | ||
1625 | 1555 | |||
1626 | 1556 | $.fn.affix = function (option) { | ||
1627 | 1557 | return this.each(function () { | ||
1628 | 1558 | var $this = $(this) | ||
1629 | 1559 | var data = $this.data('bs.affix') | ||
1630 | 1560 | var options = typeof option == 'object' && option | ||
1631 | 1561 | |||
1632 | 1562 | if (!data) $this.data('bs.affix', (data = new Affix(this, options))) | ||
1633 | 1563 | if (typeof option == 'string') data[option]() | ||
1634 | 1564 | }) | ||
1635 | 1565 | } | ||
1636 | 1566 | |||
1637 | 1567 | $.fn.affix.Constructor = Affix | ||
1638 | 1568 | |||
1639 | 1569 | |||
1640 | 1570 | // AFFIX NO CONFLICT | ||
1641 | 1571 | // ================= | ||
1642 | 1572 | |||
1643 | 1573 | $.fn.affix.noConflict = function () { | ||
1644 | 1574 | $.fn.affix = old | ||
1645 | 1575 | return this | ||
1646 | 1576 | } | ||
1647 | 1577 | |||
1648 | 1578 | |||
1649 | 1579 | // AFFIX DATA-API | ||
1650 | 1580 | // ============== | ||
1651 | 1581 | |||
1652 | 1582 | $(window).on('load', function () { | ||
1653 | 1583 | $('[data-spy="affix"]').each(function () { | ||
1654 | 1584 | var $spy = $(this) | ||
1655 | 1585 | var data = $spy.data() | ||
1656 | 1586 | |||
1657 | 1587 | data.offset = data.offset || {} | ||
1658 | 1588 | |||
1659 | 1589 | if (data.offsetBottom) data.offset.bottom = data.offsetBottom | ||
1660 | 1590 | if (data.offsetTop) data.offset.top = data.offsetTop | ||
1661 | 1591 | |||
1662 | 1592 | $spy.affix(data) | ||
1663 | 1593 | }) | ||
1664 | 1594 | }) | ||
1665 | 1595 | |||
1666 | 1596 | }(window.jQuery); | ||
1667 | 1597 | |||
1668 | 1598 | /* ======================================================================== | ||
1669 | 1599 | * Bootstrap: collapse.js v3.0.0 | ||
1670 | 1600 | * http://getbootstrap.com/javascript/#collapse | ||
1671 | 1601 | * ======================================================================== | ||
1672 | 1602 | * Copyright 2013 Twitter, Inc. | ||
1673 | 1603 | * | ||
1674 | 1604 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
1675 | 1605 | * you may not use this file except in compliance with the License. | ||
1676 | 1606 | * You may obtain a copy of the License at | ||
1677 | 1607 | * | ||
1678 | 1608 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
1679 | 1609 | * | ||
1680 | 1610 | * Unless required by applicable law or agreed to in writing, software | ||
1681 | 1611 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
1682 | 1612 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
1683 | 1613 | * See the License for the specific language governing permissions and | ||
1684 | 1614 | * limitations under the License. | ||
1685 | 1615 | * ======================================================================== */ | ||
1686 | 1616 | |||
1687 | 1617 | |||
1688 | 1618 | +function ($) { "use strict"; | ||
1689 | 1619 | |||
1690 | 1620 | // COLLAPSE PUBLIC CLASS DEFINITION | ||
1691 | 1621 | // ================================ | ||
1692 | 1622 | |||
1693 | 1623 | var Collapse = function (element, options) { | ||
1694 | 1624 | this.$element = $(element) | ||
1695 | 1625 | this.options = $.extend({}, Collapse.DEFAULTS, options) | ||
1696 | 1626 | this.transitioning = null | ||
1697 | 1627 | |||
1698 | 1628 | if (this.options.parent) this.$parent = $(this.options.parent) | ||
1699 | 1629 | if (this.options.toggle) this.toggle() | ||
1700 | 1630 | } | ||
1701 | 1631 | |||
1702 | 1632 | Collapse.DEFAULTS = { | ||
1703 | 1633 | toggle: true | ||
1704 | 1634 | } | ||
1705 | 1635 | |||
1706 | 1636 | Collapse.prototype.dimension = function () { | ||
1707 | 1637 | var hasWidth = this.$element.hasClass('width') | ||
1708 | 1638 | return hasWidth ? 'width' : 'height' | ||
1709 | 1639 | } | ||
1710 | 1640 | |||
1711 | 1641 | Collapse.prototype.show = function () { | ||
1712 | 1642 | if (this.transitioning || this.$element.hasClass('in')) return | ||
1713 | 1643 | |||
1714 | 1644 | var startEvent = $.Event('show.bs.collapse') | ||
1715 | 1645 | this.$element.trigger(startEvent) | ||
1716 | 1646 | if (startEvent.isDefaultPrevented()) return | ||
1717 | 1647 | |||
1718 | 1648 | var actives = this.$parent && this.$parent.find('> .panel > .in') | ||
1719 | 1649 | |||
1720 | 1650 | if (actives && actives.length) { | ||
1721 | 1651 | var hasData = actives.data('bs.collapse') | ||
1722 | 1652 | if (hasData && hasData.transitioning) return | ||
1723 | 1653 | actives.collapse('hide') | ||
1724 | 1654 | hasData || actives.data('bs.collapse', null) | ||
1725 | 1655 | } | ||
1726 | 1656 | |||
1727 | 1657 | var dimension = this.dimension() | ||
1728 | 1658 | |||
1729 | 1659 | this.$element | ||
1730 | 1660 | .removeClass('collapse') | ||
1731 | 1661 | .addClass('collapsing') | ||
1732 | 1662 | [dimension](0) | ||
1733 | 1663 | |||
1734 | 1664 | this.transitioning = 1 | ||
1735 | 1665 | |||
1736 | 1666 | var complete = function () { | ||
1737 | 1667 | this.$element | ||
1738 | 1668 | .removeClass('collapsing') | ||
1739 | 1669 | .addClass('in') | ||
1740 | 1670 | [dimension]('auto') | ||
1741 | 1671 | this.transitioning = 0 | ||
1742 | 1672 | this.$element.trigger('shown.bs.collapse') | ||
1743 | 1673 | } | ||
1744 | 1674 | |||
1745 | 1675 | if (!$.support.transition) return complete.call(this) | ||
1746 | 1676 | |||
1747 | 1677 | var scrollSize = $.camelCase(['scroll', dimension].join('-')) | ||
1748 | 1678 | |||
1749 | 1679 | this.$element | ||
1750 | 1680 | .one($.support.transition.end, $.proxy(complete, this)) | ||
1751 | 1681 | .emulateTransitionEnd(350) | ||
1752 | 1682 | [dimension](this.$element[0][scrollSize]) | ||
1753 | 1683 | } | ||
1754 | 1684 | |||
1755 | 1685 | Collapse.prototype.hide = function () { | ||
1756 | 1686 | if (this.transitioning || !this.$element.hasClass('in')) return | ||
1757 | 1687 | |||
1758 | 1688 | var startEvent = $.Event('hide.bs.collapse') | ||
1759 | 1689 | this.$element.trigger(startEvent) | ||
1760 | 1690 | if (startEvent.isDefaultPrevented()) return | ||
1761 | 1691 | |||
1762 | 1692 | var dimension = this.dimension() | ||
1763 | 1693 | |||
1764 | 1694 | this.$element | ||
1765 | 1695 | [dimension](this.$element[dimension]()) | ||
1766 | 1696 | [0].offsetHeight | ||
1767 | 1697 | |||
1768 | 1698 | this.$element | ||
1769 | 1699 | .addClass('collapsing') | ||
1770 | 1700 | .removeClass('collapse') | ||
1771 | 1701 | .removeClass('in') | ||
1772 | 1702 | |||
1773 | 1703 | this.transitioning = 1 | ||
1774 | 1704 | |||
1775 | 1705 | var complete = function () { | ||
1776 | 1706 | this.transitioning = 0 | ||
1777 | 1707 | this.$element | ||
1778 | 1708 | .trigger('hidden.bs.collapse') | ||
1779 | 1709 | .removeClass('collapsing') | ||
1780 | 1710 | .addClass('collapse') | ||
1781 | 1711 | } | ||
1782 | 1712 | |||
1783 | 1713 | if (!$.support.transition) return complete.call(this) | ||
1784 | 1714 | |||
1785 | 1715 | this.$element | ||
1786 | 1716 | [dimension](0) | ||
1787 | 1717 | .one($.support.transition.end, $.proxy(complete, this)) | ||
1788 | 1718 | .emulateTransitionEnd(350) | ||
1789 | 1719 | } | ||
1790 | 1720 | |||
1791 | 1721 | Collapse.prototype.toggle = function () { | ||
1792 | 1722 | this[this.$element.hasClass('in') ? 'hide' : 'show']() | ||
1793 | 1723 | } | ||
1794 | 1724 | |||
1795 | 1725 | |||
1796 | 1726 | // COLLAPSE PLUGIN DEFINITION | ||
1797 | 1727 | // ========================== | ||
1798 | 1728 | |||
1799 | 1729 | var old = $.fn.collapse | ||
1800 | 1730 | |||
1801 | 1731 | $.fn.collapse = function (option) { | ||
1802 | 1732 | return this.each(function () { | ||
1803 | 1733 | var $this = $(this) | ||
1804 | 1734 | var data = $this.data('bs.collapse') | ||
1805 | 1735 | var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) | ||
1806 | 1736 | |||
1807 | 1737 | if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) | ||
1808 | 1738 | if (typeof option == 'string') data[option]() | ||
1809 | 1739 | }) | ||
1810 | 1740 | } | ||
1811 | 1741 | |||
1812 | 1742 | $.fn.collapse.Constructor = Collapse | ||
1813 | 1743 | |||
1814 | 1744 | |||
1815 | 1745 | // COLLAPSE NO CONFLICT | ||
1816 | 1746 | // ==================== | ||
1817 | 1747 | |||
1818 | 1748 | $.fn.collapse.noConflict = function () { | ||
1819 | 1749 | $.fn.collapse = old | ||
1820 | 1750 | return this | ||
1821 | 1751 | } | ||
1822 | 1752 | |||
1823 | 1753 | |||
1824 | 1754 | // COLLAPSE DATA-API | ||
1825 | 1755 | // ================= | ||
1826 | 1756 | |||
1827 | 1757 | $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) { | ||
1828 | 1758 | var $this = $(this), href | ||
1829 | 1759 | var target = $this.attr('data-target') | ||
1830 | 1760 | || e.preventDefault() | ||
1831 | 1761 | || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 | ||
1832 | 1762 | var $target = $(target) | ||
1833 | 1763 | var data = $target.data('bs.collapse') | ||
1834 | 1764 | var option = data ? 'toggle' : $this.data() | ||
1835 | 1765 | var parent = $this.attr('data-parent') | ||
1836 | 1766 | var $parent = parent && $(parent) | ||
1837 | 1767 | |||
1838 | 1768 | if (!data || !data.transitioning) { | ||
1839 | 1769 | if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed') | ||
1840 | 1770 | $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') | ||
1841 | 1771 | } | ||
1842 | 1772 | |||
1843 | 1773 | $target.collapse(option) | ||
1844 | 1774 | }) | ||
1845 | 1775 | |||
1846 | 1776 | }(window.jQuery); | ||
1847 | 1777 | |||
1848 | 1778 | /* ======================================================================== | ||
1849 | 1779 | * Bootstrap: scrollspy.js v3.0.0 | ||
1850 | 1780 | * http://getbootstrap.com/javascript/#scrollspy | ||
1851 | 1781 | * ======================================================================== | ||
1852 | 1782 | * Copyright 2013 Twitter, Inc. | ||
1853 | 1783 | * | ||
1854 | 1784 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
1855 | 1785 | * you may not use this file except in compliance with the License. | ||
1856 | 1786 | * You may obtain a copy of the License at | ||
1857 | 1787 | * | ||
1858 | 1788 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
1859 | 1789 | * | ||
1860 | 1790 | * Unless required by applicable law or agreed to in writing, software | ||
1861 | 1791 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
1862 | 1792 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
1863 | 1793 | * See the License for the specific language governing permissions and | ||
1864 | 1794 | * limitations under the License. | ||
1865 | 1795 | * ======================================================================== */ | ||
1866 | 1796 | |||
1867 | 1797 | |||
1868 | 1798 | +function ($) { "use strict"; | ||
1869 | 1799 | |||
1870 | 1800 | // SCROLLSPY CLASS DEFINITION | ||
1871 | 1801 | // ========================== | ||
1872 | 1802 | |||
1873 | 1803 | function ScrollSpy(element, options) { | ||
1874 | 1804 | var href | ||
1875 | 1805 | var process = $.proxy(this.process, this) | ||
1876 | 1806 | |||
1877 | 1807 | this.$element = $(element).is('body') ? $(window) : $(element) | ||
1878 | 1808 | this.$body = $('body') | ||
1879 | 1809 | this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process) | ||
1880 | 1810 | this.options = $.extend({}, ScrollSpy.DEFAULTS, options) | ||
1881 | 1811 | this.selector = (this.options.target | ||
1882 | 1812 | || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 | ||
1883 | 1813 | || '') + ' .nav li > a' | ||
1884 | 1814 | this.offsets = $([]) | ||
1885 | 1815 | this.targets = $([]) | ||
1886 | 1816 | this.activeTarget = null | ||
1887 | 1817 | |||
1888 | 1818 | this.refresh() | ||
1889 | 1819 | this.process() | ||
1890 | 1820 | } | ||
1891 | 1821 | |||
1892 | 1822 | ScrollSpy.DEFAULTS = { | ||
1893 | 1823 | offset: 10 | ||
1894 | 1824 | } | ||
1895 | 1825 | |||
1896 | 1826 | ScrollSpy.prototype.refresh = function () { | ||
1897 | 1827 | var offsetMethod = this.$element[0] == window ? 'offset' : 'position' | ||
1898 | 1828 | |||
1899 | 1829 | this.offsets = $([]) | ||
1900 | 1830 | this.targets = $([]) | ||
1901 | 1831 | |||
1902 | 1832 | var self = this | ||
1903 | 1833 | var $targets = this.$body | ||
1904 | 1834 | .find(this.selector) | ||
1905 | 1835 | .map(function () { | ||
1906 | 1836 | var $el = $(this) | ||
1907 | 1837 | var href = $el.data('target') || $el.attr('href') | ||
1908 | 1838 | var $href = /^#\w/.test(href) && $(href) | ||
1909 | 1839 | |||
1910 | 1840 | return ($href | ||
1911 | 1841 | && $href.length | ||
1912 | 1842 | && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null | ||
1913 | 1843 | }) | ||
1914 | 1844 | .sort(function (a, b) { return a[0] - b[0] }) | ||
1915 | 1845 | .each(function () { | ||
1916 | 1846 | self.offsets.push(this[0]) | ||
1917 | 1847 | self.targets.push(this[1]) | ||
1918 | 1848 | }) | ||
1919 | 1849 | } | ||
1920 | 1850 | |||
1921 | 1851 | ScrollSpy.prototype.process = function () { | ||
1922 | 1852 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset | ||
1923 | 1853 | var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight | ||
1924 | 1854 | var maxScroll = scrollHeight - this.$scrollElement.height() | ||
1925 | 1855 | var offsets = this.offsets | ||
1926 | 1856 | var targets = this.targets | ||
1927 | 1857 | var activeTarget = this.activeTarget | ||
1928 | 1858 | var i | ||
1929 | 1859 | |||
1930 | 1860 | if (scrollTop >= maxScroll) { | ||
1931 | 1861 | return activeTarget != (i = targets.last()[0]) && this.activate(i) | ||
1932 | 1862 | } | ||
1933 | 1863 | |||
1934 | 1864 | for (i = offsets.length; i--;) { | ||
1935 | 1865 | activeTarget != targets[i] | ||
1936 | 1866 | && scrollTop >= offsets[i] | ||
1937 | 1867 | && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) | ||
1938 | 1868 | && this.activate( targets[i] ) | ||
1939 | 1869 | } | ||
1940 | 1870 | } | ||
1941 | 1871 | |||
1942 | 1872 | ScrollSpy.prototype.activate = function (target) { | ||
1943 | 1873 | this.activeTarget = target | ||
1944 | 1874 | |||
1945 | 1875 | $(this.selector) | ||
1946 | 1876 | .parents('.active') | ||
1947 | 1877 | .removeClass('active') | ||
1948 | 1878 | |||
1949 | 1879 | var selector = this.selector | ||
1950 | 1880 | + '[data-target="' + target + '"],' | ||
1951 | 1881 | + this.selector + '[href="' + target + '"]' | ||
1952 | 1882 | |||
1953 | 1883 | var active = $(selector) | ||
1954 | 1884 | .parents('li') | ||
1955 | 1885 | .addClass('active') | ||
1956 | 1886 | |||
1957 | 1887 | if (active.parent('.dropdown-menu').length) { | ||
1958 | 1888 | active = active | ||
1959 | 1889 | .closest('li.dropdown') | ||
1960 | 1890 | .addClass('active') | ||
1961 | 1891 | } | ||
1962 | 1892 | |||
1963 | 1893 | active.trigger('activate') | ||
1964 | 1894 | } | ||
1965 | 1895 | |||
1966 | 1896 | |||
1967 | 1897 | // SCROLLSPY PLUGIN DEFINITION | ||
1968 | 1898 | // =========================== | ||
1969 | 1899 | |||
1970 | 1900 | var old = $.fn.scrollspy | ||
1971 | 1901 | |||
1972 | 1902 | $.fn.scrollspy = function (option) { | ||
1973 | 1903 | return this.each(function () { | ||
1974 | 1904 | var $this = $(this) | ||
1975 | 1905 | var data = $this.data('bs.scrollspy') | ||
1976 | 1906 | var options = typeof option == 'object' && option | ||
1977 | 1907 | |||
1978 | 1908 | if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) | ||
1979 | 1909 | if (typeof option == 'string') data[option]() | ||
1980 | 1910 | }) | ||
1981 | 1911 | } | ||
1982 | 1912 | |||
1983 | 1913 | $.fn.scrollspy.Constructor = ScrollSpy | ||
1984 | 1914 | |||
1985 | 1915 | |||
1986 | 1916 | // SCROLLSPY NO CONFLICT | ||
1987 | 1917 | // ===================== | ||
1988 | 1918 | |||
1989 | 1919 | $.fn.scrollspy.noConflict = function () { | ||
1990 | 1920 | $.fn.scrollspy = old | ||
1991 | 1921 | return this | ||
1992 | 1922 | } | ||
1993 | 1923 | |||
1994 | 1924 | |||
1995 | 1925 | // SCROLLSPY DATA-API | ||
1996 | 1926 | // ================== | ||
1997 | 1927 | |||
1998 | 1928 | $(window).on('load', function () { | ||
1999 | 1929 | $('[data-spy="scroll"]').each(function () { | ||
2000 | 1930 | var $spy = $(this) | ||
2001 | 1931 | $spy.scrollspy($spy.data()) | ||
2002 | 1932 | }) | ||
2003 | 1933 | }) | ||
2004 | 1934 | |||
2005 | 1935 | }(window.jQuery); | ||
2006 | 1936 | |||
2007 | 1937 | /* ======================================================================== | ||
2008 | 1938 | * Bootstrap: transition.js v3.0.0 | ||
2009 | 1939 | * http://getbootstrap.com/javascript/#transitions | ||
2010 | 1940 | * ======================================================================== | ||
2011 | 1941 | * Copyright 2013 Twitter, Inc. | ||
2012 | 1942 | * | ||
2013 | 1943 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
2014 | 1944 | * you may not use this file except in compliance with the License. | ||
2015 | 1945 | * You may obtain a copy of the License at | ||
2016 | 1946 | * | ||
2017 | 1947 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
2018 | 1948 | * | ||
2019 | 1949 | * Unless required by applicable law or agreed to in writing, software | ||
2020 | 1950 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
2021 | 1951 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
2022 | 1952 | * See the License for the specific language governing permissions and | ||
2023 | 1953 | * limitations under the License. | ||
2024 | 1954 | * ======================================================================== */ | ||
2025 | 1955 | |||
2026 | 1956 | |||
2027 | 1957 | +function ($) { "use strict"; | ||
2028 | 1958 | |||
2029 | 1959 | // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) | ||
2030 | 1960 | // ============================================================ | ||
2031 | 1961 | |||
2032 | 1962 | function transitionEnd() { | ||
2033 | 1963 | var el = document.createElement('bootstrap') | ||
2034 | 1964 | |||
2035 | 1965 | var transEndEventNames = { | ||
2036 | 1966 | 'WebkitTransition' : 'webkitTransitionEnd' | ||
2037 | 1967 | , 'MozTransition' : 'transitionend' | ||
2038 | 1968 | , 'OTransition' : 'oTransitionEnd otransitionend' | ||
2039 | 1969 | , 'transition' : 'transitionend' | ||
2040 | 1970 | } | ||
2041 | 1971 | |||
2042 | 1972 | for (var name in transEndEventNames) { | ||
2043 | 1973 | if (el.style[name] !== undefined) { | ||
2044 | 1974 | return { end: transEndEventNames[name] } | ||
2045 | 1975 | } | ||
2046 | 1976 | } | ||
2047 | 1977 | } | ||
2048 | 1978 | |||
2049 | 1979 | // http://blog.alexmaccaw.com/css-transitions | ||
2050 | 1980 | $.fn.emulateTransitionEnd = function (duration) { | ||
2051 | 1981 | var called = false, $el = this | ||
2052 | 1982 | $(this).one($.support.transition.end, function () { called = true }) | ||
2053 | 1983 | var callback = function () { if (!called) $($el).trigger($.support.transition.end) } | ||
2054 | 1984 | setTimeout(callback, duration) | ||
2055 | 1985 | return this | ||
2056 | 1986 | } | ||
2057 | 1987 | |||
2058 | 1988 | $(function () { | ||
2059 | 1989 | $.support.transition = transitionEnd() | ||
2060 | 1990 | }) | ||
2061 | 1991 | |||
2062 | 1992 | }(window.jQuery); | ||
2063 | 0 | 1993 | ||
2064 | === removed file 'addons/web_graph/static/lib/dropdown.js' | |||
2065 | --- addons/web_graph/static/lib/dropdown.js 2012-05-07 13:38:21 +0000 | |||
2066 | +++ addons/web_graph/static/lib/dropdown.js 1970-01-01 00:00:00 +0000 | |||
2067 | @@ -1,92 +0,0 @@ | |||
2068 | 1 | /* ============================================================ | ||
2069 | 2 | * bootstrap-dropdown.js v2.0.2 | ||
2070 | 3 | * http://twitter.github.com/bootstrap/javascript.html#dropdowns | ||
2071 | 4 | * ============================================================ | ||
2072 | 5 | * Copyright 2012 Twitter, Inc. | ||
2073 | 6 | * | ||
2074 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
2075 | 8 | * you may not use this file except in compliance with the License. | ||
2076 | 9 | * You may obtain a copy of the License at | ||
2077 | 10 | * | ||
2078 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
2079 | 12 | * | ||
2080 | 13 | * Unless required by applicable law or agreed to in writing, software | ||
2081 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
2082 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
2083 | 16 | * See the License for the specific language governing permissions and | ||
2084 | 17 | * limitations under the License. | ||
2085 | 18 | * ============================================================ */ | ||
2086 | 19 | |||
2087 | 20 | |||
2088 | 21 | !function( $ ){ | ||
2089 | 22 | |||
2090 | 23 | "use strict" | ||
2091 | 24 | |||
2092 | 25 | /* DROPDOWN CLASS DEFINITION | ||
2093 | 26 | * ========================= */ | ||
2094 | 27 | |||
2095 | 28 | var toggle = '[data-toggle="dropdown"]' | ||
2096 | 29 | , Dropdown = function ( element ) { | ||
2097 | 30 | var $el = $(element).on('click.dropdown.data-api', this.toggle) | ||
2098 | 31 | $('html').on('click.dropdown.data-api', function () { | ||
2099 | 32 | $el.parent().removeClass('open') | ||
2100 | 33 | }) | ||
2101 | 34 | } | ||
2102 | 35 | |||
2103 | 36 | Dropdown.prototype = { | ||
2104 | 37 | |||
2105 | 38 | constructor: Dropdown | ||
2106 | 39 | |||
2107 | 40 | , toggle: function ( e ) { | ||
2108 | 41 | var $this = $(this) | ||
2109 | 42 | , selector = $this.attr('data-target') | ||
2110 | 43 | , $parent | ||
2111 | 44 | , isActive | ||
2112 | 45 | |||
2113 | 46 | if (!selector) { | ||
2114 | 47 | selector = $this.attr('href') | ||
2115 | 48 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 | ||
2116 | 49 | } | ||
2117 | 50 | |||
2118 | 51 | $parent = $(selector) | ||
2119 | 52 | $parent.length || ($parent = $this.parent()) | ||
2120 | 53 | |||
2121 | 54 | isActive = $parent.hasClass('open') | ||
2122 | 55 | |||
2123 | 56 | clearMenus() | ||
2124 | 57 | !isActive && $parent.toggleClass('open') | ||
2125 | 58 | |||
2126 | 59 | return false | ||
2127 | 60 | } | ||
2128 | 61 | |||
2129 | 62 | } | ||
2130 | 63 | |||
2131 | 64 | function clearMenus() { | ||
2132 | 65 | $(toggle).parent().removeClass('open') | ||
2133 | 66 | } | ||
2134 | 67 | |||
2135 | 68 | |||
2136 | 69 | /* DROPDOWN PLUGIN DEFINITION | ||
2137 | 70 | * ========================== */ | ||
2138 | 71 | |||
2139 | 72 | $.fn.dropdown = function ( option ) { | ||
2140 | 73 | return this.each(function () { | ||
2141 | 74 | var $this = $(this) | ||
2142 | 75 | , data = $this.data('dropdown') | ||
2143 | 76 | if (!data) $this.data('dropdown', (data = new Dropdown(this))) | ||
2144 | 77 | if (typeof option == 'string') data[option].call($this) | ||
2145 | 78 | }) | ||
2146 | 79 | } | ||
2147 | 80 | |||
2148 | 81 | $.fn.dropdown.Constructor = Dropdown | ||
2149 | 82 | |||
2150 | 83 | |||
2151 | 84 | /* APPLY TO STANDARD DROPDOWN ELEMENTS | ||
2152 | 85 | * =================================== */ | ||
2153 | 86 | |||
2154 | 87 | $(function () { | ||
2155 | 88 | $('html').on('click.dropdown.data-api', clearMenus) | ||
2156 | 89 | $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle) | ||
2157 | 90 | }) | ||
2158 | 91 | |||
2159 | 92 | }( window.jQuery ); | ||
2160 | 93 | \ No newline at end of file | 0 | \ No newline at end of file |
2161 | 94 | 1 | ||
2162 | === removed directory 'addons/web_graph/static/lib/flotr2' | |||
2163 | === removed file 'addons/web_graph/static/lib/flotr2/LICENSE' | |||
2164 | --- addons/web_graph/static/lib/flotr2/LICENSE 2012-05-07 08:19:08 +0000 | |||
2165 | +++ addons/web_graph/static/lib/flotr2/LICENSE 1970-01-01 00:00:00 +0000 | |||
2166 | @@ -1,19 +0,0 @@ | |||
2167 | 1 | Copyright (c) 2012 Carl Sutherland | ||
2168 | 2 | |||
2169 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
2170 | 4 | of this software and associated documentation files (the "Software"), to deal | ||
2171 | 5 | in the Software without restriction, including without limitation the rights | ||
2172 | 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
2173 | 7 | copies of the Software, and to permit persons to whom the Software is | ||
2174 | 8 | furnished to do so, subject to the following conditions: | ||
2175 | 9 | |||
2176 | 10 | The above copyright notice and this permission notice shall be included in | ||
2177 | 11 | all copies or substantial portions of the Software. | ||
2178 | 12 | |||
2179 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
2180 | 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
2181 | 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
2182 | 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
2183 | 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
2184 | 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
2185 | 19 | THE SOFTWARE. | ||
2186 | 20 | 0 | ||
2187 | === removed file 'addons/web_graph/static/lib/flotr2/Makefile' | |||
2188 | --- addons/web_graph/static/lib/flotr2/Makefile 2012-05-07 10:34:07 +0000 | |||
2189 | +++ addons/web_graph/static/lib/flotr2/Makefile 1970-01-01 00:00:00 +0000 | |||
2190 | @@ -1,40 +0,0 @@ | |||
2191 | 1 | all: test flotr2 | ||
2192 | 2 | |||
2193 | 3 | test: | ||
2194 | 4 | cd spec; jasmine-headless-webkit -j jasmine.yml -c | ||
2195 | 5 | |||
2196 | 6 | libraries: | ||
2197 | 7 | smoosh make/lib.json | ||
2198 | 8 | cat ./build/bean.js > build/lib.js | ||
2199 | 9 | cat ./build/underscore.js >> build/lib.js | ||
2200 | 10 | cat ./build/bean.min.js > build/lib.min.js | ||
2201 | 11 | echo ";" >> build/lib.min.js | ||
2202 | 12 | cat ./build/underscore.min.js >> build/lib.min.js | ||
2203 | 13 | echo ";" >> build/lib.min.js | ||
2204 | 14 | |||
2205 | 15 | ie: | ||
2206 | 16 | smoosh make/ie.json | ||
2207 | 17 | |||
2208 | 18 | flotr2: libraries ie | ||
2209 | 19 | smoosh make/flotr2.json | ||
2210 | 20 | cat build/lib.js build/flotr2.js > flotr2.js | ||
2211 | 21 | cat build/lib.min.js > flotr2.min.js | ||
2212 | 22 | cat build/flotr2.min.js >> flotr2.min.js | ||
2213 | 23 | echo ';' >> flotr2.min.js | ||
2214 | 24 | cp build/ie.min.js flotr2.ie.min.js | ||
2215 | 25 | |||
2216 | 26 | flotr2-basic: libraries ie | ||
2217 | 27 | smoosh make/basic.json | ||
2218 | 28 | cat build/lib.min.js > flotr2-basic.min.js | ||
2219 | 29 | cat build/flotr2-basic.min.js >> flotr2-basic.min.js | ||
2220 | 30 | |||
2221 | 31 | flotr2-standalone: ie | ||
2222 | 32 | smoosh make/flotr2.json | ||
2223 | 33 | cat build/flotr2.js > flotr2.js | ||
2224 | 34 | cp build/ie.min.js flotr2.ie.min.js | ||
2225 | 35 | |||
2226 | 36 | flotr-examples: | ||
2227 | 37 | smoosh make/examples.json | ||
2228 | 38 | cp build/examples.min.js flotr2.examples.min.js | ||
2229 | 39 | cp build/examples-types.js flotr2.examples.types.js | ||
2230 | 40 | |||
2231 | 41 | 0 | ||
2232 | === removed file 'addons/web_graph/static/lib/flotr2/README.md' | |||
2233 | --- addons/web_graph/static/lib/flotr2/README.md 2012-05-07 08:19:08 +0000 | |||
2234 | +++ addons/web_graph/static/lib/flotr2/README.md 1970-01-01 00:00:00 +0000 | |||
2235 | @@ -1,89 +0,0 @@ | |||
2236 | 1 | Flotr2 | ||
2237 | 2 | ====== | ||
2238 | 3 | |||
2239 | 4 | The Canvas graphing library. | ||
2240 | 5 | |||
2241 | 6 | ![Google Groups](http://groups.google.com/intl/en/images/logos/groups_logo_sm.gif) | ||
2242 | 7 | |||
2243 | 8 | http://groups.google.com/group/flotr2/ | ||
2244 | 9 | |||
2245 | 10 | Please fork http://jsfiddle.net/cesutherland/ZFBj5/ with your question or bug reproduction case. | ||
2246 | 11 | |||
2247 | 12 | |||
2248 | 13 | API | ||
2249 | 14 | --- | ||
2250 | 15 | |||
2251 | 16 | The API consists of a primary draw method which accepts a configuration object, helper methods, and several microlibs. | ||
2252 | 17 | |||
2253 | 18 | ### Example | ||
2254 | 19 | |||
2255 | 20 | ```javascript | ||
2256 | 21 | var | ||
2257 | 22 | // Container div: | ||
2258 | 23 | container = document.getElementById("flotr-example-graph"), | ||
2259 | 24 | // First data series: | ||
2260 | 25 | d1 = [[0, 3], [4, 8], [8, 5], [9, 13]], | ||
2261 | 26 | // Second data series: | ||
2262 | 27 | d2 = [], | ||
2263 | 28 | // A couple flotr configuration options: | ||
2264 | 29 | options = { | ||
2265 | 30 | xaxis: { | ||
2266 | 31 | minorTickFreq: 4 | ||
2267 | 32 | }, | ||
2268 | 33 | grid: { | ||
2269 | 34 | minorVerticalLines: true | ||
2270 | 35 | } | ||
2271 | 36 | }, | ||
2272 | 37 | i, graph; | ||
2273 | 38 | |||
2274 | 39 | // Generated second data set: | ||
2275 | 40 | for (i = 0; i < 14; i += 0.5) { | ||
2276 | 41 | d2.push([i, Math.sin(i)]); | ||
2277 | 42 | } | ||
2278 | 43 | |||
2279 | 44 | // Draw the graph: | ||
2280 | 45 | graph = Flotr.draw( | ||
2281 | 46 | container, // Container element | ||
2282 | 47 | [ d1, d2 ], // Array of data series | ||
2283 | 48 | options // Configuration options | ||
2284 | 49 | ); | ||
2285 | 50 | ``` | ||
2286 | 51 | |||
2287 | 52 | ### Microlibs | ||
2288 | 53 | |||
2289 | 54 | * [underscore.js](http://documentcloud.github.com/underscore/) | ||
2290 | 55 | * [bean.js](https://github.com/fat/bean) | ||
2291 | 56 | |||
2292 | 57 | Extending | ||
2293 | 58 | --------- | ||
2294 | 59 | |||
2295 | 60 | Flotr may be extended by adding new plugins and graph types. | ||
2296 | 61 | |||
2297 | 62 | ### Graph Types | ||
2298 | 63 | |||
2299 | 64 | Graph types define how a particular chart is rendered. Examples include line, bar, pie. | ||
2300 | 65 | |||
2301 | 66 | Existing graph types are found in `js/types/`. | ||
2302 | 67 | |||
2303 | 68 | ### Plugins | ||
2304 | 69 | |||
2305 | 70 | Plugins extend the core of flotr with new functionality. They can add interactions, new decorations, etc. Examples | ||
2306 | 71 | include titles, labels and selection. | ||
2307 | 72 | |||
2308 | 73 | The plugins included are found in `js/plugins/`. | ||
2309 | 74 | |||
2310 | 75 | Development | ||
2311 | 76 | ----------- | ||
2312 | 77 | |||
2313 | 78 | This project uses [smoosh](https://github.com/fat/smoosh) to build and [jasmine](http://pivotal.github.com/jasmine/) | ||
2314 | 79 | with [js-imagediff](https://github.com/HumbleSoftware/js-imagediff) to test. Tests may be executed by | ||
2315 | 80 | [jasmine-headless-webkit](http://johnbintz.github.com/jasmine-headless-webkit/) with | ||
2316 | 81 | `cd spec; jasmine-headless-webkit -j jasmine.yml -c` or by a browser by navigating to | ||
2317 | 82 | `flotr2/spec/SpecRunner.html`. | ||
2318 | 83 | |||
2319 | 84 | Shoutouts | ||
2320 | 85 | --------- | ||
2321 | 86 | |||
2322 | 87 | Thanks to Bas Wenneker, Fabien Ménager and others for all the work on the original Flotr. | ||
2323 | 88 | Thanks to Jochen Berger and Jordan Santell for their contributions to Flotr2. | ||
2324 | 89 | |||
2325 | 90 | 0 | ||
2326 | === removed directory 'addons/web_graph/static/lib/flotr2/dev' | |||
2327 | === removed file 'addons/web_graph/static/lib/flotr2/dev/notes.txt' | |||
2328 | --- addons/web_graph/static/lib/flotr2/dev/notes.txt 2012-05-07 08:19:08 +0000 | |||
2329 | +++ addons/web_graph/static/lib/flotr2/dev/notes.txt 1970-01-01 00:00:00 +0000 | |||
2330 | @@ -1,86 +0,0 @@ | |||
2331 | 1 | Flotr 2 Architecture Notes | ||
2332 | 2 | |||
2333 | 3 | |||
2334 | 4 | Global: | ||
2335 | 5 | ====== | ||
2336 | 6 | |||
2337 | 7 | Flotr.js - | ||
2338 | 8 | versioning information | ||
2339 | 9 | browser detection | ||
2340 | 10 | extension (plugins, graph types) | ||
2341 | 11 | draw | ||
2342 | 12 | clone / merge | ||
2343 | 13 | tick size | ||
2344 | 14 | tick formatter | ||
2345 | 15 | engineering notation | ||
2346 | 16 | magnitude | ||
2347 | 17 | rad, pixel, floor | ||
2348 | 18 | drawText | ||
2349 | 19 | measureText | ||
2350 | 20 | getBestTextAlign | ||
2351 | 21 | align map | ||
2352 | 22 | compatibility | ||
2353 | 23 | |||
2354 | 24 | |||
2355 | 25 | Graph Architecture: | ||
2356 | 26 | =================== | ||
2357 | 27 | |||
2358 | 28 | Axis - | ||
2359 | 29 | all series | ||
2360 | 30 | orientation | ||
2361 | 31 | ticks (major, minor) | ||
2362 | 32 | scale (d2p, p2d, logarithmic) | ||
2363 | 33 | notion of stacks | ||
2364 | 34 | |||
2365 | 35 | Series - | ||
2366 | 36 | per 'data' | ||
2367 | 37 | notion of range (x, y, min, max) | ||
2368 | 38 | |||
2369 | 39 | Graph - | ||
2370 | 40 | DOM constructon | ||
2371 | 41 | event attachment | ||
2372 | 42 | options initialization | ||
2373 | 43 | data range calculations | ||
2374 | 44 | canvas spacing calculations | ||
2375 | 45 | event normalization | ||
2376 | 46 | draw methods | ||
2377 | 47 | DOM cleanup | ||
2378 | 48 | event cleanup | ||
2379 | 49 | |||
2380 | 50 | |||
2381 | 51 | Utilities: | ||
2382 | 52 | ========== | ||
2383 | 53 | |||
2384 | 54 | Color | ||
2385 | 55 | build colors | ||
2386 | 56 | parse textual color data | ||
2387 | 57 | convert colors | ||
2388 | 58 | clone colors | ||
2389 | 59 | |||
2390 | 60 | Text | ||
2391 | 61 | calculate text size | ||
2392 | 62 | canvas size | ||
2393 | 63 | html size | ||
2394 | 64 | |||
2395 | 65 | Date | ||
2396 | 66 | formatting | ||
2397 | 67 | constants | ||
2398 | 68 | |||
2399 | 69 | |||
2400 | 70 | Spacing Calculation | ||
2401 | 71 | =================== | ||
2402 | 72 | |||
2403 | 73 | Flotr | ||
2404 | 74 | calculate data | ||
2405 | 75 | calculate margins | ||
2406 | 76 | |||
2407 | 77 | Chart | ||
2408 | 78 | calculate Data Ranges - Explicit or auto data minimum, maximums | ||
2409 | 79 | calculate Data Range Extensions - By chart type, extend data range with needs of chart type (ie. stacked bars, stacked lines) | ||
2410 | 80 | add Chart Padding - By chart type | ||
2411 | 81 | |||
2412 | 82 | Text | ||
2413 | 83 | use explicit margins | ||
2414 | 84 | calculate label margins | ||
2415 | 85 | calculate title margins | ||
2416 | 86 | |||
2417 | 87 | 0 | ||
2418 | === removed file 'addons/web_graph/static/lib/flotr2/flotr2.examples.min.js' | |||
2419 | --- addons/web_graph/static/lib/flotr2/flotr2.examples.min.js 2012-05-07 08:19:08 +0000 | |||
2420 | +++ addons/web_graph/static/lib/flotr2/flotr2.examples.min.js 1970-01-01 00:00:00 +0000 | |||
2421 | @@ -1,2 +0,0 @@ | |||
2422 | 1 | |||
2423 | 2 | (function(){var a=Flotr.EventAdapter,b=Flotr._,c="click",d="example",e="mouseenter",f="mouseleave",g=".",h="flotr-examples",i="flotr-examples-container",j="flotr-examples-reset",k="flotr-examples-thumbs",l="flotr-examples-thumb",m="flotr-examples-collapsed",n="flotr-examples-highlight",o="flotr-examples-large",p="flotr-examples-medium",q="flotr-examples-small",r="flotr-examples-mobile",s='<div class="'+l+'"></div>',t='<div class="'+h+'">'+'<div class="'+j+'">View All</div>'+'<div class="'+k+'"></div>'+'<div class="'+i+'"></div>'+"</div>";Examples=function(a){if(b.isUndefined(Flotr.ExampleList))throw"Flotr.ExampleList not defined.";this.options=a,this.list=Flotr.ExampleList,this.current=null,this.single=!1,this._initNodes(),this._example=new Flotr.Examples.Example({node:this._exampleNode}),this._initExamples()},Examples.prototype={examples:function(){function f(b){var c=$(b.currentTarget),e=c.data("example"),f=b.data.orientation;f^c.hasClass(n)&&(c.toggleClass(n).css(a),d._example.executeCallback(e,c))}var a={cursor:"pointer"},b=this._thumbsNode,c=this.list.get(),d=this,e=["basic","basic-axis","basic-bars","basic-bars-horizontal","basic-bar-stacked","basic-stacked-horizontal","basic-pie","basic-radar","basic-bubble","basic-candle","basic-legend","mouse-tracking","mouse-zoom","mouse-drag","basic-time","negative-values","click-example","download-image","download-data","advanced-titles","color-gradients","basic-timeline","advanced-markers"];(function h(){var a=e.shift(),f=c[a];if(f.type==="profile"||f.type==="test")return;var g=$(s);g.data("example",f),b.append(g),d._example.executeCallback(f,g),g.click(function(){d._loadExample(f)}),e.length&&setTimeout(h,20)})(),b.delegate(g+l,"mouseenter",{orientation:!0},f),b.delegate(g+l,"mouseleave",{orientation:!1},f)},_loadExample:function(a){a&&(window.location.hash="!"+(this.single?"single/":"")+a.key,u||(this._thumbsNode.css({position:"absolute",height:"0px",overflow:"hidden",width:"0px"}),this._resetNode.css({top:"16px"})),this._examplesNode.addClass(m),this._exampleNode.show(),this._example.setExample(a),this._resize(),$(document).scrollTop(0))},_reset:function(){window.location.hash="",u||this._thumbsNode.css({position:"",height:"",overflow:"",width:""}),this._examplesNode.removeClass(m),this._thumbsNode.height(""),this._exampleNode.hide()},_initNodes:function(){var a=$(this.options.node),b=this,c=$(t);b._resetNode=c.find(g+j),b._exampleNode=c.find(g+i),b._thumbsNode=c.find(g+k),b._examplesNode=c,b._resetNode.click(function(){b._reset()}),a.append(c),this._initResizer()},_initResizer:function(){function e(){var b=c.height()-(a.options.thumbPadding||0),e=c.width(),f;e>1760?(f=o,a._thumbsNode.height(b)):e>1140?(f=p,a._thumbsNode.height(b)):(f=q,a._thumbsNode.height("")),d!==f&&(d&&a._examplesNode.removeClass(d),a._examplesNode.addClass(f),d=f)}var a=this,b=a._examplesNode,c=$(window),d;$(window).resize(e),e(),this._resize=e},_initExamples:function(){var a=window.location.hash,b,c;a?(a=a.substring(2),c=a.split("/"),c.length==1?(b=this.list.get(a),this.examples()):c[0]=="single"&&(this.single=!0,b=this.list.get(c[1])),this._loadExample(b)):this.examples()}};var u=function(){var a=!!(navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i)),b=!!$.browser.mozilla;return!a||b}();Flotr.Examples=Examples})(),function(){var a=Flotr._,b=".",c="flotr-example",d="flotr-example-label",e="flotr-example-title",f="flotr-example-description",g="flotr-example-editor",h="flotr-example-graph",i='<div class="'+c+'">'+'<div class="'+d+" "+e+'"></div>'+'<div class="'+f+'"></div>'+'<div class="'+g+'"></div>'+"</div>",j=function(a){this.options=a,this.example=null,this._initNodes()};j.prototype={setExample:function(a){var b=this.getSource(a),c=this._editorNode;this.example=a,Math.seedrandom(a.key),this._exampleNode.css({display:"block"}),this._titleNode.html(a.name||""),this._markupNode.html(a.description||""),this._editor?this._editor.setExample(b):this._editor=new Flotr.Examples.Editor(c,{example:b,teardown:function(){Flotr.EventAdapter.stopObserving($(c).find(".render")[0]),$(c).find("canvas").each(function(a,b){Flotr.EventAdapter.stopObserving(b)})}})},getSource:function(a){var b=a.callback.toString();return navigator.userAgent.search(/firefox/i)!==-1&&(b=js_beautify(b)),b},executeCallback:function(b,c){a.isElement(c)||(c=c[0]);var d=b.args?[c].concat(b.args):[c];return Math.seedrandom(b.key),b.callback.apply(this,d)},_initNodes:function(){var a=this.options.node,c=$(i);this._titleNode=c.find(b+e),this._markupNode=c.find(b+f),this._editorNode=c.find(b+g),this._exampleNode=c,a.append(c)}},Flotr.Examples.Example=j}(),function(){function Editor(a,b){function o(){i.hide(),f&&f.call(),m.render({example:d,render:h})}function p(a,b,c){var d=!1,e='<span class="error">Error: </span>',f,g;e+='<span class="message">'+a+"</span>",typeof c!="undefined"&&(e+='<span class="position">',e+='Line <span class="line">'+c+"</span>",console.log(b),b&&(e+=" of ",b==window.location?(e+='<span class="url">script</span>',!d):e+='<span class="url">'+b+"</span>"),e+=".</span>"),i.show(),i.html(e)}var c=b.type||"javascript",d=b.example||"",e=b.noRun||!1,f=b.teardown||!1,g=$(T_CONTROLS),h=$(T_RENDER),i=$(T_ERRORS),j=$(T_SOURCE),k=$(T_EDITOR),l="editor-render-"+COUNT,m,h,n;m=new TYPES[c]({onerror:p});if(!m)throw"Invalid type: API not found for type `"+c+"`.";h.attr("id",l),i.hide(),k.append(h).append(g).append(j).addClass(c).addClass(e?"no-run":""),a=$(a),a.append(k),j.append(i),d=m.example({example:d,render:h}),n=CodeMirror(j[0],{value:d,readOnly:e,lineNumbers:!0,mode:m.codeMirrorType}),e||(g.delegate(".run","click",function(){d=n.getValue(),o()}),o()),window.onerror=function(a,b,c){return p(a,b,c),console.log(a),ONERROR&&$.isFunction(ONERROR)?ONERROR(a,b,c):!1},COUNT++,this.setExample=function(a){d=m.example({example:a,render:h}),n.setValue(d),n.refresh(),o()}}var ONERROR=window.onerror,COUNT=0,TYPES={},T_CONTROLS='<div class="controls"><button class="run btn large primary">Run</button></div>',T_EDITOR='<div class="editor"></div>',T_SOURCE='<div class="source"></div>',T_ERRORS='<div class="errors"></div>',T_RENDER='<div class="render"></div>',T_IFRAME="<iframe></iframe>";TYPES.javascript=function(b){this.onerror=b.onerror},TYPES.javascript.prototype={codeMirrorType:"javascript",example:function(a){var b=a.example,c=a.render,d=$(c).attr("id");return"("+b+')(document.getElementById("'+d+'"));'},render:function(o){eval(o.example)}},TYPES.html=function(b){this.onerror=b.onerror},TYPES.html.prototype={codeMirrorType:"htmlmixed",example:function(a){return $.trim(a.example)},render:function(a){var b=a.example,c=a.render,d=$(T_IFRAME),e=this,f,g;c.html(d),f=d[0].contentWindow,g=f.document,g.open(),f.onerror=d.onerror=function(){e.onerror.apply(null,arguments)},g.write(b),g.close()}},typeof Flotr.Examples=="undefined"&&(Flotr.Examples={}),Flotr.Examples.Editor=Editor}(),function(){var a=Flotr.DOM,b=Flotr.EventAdapter,c=Flotr._,d="click",e="example-profile",f="examples",g=function(a){if(c.isUndefined(Flotr.ExampleList))throw"Flotr.ExampleList not defined.";this.editMode="off",this.list=Flotr.ExampleList,this.current=null,this.single=!1,this.init()};g.prototype=c.extend({},Flotr.Examples.prototype,{examples:function(){var e=document.getElementById(f),g=a.node("<ul></ul>"),h;c.each(this.list.getType("profile"),function(e){h=a.node("<li>"+e.name+"</li>"),a.insert(g,h),b.observe(h,d,c.bind(function(){this.example(e)},this))},this),a.insert(e,g)},example:function(a){this._renderSource(a),this.profileStart(a),setTimeout(c.bind(function(){this._renderGraph(a),this.profileEnd()},this),50)},profileStart:function(a){var b=document.getElementById(e);this._startTime=new Date,b.innerHTML='<div>Profile started for "'+a.name+'"...</div>'},profileEnd:function(a){var b=document.getElementById(e);profileTime=new Date-this._startTime,this._startTime=null,b.innerHTML+="<div>Profile complete: "+profileTime+"ms<div>"}}),Flotr.Profile=g}() | ||
2424 | 3 | \ No newline at end of file | 0 | \ No newline at end of file |
2425 | 4 | 1 | ||
2426 | === removed file 'addons/web_graph/static/lib/flotr2/flotr2.examples.types.js' | |||
2427 | --- addons/web_graph/static/lib/flotr2/flotr2.examples.types.js 2012-05-07 08:19:08 +0000 | |||
2428 | +++ addons/web_graph/static/lib/flotr2/flotr2.examples.types.js 1970-01-01 00:00:00 +0000 | |||
2429 | @@ -1,1425 +0,0 @@ | |||
2430 | 1 | (function () { | ||
2431 | 2 | |||
2432 | 3 | var ExampleList = function () { | ||
2433 | 4 | |||
2434 | 5 | // Map of examples. | ||
2435 | 6 | this.examples = {}; | ||
2436 | 7 | |||
2437 | 8 | }; | ||
2438 | 9 | |||
2439 | 10 | ExampleList.prototype = { | ||
2440 | 11 | |||
2441 | 12 | add : function (example) { | ||
2442 | 13 | this.examples[example.key] = example; | ||
2443 | 14 | }, | ||
2444 | 15 | |||
2445 | 16 | get : function (key) { | ||
2446 | 17 | return key ? (this.examples[key] || null) : this.examples; | ||
2447 | 18 | }, | ||
2448 | 19 | |||
2449 | 20 | getType : function (type) { | ||
2450 | 21 | return Flotr._.select(this.examples, function (example) { | ||
2451 | 22 | return (example.type === type); | ||
2452 | 23 | }); | ||
2453 | 24 | } | ||
2454 | 25 | } | ||
2455 | 26 | |||
2456 | 27 | Flotr.ExampleList = new ExampleList(); | ||
2457 | 28 | |||
2458 | 29 | })(); | ||
2459 | 30 | |||
2460 | 31 | (function () { | ||
2461 | 32 | |||
2462 | 33 | Flotr.ExampleList.add({ | ||
2463 | 34 | key : 'basic', | ||
2464 | 35 | name : 'Basic', | ||
2465 | 36 | callback : basic | ||
2466 | 37 | }); | ||
2467 | 38 | |||
2468 | 39 | function basic (container) { | ||
2469 | 40 | |||
2470 | 41 | var | ||
2471 | 42 | d1 = [[0, 3], [4, 8], [8, 5], [9, 13]], // First data series | ||
2472 | 43 | d2 = [], // Second data series | ||
2473 | 44 | i, graph; | ||
2474 | 45 | |||
2475 | 46 | // Generate first data set | ||
2476 | 47 | for (i = 0; i < 14; i += 0.5) { | ||
2477 | 48 | d2.push([i, Math.sin(i)]); | ||
2478 | 49 | } | ||
2479 | 50 | |||
2480 | 51 | // Draw Graph | ||
2481 | 52 | graph = Flotr.draw(container, [ d1, d2 ], { | ||
2482 | 53 | xaxis: { | ||
2483 | 54 | minorTickFreq: 4 | ||
2484 | 55 | }, | ||
2485 | 56 | grid: { | ||
2486 | 57 | minorVerticalLines: true | ||
2487 | 58 | } | ||
2488 | 59 | }); | ||
2489 | 60 | } | ||
2490 | 61 | |||
2491 | 62 | })(); | ||
2492 | 63 | |||
2493 | 64 | (function () { | ||
2494 | 65 | |||
2495 | 66 | Flotr.ExampleList.add({ | ||
2496 | 67 | key : 'basic-stacked', | ||
2497 | 68 | name : 'Basic Stacked', | ||
2498 | 69 | callback : basic_stacked, | ||
2499 | 70 | type : 'test' | ||
2500 | 71 | }); | ||
2501 | 72 | |||
2502 | 73 | function basic_stacked (container) { | ||
2503 | 74 | |||
2504 | 75 | var | ||
2505 | 76 | d1 = [[0, 3], [4, 8], [8, 2], [9, 3]], // First data series | ||
2506 | 77 | d2 = [[0, 2], [4, 3], [8, 8], [9, 4]], // Second data series | ||
2507 | 78 | i, graph; | ||
2508 | 79 | |||
2509 | 80 | // Draw Graph | ||
2510 | 81 | graph = Flotr.draw(container, [ d1, d2 ], { | ||
2511 | 82 | lines: { | ||
2512 | 83 | show : true, | ||
2513 | 84 | stacked: true | ||
2514 | 85 | }, | ||
2515 | 86 | xaxis: { | ||
2516 | 87 | minorTickFreq: 4 | ||
2517 | 88 | }, | ||
2518 | 89 | grid: { | ||
2519 | 90 | minorVerticalLines: true | ||
2520 | 91 | } | ||
2521 | 92 | }); | ||
2522 | 93 | } | ||
2523 | 94 | |||
2524 | 95 | })(); | ||
2525 | 96 | |||
2526 | 97 | (function () { | ||
2527 | 98 | |||
2528 | 99 | Flotr.ExampleList.add({ | ||
2529 | 100 | key : 'basic-stepped', | ||
2530 | 101 | name : 'Basic Stepped', | ||
2531 | 102 | callback : basic_stepped, | ||
2532 | 103 | type : 'test' | ||
2533 | 104 | }); | ||
2534 | 105 | |||
2535 | 106 | function basic_stepped (container) { | ||
2536 | 107 | |||
2537 | 108 | var | ||
2538 | 109 | d1 = [[0, 3], [4, 8], [8, 5], [9, 13]], // First data series | ||
2539 | 110 | d2 = [], // Second data series | ||
2540 | 111 | i, graph; | ||
2541 | 112 | |||
2542 | 113 | // Generate first data set | ||
2543 | 114 | for (i = 0; i < 14; i += 0.5) { | ||
2544 | 115 | d2.push([i, Math.sin(i)]); | ||
2545 | 116 | } | ||
2546 | 117 | |||
2547 | 118 | // Draw Graph | ||
2548 | 119 | graph = Flotr.draw(container, [ d1, d2 ], { | ||
2549 | 120 | lines: { | ||
2550 | 121 | steps : true, | ||
2551 | 122 | show : true | ||
2552 | 123 | }, | ||
2553 | 124 | xaxis: { | ||
2554 | 125 | minorTickFreq: 4 | ||
2555 | 126 | }, | ||
2556 | 127 | yaxis: { | ||
2557 | 128 | autoscale: true | ||
2558 | 129 | }, | ||
2559 | 130 | grid: { | ||
2560 | 131 | minorVerticalLines: true | ||
2561 | 132 | }, | ||
2562 | 133 | mouse : { | ||
2563 | 134 | track : true, | ||
2564 | 135 | relative : true | ||
2565 | 136 | } | ||
2566 | 137 | }); | ||
2567 | 138 | } | ||
2568 | 139 | |||
2569 | 140 | })(); | ||
2570 | 141 | |||
2571 | 142 | (function () { | ||
2572 | 143 | |||
2573 | 144 | Flotr.ExampleList.add({ | ||
2574 | 145 | key : 'basic-axis', | ||
2575 | 146 | name : 'Basic Axis', | ||
2576 | 147 | callback : basic_axis | ||
2577 | 148 | }); | ||
2578 | 149 | |||
2579 | 150 | function basic_axis (container) { | ||
2580 | 151 | |||
2581 | 152 | var | ||
2582 | 153 | d1 = [], | ||
2583 | 154 | d2 = [], | ||
2584 | 155 | d3 = [], | ||
2585 | 156 | d4 = [], | ||
2586 | 157 | d5 = [], // Data | ||
2587 | 158 | ticks = [[ 0, "Lower"], 10, 20, 30, [40, "Upper"]], // Ticks for the Y-Axis | ||
2588 | 159 | graph; | ||
2589 | 160 | |||
2590 | 161 | for(var i = 0; i <= 10; i += 0.1){ | ||
2591 | 162 | d1.push([i, 4 + Math.pow(i,1.5)]); | ||
2592 | 163 | d2.push([i, Math.pow(i,3)]); | ||
2593 | 164 | d3.push([i, i*5+3*Math.sin(i*4)]); | ||
2594 | 165 | d4.push([i, i]); | ||
2595 | 166 | if( i.toFixed(1)%1 == 0 ){ | ||
2596 | 167 | d5.push([i, 2*i]); | ||
2597 | 168 | } | ||
2598 | 169 | } | ||
2599 | 170 | |||
2600 | 171 | d3[30][1] = null; | ||
2601 | 172 | d3[31][1] = null; | ||
2602 | 173 | |||
2603 | 174 | function ticksFn (n) { return '('+n+')'; } | ||
2604 | 175 | |||
2605 | 176 | graph = Flotr.draw(container, [ | ||
2606 | 177 | { data : d1, label : 'y = 4 + x^(1.5)', lines : { fill : true } }, | ||
2607 | 178 | { data : d2, label : 'y = x^3'}, | ||
2608 | 179 | { data : d3, label : 'y = 5x + 3sin(4x)'}, | ||
2609 | 180 | { data : d4, label : 'y = x'}, | ||
2610 | 181 | { data : d5, label : 'y = 2x', lines : { show : true }, points : { show : true } } | ||
2611 | 182 | ], { | ||
2612 | 183 | xaxis : { | ||
2613 | 184 | noTicks : 7, // Display 7 ticks. | ||
2614 | 185 | tickFormatter : ticksFn, // Displays tick values between brackets. | ||
2615 | 186 | min : 1, // Part of the series is not displayed. | ||
2616 | 187 | max : 7.5 // Part of the series is not displayed. | ||
2617 | 188 | }, | ||
2618 | 189 | yaxis : { | ||
2619 | 190 | ticks : ticks, // Set Y-Axis ticks | ||
2620 | 191 | max : 40 // Maximum value along Y-Axis | ||
2621 | 192 | }, | ||
2622 | 193 | grid : { | ||
2623 | 194 | verticalLines : false, | ||
2624 | 195 | backgroundColor : { | ||
2625 | 196 | colors : [[0,'#fff'], [1,'#ccc']], | ||
2626 | 197 | start : 'top', | ||
2627 | 198 | end : 'bottom' | ||
2628 | 199 | } | ||
2629 | 200 | }, | ||
2630 | 201 | legend : { | ||
2631 | 202 | position : 'nw' | ||
2632 | 203 | }, | ||
2633 | 204 | title : 'Basic Axis example', | ||
2634 | 205 | subtitle : 'This is a subtitle' | ||
2635 | 206 | }); | ||
2636 | 207 | } | ||
2637 | 208 | |||
2638 | 209 | })(); | ||
2639 | 210 | |||
2640 | 211 | (function () { | ||
2641 | 212 | |||
2642 | 213 | Flotr.ExampleList.add({ | ||
2643 | 214 | key : 'basic-bars', | ||
2644 | 215 | name : 'Basic Bars', | ||
2645 | 216 | callback : basic_bars | ||
2646 | 217 | }); | ||
2647 | 218 | |||
2648 | 219 | Flotr.ExampleList.add({ | ||
2649 | 220 | key : 'basic-bars-horizontal', | ||
2650 | 221 | name : 'Horizontal Bars', | ||
2651 | 222 | args : [true], | ||
2652 | 223 | callback : basic_bars, | ||
2653 | 224 | tolerance : 5 | ||
2654 | 225 | }); | ||
2655 | 226 | |||
2656 | 227 | function basic_bars (container, horizontal) { | ||
2657 | 228 | |||
2658 | 229 | var | ||
2659 | 230 | horizontal = (horizontal ? true : false), // Show horizontal bars | ||
2660 | 231 | d1 = [], // First data series | ||
2661 | 232 | d2 = [], // Second data series | ||
2662 | 233 | point, // Data point variable declaration | ||
2663 | 234 | i; | ||
2664 | 235 | |||
2665 | 236 | for (i = 0; i < 4; i++) { | ||
2666 | 237 | |||
2667 | 238 | if (horizontal) { | ||
2668 | 239 | point = [Math.ceil(Math.random()*10), i]; | ||
2669 | 240 | } else { | ||
2670 | 241 | point = [i, Math.ceil(Math.random()*10)]; | ||
2671 | 242 | } | ||
2672 | 243 | |||
2673 | 244 | d1.push(point); | ||
2674 | 245 | |||
2675 | 246 | if (horizontal) { | ||
2676 | 247 | point = [Math.ceil(Math.random()*10), i+0.5]; | ||
2677 | 248 | } else { | ||
2678 | 249 | point = [i+0.5, Math.ceil(Math.random()*10)]; | ||
2679 | 250 | } | ||
2680 | 251 | |||
2681 | 252 | d2.push(point); | ||
2682 | 253 | }; | ||
2683 | 254 | |||
2684 | 255 | // Draw the graph | ||
2685 | 256 | Flotr.draw( | ||
2686 | 257 | container, | ||
2687 | 258 | [d1, d2], | ||
2688 | 259 | { | ||
2689 | 260 | bars : { | ||
2690 | 261 | show : true, | ||
2691 | 262 | horizontal : horizontal, | ||
2692 | 263 | shadowSize : 0, | ||
2693 | 264 | barWidth : 0.5 | ||
2694 | 265 | }, | ||
2695 | 266 | mouse : { | ||
2696 | 267 | track : true, | ||
2697 | 268 | relative : true | ||
2698 | 269 | }, | ||
2699 | 270 | yaxis : { | ||
2700 | 271 | min : 0, | ||
2701 | 272 | autoscaleMargin : 1 | ||
2702 | 273 | } | ||
2703 | 274 | } | ||
2704 | 275 | ); | ||
2705 | 276 | } | ||
2706 | 277 | |||
2707 | 278 | })(); | ||
2708 | 279 | |||
2709 | 280 | (function () { | ||
2710 | 281 | |||
2711 | 282 | Flotr.ExampleList.add({ | ||
2712 | 283 | key : 'basic-bar-stacked', | ||
2713 | 284 | name : 'Stacked Bars', | ||
2714 | 285 | callback : bars_stacked | ||
2715 | 286 | }); | ||
2716 | 287 | |||
2717 | 288 | Flotr.ExampleList.add({ | ||
2718 | 289 | key : 'basic-stacked-horizontal', | ||
2719 | 290 | name : 'Stacked Horizontal Bars', | ||
2720 | 291 | args : [true], | ||
2721 | 292 | callback : bars_stacked, | ||
2722 | 293 | tolerance : 5 | ||
2723 | 294 | }); | ||
2724 | 295 | |||
2725 | 296 | function bars_stacked (container, horizontal) { | ||
2726 | 297 | |||
2727 | 298 | var | ||
2728 | 299 | d1 = [], | ||
2729 | 300 | d2 = [], | ||
2730 | 301 | d3 = [], | ||
2731 | 302 | graph, i; | ||
2732 | 303 | |||
2733 | 304 | for (i = -10; i < 10; i++) { | ||
2734 | 305 | if (horizontal) { | ||
2735 | 306 | d1.push([Math.random(), i]); | ||
2736 | 307 | d2.push([Math.random(), i]); | ||
2737 | 308 | d3.push([Math.random(), i]); | ||
2738 | 309 | } else { | ||
2739 | 310 | d1.push([i, Math.random()]); | ||
2740 | 311 | d2.push([i, Math.random()]); | ||
2741 | 312 | d3.push([i, Math.random()]); | ||
2742 | 313 | } | ||
2743 | 314 | } | ||
2744 | 315 | |||
2745 | 316 | graph = Flotr.draw(container,[ | ||
2746 | 317 | { data : d1, label : 'Serie 1' }, | ||
2747 | 318 | { data : d2, label : 'Serie 2' }, | ||
2748 | 319 | { data : d3, label : 'Serie 3' } | ||
2749 | 320 | ], { | ||
2750 | 321 | legend : { | ||
2751 | 322 | backgroundColor : '#D2E8FF' // Light blue | ||
2752 | 323 | }, | ||
2753 | 324 | bars : { | ||
2754 | 325 | show : true, | ||
2755 | 326 | stacked : true, | ||
2756 | 327 | horizontal : horizontal, | ||
2757 | 328 | barWidth : 0.6, | ||
2758 | 329 | lineWidth : 1, | ||
2759 | 330 | shadowSize : 0 | ||
2760 | 331 | }, | ||
2761 | 332 | grid : { | ||
2762 | 333 | verticalLines : horizontal, | ||
2763 | 334 | horizontalLines : !horizontal | ||
2764 | 335 | } | ||
2765 | 336 | }); | ||
2766 | 337 | } | ||
2767 | 338 | |||
2768 | 339 | })(); | ||
2769 | 340 | |||
2770 | 341 | (function () { | ||
2771 | 342 | |||
2772 | 343 | Flotr.ExampleList.add({ | ||
2773 | 344 | key : 'basic-pie', | ||
2774 | 345 | name : 'Basic Pie', | ||
2775 | 346 | callback : basic_pie | ||
2776 | 347 | }); | ||
2777 | 348 | |||
2778 | 349 | function basic_pie (container) { | ||
2779 | 350 | |||
2780 | 351 | var | ||
2781 | 352 | d1 = [[0, 4]], | ||
2782 | 353 | d2 = [[0, 3]], | ||
2783 | 354 | d3 = [[0, 1.03]], | ||
2784 | 355 | d4 = [[0, 3.5]], | ||
2785 | 356 | graph; | ||
2786 | 357 | |||
2787 | 358 | graph = Flotr.draw(container, [ | ||
2788 | 359 | { data : d1, label : 'Comedy' }, | ||
2789 | 360 | { data : d2, label : 'Action' }, | ||
2790 | 361 | { data : d3, label : 'Romance', | ||
2791 | 362 | pie : { | ||
2792 | 363 | explode : 50 | ||
2793 | 364 | } | ||
2794 | 365 | }, | ||
2795 | 366 | { data : d4, label : 'Drama' } | ||
2796 | 367 | ], { | ||
2797 | 368 | HtmlText : false, | ||
2798 | 369 | grid : { | ||
2799 | 370 | verticalLines : false, | ||
2800 | 371 | horizontalLines : false | ||
2801 | 372 | }, | ||
2802 | 373 | xaxis : { showLabels : false }, | ||
2803 | 374 | yaxis : { showLabels : false }, | ||
2804 | 375 | pie : { | ||
2805 | 376 | show : true, | ||
2806 | 377 | explode : 6 | ||
2807 | 378 | }, | ||
2808 | 379 | mouse : { track : true }, | ||
2809 | 380 | legend : { | ||
2810 | 381 | position : 'se', | ||
2811 | 382 | backgroundColor : '#D2E8FF' | ||
2812 | 383 | } | ||
2813 | 384 | }); | ||
2814 | 385 | } | ||
2815 | 386 | |||
2816 | 387 | })(); | ||
2817 | 388 | |||
2818 | 389 | (function () { | ||
2819 | 390 | |||
2820 | 391 | Flotr.ExampleList.add({ | ||
2821 | 392 | key : 'basic-radar', | ||
2822 | 393 | name : 'Basic Radar', | ||
2823 | 394 | callback : basic_radar | ||
2824 | 395 | }); | ||
2825 | 396 | |||
2826 | 397 | function basic_radar (container) { | ||
2827 | 398 | |||
2828 | 399 | // Fill series s1 and s2. | ||
2829 | 400 | var | ||
2830 | 401 | s1 = { label : 'Actual', data : [[0, 3], [1, 8], [2, 5], [3, 5], [4, 3], [5, 9]] }, | ||
2831 | 402 | s2 = { label : 'Target', data : [[0, 8], [1, 7], [2, 8], [3, 2], [4, 4], [5, 7]] }, | ||
2832 | 403 | graph, ticks; | ||
2833 | 404 | |||
2834 | 405 | // Radar Labels | ||
2835 | 406 | ticks = [ | ||
2836 | 407 | [0, "Statutory"], | ||
2837 | 408 | [1, "External"], | ||
2838 | 409 | [2, "Videos"], | ||
2839 | 410 | [3, "Yippy"], | ||
2840 | 411 | [4, "Management"], | ||
2841 | 412 | [5, "oops"] | ||
2842 | 413 | ]; | ||
2843 | 414 | |||
2844 | 415 | // Draw the graph. | ||
2845 | 416 | graph = Flotr.draw(container, [ s1, s2 ], { | ||
2846 | 417 | radar : { show : true}, | ||
2847 | 418 | grid : { circular : true, minorHorizontalLines : true}, | ||
2848 | 419 | yaxis : { min : 0, max : 10, minorTickFreq : 2}, | ||
2849 | 420 | xaxis : { ticks : ticks} | ||
2850 | 421 | }); | ||
2851 | 422 | } | ||
2852 | 423 | |||
2853 | 424 | })(); | ||
2854 | 425 | |||
2855 | 426 | (function () { | ||
2856 | 427 | |||
2857 | 428 | Flotr.ExampleList.add({ | ||
2858 | 429 | key : 'basic-bubble', | ||
2859 | 430 | name : 'Basic Bubble', | ||
2860 | 431 | callback : basic_bubble | ||
2861 | 432 | }); | ||
2862 | 433 | |||
2863 | 434 | function basic_bubble (container) { | ||
2864 | 435 | |||
2865 | 436 | var | ||
2866 | 437 | d1 = [], | ||
2867 | 438 | d2 = [], | ||
2868 | 439 | point, graph, i; | ||
2869 | 440 | |||
2870 | 441 | for (i = 0; i < 10; i++ ){ | ||
2871 | 442 | point = [i, Math.ceil(Math.random()*10), Math.ceil(Math.random()*10)]; | ||
2872 | 443 | d1.push(point); | ||
2873 | 444 | |||
2874 | 445 | point = [i, Math.ceil(Math.random()*10), Math.ceil(Math.random()*10)]; | ||
2875 | 446 | d2.push(point); | ||
2876 | 447 | } | ||
2877 | 448 | |||
2878 | 449 | // Draw the graph | ||
2879 | 450 | graph = Flotr.draw(container, [d1, d2], { | ||
2880 | 451 | bubbles : { show : true, baseRadius : 5 }, | ||
2881 | 452 | xaxis : { min : -4, max : 14 }, | ||
2882 | 453 | yaxis : { min : -4, max : 14 } | ||
2883 | 454 | }); | ||
2884 | 455 | } | ||
2885 | 456 | |||
2886 | 457 | })(); | ||
2887 | 458 | |||
2888 | 459 | (function () { | ||
2889 | 460 | |||
2890 | 461 | Flotr.ExampleList.add({ | ||
2891 | 462 | key : 'basic-candle', | ||
2892 | 463 | name : 'Basic Candle', | ||
2893 | 464 | callback : basic_candle | ||
2894 | 465 | }); | ||
2895 | 466 | |||
2896 | 467 | function basic_candle (container) { | ||
2897 | 468 | |||
2898 | 469 | var | ||
2899 | 470 | d1 = [], | ||
2900 | 471 | price = 3.206, | ||
2901 | 472 | graph, | ||
2902 | 473 | i, a, b, c; | ||
2903 | 474 | |||
2904 | 475 | for (i = 0; i < 50; i++) { | ||
2905 | 476 | a = Math.random(); | ||
2906 | 477 | b = Math.random(); | ||
2907 | 478 | c = (Math.random() * (a + b)) - b; | ||
2908 | 479 | d1.push([i, price, price + a, price - b, price + c]); | ||
2909 | 480 | price = price + c; | ||
2910 | 481 | } | ||
2911 | 482 | |||
2912 | 483 | // Graph | ||
2913 | 484 | graph = Flotr.draw(container, [ d1 ], { | ||
2914 | 485 | candles : { show : true, candleWidth : 0.6 }, | ||
2915 | 486 | xaxis : { noTicks : 10 } | ||
2916 | 487 | }); | ||
2917 | 488 | } | ||
2918 | 489 | |||
2919 | 490 | })(); | ||
2920 | 491 | |||
2921 | 492 | |||
2922 | 493 | (function () { | ||
2923 | 494 | |||
2924 | 495 | Flotr.ExampleList.add({ | ||
2925 | 496 | key : 'basic-legend', | ||
2926 | 497 | name : 'Basic Legend', | ||
2927 | 498 | callback : basic_legend | ||
2928 | 499 | }); | ||
2929 | 500 | |||
2930 | 501 | function basic_legend (container) { | ||
2931 | 502 | |||
2932 | 503 | var | ||
2933 | 504 | d1 = [], | ||
2934 | 505 | d2 = [], | ||
2935 | 506 | d3 = [], | ||
2936 | 507 | data, | ||
2937 | 508 | graph, i; | ||
2938 | 509 | |||
2939 | 510 | // Data Generation | ||
2940 | 511 | for (i = 0; i < 15; i += 0.5) { | ||
2941 | 512 | d1.push([i, i + Math.sin(i+Math.PI)]); | ||
2942 | 513 | d2.push([i, i]); | ||
2943 | 514 | d3.push([i, 15-Math.cos(i)]); | ||
2944 | 515 | } | ||
2945 | 516 | |||
2946 | 517 | data = [ | ||
2947 | 518 | { data : d1, label :'x + sin(x+π)' }, | ||
2948 | 519 | { data : d2, label :'x' }, | ||
2949 | 520 | { data : d3, label :'15 - cos(x)' } | ||
2950 | 521 | ]; | ||
2951 | 522 | |||
2952 | 523 | |||
2953 | 524 | // This function prepend each label with 'y = ' | ||
2954 | 525 | function labelFn (label) { | ||
2955 | 526 | return 'y = ' + label; | ||
2956 | 527 | } | ||
2957 | 528 | |||
2958 | 529 | // Draw graph | ||
2959 | 530 | graph = Flotr.draw(container, data, { | ||
2960 | 531 | legend : { | ||
2961 | 532 | position : 'se', // Position the legend 'south-east'. | ||
2962 | 533 | labelFormatter : labelFn, // Format the labels. | ||
2963 | 534 | backgroundColor : '#D2E8FF' // A light blue background color. | ||
2964 | 535 | }, | ||
2965 | 536 | HtmlText : false | ||
2966 | 537 | }); | ||
2967 | 538 | } | ||
2968 | 539 | |||
2969 | 540 | })(); | ||
2970 | 541 | |||
2971 | 542 | (function () { | ||
2972 | 543 | |||
2973 | 544 | Flotr.ExampleList.add({ | ||
2974 | 545 | key : 'mouse-tracking', | ||
2975 | 546 | name : 'Mouse Tracking', | ||
2976 | 547 | callback : mouse_tracking | ||
2977 | 548 | }); | ||
2978 | 549 | |||
2979 | 550 | function mouse_tracking (container) { | ||
2980 | 551 | |||
2981 | 552 | var | ||
2982 | 553 | d1 = [], | ||
2983 | 554 | d2 = [], | ||
2984 | 555 | d3 = [], | ||
2985 | 556 | graph, i; | ||
2986 | 557 | |||
2987 | 558 | for (i = 0; i < 20; i += 0.5) { | ||
2988 | 559 | d1.push([i, 2*i]); | ||
2989 | 560 | d2.push([i, i*1.5+1.5*Math.sin(i)]); | ||
2990 | 561 | d3.push([i, 3*Math.cos(i)+10]); | ||
2991 | 562 | } | ||
2992 | 563 | |||
2993 | 564 | graph = Flotr.draw( | ||
2994 | 565 | container, | ||
2995 | 566 | [ | ||
2996 | 567 | { | ||
2997 | 568 | data : d1, | ||
2998 | 569 | mouse : { track : false } // Disable mouse tracking for d1 | ||
2999 | 570 | }, | ||
3000 | 571 | d2, | ||
3001 | 572 | d3 | ||
3002 | 573 | ], | ||
3003 | 574 | { | ||
3004 | 575 | mouse : { | ||
3005 | 576 | track : true, // Enable mouse tracking | ||
3006 | 577 | lineColor : 'purple', | ||
3007 | 578 | relative : true, | ||
3008 | 579 | position : 'ne', | ||
3009 | 580 | sensibility : 1, | ||
3010 | 581 | trackDecimals : 2, | ||
3011 | 582 | trackFormatter : function (o) { return 'x = ' + o.x +', y = ' + o.y; } | ||
3012 | 583 | }, | ||
3013 | 584 | crosshair : { | ||
3014 | 585 | mode : 'xy' | ||
3015 | 586 | } | ||
3016 | 587 | } | ||
3017 | 588 | ); | ||
3018 | 589 | |||
3019 | 590 | }; | ||
3020 | 591 | |||
3021 | 592 | })(); | ||
3022 | 593 | |||
3023 | 594 | (function () { | ||
3024 | 595 | |||
3025 | 596 | Flotr.ExampleList.add({ | ||
3026 | 597 | key : 'mouse-zoom', | ||
3027 | 598 | name : 'Mouse Zoom', | ||
3028 | 599 | callback : mouse_zoom, | ||
3029 | 600 | description : "<p>Select an area of the graph to zoom. Click to reset the chart.</p>" | ||
3030 | 601 | }); | ||
3031 | 602 | |||
3032 | 603 | function mouse_zoom (container) { | ||
3033 | 604 | |||
3034 | 605 | var | ||
3035 | 606 | d1 = [], | ||
3036 | 607 | d2 = [], | ||
3037 | 608 | d3 = [], | ||
3038 | 609 | options, | ||
3039 | 610 | graph, | ||
3040 | 611 | i; | ||
3041 | 612 | |||
3042 | 613 | for (i = 0; i < 40; i += 0.5) { | ||
3043 | 614 | d1.push([i, Math.sin(i)+3*Math.cos(i)]); | ||
3044 | 615 | d2.push([i, Math.pow(1.1, i)]); | ||
3045 | 616 | d3.push([i, 40 - i+Math.random()*10]); | ||
3046 | 617 | } | ||
3047 | 618 | |||
3048 | 619 | options = { | ||
3049 | 620 | selection : { mode : 'x', fps : 30 }, | ||
3050 | 621 | title : 'Mouse Zoom' | ||
3051 | 622 | }; | ||
3052 | 623 | |||
3053 | 624 | // Draw graph with default options, overwriting with passed options | ||
3054 | 625 | function drawGraph (opts) { | ||
3055 | 626 | |||
3056 | 627 | // Clone the options, so the 'options' variable always keeps intact. | ||
3057 | 628 | var o = Flotr._.extend(Flotr._.clone(options), opts || {}); | ||
3058 | 629 | |||
3059 | 630 | // Return a new graph. | ||
3060 | 631 | return Flotr.draw( | ||
3061 | 632 | container, | ||
3062 | 633 | [ d1, d2, d3 ], | ||
3063 | 634 | o | ||
3064 | 635 | ); | ||
3065 | 636 | } | ||
3066 | 637 | |||
3067 | 638 | // Actually draw the graph. | ||
3068 | 639 | graph = drawGraph(); | ||
3069 | 640 | |||
3070 | 641 | // Hook into the 'flotr:select' event. | ||
3071 | 642 | Flotr.EventAdapter.observe(container, 'flotr:select', function (area) { | ||
3072 | 643 | |||
3073 | 644 | // Draw graph with new area | ||
3074 | 645 | f = drawGraph({ | ||
3075 | 646 | xaxis: {min:area.x1, max:area.x2}, | ||
3076 | 647 | yaxis: {min:area.y1, max:area.y2} | ||
3077 | 648 | }); | ||
3078 | 649 | |||
3079 | 650 | }); | ||
3080 | 651 | |||
3081 | 652 | // When graph is clicked, draw the graph with default area. | ||
3082 | 653 | Flotr.EventAdapter.observe(container, 'flotr:click', function () { drawGraph(); }); | ||
3083 | 654 | }; | ||
3084 | 655 | |||
3085 | 656 | })(); | ||
3086 | 657 | |||
3087 | 658 | |||
3088 | 659 | (function () { | ||
3089 | 660 | |||
3090 | 661 | Flotr.ExampleList.add({ | ||
3091 | 662 | key : 'mouse-drag', | ||
3092 | 663 | name : 'Mouse Drag', | ||
3093 | 664 | callback : mouse_drag | ||
3094 | 665 | }); | ||
3095 | 666 | |||
3096 | 667 | function mouse_drag (container) { | ||
3097 | 668 | |||
3098 | 669 | var | ||
3099 | 670 | d1 = [], | ||
3100 | 671 | d2 = [], | ||
3101 | 672 | d3 = [], | ||
3102 | 673 | options, | ||
3103 | 674 | graph, | ||
3104 | 675 | start, | ||
3105 | 676 | i; | ||
3106 | 677 | |||
3107 | 678 | for (i = -40; i < 40; i += 0.5) { | ||
3108 | 679 | d1.push([i, Math.sin(i)+3*Math.cos(i)]); | ||
3109 | 680 | d2.push([i, Math.pow(1.1, i)]); | ||
3110 | 681 | d3.push([i, 40 - i+Math.random()*10]); | ||
3111 | 682 | } | ||
3112 | 683 | |||
3113 | 684 | options = { | ||
3114 | 685 | xaxis: {min: 0, max: 20}, | ||
3115 | 686 | title : 'Mouse Drag' | ||
3116 | 687 | }; | ||
3117 | 688 | |||
3118 | 689 | // Draw graph with default options, overwriting with passed options | ||
3119 | 690 | function drawGraph (opts) { | ||
3120 | 691 | |||
3121 | 692 | // Clone the options, so the 'options' variable always keeps intact. | ||
3122 | 693 | var o = Flotr._.extend(Flotr._.clone(options), opts || {}); | ||
3123 | 694 | |||
3124 | 695 | // Return a new graph. | ||
3125 | 696 | return Flotr.draw( | ||
3126 | 697 | container, | ||
3127 | 698 | [ d1, d2, d3 ], | ||
3128 | 699 | o | ||
3129 | 700 | ); | ||
3130 | 701 | } | ||
3131 | 702 | |||
3132 | 703 | graph = drawGraph(); | ||
3133 | 704 | |||
3134 | 705 | function initializeDrag (e) { | ||
3135 | 706 | start = graph.getEventPosition(e); | ||
3136 | 707 | Flotr.EventAdapter.observe(document, 'mousemove', move); | ||
3137 | 708 | Flotr.EventAdapter.observe(document, 'mouseup', stopDrag); | ||
3138 | 709 | } | ||
3139 | 710 | |||
3140 | 711 | function move (e) { | ||
3141 | 712 | var | ||
3142 | 713 | end = graph.getEventPosition(e), | ||
3143 | 714 | xaxis = graph.axes.x, | ||
3144 | 715 | offset = start.x - end.x; | ||
3145 | 716 | |||
3146 | 717 | graph = drawGraph({ | ||
3147 | 718 | xaxis : { | ||
3148 | 719 | min : xaxis.min + offset, | ||
3149 | 720 | max : xaxis.max + offset | ||
3150 | 721 | } | ||
3151 | 722 | }); | ||
3152 | 723 | // @todo: refector initEvents in order not to remove other observed events | ||
3153 | 724 | Flotr.EventAdapter.observe(graph.overlay, 'mousedown', initializeDrag); | ||
3154 | 725 | } | ||
3155 | 726 | |||
3156 | 727 | function stopDrag () { | ||
3157 | 728 | Flotr.EventAdapter.stopObserving(document, 'mousemove', move); | ||
3158 | 729 | } | ||
3159 | 730 | |||
3160 | 731 | Flotr.EventAdapter.observe(graph.overlay, 'mousedown', initializeDrag); | ||
3161 | 732 | |||
3162 | 733 | }; | ||
3163 | 734 | |||
3164 | 735 | })(); | ||
3165 | 736 | |||
3166 | 737 | (function () { | ||
3167 | 738 | |||
3168 | 739 | Flotr.ExampleList.add({ | ||
3169 | 740 | key : 'basic-time', | ||
3170 | 741 | name : 'Basic Time', | ||
3171 | 742 | callback : basic_time, | ||
3172 | 743 | description : "<p>Select an area of the graph to zoom. Click to reset the chart.</p>" | ||
3173 | 744 | }); | ||
3174 | 745 | |||
3175 | 746 | function basic_time (container) { | ||
3176 | 747 | |||
3177 | 748 | var | ||
3178 | 749 | d1 = [], | ||
3179 | 750 | start = new Date("2009/01/01 01:00").getTime(), | ||
3180 | 751 | options, | ||
3181 | 752 | graph, | ||
3182 | 753 | i, x, o; | ||
3183 | 754 | |||
3184 | 755 | for (i = 0; i < 100; i++) { | ||
3185 | 756 | x = start+(i*1000*3600*24*36.5); | ||
3186 | 757 | d1.push([x, i+Math.random()*30+Math.sin(i/20+Math.random()*2)*20+Math.sin(i/10+Math.random())*10]); | ||
3187 | 758 | } | ||
3188 | 759 | |||
3189 | 760 | options = { | ||
3190 | 761 | xaxis : { | ||
3191 | 762 | mode : 'time', | ||
3192 | 763 | labelsAngle : 45 | ||
3193 | 764 | }, | ||
3194 | 765 | selection : { | ||
3195 | 766 | mode : 'x' | ||
3196 | 767 | }, | ||
3197 | 768 | HtmlText : false, | ||
3198 | 769 | title : 'Time' | ||
3199 | 770 | }; | ||
3200 | 771 | |||
3201 | 772 | // Draw graph with default options, overwriting with passed options | ||
3202 | 773 | function drawGraph (opts) { | ||
3203 | 774 | |||
3204 | 775 | // Clone the options, so the 'options' variable always keeps intact. | ||
3205 | 776 | o = Flotr._.extend(Flotr._.clone(options), opts || {}); | ||
3206 | 777 | |||
3207 | 778 | // Return a new graph. | ||
3208 | 779 | return Flotr.draw( | ||
3209 | 780 | container, | ||
3210 | 781 | [ d1 ], | ||
3211 | 782 | o | ||
3212 | 783 | ); | ||
3213 | 784 | } | ||
3214 | 785 | |||
3215 | 786 | graph = drawGraph(); | ||
3216 | 787 | |||
3217 | 788 | Flotr.EventAdapter.observe(container, 'flotr:select', function(area){ | ||
3218 | 789 | // Draw selected area | ||
3219 | 790 | graph = drawGraph({ | ||
3220 | 791 | xaxis : { min : area.x1, max : area.x2, mode : 'time', labelsAngle : 45 }, | ||
3221 | 792 | yaxis : { min : area.y1, max : area.y2 } | ||
3222 | 793 | }); | ||
3223 | 794 | }); | ||
3224 | 795 | |||
3225 | 796 | // When graph is clicked, draw the graph with default area. | ||
3226 | 797 | Flotr.EventAdapter.observe(container, 'flotr:click', function () { graph = drawGraph(); }); | ||
3227 | 798 | }; | ||
3228 | 799 | |||
3229 | 800 | })(); | ||
3230 | 801 | |||
3231 | 802 | (function () { | ||
3232 | 803 | |||
3233 | 804 | Flotr.ExampleList.add({ | ||
3234 | 805 | key : 'negative-values', | ||
3235 | 806 | name : 'Negative Values', | ||
3236 | 807 | callback : negative_values | ||
3237 | 808 | }); | ||
3238 | 809 | |||
3239 | 810 | function negative_values (container) { | ||
3240 | 811 | |||
3241 | 812 | var | ||
3242 | 813 | d0 = [], // Line through y = 0 | ||
3243 | 814 | d1 = [], // Random data presented as a scatter plot. | ||
3244 | 815 | d2 = [], // A regression line for the scatter. | ||
3245 | 816 | sx = 0, | ||
3246 | 817 | sy = 0, | ||
3247 | 818 | sxy = 0, | ||
3248 | 819 | sxsq = 0, | ||
3249 | 820 | xmean, | ||
3250 | 821 | ymean, | ||
3251 | 822 | alpha, | ||
3252 | 823 | beta, | ||
3253 | 824 | n, x, y; | ||
3254 | 825 | |||
3255 | 826 | for (n = 0; n < 20; n++){ | ||
3256 | 827 | |||
3257 | 828 | x = n; | ||
3258 | 829 | y = x + Math.random()*8 - 15; | ||
3259 | 830 | |||
3260 | 831 | d0.push([x, 0]); | ||
3261 | 832 | d1.push([x, y]); | ||
3262 | 833 | |||
3263 | 834 | // Computations used for regression line | ||
3264 | 835 | sx += x; | ||
3265 | 836 | sy += y; | ||
3266 | 837 | sxy += x*y; | ||
3267 | 838 | sxsq += Math.pow(x,2); | ||
3268 | 839 | } | ||
3269 | 840 | |||
3270 | 841 | xmean = sx/n; | ||
3271 | 842 | ymean = sy/n; | ||
3272 | 843 | beta = ((n*sxy) - (sx*sy))/((n*sxsq)-(Math.pow(sx,2))); | ||
3273 | 844 | alpha = ymean - (beta * xmean); | ||
3274 | 845 | |||
3275 | 846 | // Compute the regression line. | ||
3276 | 847 | for (n = 0; n < 20; n++){ | ||
3277 | 848 | d2.push([n, alpha + beta*n]) | ||
3278 | 849 | } | ||
3279 | 850 | |||
3280 | 851 | // Draw the graph | ||
3281 | 852 | graph = Flotr.draw( | ||
3282 | 853 | container, [ | ||
3283 | 854 | { data : d0, shadowSize : 0, color : '#545454' }, // Horizontal | ||
3284 | 855 | { data : d1, label : 'y = x + (Math.random() * 8) - 15', points : { show : true } }, // Scatter | ||
3285 | 856 | { data : d2, label : 'y = ' + alpha.toFixed(2) + ' + ' + beta.toFixed(2) + '*x' } // Regression | ||
3286 | 857 | ], | ||
3287 | 858 | { | ||
3288 | 859 | legend : { position : 'se', backgroundColor : '#D2E8FF' }, | ||
3289 | 860 | title : 'Negative Values' | ||
3290 | 861 | } | ||
3291 | 862 | ); | ||
3292 | 863 | }; | ||
3293 | 864 | |||
3294 | 865 | })(); | ||
3295 | 866 | |||
3296 | 867 | (function () { | ||
3297 | 868 | |||
3298 | 869 | Flotr.ExampleList.add({ | ||
3299 | 870 | key : 'click-example', | ||
3300 | 871 | name : 'Click Example', | ||
3301 | 872 | callback : click_example | ||
3302 | 873 | }); | ||
3303 | 874 | |||
3304 | 875 | function click_example (container) { | ||
3305 | 876 | |||
3306 | 877 | var | ||
3307 | 878 | d1 = [[0,0]], // Point at origin | ||
3308 | 879 | options, | ||
3309 | 880 | graph; | ||
3310 | 881 | |||
3311 | 882 | options = { | ||
3312 | 883 | xaxis: {min: 0, max: 15}, | ||
3313 | 884 | yaxis: {min: 0, max: 15}, | ||
3314 | 885 | lines: {show: true}, | ||
3315 | 886 | points: {show: true}, | ||
3316 | 887 | mouse: {track:true}, | ||
3317 | 888 | title: 'Click Example' | ||
3318 | 889 | }; | ||
3319 | 890 | |||
3320 | 891 | graph = Flotr.draw(container, [d1], options); | ||
3321 | 892 | |||
3322 | 893 | // Add a point to the series and redraw the graph | ||
3323 | 894 | Flotr.EventAdapter.observe(container, 'flotr:click', function(position){ | ||
3324 | 895 | |||
3325 | 896 | // Add a point to the series at the location of the click | ||
3326 | 897 | d1.push([position.x, position.y]); | ||
3327 | 898 | |||
3328 | 899 | // Sort the series. | ||
3329 | 900 | d1 = d1.sort(function (a, b) { return a[0] - b[0]; }); | ||
3330 | 901 | |||
3331 | 902 | // Redraw the graph, with the new series. | ||
3332 | 903 | graph = Flotr.draw(container, [d1], options); | ||
3333 | 904 | }); | ||
3334 | 905 | }; | ||
3335 | 906 | |||
3336 | 907 | })(); | ||
3337 | 908 | |||
3338 | 909 | (function () { | ||
3339 | 910 | |||
3340 | 911 | Flotr.ExampleList.add({ | ||
3341 | 912 | key : 'download-image', | ||
3342 | 913 | name : 'Download Image', | ||
3343 | 914 | callback : download_image, | ||
3344 | 915 | description : '' + | ||
3345 | 916 | '<form name="image-download" id="image-download" action="" onsubmit="return false">' + | ||
3346 | 917 | '<label><input type="radio" name="format" value="png" checked="checked" /> PNG</label>' + | ||
3347 | 918 | '<label><input type="radio" name="format" value="jpeg" /> JPEG</label>' + | ||
3348 | 919 | |||
3349 | 920 | '<button name="to-image" onclick="CurrentExample(\'to-image\')">To Image</button>' + | ||
3350 | 921 | '<button name="download" onclick="CurrentExample(\'download\')">Download</button>' + | ||
3351 | 922 | '<button name="reset" onclick="CurrentExample(\'reset\')">Reset</button>' + | ||
3352 | 923 | '</form>' | ||
3353 | 924 | }); | ||
3354 | 925 | |||
3355 | 926 | function download_image (container) { | ||
3356 | 927 | |||
3357 | 928 | var | ||
3358 | 929 | d1 = [], | ||
3359 | 930 | d2 = [], | ||
3360 | 931 | d3 = [], | ||
3361 | 932 | d4 = [], | ||
3362 | 933 | d5 = [], | ||
3363 | 934 | graph, | ||
3364 | 935 | i; | ||
3365 | 936 | |||
3366 | 937 | for (i = 0; i <= 10; i += 0.1) { | ||
3367 | 938 | d1.push([i, 4 + Math.pow(i,1.5)]); | ||
3368 | 939 | d2.push([i, Math.pow(i,3)]); | ||
3369 | 940 | d3.push([i, i*5+3*Math.sin(i*4)]); | ||
3370 | 941 | d4.push([i, i]); | ||
3371 | 942 | if( i.toFixed(1)%1 == 0 ){ | ||
3372 | 943 | d5.push([i, 2*i]); | ||
3373 | 944 | } | ||
3374 | 945 | } | ||
3375 | 946 | |||
3376 | 947 | // Draw the graph | ||
3377 | 948 | graph = Flotr.draw( | ||
3378 | 949 | container,[ | ||
3379 | 950 | {data:d1, label:'y = 4 + x^(1.5)', lines:{fill:true}}, | ||
3380 | 951 | {data:d2, label:'y = x^3', yaxis:2}, | ||
3381 | 952 | {data:d3, label:'y = 5x + 3sin(4x)'}, | ||
3382 | 953 | {data:d4, label:'y = x'}, | ||
3383 | 954 | {data:d5, label:'y = 2x', lines: {show: true}, points: {show: true}} | ||
3384 | 955 | ],{ | ||
3385 | 956 | title: 'Download Image Example', | ||
3386 | 957 | subtitle: 'You can save me as an image', | ||
3387 | 958 | xaxis:{ | ||
3388 | 959 | noTicks: 7, // Display 7 ticks. | ||
3389 | 960 | tickFormatter: function(n){ return '('+n+')'; }, // => displays tick values between brackets. | ||
3390 | 961 | min: 1, // => part of the series is not displayed. | ||
3391 | 962 | max: 7.5, // => part of the series is not displayed. | ||
3392 | 963 | labelsAngle: 45, | ||
3393 | 964 | title: 'x Axis' | ||
3394 | 965 | }, | ||
3395 | 966 | yaxis:{ | ||
3396 | 967 | ticks: [[0, "Lower"], 10, 20, 30, [40, "Upper"]], | ||
3397 | 968 | max: 40, | ||
3398 | 969 | title: 'y = f(x)' | ||
3399 | 970 | }, | ||
3400 | 971 | y2axis:{color:'#FF0000', max: 500, title: 'y = x^3'}, | ||
3401 | 972 | grid:{ | ||
3402 | 973 | verticalLines: false, | ||
3403 | 974 | backgroundColor: 'white' | ||
3404 | 975 | }, | ||
3405 | 976 | HtmlText: false, | ||
3406 | 977 | legend: { | ||
3407 | 978 | position: 'nw' | ||
3408 | 979 | } | ||
3409 | 980 | }); | ||
3410 | 981 | |||
3411 | 982 | this.CurrentExample = function (operation) { | ||
3412 | 983 | |||
3413 | 984 | var | ||
3414 | 985 | format = $('#image-download input:radio[name=format]:checked').val(); | ||
3415 | 986 | if (Flotr.isIE && Flotr.isIE < 9) { | ||
3416 | 987 | alert( | ||
3417 | 988 | "Your browser doesn't allow you to get a bitmap image from the plot, " + | ||
3418 | 989 | "you can only get a VML image that you can use in Microsoft Office.<br />" | ||
3419 | 990 | ); | ||
3420 | 991 | } | ||
3421 | 992 | |||
3422 | 993 | if (operation == 'to-image') { | ||
3423 | 994 | graph.download.saveImage(format, null, null, true) | ||
3424 | 995 | } else if (operation == 'download') { | ||
3425 | 996 | graph.download.saveImage(format); | ||
3426 | 997 | } else if (operation == 'reset') { | ||
3427 | 998 | graph.download.restoreCanvas(); | ||
3428 | 999 | } | ||
3429 | 1000 | }; | ||
3430 | 1001 | |||
3431 | 1002 | return graph; | ||
3432 | 1003 | }; | ||
3433 | 1004 | |||
3434 | 1005 | })(); | ||
3435 | 1006 | |||
3436 | 1007 | (function () { | ||
3437 | 1008 | |||
3438 | 1009 | Flotr.ExampleList.add({ | ||
3439 | 1010 | key : 'download-data', | ||
3440 | 1011 | name : 'Download Data', | ||
3441 | 1012 | callback : download_data | ||
3442 | 1013 | }); | ||
3443 | 1014 | |||
3444 | 1015 | function download_data (container) { | ||
3445 | 1016 | |||
3446 | 1017 | var | ||
3447 | 1018 | d1 = [], | ||
3448 | 1019 | d2 = [], | ||
3449 | 1020 | d3 = [], | ||
3450 | 1021 | d4 = [], | ||
3451 | 1022 | d5 = [], | ||
3452 | 1023 | graph, | ||
3453 | 1024 | i,x; | ||
3454 | 1025 | |||
3455 | 1026 | for (i = 0; i <= 100; i += 1) { | ||
3456 | 1027 | x = i / 10; | ||
3457 | 1028 | d1.push([x, 4 + Math.pow(x,1.5)]); | ||
3458 | 1029 | d2.push([x, Math.pow(x,3)]); | ||
3459 | 1030 | d3.push([x, i*5+3*Math.sin(x*4)]); | ||
3460 | 1031 | d4.push([x, x]); | ||
3461 | 1032 | if(x%1 === 0 ){ | ||
3462 | 1033 | d5.push([x, 2*x]); | ||
3463 | 1034 | } | ||
3464 | 1035 | } | ||
3465 | 1036 | |||
3466 | 1037 | // Draw the graph. | ||
3467 | 1038 | graph = Flotr.draw( | ||
3468 | 1039 | container, [ | ||
3469 | 1040 | { data : d1, label : 'y = 4 + x^(1.5)', lines : { fill : true } }, | ||
3470 | 1041 | { data : d2, label : 'y = x^3' }, | ||
3471 | 1042 | { data : d3, label : 'y = 5x + 3sin(4x)' }, | ||
3472 | 1043 | { data : d4, label : 'y = x' }, | ||
3473 | 1044 | { data : d5, label : 'y = 2x', lines : { show : true }, points : { show : true } } | ||
3474 | 1045 | ],{ | ||
3475 | 1046 | xaxis : { | ||
3476 | 1047 | noTicks : 7, | ||
3477 | 1048 | tickFormatter : function (n) { return '('+n+')'; }, | ||
3478 | 1049 | min: 1, // Part of the series is not displayed. | ||
3479 | 1050 | max: 7.5 | ||
3480 | 1051 | }, | ||
3481 | 1052 | yaxis : { | ||
3482 | 1053 | ticks : [[ 0, "Lower"], 10, 20, 30, [40, "Upper"]], | ||
3483 | 1054 | max : 40 | ||
3484 | 1055 | }, | ||
3485 | 1056 | grid : { | ||
3486 | 1057 | verticalLines : false, | ||
3487 | 1058 | backgroundColor : 'white' | ||
3488 | 1059 | }, | ||
3489 | 1060 | legend : { | ||
3490 | 1061 | position : 'nw' | ||
3491 | 1062 | }, | ||
3492 | 1063 | spreadsheet : { | ||
3493 | 1064 | show : true, | ||
3494 | 1065 | tickFormatter : function (e) { return e+''; } | ||
3495 | 1066 | } | ||
3496 | 1067 | }); | ||
3497 | 1068 | }; | ||
3498 | 1069 | |||
3499 | 1070 | })(); | ||
3500 | 1071 | |||
3501 | 1072 | (function () { | ||
3502 | 1073 | |||
3503 | 1074 | Flotr.ExampleList.add({ | ||
3504 | 1075 | key : 'advanced-titles', | ||
3505 | 1076 | name : 'Advanced Titles', | ||
3506 | 1077 | callback : advanced_titles | ||
3507 | 1078 | }); | ||
3508 | 1079 | |||
3509 | 1080 | function advanced_titles (container) { | ||
3510 | 1081 | |||
3511 | 1082 | var | ||
3512 | 1083 | d1 = [], | ||
3513 | 1084 | d2 = [], | ||
3514 | 1085 | d3 = [], | ||
3515 | 1086 | d4 = [], | ||
3516 | 1087 | d5 = [], | ||
3517 | 1088 | graph, | ||
3518 | 1089 | i; | ||
3519 | 1090 | |||
3520 | 1091 | for (i = 0; i <= 10; i += 0.1) { | ||
3521 | 1092 | d1.push([i, 4 + Math.pow(i,1.5)]); | ||
3522 | 1093 | d2.push([i, Math.pow(i,3)]); | ||
3523 | 1094 | d3.push([i, i*5+3*Math.sin(i*4)]); | ||
3524 | 1095 | d4.push([i, i]); | ||
3525 | 1096 | if (i.toFixed(1)%1 == 0) { | ||
3526 | 1097 | d5.push([i, 2*i]); | ||
3527 | 1098 | } | ||
3528 | 1099 | } | ||
3529 | 1100 | |||
3530 | 1101 | // Draw the graph. | ||
3531 | 1102 | graph = Flotr.draw( | ||
3532 | 1103 | container,[ | ||
3533 | 1104 | { data : d1, label : 'y = 4 + x^(1.5)', lines : { fill : true } }, | ||
3534 | 1105 | { data : d2, label : 'y = x^3', yaxis : 2 }, | ||
3535 | 1106 | { data : d3, label : 'y = 5x + 3sin(4x)' }, | ||
3536 | 1107 | { data : d4, label : 'y = x' }, | ||
3537 | 1108 | { data : d5, label : 'y = 2x', lines : { show : true }, points : { show : true } } | ||
3538 | 1109 | ], { | ||
3539 | 1110 | title : 'Advanced Titles Example', | ||
3540 | 1111 | subtitle : 'You can save me as an image', | ||
3541 | 1112 | xaxis : { | ||
3542 | 1113 | noTicks : 7, | ||
3543 | 1114 | tickFormatter : function (n) { return '('+n+')'; }, | ||
3544 | 1115 | min : 1, | ||
3545 | 1116 | max : 7.5, | ||
3546 | 1117 | labelsAngle : 45, | ||
3547 | 1118 | title : 'x Axis' | ||
3548 | 1119 | }, | ||
3549 | 1120 | yaxis : { | ||
3550 | 1121 | ticks : [[0, "Lower"], 10, 20, 30, [40, "Upper"]], | ||
3551 | 1122 | max : 40, | ||
3552 | 1123 | title : 'y = f(x)' | ||
3553 | 1124 | }, | ||
3554 | 1125 | y2axis : { color : '#FF0000', max : 500, title : 'y = x^3' }, | ||
3555 | 1126 | grid : { | ||
3556 | 1127 | verticalLines : false, | ||
3557 | 1128 | backgroundColor : 'white' | ||
3558 | 1129 | }, | ||
3559 | 1130 | HtmlText : false, | ||
3560 | 1131 | legend : { | ||
3561 | 1132 | position : 'nw' | ||
3562 | 1133 | } | ||
3563 | 1134 | }); | ||
3564 | 1135 | }; | ||
3565 | 1136 | |||
3566 | 1137 | })(); | ||
3567 | 1138 | |||
3568 | 1139 | (function () { | ||
3569 | 1140 | |||
3570 | 1141 | Flotr.ExampleList.add({ | ||
3571 | 1142 | key : 'color-gradients', | ||
3572 | 1143 | name : 'Color Gradients', | ||
3573 | 1144 | callback : color_gradients | ||
3574 | 1145 | }); | ||
3575 | 1146 | |||
3576 | 1147 | function color_gradients (container) { | ||
3577 | 1148 | |||
3578 | 1149 | var | ||
3579 | 1150 | bars = { | ||
3580 | 1151 | data: [], | ||
3581 | 1152 | bars: { | ||
3582 | 1153 | show: true, | ||
3583 | 1154 | barWidth: 0.8, | ||
3584 | 1155 | lineWidth: 0, | ||
3585 | 1156 | fillColor: { | ||
3586 | 1157 | colors: ['#CB4B4B', '#fff'], | ||
3587 | 1158 | start: 'top', | ||
3588 | 1159 | end: 'bottom' | ||
3589 | 1160 | }, | ||
3590 | 1161 | fillOpacity: 0.8 | ||
3591 | 1162 | } | ||
3592 | 1163 | }, markers = { | ||
3593 | 1164 | data: [], | ||
3594 | 1165 | markers: { | ||
3595 | 1166 | show: true, | ||
3596 | 1167 | position: 'ct' | ||
3597 | 1168 | } | ||
3598 | 1169 | }, lines = { | ||
3599 | 1170 | data: [], | ||
3600 | 1171 | lines: { | ||
3601 | 1172 | show: true, | ||
3602 | 1173 | fillColor: ['#00A8F0', '#fff'], | ||
3603 | 1174 | fill: true, | ||
3604 | 1175 | fillOpacity: 1 | ||
3605 | 1176 | } | ||
3606 | 1177 | }, | ||
3607 | 1178 | point, | ||
3608 | 1179 | graph, | ||
3609 | 1180 | i; | ||
3610 | 1181 | |||
3611 | 1182 | for (i = 0; i < 8; i++) { | ||
3612 | 1183 | point = [i, Math.ceil(Math.random() * 10)]; | ||
3613 | 1184 | bars.data.push(point); | ||
3614 | 1185 | markers.data.push(point); | ||
3615 | 1186 | } | ||
3616 | 1187 | |||
3617 | 1188 | for (i = -1; i < 9; i += 0.01){ | ||
3618 | 1189 | lines.data.push([i, i*i/8+2]); | ||
3619 | 1190 | } | ||
3620 | 1191 | |||
3621 | 1192 | graph = Flotr.draw( | ||
3622 | 1193 | container, | ||
3623 | 1194 | [lines, bars, markers], { | ||
3624 | 1195 | yaxis: { | ||
3625 | 1196 | min: 0, | ||
3626 | 1197 | max: 11 | ||
3627 | 1198 | }, | ||
3628 | 1199 | xaxis: { | ||
3629 | 1200 | min: -0.5, | ||
3630 | 1201 | max: 7.5 | ||
3631 | 1202 | }, | ||
3632 | 1203 | grid: { | ||
3633 | 1204 | verticalLines: false, | ||
3634 | 1205 | backgroundColor: ['#fff', '#ccc'] | ||
3635 | 1206 | } | ||
3636 | 1207 | } | ||
3637 | 1208 | ); | ||
3638 | 1209 | }; | ||
3639 | 1210 | |||
3640 | 1211 | })(); | ||
3641 | 1212 | |||
3642 | 1213 | |||
3643 | 1214 | (function () { | ||
3644 | 1215 | |||
3645 | 1216 | Flotr.ExampleList.add({ | ||
3646 | 1217 | key : 'profile-bars', | ||
3647 | 1218 | name : 'Profile Bars', | ||
3648 | 1219 | type : 'profile', | ||
3649 | 1220 | callback : profile_bars | ||
3650 | 1221 | }); | ||
3651 | 1222 | |||
3652 | 1223 | /* | ||
3653 | 1224 | Flotr.ExampleList.add({ | ||
3654 | 1225 | key : 'basic-bars-horizontal', | ||
3655 | 1226 | name : 'Horizontal Bars', | ||
3656 | 1227 | args : [true], | ||
3657 | 1228 | callback : basic_bars | ||
3658 | 1229 | }); | ||
3659 | 1230 | */ | ||
3660 | 1231 | |||
3661 | 1232 | function profile_bars (container, horizontal) { | ||
3662 | 1233 | |||
3663 | 1234 | var | ||
3664 | 1235 | horizontal = (horizontal ? true : false), // Show horizontal bars | ||
3665 | 1236 | d1 = [], // First data series | ||
3666 | 1237 | d2 = [], // Second data series | ||
3667 | 1238 | point, // Data point variable declaration | ||
3668 | 1239 | i; | ||
3669 | 1240 | |||
3670 | 1241 | for (i = 0; i < 5000; i++) { | ||
3671 | 1242 | |||
3672 | 1243 | if (horizontal) { | ||
3673 | 1244 | point = [Math.ceil(Math.random()*10), i]; | ||
3674 | 1245 | } else { | ||
3675 | 1246 | point = [i, Math.ceil(Math.random()*10)]; | ||
3676 | 1247 | } | ||
3677 | 1248 | |||
3678 | 1249 | d1.push(point); | ||
3679 | 1250 | |||
3680 | 1251 | if (horizontal) { | ||
3681 | 1252 | point = [Math.ceil(Math.random()*10), i+0.5]; | ||
3682 | 1253 | } else { | ||
3683 | 1254 | point = [i+0.5, Math.ceil(Math.random()*10)]; | ||
3684 | 1255 | } | ||
3685 | 1256 | |||
3686 | 1257 | d2.push(point); | ||
3687 | 1258 | }; | ||
3688 | 1259 | |||
3689 | 1260 | // Draw the graph | ||
3690 | 1261 | Flotr.draw( | ||
3691 | 1262 | container, | ||
3692 | 1263 | [d1, d2], | ||
3693 | 1264 | { | ||
3694 | 1265 | bars : { | ||
3695 | 1266 | show : true, | ||
3696 | 1267 | horizontal : horizontal, | ||
3697 | 1268 | barWidth : 0.5 | ||
3698 | 1269 | }, | ||
3699 | 1270 | mouse : { | ||
3700 | 1271 | track : true, | ||
3701 | 1272 | relative : true | ||
3702 | 1273 | }, | ||
3703 | 1274 | yaxis : { | ||
3704 | 1275 | min : 0, | ||
3705 | 1276 | autoscaleMargin : 1 | ||
3706 | 1277 | } | ||
3707 | 1278 | } | ||
3708 | 1279 | ); | ||
3709 | 1280 | } | ||
3710 | 1281 | |||
3711 | 1282 | })(); | ||
3712 | 1283 | |||
3713 | 1284 | (function () { | ||
3714 | 1285 | |||
3715 | 1286 | Flotr.ExampleList.add({ | ||
3716 | 1287 | key : 'basic-timeline', | ||
3717 | 1288 | name : 'Basic Timeline', | ||
3718 | 1289 | callback : basic_timeline | ||
3719 | 1290 | }); | ||
3720 | 1291 | |||
3721 | 1292 | function basic_timeline (container) { | ||
3722 | 1293 | |||
3723 | 1294 | var | ||
3724 | 1295 | d1 = [[1, 4, 5]], | ||
3725 | 1296 | d2 = [[3.2, 3, 4]], | ||
3726 | 1297 | d3 = [[1.9, 2, 2], [5, 2, 3.3]], | ||
3727 | 1298 | d4 = [[1.55, 1, 9]], | ||
3728 | 1299 | d5 = [[5, 0, 2.3]], | ||
3729 | 1300 | data = [], | ||
3730 | 1301 | timeline = { show : true, barWidth : .5 }, | ||
3731 | 1302 | markers = [], | ||
3732 | 1303 | labels = ['Obama', 'Bush', 'Clinton', 'Palin', 'McCain'], | ||
3733 | 1304 | i, graph, point; | ||
3734 | 1305 | |||
3735 | 1306 | // Timeline | ||
3736 | 1307 | Flotr._.each([d1, d2, d3, d4, d5], function (d) { | ||
3737 | 1308 | data.push({ | ||
3738 | 1309 | data : d, | ||
3739 | 1310 | timeline : Flotr._.clone(timeline) | ||
3740 | 1311 | }); | ||
3741 | 1312 | }); | ||
3742 | 1313 | |||
3743 | 1314 | // Markers | ||
3744 | 1315 | Flotr._.each([d1, d2, d3, d4, d5], function (d) { | ||
3745 | 1316 | point = d[0]; | ||
3746 | 1317 | markers.push([point[0], point[1]]); | ||
3747 | 1318 | }); | ||
3748 | 1319 | data.push({ | ||
3749 | 1320 | data: markers, | ||
3750 | 1321 | markers: { | ||
3751 | 1322 | show: true, | ||
3752 | 1323 | position: 'rm', | ||
3753 | 1324 | fontSize: 11, | ||
3754 | 1325 | labelFormatter : function (o) { return labels[o.index]; } | ||
3755 | 1326 | } | ||
3756 | 1327 | }); | ||
3757 | 1328 | |||
3758 | 1329 | // Draw Graph | ||
3759 | 1330 | graph = Flotr.draw(container, data, { | ||
3760 | 1331 | xaxis: { | ||
3761 | 1332 | noTicks: 3, | ||
3762 | 1333 | tickFormatter: function (x) { | ||
3763 | 1334 | var | ||
3764 | 1335 | x = parseInt(x), | ||
3765 | 1336 | months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | ||
3766 | 1337 | return months[(x-1)%12]; | ||
3767 | 1338 | } | ||
3768 | 1339 | }, | ||
3769 | 1340 | yaxis: { | ||
3770 | 1341 | showLabels : false | ||
3771 | 1342 | }, | ||
3772 | 1343 | grid: { | ||
3773 | 1344 | horizontalLines : false | ||
3774 | 1345 | } | ||
3775 | 1346 | }); | ||
3776 | 1347 | } | ||
3777 | 1348 | |||
3778 | 1349 | })(); | ||
3779 | 1350 | |||
3780 | 1351 | (function () { | ||
3781 | 1352 | |||
3782 | 1353 | Flotr.ExampleList.add({ | ||
3783 | 1354 | key : 'advanced-markers', | ||
3784 | 1355 | name : 'Advanced Markers', | ||
3785 | 1356 | callback : advanced_markers, | ||
3786 | 1357 | timeout : 150 | ||
3787 | 1358 | }); | ||
3788 | 1359 | |||
3789 | 1360 | function advanced_markers (container) { | ||
3790 | 1361 | |||
3791 | 1362 | var | ||
3792 | 1363 | xmark = new Image(), | ||
3793 | 1364 | checkmark = new Image(), | ||
3794 | 1365 | bars = { | ||
3795 | 1366 | data: [], | ||
3796 | 1367 | bars: { | ||
3797 | 1368 | show: true, | ||
3798 | 1369 | barWidth: 0.6, | ||
3799 | 1370 | lineWidth: 0, | ||
3800 | 1371 | fillOpacity: 0.8 | ||
3801 | 1372 | } | ||
3802 | 1373 | }, markers = { | ||
3803 | 1374 | data: [], | ||
3804 | 1375 | markers: { | ||
3805 | 1376 | show: true, | ||
3806 | 1377 | position: 'ct', | ||
3807 | 1378 | labelFormatter: function (o) { | ||
3808 | 1379 | return (o.y >= 5) ? checkmark : xmark; | ||
3809 | 1380 | } | ||
3810 | 1381 | } | ||
3811 | 1382 | }, | ||
3812 | 1383 | flotr = Flotr, | ||
3813 | 1384 | point, | ||
3814 | 1385 | graph, | ||
3815 | 1386 | i; | ||
3816 | 1387 | |||
3817 | 1388 | |||
3818 | 1389 | for (i = 0; i < 8; i++) { | ||
3819 | 1390 | point = [i, Math.ceil(Math.random() * 10)]; | ||
3820 | 1391 | bars.data.push(point); | ||
3821 | 1392 | markers.data.push(point); | ||
3822 | 1393 | } | ||
3823 | 1394 | |||
3824 | 1395 | var runner = function () { | ||
3825 | 1396 | if (!xmark.complete || !checkmark.complete) { | ||
3826 | 1397 | setTimeout(runner, 50); | ||
3827 | 1398 | return; | ||
3828 | 1399 | } | ||
3829 | 1400 | |||
3830 | 1401 | graph = flotr.draw( | ||
3831 | 1402 | container, | ||
3832 | 1403 | [bars, markers], { | ||
3833 | 1404 | yaxis: { | ||
3834 | 1405 | min: 0, | ||
3835 | 1406 | max: 11 | ||
3836 | 1407 | }, | ||
3837 | 1408 | xaxis: { | ||
3838 | 1409 | min: -0.5, | ||
3839 | 1410 | max: 7.5 | ||
3840 | 1411 | }, | ||
3841 | 1412 | grid: { | ||
3842 | 1413 | verticalLines: false | ||
3843 | 1414 | } | ||
3844 | 1415 | } | ||
3845 | 1416 | ); | ||
3846 | 1417 | } | ||
3847 | 1418 | |||
3848 | 1419 | xmark.onload = runner; | ||
3849 | 1420 | xmark.src = 'images/xmark.png'; | ||
3850 | 1421 | checkmark.src = 'images/checkmark.png'; | ||
3851 | 1422 | }; | ||
3852 | 1423 | |||
3853 | 1424 | })(); | ||
3854 | 1425 | |||
3855 | 1426 | 0 | ||
3856 | === removed file 'addons/web_graph/static/lib/flotr2/flotr2.ie.min.js' | |||
3857 | --- addons/web_graph/static/lib/flotr2/flotr2.ie.min.js 2012-05-07 08:19:08 +0000 | |||
3858 | +++ addons/web_graph/static/lib/flotr2/flotr2.ie.min.js 1970-01-01 00:00:00 +0000 | |||
3859 | @@ -1,33 +0,0 @@ | |||
3860 | 1 | // Copyright 2006 Google Inc. | ||
3861 | 2 | // | ||
3862 | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | ||
3863 | 4 | // you may not use this file except in compliance with the License. | ||
3864 | 5 | // You may obtain a copy of the License at | ||
3865 | 6 | // | ||
3866 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 | ||
3867 | 8 | // | ||
3868 | 9 | // Unless required by applicable law or agreed to in writing, software | ||
3869 | 10 | // distributed under the License is distributed on an "AS IS" BASIS, | ||
3870 | 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
3871 | 12 | // See the License for the specific language governing permissions and | ||
3872 | 13 | // limitations under the License. | ||
3873 | 14 | // Known Issues: | ||
3874 | 15 | // | ||
3875 | 16 | // * Patterns only support repeat. | ||
3876 | 17 | // * Radial gradient are not implemented. The VML version of these look very | ||
3877 | 18 | // different from the canvas one. | ||
3878 | 19 | // * Clipping paths are not implemented. | ||
3879 | 20 | // * Coordsize. The width and height attribute have higher priority than the | ||
3880 | 21 | // width and height style values which isn't correct. | ||
3881 | 22 | // * Painting mode isn't implemented. | ||
3882 | 23 | // * Canvas width/height should is using content-box by default. IE in | ||
3883 | 24 | // Quirks mode will draw the canvas using border-box. Either change your | ||
3884 | 25 | // doctype to HTML5 | ||
3885 | 26 | // (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype) | ||
3886 | 27 | // or use Box Sizing Behavior from WebFX | ||
3887 | 28 | // (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html) | ||
3888 | 29 | // * Non uniform scaling does not correctly scale strokes. | ||
3889 | 30 | // * Optimize. There is always room for speed improvements. | ||
3890 | 31 | // Only add this code if we do not already have a canvas implementation | ||
3891 | 32 | |||
3892 | 33 | document.createElement("canvas").getContext||function(){function j(){return this.context_||(this.context_=new N(this))}function l(a,b,c){var d=k.call(arguments,2);return function(){return a.apply(b,d.concat(k.call(arguments)))}}function m(a){return String(a).replace(/&/g,"&").replace(/"/g,""")}function n(a,b,c){a.namespaces[b]||a.namespaces.add(b,c,"#default#VML")}function o(a){n(a,"g_vml_","urn:schemas-microsoft-com:vml"),n(a,"g_o_","urn:schemas-microsoft-com:office:office");if(!a.styleSheets.ex_canvas_){var b=a.createStyleSheet();b.owningElement.id="ex_canvas_",b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}function q(a){var b=a.srcElement;switch(a.propertyName){case"width":b.getContext().clearRect(),b.style.width=b.attributes.width.nodeValue+"px",b.firstChild&&(b.firstChild.style.width=b.clientWidth+"px");break;case"height":b.getContext().clearRect(),b.style.height=b.attributes.height.nodeValue+"px",b.firstChild&&(b.firstChild.style.height=b.clientHeight+"px")}}function r(a){var b=a.srcElement;b.firstChild&&(b.firstChild.style.width=b.clientWidth+"px",b.firstChild.style.height=b.clientHeight+"px")}function v(){return[[1,0,0],[0,1,0],[0,0,1]]}function w(a,b){var c=v();for(var d=0;d<3;d++)for(var e=0;e<3;e++){var f=0;for(var g=0;g<3;g++)f+=a[d][g]*b[g][e];c[d][e]=f}return c}function x(a,b){b.fillStyle=a.fillStyle,b.lineCap=a.lineCap,b.lineJoin=a.lineJoin,b.lineWidth=a.lineWidth,b.miterLimit=a.miterLimit,b.shadowBlur=a.shadowBlur,b.shadowColor=a.shadowColor,b.shadowOffsetX=a.shadowOffsetX,b.shadowOffsetY=a.shadowOffsetY,b.strokeStyle=a.strokeStyle,b.globalAlpha=a.globalAlpha,b.font=a.font,b.textAlign=a.textAlign,b.textBaseline=a.textBaseline,b.arcScaleX_=a.arcScaleX_,b.arcScaleY_=a.arcScaleY_,b.lineScale_=a.lineScale_}function z(a){var b=a.indexOf("(",3),c=a.indexOf(")",b+1),d=a.substring(b+1,c).split(",");if(d.length!=4||a.charAt(3)!="a")d[3]=1;return d}function A(a){return parseFloat(a)/100}function B(a,b,c){return Math.min(c,Math.max(b,a))}function C(a){var b,c,d,e,f,g;e=parseFloat(a[0])/360%360,e<0&&e++,f=B(A(a[1]),0,1),g=B(A(a[2]),0,1);if(f==0)b=c=d=g;else{var h=g<.5?g*(1+f):g+f-g*f,i=2*g-h;b=D(i,h,e+1/3),c=D(i,h,e),d=D(i,h,e-1/3)}return"#"+s[Math.floor(b*255)]+s[Math.floor(c*255)]+s[Math.floor(d*255)]}function D(a,b,c){return c<0&&c++,c>1&&c--,6*c<1?a+(b-a)*6*c:2*c<1?b:3*c<2?a+(b-a)*(2/3-c)*6:a}function F(a){if(a in E)return E[a];var b,c=1;a=String(a);if(a.charAt(0)=="#")b=a;else if(/^rgb/.test(a)){var d=z(a),b="#",e;for(var f=0;f<3;f++)d[f].indexOf("%")!=-1?e=Math.floor(A(d[f])*255):e=+d[f],b+=s[B(e,0,255)];c=+d[3]}else if(/^hsl/.test(a)){var d=z(a);b=C(d),c=d[3]}else b=y[a]||a;return E[a]={color:b,alpha:c}}function I(a){if(H[a])return H[a];var b=document.createElement("div"),c=b.style;try{c.font=a}catch(d){}return H[a]={style:c.fontStyle||G.style,variant:c.fontVariant||G.variant,weight:c.fontWeight||G.weight,size:c.fontSize||G.size,family:c.fontFamily||G.family}}function J(a,b){var c={};for(var d in a)c[d]=a[d];var e=parseFloat(b.currentStyle.fontSize),f=parseFloat(a.size);return typeof a.size=="number"?c.size=a.size:a.size.indexOf("px")!=-1?c.size=f:a.size.indexOf("em")!=-1?c.size=e*f:a.size.indexOf("%")!=-1?c.size=e/100*f:a.size.indexOf("pt")!=-1?c.size=f/.75:c.size=e,c}function K(a){return a.style+" "+a.variant+" "+a.weight+" "+a.size+"px "+a.family}function M(a){return L[a]||"square"}function N(a){this.m_=v(),this.mStack_=[],this.aStack_=[],this.currentPath_=[],this.strokeStyle="#000",this.fillStyle="#000",this.lineWidth=1,this.lineJoin="miter",this.lineCap="butt",this.miterLimit=g*1,this.globalAlpha=1,this.font="10px sans-serif",this.textAlign="left",this.textBaseline="alphabetic",this.canvas=a;var b="width:"+a.clientWidth+"px;height:"+a.clientHeight+"px;overflow:hidden;position:absolute",c=a.ownerDocument.createElement("div");c.style.cssText=b,a.appendChild(c);var d=c.cloneNode(!1);d.style.backgroundColor="red",d.style.filter="alpha(opacity=0)",a.appendChild(d),this.element_=c,this.arcScaleX_=1,this.arcScaleY_=1,this.lineScale_=1}function P(a,b,c,d){a.currentPath_.push({type:"bezierCurveTo",cp1x:b.x,cp1y:b.y,cp2x:c.x,cp2y:c.y,x:d.x,y:d.y}),a.currentX_=d.x,a.currentY_=d.y}function Q(a,b){var c=F(a.strokeStyle),d=c.color,e=c.alpha*a.globalAlpha,f=a.lineScale_*a.lineWidth;f<1&&(e*=f),b.push("<g_vml_:stroke",' opacity="',e,'"',' joinstyle="',a.lineJoin,'"',' miterlimit="',a.miterLimit,'"',' endcap="',M(a.lineCap),'"',' weight="',f,'px"',' color="',d,'" />')}function R(b,c,d,e){var f=b.fillStyle,h=b.arcScaleX_,i=b.arcScaleY_,j=e.x-d.x,k=e.y-d.y;if(f instanceof V){var l=0,m={x:0,y:0},n=0,o=1;if(f.type_=="gradient"){var p=f.x0_/h,q=f.y0_/i,r=f.x1_/h,s=f.y1_/i,t=S(b,p,q),u=S(b,r,s),v=u.x-t.x,w=u.y-t.y;l=Math.atan2(v,w)*180/Math.PI,l<0&&(l+=360),l<1e-6&&(l=0)}else{var t=S(b,f.x0_,f.y0_);m={x:(t.x-d.x)/j,y:(t.y-d.y)/k},j/=h*g,k/=i*g;var x=a.max(j,k);n=2*f.r0_/x,o=2*f.r1_/x-n}var y=f.colors_;y.sort(function(a,b){return a.offset-b.offset});var z=y.length,A=y[0].color,B=y[z-1].color,C=y[0].alpha*b.globalAlpha,D=y[z-1].alpha*b.globalAlpha,E=[];for(var G=0;G<z;G++){var H=y[G];E.push(H.offset*o+n+" "+H.color)}c.push('<g_vml_:fill type="',f.type_,'"',' method="none" focus="100%"',' color="',A,'"',' color2="',B,'"',' colors="',E.join(","),'"',' opacity="',D,'"',' g_o_:opacity2="',C,'"',' angle="',l,'"',' focusposition="',m.x,",",m.y,'" />')}else if(f instanceof W){if(j&&k){var I=-d.x,J=-d.y;c.push("<g_vml_:fill",' position="',I/j*h*h,",",J/k*i*i,'"',' type="tile"',' src="',f.src_,'" />')}}else{var K=F(b.fillStyle),L=K.color,M=K.alpha*b.globalAlpha;c.push('<g_vml_:fill color="',L,'" opacity="',M,'" />')}}function S(a,b,c){var d=a.m_;return{x:g*(b*d[0][0]+c*d[1][0]+d[2][0])-h,y:g*(b*d[0][1]+c*d[1][1]+d[2][1])-h}}function T(a){return isFinite(a[0][0])&&isFinite(a[0][1])&&isFinite(a[1][0])&&isFinite(a[1][1])&&isFinite(a[2][0])&&isFinite(a[2][1])}function U(a,b,c){if(!T(b))return;a.m_=b;if(c){var d=b[0][0]*b[1][1]-b[0][1]*b[1][0];a.lineScale_=f(e(d))}}function V(a){this.type_=a,this.x0_=0,this.y0_=0,this.r0_=0,this.x1_=0,this.y1_=0,this.r1_=0,this.colors_=[]}function W(a,b){Y(a);switch(b){case"repeat":case null:case"":this.repetition_="repeat";break;case"repeat-x":case"repeat-y":case"no-repeat":this.repetition_=b;break;default:X("SYNTAX_ERR")}this.src_=a.src,this.width_=a.width,this.height_=a.height}function X(a){throw new Z(a)}function Y(a){(!a||a.nodeType!=1||a.tagName!="IMG")&&X("TYPE_MISMATCH_ERR"),a.readyState!="complete"&&X("INVALID_STATE_ERR")}function Z(a){this.code=this[a],this.message=a+": DOM Exception "+this.code}var a=Math,b=a.round,c=a.sin,d=a.cos,e=a.abs,f=a.sqrt,g=10,h=g/2,i=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1],k=Array.prototype.slice;o(document);var p={init:function(a){var b=a||document;b.createElement("canvas"),b.attachEvent("onreadystatechange",l(this.init_,this,b))},init_:function(a){var b=a.getElementsByTagName("canvas");for(var c=0;c<b.length;c++)this.initElement(b[c])},initElement:function(a){if(!a.getContext){a.getContext=j,o(a.ownerDocument),a.innerHTML="",a.attachEvent("onpropertychange",q),a.attachEvent("onresize",r);var b=a.attributes;b.width&&b.width.specified?a.style.width=b.width.nodeValue+"px":a.width=a.clientWidth,b.height&&b.height.specified?a.style.height=b.height.nodeValue+"px":a.height=a.clientHeight}return a}};p.init();var s=[];for(var t=0;t<16;t++)for(var u=0;u<16;u++)s[t*16+u]=t.toString(16)+u.toString(16);var y={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",whitesmoke:"#F5F5F5",yellowgreen:"#9ACD32"},E={},G={style:"normal",variant:"normal",weight:"normal",size:10,family:"sans-serif"},H={},L={butt:"flat",round:"round"},O=N.prototype;O.clearRect=function(){this.textMeasureEl_&&(this.textMeasureEl_.removeNode(!0),this.textMeasureEl_=null),this.element_.innerHTML=""},O.beginPath=function(){this.currentPath_=[]},O.moveTo=function(a,b){var c=S(this,a,b);this.currentPath_.push({type:"moveTo",x:c.x,y:c.y}),this.currentX_=c.x,this.currentY_=c.y},O.lineTo=function(a,b){var c=S(this,a,b);this.currentPath_.push({type:"lineTo",x:c.x,y:c.y}),this.currentX_=c.x,this.currentY_=c.y},O.bezierCurveTo=function(a,b,c,d,e,f){var g=S(this,e,f),h=S(this,a,b),i=S(this,c,d);P(this,h,i,g)},O.quadraticCurveTo=function(a,b,c,d){var e=S(this,a,b),f=S(this,c,d),g={x:this.currentX_+2/3*(e.x-this.currentX_),y:this.currentY_+2/3*(e.y-this.currentY_)},h={x:g.x+(f.x-this.currentX_)/3,y:g.y+(f.y-this.currentY_)/3};P(this,g,h,f)},O.arc=function(a,b,f,i,j,k){f*=g;var l=k?"at":"wa",m=a+d(i)*f-h,n=b+c(i)*f-h,o=a+d(j)*f-h,p=b+c(j)*f-h;e(m-o)<1e-7&&!k&&(m+=.125),e(n-p)<1e-7&&k&&(n-=.125);var q=S(this,a,b),r=S(this,m,n),s=S(this,o,p);this.currentPath_.push({type:l,x:q.x,y:q.y,radius:f,xStart:r.x,yStart:r.y,xEnd:s.x,yEnd:s.y})},O.rect=function(a,b,c,d){this.moveTo(a,b),this.lineTo(a+c,b),this.lineTo(a+c,b+d),this.lineTo(a,b+d),this.closePath()},O.strokeRect=function(a,b,c,d){var e=this.currentPath_;this.beginPath(),this.moveTo(a,b),this.lineTo(a+c,b),this.lineTo(a+c,b+d),this.lineTo(a,b+d),this.closePath(),this.stroke(),this.currentPath_=e},O.fillRect=function(a,b,c,d){var e=this.currentPath_;this.beginPath(),this.moveTo(a,b),this.lineTo(a+c,b),this.lineTo(a+c,b+d),this.lineTo(a,b+d),this.closePath(),this.fill(),this.currentPath_=e},O.createLinearGradient=function(a,b,c,d){var e=new V("gradient");return e.x0_=a,e.y0_=b,e.x1_=c,e.y1_=d,e},O.createRadialGradient=function(a,b,c,d,e,f){var g=new V("gradientradial");return g.x0_=a,g.y0_=b,g.r0_=c,g.x1_=d,g.y1_=e,g.r1_=f,g},O.drawImage=function(c,d){var e,f,h,i,j,k,l,m,n=c.runtimeStyle.width,o=c.runtimeStyle.height;c.runtimeStyle.width="auto",c.runtimeStyle.height="auto";var p=c.width,q=c.height;c.runtimeStyle.width=n,c.runtimeStyle.height=o;if(arguments.length==3)e=arguments[1],f=arguments[2],j=k=0,l=h=p,m=i=q;else if(arguments.length==5)e=arguments[1],f=arguments[2],h=arguments[3],i=arguments[4],j=k=0,l=p,m=q;else if(arguments.length==9)j=arguments[1],k=arguments[2],l=arguments[3],m=arguments[4],e=arguments[5],f=arguments[6],h=arguments[7],i=arguments[8];else throw Error("Invalid number of arguments");var r=S(this,e,f),s=l/2,t=m/2,u=[],v=10,w=10;u.push(" <g_vml_:group",' coordsize="',g*v,",",g*w,'"',' coordorigin="0,0"',' style="width:',v,"px;height:",w,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var x=[];x.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",b(r.x/g),",","Dy=",b(r.y/g),"");var y=r,z=S(this,e+h,f),A=S(this,e,f+i),B=S(this,e+h,f+i);y.x=a.max(y.x,z.x,A.x,B.x),y.y=a.max(y.y,z.y,A.y,B.y),u.push("padding:0 ",b(y.x/g),"px ",b(y.y/g),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",x.join(""),", sizingmethod='clip');")}else u.push("top:",b(r.y/g),"px;left:",b(r.x/g),"px;");u.push(' ">','<g_vml_:image src="',c.src,'"',' style="width:',g*h,"px;"," height:",g*i,'px"',' cropleft="',j/p,'"',' croptop="',k/q,'"',' cropright="',(p-j-l)/p,'"',' cropbottom="',(q-k-m)/q,'"'," />","</g_vml_:group>"),this.element_.insertAdjacentHTML("BeforeEnd",u.join(""))},O.stroke=function(a){var c=[],d=!1,e=10,f=10;c.push("<g_vml_:shape",' filled="',!!a,'"',' style="position:absolute;width:',e,"px;height:",f,'px;"',' coordorigin="0,0"',' coordsize="',g*e,",",g*f,'"',' stroked="',!a,'"',' path="');var h=!1,i={x:null,y:null},j={x:null,y:null};for(var k=0;k<this.currentPath_.length;k++){var l=this.currentPath_[k],m;switch(l.type){case"moveTo":m=l,c.push(" m ",b(l.x),",",b(l.y));break;case"lineTo":c.push(" l ",b(l.x),",",b(l.y));break;case"close":c.push(" x "),l=null;break;case"bezierCurveTo":c.push(" c ",b(l.cp1x),",",b(l.cp1y),",",b(l.cp2x),",",b(l.cp2y),",",b(l.x),",",b(l.y));break;case"at":case"wa":c.push(" ",l.type," ",b(l.x-this.arcScaleX_*l.radius),",",b(l.y-this.arcScaleY_*l.radius)," ",b(l.x+this.arcScaleX_*l.radius),",",b(l.y+this.arcScaleY_*l.radius)," ",b(l.xStart),",",b(l.yStart)," ",b(l.xEnd),",",b(l.yEnd))}if(l){if(i.x==null||l.x<i.x)i.x=l.x;if(j.x==null||l.x>j.x)j.x=l.x;if(i.y==null||l.y<i.y)i.y=l.y;if(j.y==null||l.y>j.y)j.y=l.y}}c.push(' ">'),a?R(this,c,i,j):Q(this,c),c.push("</g_vml_:shape>"),this.element_.insertAdjacentHTML("beforeEnd",c.join(""))},O.fill=function(){this.stroke(!0)},O.closePath=function(){this.currentPath_.push({type:"close"})},O.save=function(){var a={};x(this,a),this.aStack_.push(a),this.mStack_.push(this.m_),this.m_=w(v(),this.m_)},O.restore=function(){this.aStack_.length&&(x(this.aStack_.pop(),this),this.m_=this.mStack_.pop())},O.translate=function(a,b){var c=[[1,0,0],[0,1,0],[a,b,1]];U(this,w(c,this.m_),!1)},O.rotate=function(a){var b=d(a),e=c(a),f=[[b,e,0],[-e,b,0],[0,0,1]];U(this,w(f,this.m_),!1)},O.scale=function(a,b){this.arcScaleX_*=a,this.arcScaleY_*=b;var c=[[a,0,0],[0,b,0],[0,0,1]];U(this,w(c,this.m_),!0)},O.transform=function(a,b,c,d,e,f){var g=[[a,b,0],[c,d,0],[e,f,1]];U(this,w(g,this.m_),!0)},O.setTransform=function(a,b,c,d,e,f){var g=[[a,b,0],[c,d,0],[e,f,1]];U(this,g,!0)},O.drawText_=function(a,c,d,e,f){var h=this.m_,i=1e3,j=0,k=i,l={x:0,y:0},n=[],o=J(I(this.font),this.element_),p=K(o),q=this.element_.currentStyle,r=this.textAlign.toLowerCase();switch(r){case"left":case"center":case"right":break;case"end":r=q.direction=="ltr"?"right":"left";break;case"start":r=q.direction=="rtl"?"right":"left";break;default:r="left"}switch(this.textBaseline){case"hanging":case"top":l.y=o.size/1.75;break;case"middle":break;default:case null:case"alphabetic":case"ideographic":case"bottom":l.y=-o.size/2.25}switch(r){case"right":j=i,k=.05;break;case"center":j=k=i/2}var s=S(this,c+l.x,d+l.y);n.push('<g_vml_:line from="',-j,' 0" to="',k,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!f,'" stroked="',!!f,'" style="position:absolute;width:1px;height:1px;">'),f?Q(this,n):R(this,n,{x:-j,y:0},{x:k,y:o.size});var t=h[0][0].toFixed(3)+","+h[1][0].toFixed(3)+","+h[0][1].toFixed(3)+","+h[1][1].toFixed(3)+",0,0",u=b(s.x/g)+","+b(s.y/g);n.push('<g_vml_:skew on="t" matrix="',t,'" ',' offset="',u,'" origin="',j,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',m(a),'" style="v-text-align:',r,";font:",m(p),'" /></g_vml_:line>'),this.element_.insertAdjacentHTML("beforeEnd",n.join(""))},O.fillText=function(a,b,c,d){this.drawText_(a,b,c,d,!1)},O.strokeText=function(a,b,c,d){this.drawText_(a,b,c,d,!0)},O.measureText=function(a){if(!this.textMeasureEl_){var b='<span style="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;"></span>';this.element_.insertAdjacentHTML("beforeEnd",b),this.textMeasureEl_=this.element_.lastChild}var c=this.element_.ownerDocument;return this.textMeasureEl_.innerHTML="",this.textMeasureEl_.style.font=this.font,this.textMeasureEl_.appendChild(c.createTextNode(a)),{width:this.textMeasureEl_.offsetWidth}},O.clip=function(){},O.arcTo=function(){},O.createPattern=function(a,b){return new W(a,b)},V.prototype.addColorStop=function(a,b){b=F(b),this.colors_.push({offset:a,color:b.color,alpha:b.alpha})};var $=Z.prototype=new Error;$.INDEX_SIZE_ERR=1,$.DOMSTRING_SIZE_ERR=2,$.HIERARCHY_REQUEST_ERR=3,$.WRONG_DOCUMENT_ERR=4,$.INVALID_CHARACTER_ERR=5,$.NO_DATA_ALLOWED_ERR=6,$.NO_MODIFICATION_ALLOWED_ERR=7,$.NOT_FOUND_ERR=8,$.NOT_SUPPORTED_ERR=9,$.INUSE_ATTRIBUTE_ERR=10,$.INVALID_STATE_ERR=11,$.SYNTAX_ERR=12,$.INVALID_MODIFICATION_ERR=13,$.NAMESPACE_ERR=14,$.INVALID_ACCESS_ERR=15,$.VALIDATION_ERR=16,$.TYPE_MISMATCH_ERR=17,G_vmlCanvasManager=p,CanvasRenderingContext2D=N,CanvasGradient=V,CanvasPattern=W,DOMException=Z}(),function(){function c(b){var c,d,e,f,g,h;e=b.length,d=0,c="";while(d<e){f=b.charCodeAt(d++)&255;if(d==e){c+=a.charAt(f>>2),c+=a.charAt((f&3)<<4),c+="==";break}g=b.charCodeAt(d++);if(d==e){c+=a.charAt(f>>2),c+=a.charAt((f&3)<<4|(g&240)>>4),c+=a.charAt((g&15)<<2),c+="=";break}h=b.charCodeAt(d++),c+=a.charAt(f>>2),c+=a.charAt((f&3)<<4|(g&240)>>4),c+=a.charAt((g&15)<<2|(h&192)>>6),c+=a.charAt(h&63)}return c}function d(a){var c,d,e,f,g,h,i;h=a.length,g=0,i="";while(g<h){do c=b[a.charCodeAt(g++)&255];while(g<h&&c==-1);if(c==-1)break;do d=b[a.charCodeAt(g++)&255];while(g<h&&d==-1);if(d==-1)break;i+=String.fromCharCode(c<<2|(d&48)>>4);do{e=a.charCodeAt(g++)&255;if(e==61)return i;e=b[e]}while(g<h&&e==-1);if(e==-1)break;i+=String.fromCharCode((d&15)<<4|(e&60)>>2);do{f=a.charCodeAt(g++)&255;if(f==61)return i;f=b[f]}while(g<h&&f==-1);if(f==-1)break;i+=String.fromCharCode((e&3)<<6|f)}return i}var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1];window.btoa||(window.btoa=c),window.atob||(window.atob=d)}();var CanvasText={letters:{"\n":{width:-1,points:[]}," ":{width:10,points:[]},"!":{width:10,points:[[5,21],[5,7],null,[5,2],[4,1],[5,0],[6,1],[5,2]]},'"':{width:16,points:[[4,21],[4,14],null,[12,21],[12,14]]},"#":{width:21,points:[[11,25],[4,-7],null,[17,25],[10,-7],null,[4,12],[18,12],null,[3,6],[17,6]]},$:{width:20,points:[[8,25],[8,-4],null,[12,25],[12,-4],null,[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},"%":{width:24,points:[[21,21],[3,0],null,[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],null,[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]]},"&":{width:26,points:[[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]]},"'":{width:10,points:[[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]]},"(":{width:14,points:[[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]]},")":{width:14,points:[[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]]},"*":{width:16,points:[[8,21],[8,9],null,[3,18],[13,12],null,[13,18],[3,12]]},"+":{width:26,points:[[13,18],[13,0],null,[4,9],[22,9]]},",":{width:10,points:[[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]]},"-":{width:26,points:[[4,9],[22,9]]},".":{width:10,points:[[5,2],[4,1],[5,0],[6,1],[5,2]]},"/":{width:22,points:[[20,25],[2,-7]]},0:{width:20,points:[[9,21],[6,20],[4,17],[3,12],[3,9],[4,4],[6,1],[9,0],[11,0],[14,1],[16,4],[17,9],[17,12],[16,17],[14,20],[11,21],[9,21]]},1:{width:20,points:[[6,17],[8,18],[11,21],[11,0]]},2:{width:20,points:[[4,16],[4,17],[5,19],[6,20],[8,21],[12,21],[14,20],[15,19],[16,17],[16,15],[15,13],[13,10],[3,0],[17,0]]},3:{width:20,points:[[5,21],[16,21],[10,13],[13,13],[15,12],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]]},4:{width:20,points:[[13,21],[3,7],[18,7],null,[13,21],[13,0]]},5:{width:20,points:[[15,21],[5,21],[4,12],[5,13],[8,14],[11,14],[14,13],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]]},6:{width:20,points:[[16,18],[15,20],[12,21],[10,21],[7,20],[5,17],[4,12],[4,7],[5,3],[7,1],[10,0],[11,0],[14,1],[16,3],[17,6],[17,7],[16,10],[14,12],[11,13],[10,13],[7,12],[5,10],[4,7]]},7:{width:20,points:[[17,21],[7,0],null,[3,21],[17,21]]},8:{width:20,points:[[8,21],[5,20],[4,18],[4,16],[5,14],[7,13],[11,12],[14,11],[16,9],[17,7],[17,4],[16,2],[15,1],[12,0],[8,0],[5,1],[4,2],[3,4],[3,7],[4,9],[6,11],[9,12],[13,13],[15,14],[16,16],[16,18],[15,20],[12,21],[8,21]]},9:{width:20,points:[[16,14],[15,11],[13,9],[10,8],[9,8],[6,9],[4,11],[3,14],[3,15],[4,18],[6,20],[9,21],[10,21],[13,20],[15,18],[16,14],[16,9],[15,4],[13,1],[10,0],[8,0],[5,1],[4,3]]},":":{width:10,points:[[5,14],[4,13],[5,12],[6,13],[5,14],null,[5,2],[4,1],[5,0],[6,1],[5,2]]},";":{width:10,points:[[5,14],[4,13],[5,12],[6,13],[5,14],null,[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]]},"<":{width:24,points:[[20,18],[4,9],[20,0]]},"=":{width:26,points:[[4,12],[22,12],null,[4,6],[22,6]]},">":{width:24,points:[[4,18],[20,9],[4,0]]},"?":{width:18,points:[[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],null,[9,2],[8,1],[9,0],[10,1],[9,2]]},"@":{width:27,points:[[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],null,[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],null,[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],null,[19,16],[18,8],[18,6],[19,5]]},A:{width:18,points:[[9,21],[1,0],null,[9,21],[17,0],null,[4,7],[14,7]]},B:{width:21,points:[[4,21],[4,0],null,[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],null,[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]]},C:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]]},D:{width:21,points:[[4,21],[4,0],null,[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]]},E:{width:19,points:[[4,21],[4,0],null,[4,21],[17,21],null,[4,11],[12,11],null,[4,0],[17,0]]},F:{width:18,points:[[4,21],[4,0],null,[4,21],[17,21],null,[4,11],[12,11]]},G:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],null,[13,8],[18,8]]},H:{width:22,points:[[4,21],[4,0],null,[18,21],[18,0],null,[4,11],[18,11]]},I:{width:8,points:[[4,21],[4,0]]},J:{width:16,points:[[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]]},K:{width:21,points:[[4,21],[4,0],null,[18,21],[4,7],null,[9,12],[18,0]]},L:{width:17,points:[[4,21],[4,0],null,[4,0],[16,0]]},M:{width:24,points:[[4,21],[4,0],null,[4,21],[12,0],null,[20,21],[12,0],null,[20,21],[20,0]]},N:{width:22,points:[[4,21],[4,0],null,[4,21],[18,0],null,[18,21],[18,0]]},O:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]]},P:{width:21,points:[[4,21],[4,0],null,[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]]},Q:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],null,[12,4],[18,-2]]},R:{width:21,points:[[4,21],[4,0],null,[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],null,[11,11],[18,0]]},S:{width:20,points:[[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},T:{width:16,points:[[8,21],[8,0],null,[1,21],[15,21]]},U:{width:22,points:[[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]]},V:{width:18,points:[[1,21],[9,0],null,[17,21],[9,0]]},W:{width:24,points:[[2,21],[7,0],null,[12,21],[7,0],null,[12,21],[17,0],null,[22,21],[17,0]]},X:{width:20,points:[[3,21],[17,0],null,[17,21],[3,0]]},Y:{width:18,points:[[1,21],[9,11],[9,0],null,[17,21],[9,11]]},Z:{width:20,points:[[17,21],[3,0],null,[3,21],[17,21],null,[3,0],[17,0]]},"[":{width:14,points:[[4,25],[4,-7],null,[5,25],[5,-7],null,[4,25],[11,25],null,[4,-7],[11,-7]]},"\\":{width:14,points:[[0,21],[14,-3]]},"]":{width:14,points:[[9,25],[9,-7],null,[10,25],[10,-7],null,[3,25],[10,25],null,[3,-7],[10,-7]]},"^":{width:14,points:[[3,10],[8,18],[13,10]]},_:{width:16,points:[[0,-2],[16,-2]]},"`":{width:10,points:[[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]]},a:{width:19,points:[[15,14],[15,0],null,[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},b:{width:19,points:[[4,21],[4,0],null,[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},c:{width:18,points:[[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},d:{width:19,points:[[15,21],[15,0],null,[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},e:{width:18,points:[[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},f:{width:12,points:[[10,21],[8,21],[6,20],[5,17],[5,0],null,[2,14],[9,14]]},g:{width:19,points:[[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],null,[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},h:{width:19,points:[[4,21],[4,0],null,[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},i:{width:8,points:[[3,21],[4,20],[5,21],[4,22],[3,21],null,[4,14],[4,0]]},j:{width:10,points:[[5,21],[6,20],[7,21],[6,22],[5,21],null,[6,14],[6,-3],[5,-6],[3,-7],[1,-7]]},k:{width:17,points:[[4,21],[4,0],null,[14,14],[4,4],null,[8,8],[15,0]]},l:{width:8,points:[[4,21],[4,0]]},m:{width:30,points:[[4,14],[4,0],null,[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],null,[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]]},n:{width:19,points:[[4,14],[4,0],null,[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},o:{width:19,points:[[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]]},p:{width:19,points:[[4,14],[4,-7],null,[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},q:{width:19,points:[[15,14],[15,-7],null,[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},r:{width:13,points:[[4,14],[4,0],null,[4,8],[5,11],[7,13],[9,14],[12,14]]},s:{width:17,points:[[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]]},t:{width:12,points:[[5,21],[5,4],[6,1],[8,0],[10,0],null,[2,14],[9,14]]},u:{width:19,points:[[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],null,[15,14],[15,0]]},v:{width:16,points:[[2,14],[8,0],null,[14,14],[8,0]]},w:{width:22,points:[[3,14],[7,0],null,[11,14],[7,0],null,[11,14],[15,0],null,[19,14],[15,0]]},x:{width:17,points:[[3,14],[14,0],null,[14,14],[3,0]]},y:{width:16,points:[[2,14],[8,0],null,[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]]},z:{width:17,points:[[14,14],[3,0],null,[3,14],[14,14],null,[3,0],[14,0]]},"{":{width:14,points:[[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],null,[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],null,[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]]},"|":{width:8,points:[[4,25],[4,-7]]},"}":{width:14,points:[[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],null,[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],null,[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]]},"~":{width:24,points:[[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],null,[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]]},"�":{diacritic:"`",letter:"a"},"�":{diacritic:"�",letter:"a"},"�":{diacritic:"^",letter:"a"},"�":{diacritic:"�",letter:"a"},"�":{diacritic:"~",letter:"a"},"�":{diacritic:"`",letter:"e"},"�":{diacritic:"�",letter:"e"},"�":{diacritic:"^",letter:"e"},"�":{diacritic:"�",letter:"e"},"�":{diacritic:"`",letter:"i"},"�":{diacritic:"�",letter:"i"},"�":{diacritic:"^",letter:"i"},"�":{diacritic:"�",letter:"i"},"�":{diacritic:"`",letter:"o"},"�":{diacritic:"�",letter:"o"},"�":{diacritic:"^",letter:"o"},"�":{diacritic:"�",letter:"o"},"�":{diacritic:"~",letter:"o"},"�":{diacritic:"`",letter:"u"},"�":{diacritic:"�",letter:"u"},"�":{diacritic:"^",letter:"u"},"�":{diacritic:"�",letter:"u"},"�":{diacritic:"�",letter:"y"},"�":{diacritic:"�",letter:"y"},"�":{diacritic:"�",letter:"c"},"�":{diacritic:"~",letter:"n"},"�":{diacritic:"`",letter:"A"},"�":{diacritic:"�",letter:"A"},"�":{diacritic:"^",letter:"A"},"�":{diacritic:"�",letter:"A"},"�":{diacritic:"~",letter:"A"},"�":{diacritic:"`",letter:"E"},"�":{diacritic:"�",letter:"E"},"�":{diacritic:"^",letter:"E"},"�":{diacritic:"�",letter:"E"},"�":{diacritic:"`",letter:"I"},"�":{diacritic:"�",letter:"I"},"�":{diacritic:"^",letter:"I"},"�":{diacritic:"�",letter:"I"},"�":{diacritic:"`",letter:"O"},"�":{diacritic:"�",letter:"O"},"�":{diacritic:"^",letter:"O"},"�":{diacritic:"�",letter:"O"},"�":{diacritic:"~",letter:"O"},"�":{diacritic:"`",letter:"U"},"�":{diacritic:"�",letter:"U"},"�":{diacritic:"^",letter:"U"},"�":{diacritic:"�",letter:"U"},"�":{diacritic:"�",letter:"Y"},"�":{diacritic:"�",letter:"C"},"�":{diacritic:"~",letter:"N"}},specialchars:{pi:{width:19,points:[[6,14],[6,0],null,[14,14],[14,0],null,[2,13],[6,16],[13,13],[17,16]]}},diacritics:{"�":{entity:"cedil",points:[[6,-4],[4,-6],[2,-7],[1,-7]]},"�":{entity:"acute",points:[[8,19],[13,22]]},"`":{entity:"grave",points:[[7,22],[12,19]]},"^":{entity:"circ",points:[[5.5,19],[9.5,23],[12.5,19]]},"�":{entity:"trema",points:[[5,21],[6,20],[7,21],[6,22],[5,21],null,[12,21],[13,20],[14,21],[13,22],[12,21]]},"~":{entity:"tilde",points:[[4,18],[7,22],[10,18],[13,22]]}},style:{size:8,font:null,color:"#000000",weight:1,textAlign:"left",textBaseline:"bottom",adjustAlign:!1,angle:0,tracking:1,boundingBoxColor:"#ff0000",originPointColor:"#000000"},debug:!1,_bufferLexemes:{},extend:function(a,b){for(var c in b){if(c in a)continue;a[c]=b[c]}return a},letter:function(a){return CanvasText.letters[a]},parseLexemes:function(a){if(CanvasText._bufferLexemes[a])return CanvasText._bufferLexemes[a];var b,c,d=a.match(/&[A-Za-z]{2,5};|\s|./g),e=[],f=[];for(b=0;b<d.length;b++){c=d[b];if(c.length==1)f.push(c);else{var g=c.substring(1,c.length-1);CanvasText.specialchars[g]?f.push(g):f=f.concat(c.toArray())}}for(b=0;b<f.length;b++)c=f[b],(c=CanvasText.letters[c]||CanvasText.specialchars[c])&&e.push(c);for(b=0;b<e.length;b++)(e===null||typeof e=="undefined")&&delete e[b];return CanvasText._bufferLexemes[a]=e},ascent:function(a){return a=a||CanvasText.style,a.size||CanvasText.style.size},descent:function(a){return a=a||CanvasText.style,7*(a.size||CanvasText.style.size)/25},measure:function(a,b){if(!a)return;b=b||CanvasText.style;var d,e,f=CanvasText.parseLexemes(a),g=0;for(d=f.length-1;d>-1;--d)c=f[d],e=c.diacritic?CanvasText.letter(c.letter).width:c.width,g+=e*(b.tracking||CanvasText.style.tracking)*(b.size||CanvasText.style.size)/25;return g},getDimensions:function(a,b){b=b||CanvasText.style;var c=CanvasText.measure(a,b),d=b.size||CanvasText.style.size,e=b.angle||CanvasText.style.angle;return b.angle==0?{width:c,height:d}:{width:Math.abs(Math.cos(e)*c)+Math.abs(Math.sin(e)*d),height:Math.abs(Math.sin(e)*c)+Math.abs(Math.cos(e)*d)}},drawPoints:function(a,b,c,d,e,f){var g,h,i=!0,j=0;f=f||{x:0,y:0},a.beginPath();for(g=0;g<b.length;g++){h=b[g];if(!h){i=!0;continue}i?(a.moveTo(c+h[0]*e+f.x,d-h[1]*e+f.y),i=!1):a.lineTo(c+h[0]*e+f.x,d-h[1]*e+f.y)}a.stroke(),a.closePath()},draw:function(a,b,c,d){if(!a)return;CanvasText.extend(d,CanvasText.style);var e,f,g=0,h=d.size/25,i=0,j=0,k=CanvasText.parseLexemes(a),l={x:0,y:0},m=CanvasText.measure(a,d),n;d.adjustAlign&&(n=CanvasText.getBestAlign(d.angle,d),CanvasText.extend(d,n));switch(d.textAlign){case"left":break;case"center":l.x=-m/2;break;case"right":l.x=-m}switch(d.textBaseline){case"bottom":break;case"middle":l.y=d.size/2;break;case"top":l.y=d.size}this.save(),this.translate(b,c),this.rotate(d.angle),this.lineCap="round",this.lineWidth=2*h*(d.weight||CanvasText.style.weight),this.strokeStyle=d.color||CanvasText.style.color;for(e=0;e<k.length;e++){f=k[e];if(f.width==-1){i=0,j=d.size*1.4;continue}var o=f.points,p=f.width;if(f.diacritic){var q=CanvasText.diacritics[f.diacritic],r=CanvasText.letter(f.letter);CanvasText.drawPoints(this,q.points,i,j-(f.letter.toUpperCase()==f.letter?3:0),h,l),o=r.points,p=r.width}CanvasText.drawPoints(this,o,i,j,h,l),CanvasText.debug&&(this.save(),this.lineJoin="miter",this.lineWidth=.5,this.strokeStyle=d.boundingBoxColor||CanvasText.style.boundingBoxColor,this.strokeRect(i+l.x,j+l.y,p*h,-d.size),this.fillStyle=d.originPointColor||CanvasText.style.originPointColor,this.beginPath(),this.arc(0,0,1.5,0,Math.PI*2,!0),this.fill(),this.closePath(),this.restore()),i+=p*h*(d.tracking||CanvasText.style.tracking)}return this.restore(),g}};CanvasText.proto=window.CanvasRenderingContext2D?window.CanvasRenderingContext2D.prototype:document.createElement("canvas").getContext("2d").__proto__,CanvasText.proto&&(CanvasText.proto.drawText=CanvasText.draw,CanvasText.proto.measure=CanvasText.measure,CanvasText.proto.getTextBounds=CanvasText.getDimensions,CanvasText.proto.fontAscent=CanvasText.ascent,CanvasText.proto.fontDescent=CanvasText.descent) | ||
3893 | 34 | \ No newline at end of file | 0 | \ No newline at end of file |
3894 | 35 | 1 | ||
3895 | === removed file 'addons/web_graph/static/lib/flotr2/flotr2.js' | |||
3896 | --- addons/web_graph/static/lib/flotr2/flotr2.js 2012-05-07 08:19:08 +0000 | |||
3897 | +++ addons/web_graph/static/lib/flotr2/flotr2.js 1970-01-01 00:00:00 +0000 | |||
3898 | @@ -1,6865 +0,0 @@ | |||
3899 | 1 | /*! | ||
3900 | 2 | * bean.js - copyright Jacob Thornton 2011 | ||
3901 | 3 | * https://github.com/fat/bean | ||
3902 | 4 | * MIT License | ||
3903 | 5 | * special thanks to: | ||
3904 | 6 | * dean edwards: http://dean.edwards.name/ | ||
3905 | 7 | * dperini: https://github.com/dperini/nwevents | ||
3906 | 8 | * the entire mootools team: github.com/mootools/mootools-core | ||
3907 | 9 | */ | ||
3908 | 10 | /*global module:true, define:true*/ | ||
3909 | 11 | !function (name, context, definition) { | ||
3910 | 12 | if (typeof module !== 'undefined') module.exports = definition(name, context); | ||
3911 | 13 | else if (typeof define === 'function' && typeof define.amd === 'object') define(definition); | ||
3912 | 14 | else context[name] = definition(name, context); | ||
3913 | 15 | }('bean', this, function (name, context) { | ||
3914 | 16 | var win = window | ||
3915 | 17 | , old = context[name] | ||
3916 | 18 | , overOut = /over|out/ | ||
3917 | 19 | , namespaceRegex = /[^\.]*(?=\..*)\.|.*/ | ||
3918 | 20 | , nameRegex = /\..*/ | ||
3919 | 21 | , addEvent = 'addEventListener' | ||
3920 | 22 | , attachEvent = 'attachEvent' | ||
3921 | 23 | , removeEvent = 'removeEventListener' | ||
3922 | 24 | , detachEvent = 'detachEvent' | ||
3923 | 25 | , doc = document || {} | ||
3924 | 26 | , root = doc.documentElement || {} | ||
3925 | 27 | , W3C_MODEL = root[addEvent] | ||
3926 | 28 | , eventSupport = W3C_MODEL ? addEvent : attachEvent | ||
3927 | 29 | , slice = Array.prototype.slice | ||
3928 | 30 | , mouseTypeRegex = /click|mouse|menu|drag|drop/i | ||
3929 | 31 | , touchTypeRegex = /^touch|^gesture/i | ||
3930 | 32 | , ONE = { one: 1 } // singleton for quick matching making add() do one() | ||
3931 | 33 | |||
3932 | 34 | , nativeEvents = (function (hash, events, i) { | ||
3933 | 35 | for (i = 0; i < events.length; i++) | ||
3934 | 36 | hash[events[i]] = 1 | ||
3935 | 37 | return hash | ||
3936 | 38 | })({}, ( | ||
3937 | 39 | 'click dblclick mouseup mousedown contextmenu ' + // mouse buttons | ||
3938 | 40 | 'mousewheel DOMMouseScroll ' + // mouse wheel | ||
3939 | 41 | 'mouseover mouseout mousemove selectstart selectend ' + // mouse movement | ||
3940 | 42 | 'keydown keypress keyup ' + // keyboard | ||
3941 | 43 | 'orientationchange ' + // mobile | ||
3942 | 44 | 'focus blur change reset select submit ' + // form elements | ||
3943 | 45 | 'load unload beforeunload resize move DOMContentLoaded readystatechange ' + // window | ||
3944 | 46 | 'error abort scroll ' + // misc | ||
3945 | 47 | (W3C_MODEL ? // element.fireEvent('onXYZ'... is not forgiving if we try to fire an event | ||
3946 | 48 | // that doesn't actually exist, so make sure we only do these on newer browsers | ||
3947 | 49 | 'show ' + // mouse buttons | ||
3948 | 50 | 'input invalid ' + // form elements | ||
3949 | 51 | 'touchstart touchmove touchend touchcancel ' + // touch | ||
3950 | 52 | 'gesturestart gesturechange gestureend ' + // gesture | ||
3951 | 53 | 'message readystatechange pageshow pagehide popstate ' + // window | ||
3952 | 54 | 'hashchange offline online ' + // window | ||
3953 | 55 | 'afterprint beforeprint ' + // printing | ||
3954 | 56 | 'dragstart dragenter dragover dragleave drag drop dragend ' + // dnd | ||
3955 | 57 | 'loadstart progress suspend emptied stalled loadmetadata ' + // media | ||
3956 | 58 | 'loadeddata canplay canplaythrough playing waiting seeking ' + // media | ||
3957 | 59 | 'seeked ended durationchange timeupdate play pause ratechange ' + // media | ||
3958 | 60 | 'volumechange cuechange ' + // media | ||
3959 | 61 | 'checking noupdate downloading cached updateready obsolete ' + // appcache | ||
3960 | 62 | '' : '') | ||
3961 | 63 | ).split(' ') | ||
3962 | 64 | ) | ||
3963 | 65 | |||
3964 | 66 | , customEvents = (function () { | ||
3965 | 67 | function isDescendant(parent, node) { | ||
3966 | 68 | while ((node = node.parentNode) !== null) { | ||
3967 | 69 | if (node === parent) return true | ||
3968 | 70 | } | ||
3969 | 71 | return false | ||
3970 | 72 | } | ||
3971 | 73 | |||
3972 | 74 | function check(event) { | ||
3973 | 75 | var related = event.relatedTarget | ||
3974 | 76 | if (!related) return related === null | ||
3975 | 77 | return (related !== this && related.prefix !== 'xul' && !/document/.test(this.toString()) && !isDescendant(this, related)) | ||
3976 | 78 | } | ||
3977 | 79 | |||
3978 | 80 | return { | ||
3979 | 81 | mouseenter: { base: 'mouseover', condition: check } | ||
3980 | 82 | , mouseleave: { base: 'mouseout', condition: check } | ||
3981 | 83 | , mousewheel: { base: /Firefox/.test(navigator.userAgent) ? 'DOMMouseScroll' : 'mousewheel' } | ||
3982 | 84 | } | ||
3983 | 85 | })() | ||
3984 | 86 | |||
3985 | 87 | , fixEvent = (function () { | ||
3986 | 88 | var commonProps = 'altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which'.split(' ') | ||
3987 | 89 | , mouseProps = commonProps.concat('button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement'.split(' ')) | ||
3988 | 90 | , keyProps = commonProps.concat('char charCode key keyCode'.split(' ')) | ||
3989 | 91 | , touchProps = commonProps.concat('touches targetTouches changedTouches scale rotation'.split(' ')) | ||
3990 | 92 | , preventDefault = 'preventDefault' | ||
3991 | 93 | , createPreventDefault = function (event) { | ||
3992 | 94 | return function () { | ||
3993 | 95 | if (event[preventDefault]) | ||
3994 | 96 | event[preventDefault]() | ||
3995 | 97 | else | ||
3996 | 98 | event.returnValue = false | ||
3997 | 99 | } | ||
3998 | 100 | } | ||
3999 | 101 | , stopPropagation = 'stopPropagation' | ||
4000 | 102 | , createStopPropagation = function (event) { | ||
4001 | 103 | return function () { | ||
4002 | 104 | if (event[stopPropagation]) | ||
4003 | 105 | event[stopPropagation]() | ||
4004 | 106 | else | ||
4005 | 107 | event.cancelBubble = true | ||
4006 | 108 | } | ||
4007 | 109 | } | ||
4008 | 110 | , createStop = function (synEvent) { | ||
4009 | 111 | return function () { | ||
4010 | 112 | synEvent[preventDefault]() | ||
4011 | 113 | synEvent[stopPropagation]() | ||
4012 | 114 | synEvent.stopped = true | ||
4013 | 115 | } | ||
4014 | 116 | } | ||
4015 | 117 | , copyProps = function (event, result, props) { | ||
4016 | 118 | var i, p | ||
4017 | 119 | for (i = props.length; i--;) { | ||
4018 | 120 | p = props[i] | ||
4019 | 121 | if (!(p in result) && p in event) result[p] = event[p] | ||
4020 | 122 | } | ||
4021 | 123 | } | ||
4022 | 124 | |||
4023 | 125 | return function (event, isNative) { | ||
4024 | 126 | var result = { originalEvent: event, isNative: isNative } | ||
4025 | 127 | if (!event) | ||
4026 | 128 | return result | ||
4027 | 129 | |||
4028 | 130 | var props | ||
4029 | 131 | , type = event.type | ||
4030 | 132 | , target = event.target || event.srcElement | ||
4031 | 133 | |||
4032 | 134 | result[preventDefault] = createPreventDefault(event) | ||
4033 | 135 | result[stopPropagation] = createStopPropagation(event) | ||
4034 | 136 | result.stop = createStop(result) | ||
4035 | 137 | result.target = target && target.nodeType === 3 ? target.parentNode : target | ||
4036 | 138 | |||
4037 | 139 | if (isNative) { // we only need basic augmentation on custom events, the rest is too expensive | ||
4038 | 140 | if (type.indexOf('key') !== -1) { | ||
4039 | 141 | props = keyProps | ||
4040 | 142 | result.keyCode = event.which || event.keyCode | ||
4041 | 143 | } else if (mouseTypeRegex.test(type)) { | ||
4042 | 144 | props = mouseProps | ||
4043 | 145 | result.rightClick = event.which === 3 || event.button === 2 | ||
4044 | 146 | result.pos = { x: 0, y: 0 } | ||
4045 | 147 | if (event.pageX || event.pageY) { | ||
4046 | 148 | result.clientX = event.pageX | ||
4047 | 149 | result.clientY = event.pageY | ||
4048 | 150 | } else if (event.clientX || event.clientY) { | ||
4049 | 151 | result.clientX = event.clientX + doc.body.scrollLeft + root.scrollLeft | ||
4050 | 152 | result.clientY = event.clientY + doc.body.scrollTop + root.scrollTop | ||
4051 | 153 | } | ||
4052 | 154 | if (overOut.test(type)) | ||
4053 | 155 | result.relatedTarget = event.relatedTarget || event[(type === 'mouseover' ? 'from' : 'to') + 'Element'] | ||
4054 | 156 | } else if (touchTypeRegex.test(type)) { | ||
4055 | 157 | props = touchProps | ||
4056 | 158 | } | ||
4057 | 159 | copyProps(event, result, props || commonProps) | ||
4058 | 160 | } | ||
4059 | 161 | return result | ||
4060 | 162 | } | ||
4061 | 163 | })() | ||
4062 | 164 | |||
4063 | 165 | // if we're in old IE we can't do onpropertychange on doc or win so we use doc.documentElement for both | ||
4064 | 166 | , targetElement = function (element, isNative) { | ||
4065 | 167 | return !W3C_MODEL && !isNative && (element === doc || element === win) ? root : element | ||
4066 | 168 | } | ||
4067 | 169 | |||
4068 | 170 | // we use one of these per listener, of any type | ||
4069 | 171 | , RegEntry = (function () { | ||
4070 | 172 | function entry(element, type, handler, original, namespaces) { | ||
4071 | 173 | this.element = element | ||
4072 | 174 | this.type = type | ||
4073 | 175 | this.handler = handler | ||
4074 | 176 | this.original = original | ||
4075 | 177 | this.namespaces = namespaces | ||
4076 | 178 | this.custom = customEvents[type] | ||
4077 | 179 | this.isNative = nativeEvents[type] && element[eventSupport] | ||
4078 | 180 | this.eventType = W3C_MODEL || this.isNative ? type : 'propertychange' | ||
4079 | 181 | this.customType = !W3C_MODEL && !this.isNative && type | ||
4080 | 182 | this.target = targetElement(element, this.isNative) | ||
4081 | 183 | this.eventSupport = this.target[eventSupport] | ||
4082 | 184 | } | ||
4083 | 185 | |||
4084 | 186 | entry.prototype = { | ||
4085 | 187 | // given a list of namespaces, is our entry in any of them? | ||
4086 | 188 | inNamespaces: function (checkNamespaces) { | ||
4087 | 189 | var i, j | ||
4088 | 190 | if (!checkNamespaces) | ||
4089 | 191 | return true | ||
4090 | 192 | if (!this.namespaces) | ||
4091 | 193 | return false | ||
4092 | 194 | for (i = checkNamespaces.length; i--;) { | ||
4093 | 195 | for (j = this.namespaces.length; j--;) { | ||
4094 | 196 | if (checkNamespaces[i] === this.namespaces[j]) | ||
4095 | 197 | return true | ||
4096 | 198 | } | ||
4097 | 199 | } | ||
4098 | 200 | return false | ||
4099 | 201 | } | ||
4100 | 202 | |||
4101 | 203 | // match by element, original fn (opt), handler fn (opt) | ||
4102 | 204 | , matches: function (checkElement, checkOriginal, checkHandler) { | ||
4103 | 205 | return this.element === checkElement && | ||
4104 | 206 | (!checkOriginal || this.original === checkOriginal) && | ||
4105 | 207 | (!checkHandler || this.handler === checkHandler) | ||
4106 | 208 | } | ||
4107 | 209 | } | ||
4108 | 210 | |||
4109 | 211 | return entry | ||
4110 | 212 | })() | ||
4111 | 213 | |||
4112 | 214 | , registry = (function () { | ||
4113 | 215 | // our map stores arrays by event type, just because it's better than storing | ||
4114 | 216 | // everything in a single array. uses '$' as a prefix for the keys for safety | ||
4115 | 217 | var map = {} | ||
4116 | 218 | |||
4117 | 219 | // generic functional search of our registry for matching listeners, | ||
4118 | 220 | // `fn` returns false to break out of the loop | ||
4119 | 221 | , forAll = function (element, type, original, handler, fn) { | ||
4120 | 222 | if (!type || type === '*') { | ||
4121 | 223 | // search the whole registry | ||
4122 | 224 | for (var t in map) { | ||
4123 | 225 | if (t.charAt(0) === '$') | ||
4124 | 226 | forAll(element, t.substr(1), original, handler, fn) | ||
4125 | 227 | } | ||
4126 | 228 | } else { | ||
4127 | 229 | var i = 0, l, list = map['$' + type], all = element === '*' | ||
4128 | 230 | if (!list) | ||
4129 | 231 | return | ||
4130 | 232 | for (l = list.length; i < l; i++) { | ||
4131 | 233 | if (all || list[i].matches(element, original, handler)) | ||
4132 | 234 | if (!fn(list[i], list, i, type)) | ||
4133 | 235 | return | ||
4134 | 236 | } | ||
4135 | 237 | } | ||
4136 | 238 | } | ||
4137 | 239 | |||
4138 | 240 | , has = function (element, type, original) { | ||
4139 | 241 | // we're not using forAll here simply because it's a bit slower and this | ||
4140 | 242 | // needs to be fast | ||
4141 | 243 | var i, list = map['$' + type] | ||
4142 | 244 | if (list) { | ||
4143 | 245 | for (i = list.length; i--;) { | ||
4144 | 246 | if (list[i].matches(element, original, null)) | ||
4145 | 247 | return true | ||
4146 | 248 | } | ||
4147 | 249 | } | ||
4148 | 250 | return false | ||
4149 | 251 | } | ||
4150 | 252 | |||
4151 | 253 | , get = function (element, type, original) { | ||
4152 | 254 | var entries = [] | ||
4153 | 255 | forAll(element, type, original, null, function (entry) { return entries.push(entry) }) | ||
4154 | 256 | return entries | ||
4155 | 257 | } | ||
4156 | 258 | |||
4157 | 259 | , put = function (entry) { | ||
4158 | 260 | (map['$' + entry.type] || (map['$' + entry.type] = [])).push(entry) | ||
4159 | 261 | return entry | ||
4160 | 262 | } | ||
4161 | 263 | |||
4162 | 264 | , del = function (entry) { | ||
4163 | 265 | forAll(entry.element, entry.type, null, entry.handler, function (entry, list, i) { | ||
4164 | 266 | list.splice(i, 1) | ||
4165 | 267 | if (list.length === 0) | ||
4166 | 268 | delete map['$' + entry.type] | ||
4167 | 269 | return false | ||
4168 | 270 | }) | ||
4169 | 271 | } | ||
4170 | 272 | |||
4171 | 273 | // dump all entries, used for onunload | ||
4172 | 274 | , entries = function () { | ||
4173 | 275 | var t, entries = [] | ||
4174 | 276 | for (t in map) { | ||
4175 | 277 | if (t.charAt(0) === '$') | ||
4176 | 278 | entries = entries.concat(map[t]) | ||
4177 | 279 | } | ||
4178 | 280 | return entries | ||
4179 | 281 | } | ||
4180 | 282 | |||
4181 | 283 | return { has: has, get: get, put: put, del: del, entries: entries } | ||
4182 | 284 | })() | ||
4183 | 285 | |||
4184 | 286 | // add and remove listeners to DOM elements | ||
4185 | 287 | , listener = W3C_MODEL ? function (element, type, fn, add) { | ||
4186 | 288 | element[add ? addEvent : removeEvent](type, fn, false) | ||
4187 | 289 | } : function (element, type, fn, add, custom) { | ||
4188 | 290 | if (custom && add && element['_on' + custom] === null) | ||
4189 | 291 | element['_on' + custom] = 0 | ||
4190 | 292 | element[add ? attachEvent : detachEvent]('on' + type, fn) | ||
4191 | 293 | } | ||
4192 | 294 | |||
4193 | 295 | , nativeHandler = function (element, fn, args) { | ||
4194 | 296 | return function (event) { | ||
4195 | 297 | event = fixEvent(event || ((this.ownerDocument || this.document || this).parentWindow || win).event, true) | ||
4196 | 298 | return fn.apply(element, [event].concat(args)) | ||
4197 | 299 | } | ||
4198 | 300 | } | ||
4199 | 301 | |||
4200 | 302 | , customHandler = function (element, fn, type, condition, args, isNative) { | ||
4201 | 303 | return function (event) { | ||
4202 | 304 | if (condition ? condition.apply(this, arguments) : W3C_MODEL ? true : event && event.propertyName === '_on' + type || !event) { | ||
4203 | 305 | if (event) | ||
4204 | 306 | event = fixEvent(event || ((this.ownerDocument || this.document || this).parentWindow || win).event, isNative) | ||
4205 | 307 | fn.apply(element, event && (!args || args.length === 0) ? arguments : slice.call(arguments, event ? 0 : 1).concat(args)) | ||
4206 | 308 | } | ||
4207 | 309 | } | ||
4208 | 310 | } | ||
4209 | 311 | |||
4210 | 312 | , once = function (rm, element, type, fn, originalFn) { | ||
4211 | 313 | // wrap the handler in a handler that does a remove as well | ||
4212 | 314 | return function () { | ||
4213 | 315 | rm(element, type, originalFn) | ||
4214 | 316 | fn.apply(this, arguments) | ||
4215 | 317 | } | ||
4216 | 318 | } | ||
4217 | 319 | |||
4218 | 320 | , removeListener = function (element, orgType, handler, namespaces) { | ||
4219 | 321 | var i, l, entry | ||
4220 | 322 | , type = (orgType && orgType.replace(nameRegex, '')) | ||
4221 | 323 | , handlers = registry.get(element, type, handler) | ||
4222 | 324 | |||
4223 | 325 | for (i = 0, l = handlers.length; i < l; i++) { | ||
4224 | 326 | if (handlers[i].inNamespaces(namespaces)) { | ||
4225 | 327 | if ((entry = handlers[i]).eventSupport) | ||
4226 | 328 | listener(entry.target, entry.eventType, entry.handler, false, entry.type) | ||
4227 | 329 | // TODO: this is problematic, we have a registry.get() and registry.del() that | ||
4228 | 330 | // both do registry searches so we waste cycles doing this. Needs to be rolled into | ||
4229 | 331 | // a single registry.forAll(fn) that removes while finding, but the catch is that | ||
4230 | 332 | // we'll be splicing the arrays that we're iterating over. Needs extra tests to | ||
4231 | 333 | // make sure we don't screw it up. @rvagg | ||
4232 | 334 | registry.del(entry) | ||
4233 | 335 | } | ||
4234 | 336 | } | ||
4235 | 337 | } | ||
4236 | 338 | |||
4237 | 339 | , addListener = function (element, orgType, fn, originalFn, args) { | ||
4238 | 340 | var entry | ||
4239 | 341 | , type = orgType.replace(nameRegex, '') | ||
4240 | 342 | , namespaces = orgType.replace(namespaceRegex, '').split('.') | ||
4241 | 343 | |||
4242 | 344 | if (registry.has(element, type, fn)) | ||
4243 | 345 | return element // no dupe | ||
4244 | 346 | if (type === 'unload') | ||
4245 | 347 | fn = once(removeListener, element, type, fn, originalFn) // self clean-up | ||
4246 | 348 | if (customEvents[type]) { | ||
4247 | 349 | if (customEvents[type].condition) | ||
4248 | 350 | fn = customHandler(element, fn, type, customEvents[type].condition, true) | ||
4249 | 351 | type = customEvents[type].base || type | ||
4250 | 352 | } | ||
4251 | 353 | entry = registry.put(new RegEntry(element, type, fn, originalFn, namespaces[0] && namespaces)) | ||
4252 | 354 | entry.handler = entry.isNative ? | ||
4253 | 355 | nativeHandler(element, entry.handler, args) : | ||
4254 | 356 | customHandler(element, entry.handler, type, false, args, false) | ||
4255 | 357 | if (entry.eventSupport) | ||
4256 | 358 | listener(entry.target, entry.eventType, entry.handler, true, entry.customType) | ||
4257 | 359 | } | ||
4258 | 360 | |||
4259 | 361 | , del = function (selector, fn, $) { | ||
4260 | 362 | return function (e) { | ||
4261 | 363 | var target, i, array = typeof selector === 'string' ? $(selector, this) : selector | ||
4262 | 364 | for (target = e.target; target && target !== this; target = target.parentNode) { | ||
4263 | 365 | for (i = array.length; i--;) { | ||
4264 | 366 | if (array[i] === target) { | ||
4265 | 367 | return fn.apply(target, arguments) | ||
4266 | 368 | } | ||
4267 | 369 | } | ||
4268 | 370 | } | ||
4269 | 371 | } | ||
4270 | 372 | } | ||
4271 | 373 | |||
4272 | 374 | , remove = function (element, typeSpec, fn) { | ||
4273 | 375 | var k, m, type, namespaces, i | ||
4274 | 376 | , rm = removeListener | ||
4275 | 377 | , isString = typeSpec && typeof typeSpec === 'string' | ||
4276 | 378 | |||
4277 | 379 | if (isString && typeSpec.indexOf(' ') > 0) { | ||
4278 | 380 | // remove(el, 't1 t2 t3', fn) or remove(el, 't1 t2 t3') | ||
4279 | 381 | typeSpec = typeSpec.split(' ') | ||
4280 | 382 | for (i = typeSpec.length; i--;) | ||
4281 | 383 | remove(element, typeSpec[i], fn) | ||
4282 | 384 | return element | ||
4283 | 385 | } | ||
4284 | 386 | type = isString && typeSpec.replace(nameRegex, '') | ||
4285 | 387 | if (type && customEvents[type]) | ||
4286 | 388 | type = customEvents[type].type | ||
4287 | 389 | if (!typeSpec || isString) { | ||
4288 | 390 | // remove(el) or remove(el, t1.ns) or remove(el, .ns) or remove(el, .ns1.ns2.ns3) | ||
4289 | 391 | if (namespaces = isString && typeSpec.replace(namespaceRegex, '')) | ||
4290 | 392 | namespaces = namespaces.split('.') | ||
4291 | 393 | rm(element, type, fn, namespaces) | ||
4292 | 394 | } else if (typeof typeSpec === 'function') { | ||
4293 | 395 | // remove(el, fn) | ||
4294 | 396 | rm(element, null, typeSpec) | ||
4295 | 397 | } else { | ||
4296 | 398 | // remove(el, { t1: fn1, t2, fn2 }) | ||
4297 | 399 | for (k in typeSpec) { | ||
4298 | 400 | if (typeSpec.hasOwnProperty(k)) | ||
4299 | 401 | remove(element, k, typeSpec[k]) | ||
4300 | 402 | } | ||
4301 | 403 | } | ||
4302 | 404 | return element | ||
4303 | 405 | } | ||
4304 | 406 | |||
4305 | 407 | , add = function (element, events, fn, delfn, $) { | ||
4306 | 408 | var type, types, i, args | ||
4307 | 409 | , originalFn = fn | ||
4308 | 410 | , isDel = fn && typeof fn === 'string' | ||
4309 | 411 | |||
4310 | 412 | if (events && !fn && typeof events === 'object') { | ||
4311 | 413 | for (type in events) { | ||
4312 | 414 | if (events.hasOwnProperty(type)) | ||
4313 | 415 | add.apply(this, [ element, type, events[type] ]) | ||
4314 | 416 | } | ||
4315 | 417 | } else { | ||
4316 | 418 | args = arguments.length > 3 ? slice.call(arguments, 3) : [] | ||
4317 | 419 | types = (isDel ? fn : events).split(' ') | ||
4318 | 420 | isDel && (fn = del(events, (originalFn = delfn), $)) && (args = slice.call(args, 1)) | ||
4319 | 421 | // special case for one() | ||
4320 | 422 | this === ONE && (fn = once(remove, element, events, fn, originalFn)) | ||
4321 | 423 | for (i = types.length; i--;) addListener(element, types[i], fn, originalFn, args) | ||
4322 | 424 | } | ||
4323 | 425 | return element | ||
4324 | 426 | } | ||
4325 | 427 | |||
4326 | 428 | , one = function () { | ||
4327 | 429 | return add.apply(ONE, arguments) | ||
4328 | 430 | } | ||
4329 | 431 | |||
4330 | 432 | , fireListener = W3C_MODEL ? function (isNative, type, element) { | ||
4331 | 433 | var evt = doc.createEvent(isNative ? 'HTMLEvents' : 'UIEvents') | ||
4332 | 434 | evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, win, 1) | ||
4333 | 435 | element.dispatchEvent(evt) | ||
4334 | 436 | } : function (isNative, type, element) { | ||
4335 | 437 | element = targetElement(element, isNative) | ||
4336 | 438 | // if not-native then we're using onpropertychange so we just increment a custom property | ||
4337 | 439 | isNative ? element.fireEvent('on' + type, doc.createEventObject()) : element['_on' + type]++ | ||
4338 | 440 | } | ||
4339 | 441 | |||
4340 | 442 | , fire = function (element, type, args) { | ||
4341 | 443 | var i, j, l, names, handlers | ||
4342 | 444 | , types = type.split(' ') | ||
4343 | 445 | |||
4344 | 446 | for (i = types.length; i--;) { | ||
4345 | 447 | type = types[i].replace(nameRegex, '') | ||
4346 | 448 | if (names = types[i].replace(namespaceRegex, '')) | ||
4347 | 449 | names = names.split('.') | ||
4348 | 450 | if (!names && !args && element[eventSupport]) { | ||
4349 | 451 | fireListener(nativeEvents[type], type, element) | ||
4350 | 452 | } else { | ||
4351 | 453 | // non-native event, either because of a namespace, arguments or a non DOM element | ||
4352 | 454 | // iterate over all listeners and manually 'fire' | ||
4353 | 455 | handlers = registry.get(element, type) | ||
4354 | 456 | args = [false].concat(args) | ||
4355 | 457 | for (j = 0, l = handlers.length; j < l; j++) { | ||
4356 | 458 | if (handlers[j].inNamespaces(names)) | ||
4357 | 459 | handlers[j].handler.apply(element, args) | ||
4358 | 460 | } | ||
4359 | 461 | } | ||
4360 | 462 | } | ||
4361 | 463 | return element | ||
4362 | 464 | } | ||
4363 | 465 | |||
4364 | 466 | , clone = function (element, from, type) { | ||
4365 | 467 | var i = 0 | ||
4366 | 468 | , handlers = registry.get(from, type) | ||
4367 | 469 | , l = handlers.length | ||
4368 | 470 | |||
4369 | 471 | for (;i < l; i++) | ||
4370 | 472 | handlers[i].original && add(element, handlers[i].type, handlers[i].original) | ||
4371 | 473 | return element | ||
4372 | 474 | } | ||
4373 | 475 | |||
4374 | 476 | , bean = { | ||
4375 | 477 | add: add | ||
4376 | 478 | , one: one | ||
4377 | 479 | , remove: remove | ||
4378 | 480 | , clone: clone | ||
4379 | 481 | , fire: fire | ||
4380 | 482 | , noConflict: function () { | ||
4381 | 483 | context[name] = old | ||
4382 | 484 | return this | ||
4383 | 485 | } | ||
4384 | 486 | } | ||
4385 | 487 | |||
4386 | 488 | if (win[attachEvent]) { | ||
4387 | 489 | // for IE, clean up on unload to avoid leaks | ||
4388 | 490 | var cleanup = function () { | ||
4389 | 491 | var i, entries = registry.entries() | ||
4390 | 492 | for (i in entries) { | ||
4391 | 493 | if (entries[i].type && entries[i].type !== 'unload') | ||
4392 | 494 | remove(entries[i].element, entries[i].type) | ||
4393 | 495 | } | ||
4394 | 496 | win[detachEvent]('onunload', cleanup) | ||
4395 | 497 | win.CollectGarbage && win.CollectGarbage() | ||
4396 | 498 | } | ||
4397 | 499 | win[attachEvent]('onunload', cleanup) | ||
4398 | 500 | } | ||
4399 | 501 | |||
4400 | 502 | return bean | ||
4401 | 503 | }); | ||
4402 | 504 | // Underscore.js 1.1.7 | ||
4403 | 505 | // (c) 2011 Jeremy Ashkenas, DocumentCloud Inc. | ||
4404 | 506 | // Underscore is freely distributable under the MIT license. | ||
4405 | 507 | // Portions of Underscore are inspired or borrowed from Prototype, | ||
4406 | 508 | // Oliver Steele's Functional, and John Resig's Micro-Templating. | ||
4407 | 509 | // For all details and documentation: | ||
4408 | 510 | // http://documentcloud.github.com/underscore | ||
4409 | 511 | |||
4410 | 512 | (function() { | ||
4411 | 513 | |||
4412 | 514 | // Baseline setup | ||
4413 | 515 | // -------------- | ||
4414 | 516 | |||
4415 | 517 | // Establish the root object, `window` in the browser, or `global` on the server. | ||
4416 | 518 | var root = this; | ||
4417 | 519 | |||
4418 | 520 | // Save the previous value of the `_` variable. | ||
4419 | 521 | var previousUnderscore = root._; | ||
4420 | 522 | |||
4421 | 523 | // Establish the object that gets returned to break out of a loop iteration. | ||
4422 | 524 | var breaker = {}; | ||
4423 | 525 | |||
4424 | 526 | // Save bytes in the minified (but not gzipped) version: | ||
4425 | 527 | var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; | ||
4426 | 528 | |||
4427 | 529 | // Create quick reference variables for speed access to core prototypes. | ||
4428 | 530 | var slice = ArrayProto.slice, | ||
4429 | 531 | unshift = ArrayProto.unshift, | ||
4430 | 532 | toString = ObjProto.toString, | ||
4431 | 533 | hasOwnProperty = ObjProto.hasOwnProperty; | ||
4432 | 534 | |||
4433 | 535 | // All **ECMAScript 5** native function implementations that we hope to use | ||
4434 | 536 | // are declared here. | ||
4435 | 537 | var | ||
4436 | 538 | nativeForEach = ArrayProto.forEach, | ||
4437 | 539 | nativeMap = ArrayProto.map, | ||
4438 | 540 | nativeReduce = ArrayProto.reduce, | ||
4439 | 541 | nativeReduceRight = ArrayProto.reduceRight, | ||
4440 | 542 | nativeFilter = ArrayProto.filter, | ||
4441 | 543 | nativeEvery = ArrayProto.every, | ||
4442 | 544 | nativeSome = ArrayProto.some, | ||
4443 | 545 | nativeIndexOf = ArrayProto.indexOf, | ||
4444 | 546 | nativeLastIndexOf = ArrayProto.lastIndexOf, | ||
4445 | 547 | nativeIsArray = Array.isArray, | ||
4446 | 548 | nativeKeys = Object.keys, | ||
4447 | 549 | nativeBind = FuncProto.bind; | ||
4448 | 550 | |||
4449 | 551 | // Create a safe reference to the Underscore object for use below. | ||
4450 | 552 | var _ = function(obj) { return new wrapper(obj); }; | ||
4451 | 553 | |||
4452 | 554 | // Export the Underscore object for **CommonJS**, with backwards-compatibility | ||
4453 | 555 | // for the old `require()` API. If we're not in CommonJS, add `_` to the | ||
4454 | 556 | // global object. | ||
4455 | 557 | if (typeof module !== 'undefined' && module.exports) { | ||
4456 | 558 | module.exports = _; | ||
4457 | 559 | _._ = _; | ||
4458 | 560 | } else { | ||
4459 | 561 | // Exported as a string, for Closure Compiler "advanced" mode. | ||
4460 | 562 | root['_'] = _; | ||
4461 | 563 | } | ||
4462 | 564 | |||
4463 | 565 | // Current version. | ||
4464 | 566 | _.VERSION = '1.1.7'; | ||
4465 | 567 | |||
4466 | 568 | // Collection Functions | ||
4467 | 569 | // -------------------- | ||
4468 | 570 | |||
4469 | 571 | // The cornerstone, an `each` implementation, aka `forEach`. | ||
4470 | 572 | // Handles objects with the built-in `forEach`, arrays, and raw objects. | ||
4471 | 573 | // Delegates to **ECMAScript 5**'s native `forEach` if available. | ||
4472 | 574 | var each = _.each = _.forEach = function(obj, iterator, context) { | ||
4473 | 575 | if (obj == null) return; | ||
4474 | 576 | if (nativeForEach && obj.forEach === nativeForEach) { | ||
4475 | 577 | obj.forEach(iterator, context); | ||
4476 | 578 | } else if (obj.length === +obj.length) { | ||
4477 | 579 | for (var i = 0, l = obj.length; i < l; i++) { | ||
4478 | 580 | if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return; | ||
4479 | 581 | } | ||
4480 | 582 | } else { | ||
4481 | 583 | for (var key in obj) { | ||
4482 | 584 | if (hasOwnProperty.call(obj, key)) { | ||
4483 | 585 | if (iterator.call(context, obj[key], key, obj) === breaker) return; | ||
4484 | 586 | } | ||
4485 | 587 | } | ||
4486 | 588 | } | ||
4487 | 589 | }; | ||
4488 | 590 | |||
4489 | 591 | // Return the results of applying the iterator to each element. | ||
4490 | 592 | // Delegates to **ECMAScript 5**'s native `map` if available. | ||
4491 | 593 | _.map = function(obj, iterator, context) { | ||
4492 | 594 | var results = []; | ||
4493 | 595 | if (obj == null) return results; | ||
4494 | 596 | if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); | ||
4495 | 597 | each(obj, function(value, index, list) { | ||
4496 | 598 | results[results.length] = iterator.call(context, value, index, list); | ||
4497 | 599 | }); | ||
4498 | 600 | return results; | ||
4499 | 601 | }; | ||
4500 | 602 | |||
4501 | 603 | // **Reduce** builds up a single result from a list of values, aka `inject`, | ||
4502 | 604 | // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available. | ||
4503 | 605 | _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) { | ||
4504 | 606 | var initial = memo !== void 0; | ||
4505 | 607 | if (obj == null) obj = []; | ||
4506 | 608 | if (nativeReduce && obj.reduce === nativeReduce) { | ||
4507 | 609 | if (context) iterator = _.bind(iterator, context); | ||
4508 | 610 | return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); | ||
4509 | 611 | } | ||
4510 | 612 | each(obj, function(value, index, list) { | ||
4511 | 613 | if (!initial) { | ||
4512 | 614 | memo = value; | ||
4513 | 615 | initial = true; | ||
4514 | 616 | } else { | ||
4515 | 617 | memo = iterator.call(context, memo, value, index, list); | ||
4516 | 618 | } | ||
4517 | 619 | }); | ||
4518 | 620 | if (!initial) throw new TypeError("Reduce of empty array with no initial value"); | ||
4519 | 621 | return memo; | ||
4520 | 622 | }; | ||
4521 | 623 | |||
4522 | 624 | // The right-associative version of reduce, also known as `foldr`. | ||
4523 | 625 | // Delegates to **ECMAScript 5**'s native `reduceRight` if available. | ||
4524 | 626 | _.reduceRight = _.foldr = function(obj, iterator, memo, context) { | ||
4525 | 627 | if (obj == null) obj = []; | ||
4526 | 628 | if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { | ||
4527 | 629 | if (context) iterator = _.bind(iterator, context); | ||
4528 | 630 | return memo !== void 0 ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); | ||
4529 | 631 | } | ||
4530 | 632 | var reversed = (_.isArray(obj) ? obj.slice() : _.toArray(obj)).reverse(); | ||
4531 | 633 | return _.reduce(reversed, iterator, memo, context); | ||
4532 | 634 | }; | ||
4533 | 635 | |||
4534 | 636 | // Return the first value which passes a truth test. Aliased as `detect`. | ||
4535 | 637 | _.find = _.detect = function(obj, iterator, context) { | ||
4536 | 638 | var result; | ||
4537 | 639 | any(obj, function(value, index, list) { | ||
4538 | 640 | if (iterator.call(context, value, index, list)) { | ||
4539 | 641 | result = value; | ||
4540 | 642 | return true; | ||
4541 | 643 | } | ||
4542 | 644 | }); | ||
4543 | 645 | return result; | ||
4544 | 646 | }; | ||
4545 | 647 | |||
4546 | 648 | // Return all the elements that pass a truth test. | ||
4547 | 649 | // Delegates to **ECMAScript 5**'s native `filter` if available. | ||
4548 | 650 | // Aliased as `select`. | ||
4549 | 651 | _.filter = _.select = function(obj, iterator, context) { | ||
4550 | 652 | var results = []; | ||
4551 | 653 | if (obj == null) return results; | ||
4552 | 654 | if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context); | ||
4553 | 655 | each(obj, function(value, index, list) { | ||
4554 | 656 | if (iterator.call(context, value, index, list)) results[results.length] = value; | ||
4555 | 657 | }); | ||
4556 | 658 | return results; | ||
4557 | 659 | }; | ||
4558 | 660 | |||
4559 | 661 | // Return all the elements for which a truth test fails. | ||
4560 | 662 | _.reject = function(obj, iterator, context) { | ||
4561 | 663 | var results = []; | ||
4562 | 664 | if (obj == null) return results; | ||
4563 | 665 | each(obj, function(value, index, list) { | ||
4564 | 666 | if (!iterator.call(context, value, index, list)) results[results.length] = value; | ||
4565 | 667 | }); | ||
4566 | 668 | return results; | ||
4567 | 669 | }; | ||
4568 | 670 | |||
4569 | 671 | // Determine whether all of the elements match a truth test. | ||
4570 | 672 | // Delegates to **ECMAScript 5**'s native `every` if available. | ||
4571 | 673 | // Aliased as `all`. | ||
4572 | 674 | _.every = _.all = function(obj, iterator, context) { | ||
4573 | 675 | var result = true; | ||
4574 | 676 | if (obj == null) return result; | ||
4575 | 677 | if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context); | ||
4576 | 678 | each(obj, function(value, index, list) { | ||
4577 | 679 | if (!(result = result && iterator.call(context, value, index, list))) return breaker; | ||
4578 | 680 | }); | ||
4579 | 681 | return result; | ||
4580 | 682 | }; | ||
4581 | 683 | |||
4582 | 684 | // Determine if at least one element in the object matches a truth test. | ||
4583 | 685 | // Delegates to **ECMAScript 5**'s native `some` if available. | ||
4584 | 686 | // Aliased as `any`. | ||
4585 | 687 | var any = _.some = _.any = function(obj, iterator, context) { | ||
4586 | 688 | iterator = iterator || _.identity; | ||
4587 | 689 | var result = false; | ||
4588 | 690 | if (obj == null) return result; | ||
4589 | 691 | if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context); | ||
4590 | 692 | each(obj, function(value, index, list) { | ||
4591 | 693 | if (result |= iterator.call(context, value, index, list)) return breaker; | ||
4592 | 694 | }); | ||
4593 | 695 | return !!result; | ||
4594 | 696 | }; | ||
4595 | 697 | |||
4596 | 698 | // Determine if a given value is included in the array or object using `===`. | ||
4597 | 699 | // Aliased as `contains`. | ||
4598 | 700 | _.include = _.contains = function(obj, target) { | ||
4599 | 701 | var found = false; | ||
4600 | 702 | if (obj == null) return found; | ||
4601 | 703 | if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; | ||
4602 | 704 | any(obj, function(value) { | ||
4603 | 705 | if (found = value === target) return true; | ||
4604 | 706 | }); | ||
4605 | 707 | return found; | ||
4606 | 708 | }; | ||
4607 | 709 | |||
4608 | 710 | // Invoke a method (with arguments) on every item in a collection. | ||
4609 | 711 | _.invoke = function(obj, method) { | ||
4610 | 712 | var args = slice.call(arguments, 2); | ||
4611 | 713 | return _.map(obj, function(value) { | ||
4612 | 714 | return (method.call ? method || value : value[method]).apply(value, args); | ||
4613 | 715 | }); | ||
4614 | 716 | }; | ||
4615 | 717 | |||
4616 | 718 | // Convenience version of a common use case of `map`: fetching a property. | ||
4617 | 719 | _.pluck = function(obj, key) { | ||
4618 | 720 | return _.map(obj, function(value){ return value[key]; }); | ||
4619 | 721 | }; | ||
4620 | 722 | |||
4621 | 723 | // Return the maximum element or (element-based computation). | ||
4622 | 724 | _.max = function(obj, iterator, context) { | ||
4623 | 725 | if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj); | ||
4624 | 726 | var result = {computed : -Infinity}; | ||
4625 | 727 | each(obj, function(value, index, list) { | ||
4626 | 728 | var computed = iterator ? iterator.call(context, value, index, list) : value; | ||
4627 | 729 | computed >= result.computed && (result = {value : value, computed : computed}); | ||
4628 | 730 | }); | ||
4629 | 731 | return result.value; | ||
4630 | 732 | }; | ||
4631 | 733 | |||
4632 | 734 | // Return the minimum element (or element-based computation). | ||
4633 | 735 | _.min = function(obj, iterator, context) { | ||
4634 | 736 | if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj); | ||
4635 | 737 | var result = {computed : Infinity}; | ||
4636 | 738 | each(obj, function(value, index, list) { | ||
4637 | 739 | var computed = iterator ? iterator.call(context, value, index, list) : value; | ||
4638 | 740 | computed < result.computed && (result = {value : value, computed : computed}); | ||
4639 | 741 | }); | ||
4640 | 742 | return result.value; | ||
4641 | 743 | }; | ||
4642 | 744 | |||
4643 | 745 | // Sort the object's values by a criterion produced by an iterator. | ||
4644 | 746 | _.sortBy = function(obj, iterator, context) { | ||
4645 | 747 | return _.pluck(_.map(obj, function(value, index, list) { | ||
4646 | 748 | return { | ||
4647 | 749 | value : value, | ||
4648 | 750 | criteria : iterator.call(context, value, index, list) | ||
4649 | 751 | }; | ||
4650 | 752 | }).sort(function(left, right) { | ||
4651 | 753 | var a = left.criteria, b = right.criteria; | ||
4652 | 754 | return a < b ? -1 : a > b ? 1 : 0; | ||
4653 | 755 | }), 'value'); | ||
4654 | 756 | }; | ||
4655 | 757 | |||
4656 | 758 | // Groups the object's values by a criterion produced by an iterator | ||
4657 | 759 | _.groupBy = function(obj, iterator) { | ||
4658 | 760 | var result = {}; | ||
4659 | 761 | each(obj, function(value, index) { | ||
4660 | 762 | var key = iterator(value, index); | ||
4661 | 763 | (result[key] || (result[key] = [])).push(value); | ||
4662 | 764 | }); | ||
4663 | 765 | return result; | ||
4664 | 766 | }; | ||
4665 | 767 | |||
4666 | 768 | // Use a comparator function to figure out at what index an object should | ||
4667 | 769 | // be inserted so as to maintain order. Uses binary search. | ||
4668 | 770 | _.sortedIndex = function(array, obj, iterator) { | ||
4669 | 771 | iterator || (iterator = _.identity); | ||
4670 | 772 | var low = 0, high = array.length; | ||
4671 | 773 | while (low < high) { | ||
4672 | 774 | var mid = (low + high) >> 1; | ||
4673 | 775 | iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid; | ||
4674 | 776 | } | ||
4675 | 777 | return low; | ||
4676 | 778 | }; | ||
4677 | 779 | |||
4678 | 780 | // Safely convert anything iterable into a real, live array. | ||
4679 | 781 | _.toArray = function(iterable) { | ||
4680 | 782 | if (!iterable) return []; | ||
4681 | 783 | if (iterable.toArray) return iterable.toArray(); | ||
4682 | 784 | if (_.isArray(iterable)) return slice.call(iterable); | ||
4683 | 785 | if (_.isArguments(iterable)) return slice.call(iterable); | ||
4684 | 786 | return _.values(iterable); | ||
4685 | 787 | }; | ||
4686 | 788 | |||
4687 | 789 | // Return the number of elements in an object. | ||
4688 | 790 | _.size = function(obj) { | ||
4689 | 791 | return _.toArray(obj).length; | ||
4690 | 792 | }; | ||
4691 | 793 | |||
4692 | 794 | // Array Functions | ||
4693 | 795 | // --------------- | ||
4694 | 796 | |||
4695 | 797 | // Get the first element of an array. Passing **n** will return the first N | ||
4696 | 798 | // values in the array. Aliased as `head`. The **guard** check allows it to work | ||
4697 | 799 | // with `_.map`. | ||
4698 | 800 | _.first = _.head = function(array, n, guard) { | ||
4699 | 801 | return (n != null) && !guard ? slice.call(array, 0, n) : array[0]; | ||
4700 | 802 | }; | ||
4701 | 803 | |||
4702 | 804 | // Returns everything but the first entry of the array. Aliased as `tail`. | ||
4703 | 805 | // Especially useful on the arguments object. Passing an **index** will return | ||
4704 | 806 | // the rest of the values in the array from that index onward. The **guard** | ||
4705 | 807 | // check allows it to work with `_.map`. | ||
4706 | 808 | _.rest = _.tail = function(array, index, guard) { | ||
4707 | 809 | return slice.call(array, (index == null) || guard ? 1 : index); | ||
4708 | 810 | }; | ||
4709 | 811 | |||
4710 | 812 | // Get the last element of an array. | ||
4711 | 813 | _.last = function(array) { | ||
4712 | 814 | return array[array.length - 1]; | ||
4713 | 815 | }; | ||
4714 | 816 | |||
4715 | 817 | // Trim out all falsy values from an array. | ||
4716 | 818 | _.compact = function(array) { | ||
4717 | 819 | return _.filter(array, function(value){ return !!value; }); | ||
4718 | 820 | }; | ||
4719 | 821 | |||
4720 | 822 | // Return a completely flattened version of an array. | ||
4721 | 823 | _.flatten = function(array) { | ||
4722 | 824 | return _.reduce(array, function(memo, value) { | ||
4723 | 825 | if (_.isArray(value)) return memo.concat(_.flatten(value)); | ||
4724 | 826 | memo[memo.length] = value; | ||
4725 | 827 | return memo; | ||
4726 | 828 | }, []); | ||
4727 | 829 | }; | ||
4728 | 830 | |||
4729 | 831 | // Return a version of the array that does not contain the specified value(s). | ||
4730 | 832 | _.without = function(array) { | ||
4731 | 833 | return _.difference(array, slice.call(arguments, 1)); | ||
4732 | 834 | }; | ||
4733 | 835 | |||
4734 | 836 | // Produce a duplicate-free version of the array. If the array has already | ||
4735 | 837 | // been sorted, you have the option of using a faster algorithm. | ||
4736 | 838 | // Aliased as `unique`. | ||
4737 | 839 | _.uniq = _.unique = function(array, isSorted) { | ||
4738 | 840 | return _.reduce(array, function(memo, el, i) { | ||
4739 | 841 | if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) memo[memo.length] = el; | ||
4740 | 842 | return memo; | ||
4741 | 843 | }, []); | ||
4742 | 844 | }; | ||
4743 | 845 | |||
4744 | 846 | // Produce an array that contains the union: each distinct element from all of | ||
4745 | 847 | // the passed-in arrays. | ||
4746 | 848 | _.union = function() { | ||
4747 | 849 | return _.uniq(_.flatten(arguments)); | ||
4748 | 850 | }; | ||
4749 | 851 | |||
4750 | 852 | // Produce an array that contains every item shared between all the | ||
4751 | 853 | // passed-in arrays. (Aliased as "intersect" for back-compat.) | ||
4752 | 854 | _.intersection = _.intersect = function(array) { | ||
4753 | 855 | var rest = slice.call(arguments, 1); | ||
4754 | 856 | return _.filter(_.uniq(array), function(item) { | ||
4755 | 857 | return _.every(rest, function(other) { | ||
4756 | 858 | return _.indexOf(other, item) >= 0; | ||
4757 | 859 | }); | ||
4758 | 860 | }); | ||
4759 | 861 | }; | ||
4760 | 862 | |||
4761 | 863 | // Take the difference between one array and another. | ||
4762 | 864 | // Only the elements present in just the first array will remain. | ||
4763 | 865 | _.difference = function(array, other) { | ||
4764 | 866 | return _.filter(array, function(value){ return !_.include(other, value); }); | ||
4765 | 867 | }; | ||
4766 | 868 | |||
4767 | 869 | // Zip together multiple lists into a single array -- elements that share | ||
4768 | 870 | // an index go together. | ||
4769 | 871 | _.zip = function() { | ||
4770 | 872 | var args = slice.call(arguments); | ||
4771 | 873 | var length = _.max(_.pluck(args, 'length')); | ||
4772 | 874 | var results = new Array(length); | ||
4773 | 875 | for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i); | ||
4774 | 876 | return results; | ||
4775 | 877 | }; | ||
4776 | 878 | |||
4777 | 879 | // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), | ||
4778 | 880 | // we need this function. Return the position of the first occurrence of an | ||
4779 | 881 | // item in an array, or -1 if the item is not included in the array. | ||
4780 | 882 | // Delegates to **ECMAScript 5**'s native `indexOf` if available. | ||
4781 | 883 | // If the array is large and already in sort order, pass `true` | ||
4782 | 884 | // for **isSorted** to use binary search. | ||
4783 | 885 | _.indexOf = function(array, item, isSorted) { | ||
4784 | 886 | if (array == null) return -1; | ||
4785 | 887 | var i, l; | ||
4786 | 888 | if (isSorted) { | ||
4787 | 889 | i = _.sortedIndex(array, item); | ||
4788 | 890 | return array[i] === item ? i : -1; | ||
4789 | 891 | } | ||
4790 | 892 | if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item); | ||
4791 | 893 | for (i = 0, l = array.length; i < l; i++) if (array[i] === item) return i; | ||
4792 | 894 | return -1; | ||
4793 | 895 | }; | ||
4794 | 896 | |||
4795 | 897 | |||
4796 | 898 | // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. | ||
4797 | 899 | _.lastIndexOf = function(array, item) { | ||
4798 | 900 | if (array == null) return -1; | ||
4799 | 901 | if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item); | ||
4800 | 902 | var i = array.length; | ||
4801 | 903 | while (i--) if (array[i] === item) return i; | ||
4802 | 904 | return -1; | ||
4803 | 905 | }; | ||
4804 | 906 | |||
4805 | 907 | // Generate an integer Array containing an arithmetic progression. A port of | ||
4806 | 908 | // the native Python `range()` function. See | ||
4807 | 909 | // [the Python documentation](http://docs.python.org/library/functions.html#range). | ||
4808 | 910 | _.range = function(start, stop, step) { | ||
4809 | 911 | if (arguments.length <= 1) { | ||
4810 | 912 | stop = start || 0; | ||
4811 | 913 | start = 0; | ||
4812 | 914 | } | ||
4813 | 915 | step = arguments[2] || 1; | ||
4814 | 916 | |||
4815 | 917 | var len = Math.max(Math.ceil((stop - start) / step), 0); | ||
4816 | 918 | var idx = 0; | ||
4817 | 919 | var range = new Array(len); | ||
4818 | 920 | |||
4819 | 921 | while(idx < len) { | ||
4820 | 922 | range[idx++] = start; | ||
4821 | 923 | start += step; | ||
4822 | 924 | } | ||
4823 | 925 | |||
4824 | 926 | return range; | ||
4825 | 927 | }; | ||
4826 | 928 | |||
4827 | 929 | // Function (ahem) Functions | ||
4828 | 930 | // ------------------ | ||
4829 | 931 | |||
4830 | 932 | // Create a function bound to a given object (assigning `this`, and arguments, | ||
4831 | 933 | // optionally). Binding with arguments is also known as `curry`. | ||
4832 | 934 | // Delegates to **ECMAScript 5**'s native `Function.bind` if available. | ||
4833 | 935 | // We check for `func.bind` first, to fail fast when `func` is undefined. | ||
4834 | 936 | _.bind = function(func, obj) { | ||
4835 | 937 | if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); | ||
4836 | 938 | var args = slice.call(arguments, 2); | ||
4837 | 939 | return function() { | ||
4838 | 940 | return func.apply(obj, args.concat(slice.call(arguments))); | ||
4839 | 941 | }; | ||
4840 | 942 | }; | ||
4841 | 943 | |||
4842 | 944 | // Bind all of an object's methods to that object. Useful for ensuring that | ||
4843 | 945 | // all callbacks defined on an object belong to it. | ||
4844 | 946 | _.bindAll = function(obj) { | ||
4845 | 947 | var funcs = slice.call(arguments, 1); | ||
4846 | 948 | if (funcs.length == 0) funcs = _.functions(obj); | ||
4847 | 949 | each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); | ||
4848 | 950 | return obj; | ||
4849 | 951 | }; | ||
4850 | 952 | |||
4851 | 953 | // Memoize an expensive function by storing its results. | ||
4852 | 954 | _.memoize = function(func, hasher) { | ||
4853 | 955 | var memo = {}; | ||
4854 | 956 | hasher || (hasher = _.identity); | ||
4855 | 957 | return function() { | ||
4856 | 958 | var key = hasher.apply(this, arguments); | ||
4857 | 959 | return hasOwnProperty.call(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); | ||
4858 | 960 | }; | ||
4859 | 961 | }; | ||
4860 | 962 | |||
4861 | 963 | // Delays a function for the given number of milliseconds, and then calls | ||
4862 | 964 | // it with the arguments supplied. | ||
4863 | 965 | _.delay = function(func, wait) { | ||
4864 | 966 | var args = slice.call(arguments, 2); | ||
4865 | 967 | return setTimeout(function(){ return func.apply(func, args); }, wait); | ||
4866 | 968 | }; | ||
4867 | 969 | |||
4868 | 970 | // Defers a function, scheduling it to run after the current call stack has | ||
4869 | 971 | // cleared. | ||
4870 | 972 | _.defer = function(func) { | ||
4871 | 973 | return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); | ||
4872 | 974 | }; | ||
4873 | 975 | |||
4874 | 976 | // Internal function used to implement `_.throttle` and `_.debounce`. | ||
4875 | 977 | var limit = function(func, wait, debounce) { | ||
4876 | 978 | var timeout; | ||
4877 | 979 | return function() { | ||
4878 | 980 | var context = this, args = arguments; | ||
4879 | 981 | var throttler = function() { | ||
4880 | 982 | timeout = null; | ||
4881 | 983 | func.apply(context, args); | ||
4882 | 984 | }; | ||
4883 | 985 | if (debounce) clearTimeout(timeout); | ||
4884 | 986 | if (debounce || !timeout) timeout = setTimeout(throttler, wait); | ||
4885 | 987 | }; | ||
4886 | 988 | }; | ||
4887 | 989 | |||
4888 | 990 | // Returns a function, that, when invoked, will only be triggered at most once | ||
4889 | 991 | // during a given window of time. | ||
4890 | 992 | _.throttle = function(func, wait) { | ||
4891 | 993 | return limit(func, wait, false); | ||
4892 | 994 | }; | ||
4893 | 995 | |||
4894 | 996 | // Returns a function, that, as long as it continues to be invoked, will not | ||
4895 | 997 | // be triggered. The function will be called after it stops being called for | ||
4896 | 998 | // N milliseconds. | ||
4897 | 999 | _.debounce = function(func, wait) { | ||
4898 | 1000 | return limit(func, wait, true); | ||
4899 | 1001 | }; | ||
4900 | 1002 | |||
4901 | 1003 | // Returns a function that will be executed at most one time, no matter how | ||
4902 | 1004 | // often you call it. Useful for lazy initialization. | ||
4903 | 1005 | _.once = function(func) { | ||
4904 | 1006 | var ran = false, memo; | ||
4905 | 1007 | return function() { | ||
4906 | 1008 | if (ran) return memo; | ||
4907 | 1009 | ran = true; | ||
4908 | 1010 | return memo = func.apply(this, arguments); | ||
4909 | 1011 | }; | ||
4910 | 1012 | }; | ||
4911 | 1013 | |||
4912 | 1014 | // Returns the first function passed as an argument to the second, | ||
4913 | 1015 | // allowing you to adjust arguments, run code before and after, and | ||
4914 | 1016 | // conditionally execute the original function. | ||
4915 | 1017 | _.wrap = function(func, wrapper) { | ||
4916 | 1018 | return function() { | ||
4917 | 1019 | var args = [func].concat(slice.call(arguments)); | ||
4918 | 1020 | return wrapper.apply(this, args); | ||
4919 | 1021 | }; | ||
4920 | 1022 | }; | ||
4921 | 1023 | |||
4922 | 1024 | // Returns a function that is the composition of a list of functions, each | ||
4923 | 1025 | // consuming the return value of the function that follows. | ||
4924 | 1026 | _.compose = function() { | ||
4925 | 1027 | var funcs = slice.call(arguments); | ||
4926 | 1028 | return function() { | ||
4927 | 1029 | var args = slice.call(arguments); | ||
4928 | 1030 | for (var i = funcs.length - 1; i >= 0; i--) { | ||
4929 | 1031 | args = [funcs[i].apply(this, args)]; | ||
4930 | 1032 | } | ||
4931 | 1033 | return args[0]; | ||
4932 | 1034 | }; | ||
4933 | 1035 | }; | ||
4934 | 1036 | |||
4935 | 1037 | // Returns a function that will only be executed after being called N times. | ||
4936 | 1038 | _.after = function(times, func) { | ||
4937 | 1039 | return function() { | ||
4938 | 1040 | if (--times < 1) { return func.apply(this, arguments); } | ||
4939 | 1041 | }; | ||
4940 | 1042 | }; | ||
4941 | 1043 | |||
4942 | 1044 | |||
4943 | 1045 | // Object Functions | ||
4944 | 1046 | // ---------------- | ||
4945 | 1047 | |||
4946 | 1048 | // Retrieve the names of an object's properties. | ||
4947 | 1049 | // Delegates to **ECMAScript 5**'s native `Object.keys` | ||
4948 | 1050 | _.keys = nativeKeys || function(obj) { | ||
4949 | 1051 | if (obj !== Object(obj)) throw new TypeError('Invalid object'); | ||
4950 | 1052 | var keys = []; | ||
4951 | 1053 | for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key; | ||
4952 | 1054 | return keys; | ||
4953 | 1055 | }; | ||
4954 | 1056 | |||
4955 | 1057 | // Retrieve the values of an object's properties. | ||
4956 | 1058 | _.values = function(obj) { | ||
4957 | 1059 | return _.map(obj, _.identity); | ||
4958 | 1060 | }; | ||
4959 | 1061 | |||
4960 | 1062 | // Return a sorted list of the function names available on the object. | ||
4961 | 1063 | // Aliased as `methods` | ||
4962 | 1064 | _.functions = _.methods = function(obj) { | ||
4963 | 1065 | var names = []; | ||
4964 | 1066 | for (var key in obj) { | ||
4965 | 1067 | if (_.isFunction(obj[key])) names.push(key); | ||
4966 | 1068 | } | ||
4967 | 1069 | return names.sort(); | ||
4968 | 1070 | }; | ||
4969 | 1071 | |||
4970 | 1072 | // Extend a given object with all the properties in passed-in object(s). | ||
4971 | 1073 | _.extend = function(obj) { | ||
4972 | 1074 | each(slice.call(arguments, 1), function(source) { | ||
4973 | 1075 | for (var prop in source) { | ||
4974 | 1076 | if (source[prop] !== void 0) obj[prop] = source[prop]; | ||
4975 | 1077 | } | ||
4976 | 1078 | }); | ||
4977 | 1079 | return obj; | ||
4978 | 1080 | }; | ||
4979 | 1081 | |||
4980 | 1082 | // Fill in a given object with default properties. | ||
4981 | 1083 | _.defaults = function(obj) { | ||
4982 | 1084 | each(slice.call(arguments, 1), function(source) { | ||
4983 | 1085 | for (var prop in source) { | ||
4984 | 1086 | if (obj[prop] == null) obj[prop] = source[prop]; | ||
4985 | 1087 | } | ||
4986 | 1088 | }); | ||
4987 | 1089 | return obj; | ||
4988 | 1090 | }; | ||
4989 | 1091 | |||
4990 | 1092 | // Create a (shallow-cloned) duplicate of an object. | ||
4991 | 1093 | _.clone = function(obj) { | ||
4992 | 1094 | return _.isArray(obj) ? obj.slice() : _.extend({}, obj); | ||
4993 | 1095 | }; | ||
4994 | 1096 | |||
4995 | 1097 | // Invokes interceptor with the obj, and then returns obj. | ||
4996 | 1098 | // The primary purpose of this method is to "tap into" a method chain, in | ||
4997 | 1099 | // order to perform operations on intermediate results within the chain. | ||
4998 | 1100 | _.tap = function(obj, interceptor) { | ||
4999 | 1101 | interceptor(obj); | ||
5000 | 1102 | return obj; |