├── COPYING ├── README.md ├── demo.html ├── demo.js ├── eventcontrol.css ├── eventcontrol.js ├── eventcontrol.min.js ├── hammer.min.js ├── hammer.min.map ├── index.html ├── jquery.mousewheel.min.js ├── moment.min.js └── update-demo.sh /COPYING: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Kristoffer Gronlund 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | moment.js license: 12 | 13 | Copyright (c) 2011-2016 Tim Wood, Iskren Chernev, Moment.js contributors 14 | 15 | Permission is hereby granted, free of charge, to any person 16 | obtaining a copy of this software and associated documentation 17 | files (the "Software"), to deal in the Software without 18 | restriction, including without limitation the rights to use, 19 | copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the 21 | Software is furnished to do so, subject to the following 22 | conditions: 23 | 24 | The above copyright notice and this permission notice shall be 25 | included in all copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 28 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 29 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 30 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 31 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 32 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 33 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 34 | OTHER DEALINGS IN THE SOFTWARE. 35 | 36 | jquery license: 37 | 38 | Copyright jQuery Foundation and other contributors, https://jquery.org/ 39 | 40 | This software consists of voluntary contributions made by many 41 | individuals. For exact contribution history, see the revision history 42 | available at https://github.com/jquery/jquery 43 | 44 | The following license applies to all parts of this software except as 45 | documented below: 46 | 47 | ==== 48 | 49 | Permission is hereby granted, free of charge, to any person obtaining 50 | a copy of this software and associated documentation files (the 51 | "Software"), to deal in the Software without restriction, including 52 | without limitation the rights to use, copy, modify, merge, publish, 53 | distribute, sublicense, and/or sell copies of the Software, and to 54 | permit persons to whom the Software is furnished to do so, subject to 55 | the following conditions: 56 | 57 | The above copyright notice and this permission notice shall be 58 | included in all copies or substantial portions of the Software. 59 | 60 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 61 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 62 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 63 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 64 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 65 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 66 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 67 | 68 | ==== 69 | 70 | All files located in the node_modules and external directories are 71 | externally maintained libraries used by this software which have their 72 | own licenses; we recommend you read them, as their terms may differ from 73 | the terms above. 74 | 75 | jquery-mousewheel license: 76 | 77 | Copyright jQuery Foundation and other contributors 78 | https://jquery.org/ 79 | 80 | This software consists of voluntary contributions made by many 81 | individuals. For exact contribution history, see the revision history 82 | available at https://github.com/jquery/jquery-mousewheel 83 | 84 | The following license applies to all parts of this software except as 85 | documented below: 86 | 87 | ==== 88 | 89 | Permission is hereby granted, free of charge, to any person obtaining 90 | a copy of this software and associated documentation files (the 91 | "Software"), to deal in the Software without restriction, including 92 | without limitation the rights to use, copy, modify, merge, publish, 93 | distribute, sublicense, and/or sell copies of the Software, and to 94 | permit persons to whom the Software is furnished to do so, subject to 95 | the following conditions: 96 | 97 | The above copyright notice and this permission notice shall be 98 | included in all copies or substantial portions of the Software. 99 | 100 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 101 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 102 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 103 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 104 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 105 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 106 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 107 | 108 | ==== 109 | 110 | All files located in the node_modules and external directories are 111 | externally maintained libraries used by this software which have their 112 | own licenses; we recommend you read them, as their terms may differ from 113 | the terms above. 114 | 115 | hammer.js license: 116 | 117 | The MIT License (MIT) 118 | 119 | Copyright (C) 2011-2014 by Jorik Tangelder (Eight Media) 120 | 121 | Permission is hereby granted, free of charge, to any person obtaining a copy 122 | of this software and associated documentation files (the "Software"), to deal 123 | in the Software without restriction, including without limitation the rights 124 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 125 | copies of the Software, and to permit persons to whom the Software is 126 | furnished to do so, subject to the following conditions: 127 | 128 | The above copyright notice and this permission notice shall be included in 129 | all copies or substantial portions of the Software. 130 | 131 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 132 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 133 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 134 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 135 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 136 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 137 | THE SOFTWARE. 138 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EventControl 2 | 3 | jQuery timeline control with support for stacking events. 4 | 5 | ## Releases 6 | 7 | * [Latest release][latest] 8 | 9 | ## Example 10 | 11 | See the included `index.html` and `demo.js`, or the [live demo][demo]. 12 | 13 | ## Dependencies 14 | 15 | * [moment.js][moment] 16 | * [jquery][jquery] 17 | * [jquery-mousewheel][jquery-mousewheel] 18 | 19 | Optional dependency: 20 | 21 | * [hammer.js][hammer] 22 | 23 | [latest]: https://github.com/krig/eventcontrol/releases/latest 24 | [demo]: http://krig.github.io/eventcontrol/ "kri.gs/eventcontrol" 25 | [moment]: http://momentjs.com/ "moment.js" 26 | [jquery]: https://jquery.org/ "jquery" 27 | [jquery-mousewheel]: https://github.com/jquery/jquery-mousewheel "jquery-mousewheel" 28 | [hammer]: http://hammerjs.github.io/ "hammer.js" 29 | -------------------------------------------------------------------------------- /demo.html: -------------------------------------------------------------------------------- 1 | index.html -------------------------------------------------------------------------------- /demo.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 'use strict'; 3 | 4 | $('.eventcontrol').EventControl({ 5 | hammertime: true, 6 | onhover: function(item, element, event, inout) { 7 | if (inout == 'out') { 8 | $('.eventcontrol-target').html(''); 9 | element.css('color', element.data('clr')); 10 | } else { 11 | var x = ['

', moment(item.timestamp).format('YYYY-MM-DD HH:mm:ss'), '

']; 12 | $('.eventcontrol-target').html(x.join('')); 13 | $('.eventcontrol-target').css('color', element.css('color')); 14 | element.data('clr', element.css('color')); 15 | element.css('color', '#9b59b6'); 16 | } 17 | }, 18 | oncreate: function(item, element) { 19 | if (item.type == 'error') { 20 | element.css('color', '#e74c3c'); 21 | } else if (item.type == 'warning') { 22 | element.css('color', '#e67e22'); 23 | } else { 24 | element.css('color', '#1abc9c'); 25 | } 26 | }, 27 | onclick: function(item, element, event) { 28 | alert(item.timestamp); 29 | }, 30 | data: [ 31 | { 32 | "timestamp": "2016-03-02T10:57:03+01:00", 33 | "type": "warning", 34 | }, 35 | { 36 | "timestamp": "2016-03-02T11:10:39+01:00", 37 | "type": "", 38 | }, 39 | { 40 | "timestamp": "2016-03-02T12:56:32+01:00", 41 | "type": "", 42 | }, 43 | { 44 | "timestamp": "2016-03-02T14:26:37+01:00", 45 | "type": "", 46 | }, 47 | { 48 | "timestamp": "2016-03-02T14:26:52+01:00", 49 | "type": "error", 50 | }, 51 | { 52 | "timestamp": "2016-03-02T14:27:40+01:00", 53 | "type": "", 54 | }, 55 | { 56 | "timestamp": "2016-03-02T14:29:16+01:00", 57 | "type": "", 58 | }, 59 | { 60 | "timestamp": "2016-03-02T14:29:17+01:00", 61 | "type": "", 62 | }, 63 | { 64 | "timestamp": "2016-03-02T14:29:18+01:00", 65 | "type": "", 66 | }, 67 | { 68 | "timestamp": "2016-03-02T14:29:26+01:00", 69 | "type": "", 70 | }, 71 | { 72 | "timestamp": "2016-03-02T14:29:32+01:00", 73 | "type": "", 74 | }, 75 | { 76 | "timestamp": "2016-03-02T14:29:50+01:00", 77 | "type": "", 78 | }, 79 | { 80 | "timestamp": "2016-03-02T14:29:56+01:00", 81 | "type": "", 82 | }, 83 | { 84 | "timestamp": "2016-03-02T14:30:45+01:00", 85 | "type": "", 86 | }, 87 | { 88 | "timestamp": "2016-03-02T14:31:00+01:00", 89 | "type": "", 90 | }, 91 | { 92 | "timestamp": "2016-03-02T14:31:02+01:00", 93 | "type": "", 94 | }, 95 | { 96 | "timestamp": "2016-03-02T14:31:08+01:00", 97 | "type": "", 98 | }, 99 | { 100 | "timestamp": "2016-03-02T14:31:41+01:00", 101 | "type": "", 102 | }, 103 | { 104 | "timestamp": "2016-03-02T14:31:46+01:00", 105 | "type": "", 106 | }, 107 | { 108 | "timestamp": "2016-03-02T14:31:52+01:00", 109 | "type": "", 110 | }, 111 | { 112 | "timestamp": "2016-03-02T14:31:53+01:00", 113 | "type": "", 114 | }, 115 | { 116 | "timestamp": "2016-03-02T14:32:07+01:00", 117 | "type": "", 118 | }, 119 | { 120 | "timestamp": "2016-03-02T14:32:09+01:00", 121 | "type": "", 122 | }, 123 | { 124 | "timestamp": "2016-03-02T14:32:11+01:00", 125 | "type": "", 126 | }, 127 | { 128 | "timestamp": "2016-03-02T14:32:17+01:00", 129 | "type": "error", 130 | }, 131 | { 132 | "timestamp": "2016-03-02T14:58:32+01:00", 133 | "type": "", 134 | }, 135 | { 136 | "timestamp": "2016-03-02T14:58:41+01:00", 137 | "type": "", 138 | }, 139 | { 140 | "timestamp": "2016-03-02T15:00:13+01:00", 141 | "type": "", 142 | }, 143 | { 144 | "timestamp": "2016-03-02T15:00:16+01:00", 145 | "type": "warning", 146 | }, 147 | { 148 | "timestamp": "2016-03-02T15:00:27+01:00", 149 | "type": "", 150 | }, 151 | { 152 | "timestamp": "2016-03-02T15:00:27+01:00", 153 | "type": "", 154 | }, 155 | { 156 | "timestamp": "2016-03-02T15:07:15+01:00", 157 | "type": "", 158 | }, 159 | { 160 | "timestamp": "2016-03-02T15:07:15+01:00", 161 | "type": "", 162 | }, 163 | { 164 | "timestamp": "2016-03-02T15:07:29+01:00", 165 | "type": "", 166 | }, 167 | { 168 | "timestamp": "2016-03-02T15:07:29+01:00", 169 | "type": "", 170 | }, 171 | { 172 | "timestamp": "2016-03-02T15:07:34+01:00", 173 | "type": "", 174 | }, 175 | { 176 | "timestamp": "2016-03-02T15:07:43+01:00", 177 | "type": "", 178 | }, 179 | { 180 | "timestamp": "2016-03-02T15:07:56+01:00", 181 | "type": "", 182 | }, 183 | { 184 | "timestamp": "2016-03-02T15:08:01+01:00", 185 | "type": "", 186 | }, 187 | { 188 | "timestamp": "2016-03-02T15:08:02+01:00", 189 | "type": "", 190 | }, 191 | { 192 | "timestamp": "2016-03-02T15:48:45+01:00", 193 | "type": "", 194 | }, 195 | { 196 | "timestamp": "2016-03-02T15:55:29+01:00", 197 | "type": "", 198 | }, 199 | { 200 | "timestamp": "2016-03-04T10:09:08+01:00", 201 | "type": "", 202 | }, 203 | { 204 | "timestamp": "2016-03-04T10:12:55+01:00", 205 | "type": "", 206 | }, 207 | { 208 | "timestamp": "2016-03-09T14:00:36+01:00", 209 | "type": "", 210 | }, 211 | { 212 | "timestamp": "2016-03-09T16:08:59+01:00", 213 | "type": "", 214 | }, 215 | { 216 | "timestamp": "2016-03-11T14:36:06+01:00", 217 | "type": "", 218 | }, 219 | { 220 | "timestamp": "2016-03-11T14:36:06+01:00", 221 | "type": "", 222 | }, 223 | { 224 | "timestamp": "2016-03-11T14:36:06+01:00", 225 | "type": "error", 226 | }, 227 | { 228 | "timestamp": "2016-03-11T14:36:06+01:00", 229 | "type": "error", 230 | }, 231 | { 232 | "timestamp": "2016-03-11T14:36:09+01:00", 233 | "type": "", 234 | }, 235 | { 236 | "timestamp": "2016-03-13T23:20:52+01:00", 237 | "type": "", 238 | }, 239 | { 240 | "timestamp": "2016-03-13T23:25:05+01:00", 241 | "type": "", 242 | }, 243 | { 244 | "timestamp": "2016-03-13T23:25:09+01:00", 245 | "type": "", 246 | }, 247 | { 248 | "timestamp": "2017-03-13T23:25:09+01:00", 249 | "type": "", 250 | }, 251 | { 252 | "timestamp": "2019-03-13T23:25:11+01:00", 253 | "type": "", 254 | } 255 | ] 256 | 257 | }); 258 | }); 259 | -------------------------------------------------------------------------------- /eventcontrol.css: -------------------------------------------------------------------------------- 1 | .eventcontrol { 2 | /*background: #eee; */ 3 | color: #444; 4 | background: #e3e3e3; 5 | border-radius: 3px; 6 | border: 1px solid #e0e0e0; 7 | overflow: hidden; 8 | position: relative; 9 | width: 100%; 10 | } 11 | 12 | .eventcontrol .ec-items { 13 | background: #fafafa; 14 | /*border-radius: 3px;*/ 15 | } 16 | 17 | .eventcontrol .ec-markers { 18 | border-top: 1px solid #fff; 19 | } 20 | 21 | .eventcontrol .ec-dot { 22 | position: absolute; 23 | padding: 0; 24 | width: 0px; 25 | height: 0px; 26 | border: 7px solid; 27 | border-radius: 4px; 28 | cursor:pointer; 29 | background: #fff; 30 | z-index: 1; 31 | } 32 | 33 | .eventcontrol .ec-markers .ec-ticks { 34 | } 35 | 36 | .eventcontrol .ec-markers .ec-ticks .ec-tick { 37 | position: absolute; 38 | width: 0px; 39 | border-left: 1px solid #ececec; 40 | } 41 | 42 | .eventcontrol .ec-markers .ec-labels { 43 | } 44 | 45 | .eventcontrol .ec-label { 46 | position: absolute; 47 | padding: 0; 48 | font-size: 12px; 49 | text-align: left; 50 | white-space: nowrap; 51 | color: #777; 52 | } 53 | 54 | .eventcontrol .ec-region-label { 55 | position: absolute; 56 | padding: 0; 57 | font-size: 10px; 58 | font-weight: bold; 59 | text-align: left; 60 | white-space: nowrap; 61 | color: #999; 62 | } 63 | 64 | .eventcontrol .ec-draggable { 65 | cursor:hand; 66 | cursor:grab; 67 | cursor:-moz-grab; 68 | cursor:-webkit-grab; 69 | } 70 | 71 | .eventcontrol .ec-dragging { 72 | cursor:grabbing; 73 | cursor:-moz-grabbing; 74 | cursor:-webkit-grabbing; 75 | } -------------------------------------------------------------------------------- /eventcontrol.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Kristoffer Gronlund 2 | // See COPYING for license. 3 | 4 | (function($) { 5 | function unit_in_timespan(h, min_time, timespan) { 6 | var day = 24*3600*1000; 7 | var year = 365*day; 8 | if (h > day) { 9 | if (timespan > year*4) { 10 | var s = moment(min_time).startOf('year'); 11 | var e = min_time + timespan; 12 | var r = [s]; 13 | var yy = s.year(); 14 | while (s < e) { 15 | yy += 1; 16 | s = moment(yy + "-01-01", 'YYYY-MM-DD'); 17 | r.push(s); 18 | } 19 | if (r.length > 20) { 20 | r = r.slice(0, 20); 21 | } 22 | return r; 23 | } 24 | } 25 | var s = min_time - (min_time % h); 26 | var e = min_time + timespan; 27 | if (h > 15*60*1000) { 28 | s -= 3600*1000; 29 | } 30 | var r = [s]; 31 | while (s < e) { 32 | s += h; 33 | if (s >= min_time && s <= e) { 34 | r.push(s); 35 | } 36 | } 37 | if (r.length > 20) { 38 | r = r.slice(0, 20); 39 | } 40 | return r; 41 | } 42 | 43 | var MIN_SPAN = 10000; 44 | var MAX_SPAN = 1000 * 3600 * 24 * 365 * 100; 45 | var MAJSPANS = [4*365*24*3600*1000, 365*24*3600*1000, 120*24*3600*1000, 42*24*3600*1000, 28*24*3600*1000, 21*24*3600*1000, 14*24*3600*1000, 10*24*3600*1000]; 46 | var MAJUNITS = [ 365*24*3600*1000, 120*24*3600*1000, 31*24*3600*1000, 21*24*3600*1000, 14*24*3600*1000, 7*24*3600*1000, 4*24*3600*1000, 2*24*3600*1000]; 47 | var MINSPANS = [3*24*3600*1000, 2*24*3600*1000, 24*3600*1000, 12*3600*1000, 6*3600*1000, 3*3600*1000, 3600*1000, 45*60*1000, 30*60*1000, 20*60*1000, 10*60*1000, 5*60*1000, 3*60*1000, 60*1000, 45*1000, 20*1000, 12*1000, 0]; 48 | var MINUNITS = [ 12*3600*1000, 6*3600*1000, 4*3600*1000, 3*3600*1000, 3600*1000, 30*60*1000, 15*60*1000, 5*60*1000, 4*60*1000, 3*60*1000, 2*60*1000, 60*1000, 30*1000, 15*1000, 10*1000, 5*1000, 2*1000, 1000]; 49 | 50 | var EventControl = function(element, options) { 51 | this.settings = $.extend({ 52 | onhover: function(item, element, event, inout) {}, 53 | onclick: function(item, element, event) {}, 54 | oncreate: function(item, element) {}, 55 | data: [], 56 | hammertime: false, 57 | items_height: 113, 58 | markers_height: 31, 59 | item_width: 14, 60 | item_offset: 2, 61 | item_slot_x: -100, 62 | displayUTC: false 63 | }, options); 64 | 65 | this.element = element; 66 | this.width = element.width(); 67 | 68 | this.items_h = this.settings.items_height; 69 | this.markers_h = this.settings.markers_height; 70 | this.item_width = this.settings.item_width; 71 | this.item_offset = this.settings.item_offset; 72 | this.item_slot_x = this.settings.item_slot_x; 73 | this._dragging = null; 74 | this._drag_x = 0; 75 | 76 | element.addClass('eventcontrol'); 77 | element.append(['
', 78 | '
', 79 | '
', 80 | '
', 81 | '
' 82 | ].join('')); 83 | 84 | this.items = element.children('.ec-items'); 85 | this.markers = element.children('.ec-markers'); 86 | this.ticks = this.markers.children('.ec-ticks'); 87 | this.labels = this.markers.children('.ec-labels'); 88 | this.min_time = moment("2070-01-01"); 89 | this.max_time = moment("1970-01-01"); 90 | this.pan_min = this.min_time.clone(); 91 | this.pan_max = this.max_time.clone(); 92 | this.timespan = MAX_SPAN; 93 | this.max_timespan = MAX_SPAN; 94 | this.center_time = this.min_time.valueOf() + MAX_SPAN * 0.5; 95 | this.init(); 96 | return this; 97 | }; 98 | 99 | EventControl.prototype.init = function() { 100 | var self = this; 101 | var element = this.element; 102 | 103 | function stop_dragging() { 104 | element.children('.ec-draggable').removeClass('ec-dragging'); 105 | self._dragging = null; 106 | } 107 | 108 | function pan_with_delta(dragdelta, min_time, max_time) { 109 | if (dragdelta > 0.9) { 110 | dragdelta = 0.9; 111 | } else if (dragdelta < -0.9) { 112 | dragdelta = -0.9; 113 | } 114 | var time_offset = dragdelta * self.timespan; 115 | var new_min_time = moment(min_time + time_offset); 116 | var new_max_time = moment(max_time + time_offset); 117 | // disallow pan if panning to where there are no data points 118 | if ((new_min_time > self.pan_max && new_min_time > min_time) || 119 | (new_max_time < self.pan_min && new_max_time < max_time)) { 120 | return; 121 | } 122 | if (!new_min_time.isSame(self.min_time) || new_max_time.isSame(self.max_time)) { 123 | self.update_timespan(new_min_time, new_max_time); 124 | } 125 | } 126 | 127 | if (self.settings.hammertime) { 128 | self.mc = new Hammer.Manager(self.element.get()[0]); 129 | self.mc.add(new Hammer.Pan()); 130 | // Tap recognizer with minimal 2 taps 131 | self.mc.add( new Hammer.Tap({ event: 'doubletap', taps: 2 }) ); 132 | // Single tap recognizer 133 | self.mc.add( new Hammer.Tap({ event: 'singletap' }) ); 134 | self.mc.get('doubletap').recognizeWith('singletap'); 135 | // we only want to trigger a tap, when we don't have detected a doubletap 136 | self.mc.get('singletap').requireFailure('doubletap'); 137 | 138 | self.mc.on("panstart panleft panright singletap doubletap tap", function(e) { 139 | if (e.type == "singletap") { 140 | var tgt = $(e.target); 141 | if (tgt.hasClass('ec-dot')) { 142 | self.settings.onclick.call(self, tgt.data('event'), tgt, e); 143 | } 144 | } else if (e.type == "panstart") { 145 | self._pan_min_time = self.min_time.valueOf(); 146 | self._pan_max_time = self.max_time.valueOf(); 147 | } else if (e.type == "panleft" || e.type == "panright") { 148 | var deltapx = -e.deltaX; 149 | var dragdelta = deltapx / self.width; 150 | 151 | pan_with_delta(dragdelta, self._pan_min_time, self._pan_max_time); 152 | } else if (e.type == "doubletap") { 153 | var base = element.offset(); 154 | var dir = 1; 155 | var offset = (e.center.x - base.left) / self.width; 156 | self.zoom(dir, offset); 157 | } else { 158 | console.log("Unexpected hammer event", e.type); 159 | } 160 | }); 161 | 162 | } else { 163 | element.on('click', function(e) { 164 | var tgt = $(e.target); 165 | if (tgt.hasClass('ec-dot')) { 166 | self.settings.onclick.call(self, tgt.data('event'), tgt, e); 167 | } 168 | }); 169 | 170 | element.mousedown(function(e) { 171 | if (e.which == 1) { 172 | element.children('.ec-draggable').addClass('ec-dragging'); 173 | self._dragging = true; 174 | self._drag_x = e.pageX; 175 | self._drag_min_time = self.min_time.valueOf(); 176 | self._drag_max_time = self.max_time.valueOf(); 177 | return false; 178 | } 179 | }); 180 | 181 | $('body').mouseup(function(e) { 182 | if (e.which == 1) { 183 | stop_dragging(); 184 | } 185 | }); 186 | 187 | $('body').on("dragend",function(){ 188 | stop_dragging(); 189 | }); 190 | 191 | $('body').mousemove(function(e) { 192 | if (e.which == 1 && self._dragging) { 193 | var deltapx = -(e.pageX - self._drag_x); 194 | var dragdelta = deltapx / self.width; 195 | pan_with_delta(dragdelta, self._drag_min_time, self._drag_max_time); 196 | } 197 | }); 198 | } 199 | 200 | $(window).resize(function() { 201 | if (!self._dirty) { 202 | if (self.min_time && self.max_time) { 203 | self._dirty = true; 204 | window.setTimeout(function() { 205 | var mit = self.min_time.clone(); 206 | var mat = self.max_time.clone(); 207 | self.update_timespan(mit, mat); 208 | }, 400); 209 | } 210 | } 211 | }); 212 | 213 | element.on('mousewheel', function(event) { 214 | event.preventDefault(); 215 | var dir = event.deltaY; 216 | var base = element.offset(); 217 | var offset = (event.pageX - base.left) / self.width; 218 | self.zoom(dir, offset); 219 | }); 220 | 221 | $.each(self.settings.data, function(i, item) { 222 | self.items.append('
'); 223 | var elem = self.items.children('.ec-dot:last-child'); 224 | elem.data('event', item); 225 | item._starttime = moment(item.timestamp).valueOf(); 226 | 227 | self.settings.oncreate.call(self, item, elem); 228 | 229 | elem.hover(function(event) { 230 | self.settings.onhover.call(self, item, elem, event, 'in'); 231 | }, function(event) { 232 | self.settings.onhover.call(self, item, elem, event, 'out'); 233 | }); 234 | 235 | var t = moment(item.timestamp); 236 | if (t < self.min_time) { 237 | self.min_time = t.clone(); 238 | } 239 | if (t > self.max_time) { 240 | self.max_time = t; 241 | } 242 | }); 243 | 244 | self.min_time.subtract(5, 's'); 245 | self.max_time.add(5, 's'); 246 | self.center_time = self.min_time.valueOf() + (self.max_time.valueOf() - self.min_time.valueOf()) * 0.5; 247 | 248 | self.pan_min = self.min_time.clone(); 249 | self.pan_max = self.max_time.clone(); 250 | 251 | self.update_timespan(self.min_time.clone(), self.max_time.clone()); 252 | }; 253 | 254 | EventControl.prototype.save_state = function() { 255 | return {min_time: this.min_time.valueOf(), max_time: this.max_time.valueOf()}; 256 | }; 257 | 258 | EventControl.prototype.load_state = function(state) { 259 | this.update_timespan(state.min_time, state.max_time); 260 | }; 261 | 262 | EventControl.prototype.zoom = function(dir, focus) { 263 | if (focus === undefined) { 264 | focus = 0.5; 265 | } 266 | 267 | var new_min_time = this.min_time.clone(); 268 | var new_max_time = this.max_time.clone(); 269 | var delta; 270 | 271 | if (dir < 0) { 272 | delta = this.timespan * 0.5; 273 | new_min_time.subtract(delta * focus, 'ms'); 274 | new_max_time.add(delta * (1.0 - focus), 'ms'); 275 | } else { 276 | delta = this.timespan * 0.25; 277 | new_min_time.add(delta * focus, 'ms'); 278 | new_max_time.subtract(delta * (1.0 - focus), 'ms'); 279 | } 280 | 281 | return this.update_timespan(new_min_time, new_max_time); 282 | }; 283 | 284 | EventControl.prototype.update_timespan = function(new_min_time, new_max_time) { 285 | var self = this; 286 | var element = this.element; 287 | var i = 0; 288 | 289 | self._dirty = false; 290 | self.width = element.width(); 291 | 292 | if (!moment.isMoment(new_min_time)) { 293 | new_min_time = moment(new_min_time); 294 | } 295 | if (!moment.isMoment(new_max_time)) { 296 | new_max_time = moment(new_max_time); 297 | } 298 | 299 | self.timespan = new_max_time.valueOf() - new_min_time.valueOf(); 300 | if (self.timespan < MIN_SPAN) { 301 | var ct = self.min_time.valueOf() + (self.max_time.valueOf() - self.min_time.valueOf()) * 0.5; 302 | new_min_time = moment(ct - MIN_SPAN*0.5); 303 | new_max_time = moment(ct + MIN_SPAN*0.5); 304 | self.timespan = new_max_time.valueOf() - new_min_time.valueOf(); 305 | } 306 | 307 | if (self.max_timespan == MAX_SPAN) { 308 | self.max_timespan = self.timespan * 2; 309 | } 310 | 311 | if (self.timespan > self.max_timespan) { 312 | new_min_time = moment(self.center_time - self.max_timespan * 0.5); 313 | new_max_time = moment(self.center_time + self.max_timespan * 0.5); 314 | self.timespan = self.max_time.valueOf() - self.min_time.valueOf(); 315 | } 316 | self.min_time = new_min_time; 317 | self.max_time = new_max_time; 318 | 319 | var min_time_ms = self.min_time.valueOf(); 320 | var major; 321 | var minor; 322 | var major_fmt = 'YYYY-MM-DD'; 323 | var minor_fmt = 'HH:mm'; 324 | var maj_unit = 24*3600*1000; 325 | var min_unit = null; 326 | 327 | var format_time = self.settings.displayUTC ? function(t, fmt) { 328 | return moment.utc(t).format(fmt); 329 | } : function(t, fmt) { 330 | return moment(t).format(fmt); 331 | }; 332 | 333 | 334 | if (self.timespan >= 6*24*3600*1000) { 335 | min_unit = null; 336 | if (self.timespan > 4*365*24*3600*1000) { 337 | major_fmt = 'YYYY'; 338 | } else if (self.timespan > 120*24*3600*1000) { 339 | major_fmt = 'YYYY-MM'; 340 | } 341 | for (i = 0; i < MAJSPANS.length; i++) { 342 | if (self.timespan > MAJSPANS[i]) { 343 | maj_unit = MAJUNITS[i]; 344 | break; 345 | } 346 | } 347 | } else { 348 | for (i = 0; i < MINSPANS.length; i++) { 349 | if (self.timespan > MINSPANS[i]) { 350 | min_unit = MINUNITS[i]; 351 | break; 352 | } 353 | } 354 | if (min_unit < 60*1000) { 355 | minor_fmt = 'HH:mm:ss'; 356 | } 357 | } 358 | 359 | major = unit_in_timespan(maj_unit, min_time_ms, self.timespan); 360 | 361 | var lastlblend = -1; 362 | var existing_ticks = self.ticks.children('.ec-tick'); 363 | var existing_labels = self.labels.children('.ec-label,.ec-region-label'); 364 | var tick_idx = 0; 365 | var label_idx = 0; 366 | 367 | function addlabel(cls, l, t, lbl) { 368 | if (l > lastlblend) { 369 | if (label_idx < existing_labels.length) { 370 | var label = $(existing_labels[label_idx]); 371 | label.css('left', l).css('top', t).text(lbl).addClass(cls).removeClass((cls == 'ec-label') ? 'ec-region-label' : 'ec-label'); 372 | lastlblend = l + label.width(); 373 | label_idx += 1; 374 | } else { 375 | self.labels.append(['
', lbl, '
'].join("")); 376 | lastlblend = l + self.labels.children('.' + cls + ':last-child').width(); 377 | } 378 | } 379 | } 380 | 381 | function addtick(l, t, h) { 382 | if (tick_idx < existing_ticks.length) { 383 | var tick = $(existing_ticks[tick_idx]); 384 | tick.css('left', l).css('top', t).css('height', h); 385 | tick_idx += 1; 386 | } else { 387 | self.ticks.append(['
'].join('')); 388 | } 389 | } 390 | 391 | var span = self.width / self.timespan; 392 | var ts; 393 | var xoffs; 394 | 395 | if (min_unit !== null) { 396 | minor = unit_in_timespan(min_unit, min_time_ms, self.timespan); 397 | 398 | for (i = 0; i < minor.length; i++) { 399 | ts = minor[i]; 400 | xoffs = span * (ts - min_time_ms); 401 | addtick(xoffs, 1, self.items_h + 1 + self.markers_h); 402 | addlabel('ec-label', xoffs + 1, self.items_h + 1, format_time(ts, minor_fmt)); 403 | } 404 | } else { 405 | for (i = 0; i < major.length; i++) { 406 | addtick(span * (major[i] - min_time_ms), 1, self.items_h * 0.5); 407 | } 408 | } 409 | 410 | lastlblend = -1; 411 | for (i = 0; i < major.length; i++) { 412 | ts = major[i]; 413 | var l = span * (ts - min_time_ms); 414 | if (l < 2) { 415 | if (i + 1 < major.length) { 416 | var next = span * (major[i + 1] - min_time_ms); 417 | if (next > 60) { 418 | l = 2; 419 | } 420 | } else { 421 | l = 2; 422 | } 423 | } 424 | addlabel('ec-region-label', l + 1, self.items_h + self.markers_h - 14, format_time(ts, major_fmt)); 425 | } 426 | 427 | for (i = tick_idx; i < existing_ticks.length; i++) { 428 | $(existing_ticks[i]).remove(); 429 | } 430 | for (i = label_idx; i < existing_labels.length; i++) { 431 | $(existing_labels[i]).remove(); 432 | } 433 | 434 | var item_offset = self.item_offset; 435 | var item_slot_x = self.item_slot_x; 436 | var item_slot_y = item_offset; 437 | var item_w = self.item_width; 438 | var item_d = item_w + item_offset; 439 | var items = self.items.children('.ec-dot'); 440 | 441 | span = (self.width - (item_offset * 2)) / self.timespan; 442 | 443 | var push_rows = 0; 444 | 445 | for (i = 0; i < items.length; i++) { 446 | var elem = $(items[i]); 447 | var item = elem.data('event'); 448 | var m = item._starttime; 449 | 450 | if ((span * (m - min_time_ms)) < -(item_w + item_offset) * 6) { 451 | elem.css('display', 'none'); 452 | continue; 453 | } else { 454 | elem.css('display', ''); 455 | } 456 | 457 | var x = Math.floor(item_offset + span * (m - min_time_ms)); 458 | var xf = x % item_d; 459 | x = x - xf; 460 | var y = item_offset; 461 | var pushed = false; 462 | xoffs = item_slot_x; 463 | if ((x + xf - item_slot_x) <= item_w) { 464 | pushed = true; 465 | x = xoffs; 466 | y = item_slot_y + item_d; 467 | if (y > self.items_h - item_offset) { 468 | xoffs += item_d; 469 | x = xoffs; 470 | y = item_offset; 471 | push_rows += 1; 472 | } 473 | } else { 474 | item_slot_y = item_offset; 475 | push_rows = 0; 476 | } 477 | 478 | if (!pushed) { 479 | x += xf; 480 | } else if (push_rows > 5) { 481 | elem.css('display', 'none'); 482 | continue; 483 | } 484 | 485 | item_slot_x = x; 486 | item_slot_y = y; 487 | 488 | elem.css('left', x).css('top', y); 489 | } 490 | }; 491 | 492 | $.fn.EventControl = function(options) { 493 | var command_args = Array.prototype.slice(arguments, 1); 494 | return this.each(function() { 495 | var element = $(this); 496 | var self = element.data('eventcontrol'); 497 | if (!self) { 498 | self = new EventControl(element, options); 499 | element.data('eventcontrol', self); 500 | } else if (options === undefined) { 501 | return self.save_state(); 502 | } else if (options == 'zoom-in') { 503 | return self.zoom.apply(self, [1].concat(command_args)); 504 | } else if (options == 'zoom-out') { 505 | return self.zoom.apply(self, [-1].concat(command_args)); 506 | } else { 507 | self.load_state(options); 508 | } 509 | return self; 510 | }); 511 | }; 512 | }(jQuery)); 513 | -------------------------------------------------------------------------------- /eventcontrol.min.js: -------------------------------------------------------------------------------- 1 | (function($){function unit_in_timespan(h,min_time,timespan){var day=24*3600*1e3;var year=365*day;if(h>day){if(timespan>year*4){var s=moment(min_time).startOf("year");var e=min_time+timespan;var r=[s];var yy=s.year();while(s20){r=r.slice(0,20)}return r}}var s=min_time-min_time%h;var e=min_time+timespan;if(h>15*60*1e3){s-=3600*1e3}var r=[s];while(s=min_time&&s<=e){r.push(s)}}if(r.length>20){r=r.slice(0,20)}return r}var MIN_SPAN=1e4;var MAX_SPAN=1e3*3600*24*365*100;var MAJSPANS=[4*365*24*3600*1e3,365*24*3600*1e3,120*24*3600*1e3,42*24*3600*1e3,28*24*3600*1e3,21*24*3600*1e3,14*24*3600*1e3,10*24*3600*1e3];var MAJUNITS=[365*24*3600*1e3,120*24*3600*1e3,31*24*3600*1e3,21*24*3600*1e3,14*24*3600*1e3,7*24*3600*1e3,4*24*3600*1e3,2*24*3600*1e3];var MINSPANS=[3*24*3600*1e3,2*24*3600*1e3,24*3600*1e3,12*3600*1e3,6*3600*1e3,3*3600*1e3,3600*1e3,45*60*1e3,30*60*1e3,20*60*1e3,10*60*1e3,5*60*1e3,3*60*1e3,60*1e3,45*1e3,20*1e3,12*1e3,0];var MINUNITS=[12*3600*1e3,6*3600*1e3,4*3600*1e3,3*3600*1e3,3600*1e3,30*60*1e3,15*60*1e3,5*60*1e3,4*60*1e3,3*60*1e3,2*60*1e3,60*1e3,30*1e3,15*1e3,10*1e3,5*1e3,2*1e3,1e3];var EventControl=function(element,options){this.settings=$.extend({onhover:function(item,element,event,inout){},onclick:function(item,element,event){},oncreate:function(item,element){},data:[],hammertime:false,items_height:113,markers_height:31,item_width:14,item_offset:2,item_slot_x:-100,displayUTC:false},options);this.element=element;this.width=element.width();this.items_h=this.settings.items_height;this.markers_h=this.settings.markers_height;this.item_width=this.settings.item_width;this.item_offset=this.settings.item_offset;this.item_slot_x=this.settings.item_slot_x;this._dragging=null;this._drag_x=0;element.addClass("eventcontrol");element.append(['
','
','
','
',"
"].join(""));this.items=element.children(".ec-items");this.markers=element.children(".ec-markers");this.ticks=this.markers.children(".ec-ticks");this.labels=this.markers.children(".ec-labels");this.min_time=moment("2070-01-01");this.max_time=moment("1970-01-01");this.pan_min=this.min_time.clone();this.pan_max=this.max_time.clone();this.timespan=MAX_SPAN;this.max_timespan=MAX_SPAN;this.center_time=this.min_time.valueOf()+MAX_SPAN*.5;this.init();return this};EventControl.prototype.init=function(){var self=this;var element=this.element;function stop_dragging(){element.children(".ec-draggable").removeClass("ec-dragging");self._dragging=null}function pan_with_delta(dragdelta,min_time,max_time){if(dragdelta>.9){dragdelta=.9}else if(dragdelta<-.9){dragdelta=-.9}var time_offset=dragdelta*self.timespan;var new_min_time=moment(min_time+time_offset);var new_max_time=moment(max_time+time_offset);if(new_min_time>self.pan_max&&new_min_time>min_time||new_max_time');var elem=self.items.children(".ec-dot:last-child");elem.data("event",item);item._starttime=moment(item.timestamp).valueOf();self.settings.oncreate.call(self,item,elem);elem.hover(function(event){self.settings.onhover.call(self,item,elem,event,"in")},function(event){self.settings.onhover.call(self,item,elem,event,"out")});var t=moment(item.timestamp);if(tself.max_time){self.max_time=t}});self.min_time.subtract(5,"s");self.max_time.add(5,"s");self.center_time=self.min_time.valueOf()+(self.max_time.valueOf()-self.min_time.valueOf())*.5;self.pan_min=self.min_time.clone();self.pan_max=self.max_time.clone();self.update_timespan(self.min_time.clone(),self.max_time.clone())};EventControl.prototype.save_state=function(){return{min_time:this.min_time.valueOf(),max_time:this.max_time.valueOf()}};EventControl.prototype.load_state=function(state){this.update_timespan(state.min_time,state.max_time)};EventControl.prototype.zoom=function(dir,focus){if(focus===undefined){focus=.5}var new_min_time=this.min_time.clone();var new_max_time=this.max_time.clone();var delta;if(dir<0){delta=this.timespan*.5;new_min_time.subtract(delta*focus,"ms");new_max_time.add(delta*(1-focus),"ms")}else{delta=this.timespan*.25;new_min_time.add(delta*focus,"ms");new_max_time.subtract(delta*(1-focus),"ms")}return this.update_timespan(new_min_time,new_max_time)};EventControl.prototype.update_timespan=function(new_min_time,new_max_time){var self=this;var element=this.element;var i=0;self._dirty=false;self.width=element.width();if(!moment.isMoment(new_min_time)){new_min_time=moment(new_min_time)}if(!moment.isMoment(new_max_time)){new_max_time=moment(new_max_time)}self.timespan=new_max_time.valueOf()-new_min_time.valueOf();if(self.timespanself.max_timespan){new_min_time=moment(self.center_time-self.max_timespan*.5);new_max_time=moment(self.center_time+self.max_timespan*.5);self.timespan=self.max_time.valueOf()-self.min_time.valueOf()}self.min_time=new_min_time;self.max_time=new_max_time;var min_time_ms=self.min_time.valueOf();var major;var minor;var major_fmt="YYYY-MM-DD";var minor_fmt="HH:mm";var maj_unit=24*3600*1e3;var min_unit=null;var format_time=self.settings.displayUTC?function(t,fmt){return moment.utc(t).format(fmt)}:function(t,fmt){return moment(t).format(fmt)};if(self.timespan>=6*24*3600*1e3){min_unit=null;if(self.timespan>4*365*24*3600*1e3){major_fmt="YYYY"}else if(self.timespan>120*24*3600*1e3){major_fmt="YYYY-MM"}for(i=0;iMAJSPANS[i]){maj_unit=MAJUNITS[i];break}}}else{for(i=0;iMINSPANS[i]){min_unit=MINUNITS[i];break}}if(min_unit<60*1e3){minor_fmt="HH:mm:ss"}}major=unit_in_timespan(maj_unit,min_time_ms,self.timespan);var lastlblend=-1;var existing_ticks=self.ticks.children(".ec-tick");var existing_labels=self.labels.children(".ec-label,.ec-region-label");var tick_idx=0;var label_idx=0;function addlabel(cls,l,t,lbl){if(l>lastlblend){if(label_idx',lbl,""].join(""));lastlblend=l+self.labels.children("."+cls+":last-child").width()}}}function addtick(l,t,h){if(tick_idx'].join(""))}}var span=self.width/self.timespan;var ts;var xoffs;if(min_unit!==null){minor=unit_in_timespan(min_unit,min_time_ms,self.timespan);for(i=0;i60){l=2}}else{l=2}}addlabel("ec-region-label",l+1,self.items_h+self.markers_h-14,format_time(ts,major_fmt))}for(i=tick_idx;iself.items_h-item_offset){xoffs+=item_d;x=xoffs;y=item_offset;push_rows+=1}}else{item_slot_y=item_offset;push_rows=0}if(!pushed){x+=xf}else if(push_rows>5){elem.css("display","none");continue}item_slot_x=x;item_slot_y=y;elem.css("left",x).css("top",y)}};$.fn.EventControl=function(options){var command_args=Array.prototype.slice(arguments,1);return this.each(function(){var element=$(this);var self=element.data("eventcontrol");if(!self){self=new EventControl(element,options);element.data("eventcontrol",self)}else if(options===undefined){return self.save_state()}else if(options=="zoom-in"){return self.zoom.apply(self,[1].concat(command_args))}else if(options=="zoom-out"){return self.zoom.apply(self,[-1].concat(command_args))}else{self.load_state(options)}return self})}})(jQuery); -------------------------------------------------------------------------------- /hammer.min.js: -------------------------------------------------------------------------------- 1 | /*! Hammer.JS - v2.0.6 - 2016-01-06 2 | * http://hammerjs.github.io/ 3 | * 4 | * Copyright (c) 2016 Jorik Tangelder; 5 | * Licensed under the license */ 6 | !function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(j(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",f=a.console&&(a.console.warn||a.console.log);return f&&f.call(a.console,e,d),b.apply(this,arguments)}}function i(a,b,c){var d,e=b.prototype;d=a.prototype=Object.create(e),d.constructor=a,d._super=e,c&&ha(d,c)}function j(a,b){return function(){return a.apply(b,arguments)}}function k(a,b){return typeof a==ka?a.apply(b?b[0]||d:d,b):a}function l(a,b){return a===d?b:a}function m(a,b,c){g(q(b),function(b){a.addEventListener(b,c,!1)})}function n(a,b,c){g(q(b),function(b){a.removeEventListener(b,c,!1)})}function o(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1}function p(a,b){return a.indexOf(b)>-1}function q(a){return a.trim().split(/\s+/g)}function r(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;dc[b]}):d.sort()),d}function u(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g1&&!c.firstMultiple?c.firstMultiple=D(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=E(d);b.timeStamp=na(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=I(h,i),b.distance=H(h,i),B(c,b),b.offsetDirection=G(b.deltaX,b.deltaY);var j=F(b.deltaTime,b.deltaX,b.deltaY);b.overallVelocityX=j.x,b.overallVelocityY=j.y,b.overallVelocity=ma(j.x)>ma(j.y)?j.x:j.y,b.scale=g?K(g.pointers,d):1,b.rotation=g?J(g.pointers,d):0,b.maxPointers=c.prevInput?b.pointers.length>c.prevInput.maxPointers?b.pointers.length:c.prevInput.maxPointers:b.pointers.length,C(c,b);var k=a.element;o(b.srcEvent.target,k)&&(k=b.srcEvent.target),b.target=k}function B(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};(b.eventType===Aa||f.eventType===Ca)&&(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function C(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=Da&&(i>za||h.velocity===d)){var j=b.deltaX-h.deltaX,k=b.deltaY-h.deltaY,l=F(i,j,k);e=l.x,f=l.y,c=ma(l.x)>ma(l.y)?l.x:l.y,g=G(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function D(a){for(var b=[],c=0;ce;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:la(c/b),y:la(d/b)}}function F(a,b,c){return{x:b/a||0,y:c/a||0}}function G(a,b){return a===b?Ea:ma(a)>=ma(b)?0>a?Fa:Ga:0>b?Ha:Ia}function H(a,b,c){c||(c=Ma);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function I(a,b,c){c||(c=Ma);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function J(a,b){return I(b[1],b[0],Na)+I(a[1],a[0],Na)}function K(a,b){return H(b[0],b[1],Na)/H(a[0],a[1],Na)}function L(){this.evEl=Pa,this.evWin=Qa,this.allow=!0,this.pressed=!1,x.apply(this,arguments)}function M(){this.evEl=Ta,this.evWin=Ua,x.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function N(){this.evTarget=Wa,this.evWin=Xa,this.started=!1,x.apply(this,arguments)}function O(a,b){var c=s(a.touches),d=s(a.changedTouches);return b&(Ca|Da)&&(c=t(c.concat(d),"identifier",!0)),[c,d]}function P(){this.evTarget=Za,this.targetIds={},x.apply(this,arguments)}function Q(a,b){var c=s(a.touches),d=this.targetIds;if(b&(Aa|Ba)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=s(a.changedTouches),h=[],i=this.target;if(f=c.filter(function(a){return o(a.target,i)}),b===Aa)for(e=0;eh&&(b.push(a),h=b.length-1):e&(Ca|Da)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var Va={touchstart:Aa,touchmove:Ba,touchend:Ca,touchcancel:Da},Wa="touchstart",Xa="touchstart touchmove touchend touchcancel";i(N,x,{handler:function(a){var b=Va[a.type];if(b===Aa&&(this.started=!0),this.started){var c=O.call(this,a,b);b&(Ca|Da)&&c[0].length-c[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:va,srcEvent:a})}}});var Ya={touchstart:Aa,touchmove:Ba,touchend:Ca,touchcancel:Da},Za="touchstart touchmove touchend touchcancel";i(P,x,{handler:function(a){var b=Ya[a.type],c=Q.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:va,srcEvent:a})}}),i(R,x,{handler:function(a,b,c){var d=c.pointerType==va,e=c.pointerType==xa;if(d)this.mouse.allow=!1;else if(e&&!this.mouse.allow)return;b&(Ca|Da)&&(this.mouse.allow=!0),this.callback(a,b,c)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var $a=u(ja.style,"touchAction"),_a=$a!==d,ab="compute",bb="auto",cb="manipulation",db="none",eb="pan-x",fb="pan-y";S.prototype={set:function(a){a==ab&&(a=this.compute()),_a&&this.manager.element.style&&(this.manager.element.style[$a]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return g(this.manager.recognizers,function(b){k(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))}),T(a.join(" "))},preventDefaults:function(a){if(!_a){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return void b.preventDefault();var d=this.actions,e=p(d,db),f=p(d,fb),g=p(d,eb);if(e){var h=1===a.pointers.length,i=a.distance<2,j=a.deltaTime<250;if(h&&i&&j)return}if(!g||!f)return e||f&&c&Ja||g&&c&Ka?this.preventSrc(b):void 0}},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var gb=1,hb=2,ib=4,jb=8,kb=jb,lb=16,mb=32;U.prototype={defaults:{},set:function(a){return ha(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(f(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=X(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return f(a,"dropRecognizeWith",this)?this:(a=X(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(f(a,"requireFailure",this))return this;var b=this.requireFail;return a=X(a,this),-1===r(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(f(a,"dropRequireFailure",this))return this;a=X(a,this);var b=r(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(b,a)}var c=this,d=this.state;jb>d&&b(c.options.event+V(d)),b(c.options.event),a.additionalEvent&&b(a.additionalEvent),d>=jb&&b(c.options.event+V(d))},tryEmit:function(a){return this.canEmit()?this.emit(a):void(this.state=mb)},canEmit:function(){for(var a=0;af?Fa:Ga,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?Ea:0>g?Ha:Ia,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return Y.prototype.attrTest.call(this,a)&&(this.state&hb||!(this.state&hb)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=W(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),i($,Y,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[db]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&hb)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),i(_,U,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[bb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distanceb.time;if(this._input=a,!d||!c||a.eventType&(Ca|Da)&&!f)this.reset();else if(a.eventType&Aa)this.reset(),this._timer=e(function(){this.state=kb,this.tryEmit()},b.time,this);else if(a.eventType&Ca)return kb;return mb},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===kb&&(a&&a.eventType&Ca?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=na(),this.manager.emit(this.options.event,this._input)))}}),i(aa,Y,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[db]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&hb)}}),i(ba,Y,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Ja|Ka,pointers:1},getTouchAction:function(){return Z.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return c&(Ja|Ka)?b=a.overallVelocity:c&Ja?b=a.overallVelocityX:c&Ka&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&ma(b)>this.options.velocity&&a.eventType&Ca},emit:function(a){var b=W(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),i(ca,U,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[cb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | EventControl demo 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 89 | 90 | 91 | 92 |
93 |
94 | 101 |

EventControl

102 |
103 | 104 |
105 |

EventControl

106 |

jQuery timeline control with support for stacking events.

107 |
108 | 109 |
110 |
111 |

Demo

112 |
113 |
114 |
115 |
116 |
117 |
118 | 119 |
120 |
121 |

Usage

122 |
123 |
124 |
125 | $('.eventcontrol').EventControl({
126 |   oncreate: function(item, element) {
127 |     // Called when creating the item.
128 |     // Can set attributes on the element here,
129 |     // for example:
130 |     element.css('color', 'red');
131 |   },
132 |   onhover: function(item, element, event, inout) {
133 |     // Called when mouse hovers over an item
134 |     // inout is 'in' when entering, and 'out' when exiting.
135 |   },
136 |   onclick: function(item, element, event) {
137 |     // Called when an item is left-clicked.
138 |   },
139 |   data: [],  // An array of objects with a timestamp key.
140 |   hammertime: true, // Enable use of hammer.js to support touch devices
141 |   items_height: 101, // height in px of item/event area
142 |   markers_height: 31, // height in px of markers area
143 |   displayUTC: false, // Show timestamps as UTC, else local time
144 | });
145 |         
146 |

Once created, the EventControl object can be accessed as demonstrated 147 | below. Right now, there is no support for updating the dataset, I plan 148 | to add this later. 149 |

150 |
151 | var state = $('.eventcontrol').EventControl(); // save state
152 | $('.eventcontrol').EventControl(state); // restore state
153 | // zoom in / out: focus is (0 - 1), optional, default is 0.5
154 | $('.eventcontrol').EventControl('zoom-in', focus);
155 | $('.eventcontrol').EventControl('zoom-out', focus);
156 |         
157 |

The library can optionally use hammer.js to support basic 158 | touch controls. Supporting pinch to zoom interferes with all kinds of 159 | functionality, so you'll probably want to hook up zoom in/out to 160 | separate controls. 161 |

162 |
163 |
164 | 165 |
166 |
167 |

Download

168 |
169 |
170 | 176 |
177 |
178 |

Dependencies

179 | 184 |

Optional

185 | 188 |
189 |
190 | 191 | 194 | 195 |
196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | -------------------------------------------------------------------------------- /jquery.mousewheel.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Mousewheel 3.1.13 3 | * 4 | * Copyright 2015 jQuery Foundation and other contributors 5 | * Released under the MIT license. 6 | * http://jquery.org/license 7 | */ 8 | !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}); -------------------------------------------------------------------------------- /moment.min.js: -------------------------------------------------------------------------------- 1 | //! moment.js 2 | //! version : 2.12.0 3 | //! authors : Tim Wood, Iskren Chernev, Moment.js contributors 4 | //! license : MIT 5 | //! momentjs.com 6 | !function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return Zc.apply(null,arguments)}function b(a){Zc=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c0)for(c in $c)d=$c[c],e=b[d],m(e)||(a[d]=e);return a}function o(b){n(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),_c===!1&&(_c=!0,a.updateOffset(this),_c=!1)}function p(a){return a instanceof o||null!=a&&null!=a._isAMomentObject}function q(a){return 0>a?Math.ceil(a):Math.floor(a)}function r(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=q(b)),c}function s(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&r(a[d])!==r(b[d]))&&g++;return g+f}function t(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function u(a,b){var c=!0;return g(function(){return c&&(t(a+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),c=!1),b.apply(this,arguments)},b)}function v(a,b){ad[a]||(t(b),ad[a]=!0)}function w(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)}function x(a){return"[object Object]"===Object.prototype.toString.call(a)}function y(a){var b,c;for(c in a)b=a[c],w(b)?this[c]=b:this["_"+c]=b;this._config=a,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function z(a,b){var c,d=g({},a);for(c in b)f(b,c)&&(x(a[c])&&x(b[c])?(d[c]={},g(d[c],a[c]),g(d[c],b[c])):null!=b[c]?d[c]=b[c]:delete d[c]);return d}function A(a){null!=a&&this.set(a)}function B(a){return a?a.toLowerCase().replace("_","-"):a}function C(a){for(var b,c,d,e,f=0;f0;){if(d=D(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&s(e,c,!0)>=b-1)break;b--}f++}return null}function D(a){var b=null;if(!cd[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=bd._abbr,require("./locale/"+a),E(b)}catch(c){}return cd[a]}function E(a,b){var c;return a&&(c=m(b)?H(a):F(a,b),c&&(bd=c)),bd._abbr}function F(a,b){return null!==b?(b.abbr=a,null!=cd[a]?(v("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),b=z(cd[a]._config,b)):null!=b.parentLocale&&(null!=cd[b.parentLocale]?b=z(cd[b.parentLocale]._config,b):v("parentLocaleUndefined","specified parentLocale is not defined yet")),cd[a]=new A(b),E(a),cd[a]):(delete cd[a],null)}function G(a,b){if(null!=b){var c;null!=cd[a]&&(b=z(cd[a]._config,b)),c=new A(b),c.parentLocale=cd[a],cd[a]=c,E(a)}else null!=cd[a]&&(null!=cd[a].parentLocale?cd[a]=cd[a].parentLocale:null!=cd[a]&&delete cd[a]);return cd[a]}function H(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return bd;if(!c(a)){if(b=D(a))return b;a=[a]}return C(a)}function I(){return Object.keys(cd)}function J(a,b){var c=a.toLowerCase();dd[c]=dd[c+"s"]=dd[b]=a}function K(a){return"string"==typeof a?dd[a]||dd[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)f(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(b,c){return function(d){return null!=d?(O(this,b,d),a.updateOffset(this,c),this):N(this,b)}}function N(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function O(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function P(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=K(a),w(this[a]))return this[a](b);return this}function Q(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function R(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(hd[a]=e),b&&(hd[b[0]]=function(){return Q(e.apply(this,arguments),b[1],b[2])}),c&&(hd[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function S(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function T(a){var b,c,d=a.match(ed);for(b=0,c=d.length;c>b;b++)hd[d[b]]?d[b]=hd[d[b]]:d[b]=S(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function U(a,b){return a.isValid()?(b=V(b,a.localeData()),gd[b]=gd[b]||T(b),gd[b](a)):a.localeData().invalidDate()}function V(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(fd.lastIndex=0;d>=0&&fd.test(a);)a=a.replace(fd,c),fd.lastIndex=0,d-=1;return a}function W(a,b,c){zd[a]=w(b)?b:function(a,d){return a&&c?c:b}}function X(a,b){return f(zd,a)?zd[a](b._strict,b._locale):new RegExp(Y(a))}function Y(a){return Z(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function Z(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function $(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=r(a)}),c=0;cd;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function fa(a,b){var c;if(!a.isValid())return a;if("string"==typeof b)if(/^\d+$/.test(b))b=r(b);else if(b=a.localeData().monthsParse(b),"number"!=typeof b)return a;return c=Math.min(a.date(),ba(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a}function ga(b){return null!=b?(fa(this,b),a.updateOffset(this,!0),this):N(this,"Month")}function ha(){return ba(this.year(),this.month())}function ia(a){return this._monthsParseExact?(f(this,"_monthsRegex")||ka.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex}function ja(a){return this._monthsParseExact?(f(this,"_monthsRegex")||ka.call(this),a?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex}function ka(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;12>b;b++)c=h([2e3,b]),d.push(this.monthsShort(c,"")),e.push(this.months(c,"")),f.push(this.months(c,"")),f.push(this.monthsShort(c,""));for(d.sort(a),e.sort(a),f.sort(a),b=0;12>b;b++)d[b]=Z(d[b]),e[b]=Z(e[b]),f[b]=Z(f[b]);this._monthsRegex=new RegExp("^("+f.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")$","i"),this._monthsShortStrictRegex=new RegExp("^("+d.join("|")+")$","i")}function la(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[Cd]<0||c[Cd]>11?Cd:c[Dd]<1||c[Dd]>ba(c[Bd],c[Cd])?Dd:c[Ed]<0||c[Ed]>24||24===c[Ed]&&(0!==c[Fd]||0!==c[Gd]||0!==c[Hd])?Ed:c[Fd]<0||c[Fd]>59?Fd:c[Gd]<0||c[Gd]>59?Gd:c[Hd]<0||c[Hd]>999?Hd:-1,j(a)._overflowDayOfYear&&(Bd>b||b>Dd)&&(b=Dd),j(a)._overflowWeeks&&-1===b&&(b=Id),j(a)._overflowWeekday&&-1===b&&(b=Jd),j(a).overflow=b),a}function ma(a){var b,c,d,e,f,g,h=a._i,i=Pd.exec(h)||Qd.exec(h);if(i){for(j(a).iso=!0,b=0,c=Sd.length;c>b;b++)if(Sd[b][1].exec(i[1])){e=Sd[b][0],d=Sd[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=Td.length;c>b;b++)if(Td[b][1].exec(i[3])){f=(i[2]||" ")+Td[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!Rd.exec(i[4]))return void(a._isValid=!1);g="Z"}a._f=e+(f||"")+(g||""),Ba(a)}else a._isValid=!1}function na(b){var c=Ud.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(ma(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function oa(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 100>a&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function pa(a){var b=new Date(Date.UTC.apply(null,arguments));return 100>a&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function qa(a){return ra(a)?366:365}function ra(a){return a%4===0&&a%100!==0||a%400===0}function sa(){return ra(this.year())}function ta(a,b,c){var d=7+b-c,e=(7+pa(a,0,d).getUTCDay()-b)%7;return-e+d-1}function ua(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ta(a,d,e),j=1+7*(b-1)+h+i;return 0>=j?(f=a-1,g=qa(f)+j):j>qa(a)?(f=a+1,g=j-qa(a)):(f=a,g=j),{year:f,dayOfYear:g}}function va(a,b,c){var d,e,f=ta(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return 1>g?(e=a.year()-1,d=g+wa(e,b,c)):g>wa(a.year(),b,c)?(d=g-wa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function wa(a,b,c){var d=ta(a,b,c),e=ta(a+1,b,c);return(qa(a)-d+e)/7}function xa(a,b,c){return null!=a?a:null!=b?b:c}function ya(b){var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}function za(a){var b,c,d,e,f=[];if(!a._d){for(d=ya(a),a._w&&null==a._a[Dd]&&null==a._a[Cd]&&Aa(a),a._dayOfYear&&(e=xa(a._a[Bd],d[Bd]),a._dayOfYear>qa(e)&&(j(a)._overflowDayOfYear=!0),c=pa(e,0,a._dayOfYear),a._a[Cd]=c.getUTCMonth(),a._a[Dd]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[Ed]&&0===a._a[Fd]&&0===a._a[Gd]&&0===a._a[Hd]&&(a._nextDay=!0,a._a[Ed]=0),a._d=(a._useUTC?pa:oa).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[Ed]=24)}}function Aa(a){var b,c,d,e,f,g,h,i;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=xa(b.GG,a._a[Bd],va(Ja(),1,4).year),d=xa(b.W,1),e=xa(b.E,1),(1>e||e>7)&&(i=!0)):(f=a._locale._week.dow,g=a._locale._week.doy,c=xa(b.gg,a._a[Bd],va(Ja(),f,g).year),d=xa(b.w,1),null!=b.d?(e=b.d,(0>e||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f),1>d||d>wa(c,f,g)?j(a)._overflowWeeks=!0:null!=i?j(a)._overflowWeekday=!0:(h=ua(c,d,e,f,g),a._a[Bd]=h.year,a._dayOfYear=h.dayOfYear)}function Ba(b){if(b._f===a.ISO_8601)return void ma(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=V(b._f,b._locale).match(ed)||[],c=0;c0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),hd[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),aa(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[Ed]<=12&&b._a[Ed]>0&&(j(b).bigHour=void 0),b._a[Ed]=Ca(b._locale,b._a[Ed],b._meridiem),za(b),la(b)}function Ca(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function Da(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;ef)&&(d=f,c=b));g(a,c||b)}function Ea(a){if(!a._d){var b=L(a._i);a._a=e([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),za(a)}}function Fa(a){var b=new o(la(Ga(a)));return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function Ga(a){var b=a._i,e=a._f;return a._locale=a._locale||H(a._l),null===b||void 0===e&&""===b?l({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),p(b)?new o(la(b)):(c(e)?Da(a):e?Ba(a):d(b)?a._d=b:Ha(a),k(a)||(a._d=null),a))}function Ha(b){var f=b._i;void 0===f?b._d=new Date(a.now()):d(f)?b._d=new Date(+f):"string"==typeof f?na(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),za(b)):"object"==typeof f?Ea(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function Ia(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,Fa(f)}function Ja(a,b,c,d){return Ia(a,b,c,d,!1)}function Ka(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Ja();for(d=b[0],e=1;ea&&(a=-a,c="-"),c+Q(~~(a/60),2)+b+Q(~~a%60,2)})}function Qa(a,b){var c=(b||"").match(a)||[],d=c[c.length-1]||[],e=(d+"").match(Zd)||["-",0,0],f=+(60*e[1])+r(e[2]);return"+"===e[0]?f:-f}function Ra(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(p(b)||d(b)?+b:+Ja(b))-+e,e._d.setTime(+e._d+f),a.updateOffset(e,!1),e):Ja(b).local()}function Sa(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ta(b,c){var d,e=this._offset||0;return this.isValid()?null!=b?("string"==typeof b?b=Qa(wd,b):Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Sa(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?ib(this,cb(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Sa(this):null!=b?this:NaN}function Ua(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Va(a){return this.utcOffset(0,a)}function Wa(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Sa(this),"m")),this}function Xa(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Qa(vd,this._i)),this}function Ya(a){return this.isValid()?(a=a?Ja(a).utcOffset():0,(this.utcOffset()-a)%60===0):!1}function Za(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function $a(){if(!m(this._isDSTShifted))return this._isDSTShifted;var a={};if(n(a,this),a=Ga(a),a._a){var b=a._isUTC?h(a._a):Ja(a._a);this._isDSTShifted=this.isValid()&&s(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function _a(){return this.isValid()?!this._isUTC:!1}function ab(){return this.isValid()?this._isUTC:!1}function bb(){return this.isValid()?this._isUTC&&0===this._offset:!1}function cb(a,b){var c,d,e,g=a,h=null;return Oa(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=$d.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:r(h[Dd])*c,h:r(h[Ed])*c,m:r(h[Fd])*c,s:r(h[Gd])*c,ms:r(h[Hd])*c}):(h=_d.exec(a))?(c="-"===h[1]?-1:1,g={y:db(h[2],c),M:db(h[3],c),w:db(h[4],c),d:db(h[5],c),h:db(h[6],c),m:db(h[7],c),s:db(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=fb(Ja(g.from),Ja(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Na(g),Oa(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function db(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function eb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function fb(a,b){var c;return a.isValid()&&b.isValid()?(b=Ra(b,a),a.isBefore(b)?c=eb(a,b):(c=eb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function gb(a){return 0>a?-1*Math.round(-1*a):Math.round(a)}function hb(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(v(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=cb(c,d),ib(this,e,a),this}}function ib(b,c,d,e){var f=c._milliseconds,g=gb(c._days),h=gb(c._months);b.isValid()&&(e=null==e?!0:e,f&&b._d.setTime(+b._d+f*d),g&&O(b,"Date",N(b,"Date")+g*d),h&&fa(b,N(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function jb(a,b){var c=a||Ja(),d=Ra(c,this).startOf("day"),e=this.diff(d,"days",!0),f=-6>e?"sameElse":-1>e?"lastWeek":0>e?"lastDay":1>e?"sameDay":2>e?"nextDay":7>e?"nextWeek":"sameElse",g=b&&(w(b[f])?b[f]():b[f]);return this.format(g||this.localeData().calendar(f,this,Ja(c)))}function kb(){return new o(this)}function lb(a,b){var c=p(a)?a:Ja(a);return this.isValid()&&c.isValid()?(b=K(m(b)?"millisecond":b),"millisecond"===b?+this>+c:+c<+this.clone().startOf(b)):!1}function mb(a,b){var c=p(a)?a:Ja(a);return this.isValid()&&c.isValid()?(b=K(m(b)?"millisecond":b),"millisecond"===b?+c>+this:+this.clone().endOf(b)<+c):!1}function nb(a,b,c){return this.isAfter(a,c)&&this.isBefore(b,c)}function ob(a,b){var c,d=p(a)?a:Ja(a);return this.isValid()&&d.isValid()?(b=K(b||"millisecond"),"millisecond"===b?+this===+d:(c=+d,+this.clone().startOf(b)<=c&&c<=+this.clone().endOf(b))):!1}function pb(a,b){return this.isSame(a,b)||this.isAfter(a,b)}function qb(a,b){return this.isSame(a,b)||this.isBefore(a,b)}function rb(a,b,c){var d,e,f,g;return this.isValid()?(d=Ra(a,this),d.isValid()?(e=6e4*(d.utcOffset()-this.utcOffset()),b=K(b),"year"===b||"month"===b||"quarter"===b?(g=sb(this,d),"quarter"===b?g/=3:"year"===b&&(g/=12)):(f=this-d,g="second"===b?f/1e3:"minute"===b?f/6e4:"hour"===b?f/36e5:"day"===b?(f-e)/864e5:"week"===b?(f-e)/6048e5:f),c?g:q(g)):NaN):NaN}function sb(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function tb(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function ub(){var a=this.clone().utc();return 0f&&(b=f),Ub.call(this,a,b,c,d,e))}function Ub(a,b,c,d,e){var f=ua(a,b,c,d,e),g=pa(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Vb(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Wb(a){return va(a,this._week.dow,this._week.doy).week}function Xb(){return this._week.dow}function Yb(){return this._week.doy}function Zb(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function $b(a){var b=va(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function _b(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function ac(a,b){return c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]}function bc(a){return this._weekdaysShort[a.day()]}function cc(a){return this._weekdaysMin[a.day()]}function dc(a,b,c){var d,e,f;for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;7>d;d++){if(e=Ja([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function ec(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=_b(a,this.localeData()),this.add(a-b,"d")):b}function fc(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function gc(a){return this.isValid()?null==a?this.day()||7:this.day(this.day()%7?a:a-7):null!=a?this:NaN}function hc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function ic(){return this.hours()%12||12}function jc(a,b){R(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function kc(a,b){return b._meridiemParse}function lc(a){return"p"===(a+"").toLowerCase().charAt(0)}function mc(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function nc(a,b){b[Hd]=r(1e3*("0."+a))}function oc(){return this._isUTC?"UTC":""}function pc(){return this._isUTC?"Coordinated Universal Time":""}function qc(a){return Ja(1e3*a)}function rc(){return Ja.apply(null,arguments).parseZone()}function sc(a,b,c){var d=this._calendar[a];return w(d)?d.call(b,c):d}function tc(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function uc(){return this._invalidDate}function vc(a){return this._ordinal.replace("%d",a)}function wc(a){return a}function xc(a,b,c,d){var e=this._relativeTime[c];return w(e)?e(a,b,c,d):e.replace(/%d/i,a)}function yc(a,b){var c=this._relativeTime[a>0?"future":"past"];return w(c)?c(b):c.replace(/%s/i,b)}function zc(a,b,c,d){var e=H(),f=h().set(d,b);return e[c](f,a)}function Ac(a,b,c,d,e){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return zc(a,b,c,e);var f,g=[];for(f=0;d>f;f++)g[f]=zc(a,f,c,e);return g}function Bc(a,b){return Ac(a,b,"months",12,"month")}function Cc(a,b){return Ac(a,b,"monthsShort",12,"month")}function Dc(a,b){return Ac(a,b,"weekdays",7,"day")}function Ec(a,b){return Ac(a,b,"weekdaysShort",7,"day")}function Fc(a,b){return Ac(a,b,"weekdaysMin",7,"day")}function Gc(){var a=this._data;return this._milliseconds=xe(this._milliseconds),this._days=xe(this._days),this._months=xe(this._months),a.milliseconds=xe(a.milliseconds),a.seconds=xe(a.seconds),a.minutes=xe(a.minutes),a.hours=xe(a.hours),a.months=xe(a.months),a.years=xe(a.years),this}function Hc(a,b,c,d){var e=cb(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function Ic(a,b){return Hc(this,a,b,1)}function Jc(a,b){return Hc(this,a,b,-1)}function Kc(a){return 0>a?Math.floor(a):Math.ceil(a)}function Lc(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||0>=f&&0>=g&&0>=h||(f+=864e5*Kc(Nc(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=q(f/1e3),i.seconds=a%60,b=q(a/60),i.minutes=b%60,c=q(b/60),i.hours=c%24,g+=q(c/24),e=q(Mc(g)),h+=e,g-=Kc(Nc(e)),d=q(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function Mc(a){return 4800*a/146097}function Nc(a){return 146097*a/4800}function Oc(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+Mc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(Nc(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function Pc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*r(this._months/12)}function Qc(a){return function(){return this.as(a)}}function Rc(a){return a=K(a),this[a+"s"]()}function Sc(a){return function(){return this._data[a]}}function Tc(){return q(this.days()/7)}function Uc(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function Vc(a,b,c){var d=cb(a).abs(),e=Ne(d.as("s")),f=Ne(d.as("m")),g=Ne(d.as("h")),h=Ne(d.as("d")),i=Ne(d.as("M")),j=Ne(d.as("y")),k=e=f&&["m"]||f=g&&["h"]||g=h&&["d"]||h=i&&["M"]||i=j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,Uc.apply(null,k)}function Wc(a,b){return void 0===Oe[a]?!1:void 0===b?Oe[a]:(Oe[a]=b,!0)}function Xc(a){var b=this.localeData(),c=Vc(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function Yc(){var a,b,c,d=Pe(this._milliseconds)/1e3,e=Pe(this._days),f=Pe(this._months);a=q(d/60),b=q(a/60),d%=60,a%=60,c=q(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(0>m?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var Zc,$c=a.momentProperties=[],_c=!1,ad={};a.suppressDeprecationWarnings=!1;var bd,cd={},dd={},ed=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,fd=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,gd={},hd={},id=/\d/,jd=/\d\d/,kd=/\d{3}/,ld=/\d{4}/,md=/[+-]?\d{6}/,nd=/\d\d?/,od=/\d\d\d\d?/,pd=/\d\d\d\d\d\d?/,qd=/\d{1,3}/,rd=/\d{1,4}/,sd=/[+-]?\d{1,6}/,td=/\d+/,ud=/[+-]?\d+/,vd=/Z|[+-]\d\d:?\d\d/gi,wd=/Z|[+-]\d\d(?::?\d\d)?/gi,xd=/[+-]?\d+(\.\d{1,3})?/,yd=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,zd={},Ad={},Bd=0,Cd=1,Dd=2,Ed=3,Fd=4,Gd=5,Hd=6,Id=7,Jd=8;R("M",["MM",2],"Mo",function(){return this.month()+1}),R("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),R("MMMM",0,0,function(a){return this.localeData().months(this,a)}),J("month","M"),W("M",nd),W("MM",nd,jd),W("MMM",function(a,b){return b.monthsShortRegex(a)}),W("MMMM",function(a,b){return b.monthsRegex(a)}),$(["M","MM"],function(a,b){b[Cd]=r(a)-1}),$(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[Cd]=e:j(c).invalidMonth=a});var Kd=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,Ld="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Md="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Nd=yd,Od=yd,Pd=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Qd=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,Rd=/Z|[+-]\d\d(?::?\d\d)?/,Sd=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Td=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ud=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=u("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),R("Y",0,0,function(){var a=this.year();return 9999>=a?""+a:"+"+a}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),J("year","y"),W("Y",ud),W("YY",nd,jd),W("YYYY",rd,ld),W("YYYYY",sd,md),W("YYYYYY",sd,md),$(["YYYYY","YYYYYY"],Bd),$("YYYY",function(b,c){c[Bd]=2===b.length?a.parseTwoDigitYear(b):r(b); 7 | }),$("YY",function(b,c){c[Bd]=a.parseTwoDigitYear(b)}),$("Y",function(a,b){b[Bd]=parseInt(a,10)}),a.parseTwoDigitYear=function(a){return r(a)+(r(a)>68?1900:2e3)};var Vd=M("FullYear",!1);a.ISO_8601=function(){};var Wd=u("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Ja.apply(null,arguments);return this.isValid()&&a.isValid()?this>a?this:a:l()}),Xd=u("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Ja.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:l()}),Yd=function(){return Date.now?Date.now():+new Date};Pa("Z",":"),Pa("ZZ",""),W("Z",wd),W("ZZ",wd),$(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Qa(wd,a)});var Zd=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var $d=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,_d=/^(-)?P(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)W)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?$/;cb.fn=Na.prototype;var ae=hb(1,"add"),be=hb(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var ce=u("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ob("gggg","weekYear"),Ob("ggggg","weekYear"),Ob("GGGG","isoWeekYear"),Ob("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),W("G",ud),W("g",ud),W("GG",nd,jd),W("gg",nd,jd),W("GGGG",rd,ld),W("gggg",rd,ld),W("GGGGG",sd,md),W("ggggg",sd,md),_(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=r(a)}),_(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),R("Q",0,"Qo","quarter"),J("quarter","Q"),W("Q",id),$("Q",function(a,b){b[Cd]=3*(r(a)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),W("w",nd),W("ww",nd,jd),W("W",nd),W("WW",nd,jd),_(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=r(a)});var de={dow:0,doy:6};R("D",["DD",2],"Do","date"),J("date","D"),W("D",nd),W("DD",nd,jd),W("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),$(["D","DD"],Dd),$("Do",function(a,b){b[Dd]=r(a.match(nd)[0],10)});var ee=M("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),R("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),R("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),W("d",nd),W("e",nd),W("E",nd),W("dd",yd),W("ddd",yd),W("dddd",yd),_(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:j(c).invalidWeekday=a}),_(["d","e","E"],function(a,b,c,d){b[d]=r(a)});var fe="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ge="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),he="Su_Mo_Tu_We_Th_Fr_Sa".split("_");R("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),W("DDD",qd),W("DDDD",kd),$(["DDD","DDDD"],function(a,b,c){c._dayOfYear=r(a)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,ic),R("hmm",0,0,function(){return""+ic.apply(this)+Q(this.minutes(),2)}),R("hmmss",0,0,function(){return""+ic.apply(this)+Q(this.minutes(),2)+Q(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+Q(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+Q(this.minutes(),2)+Q(this.seconds(),2)}),jc("a",!0),jc("A",!1),J("hour","h"),W("a",kc),W("A",kc),W("H",nd),W("h",nd),W("HH",nd,jd),W("hh",nd,jd),W("hmm",od),W("hmmss",pd),W("Hmm",od),W("Hmmss",pd),$(["H","HH"],Ed),$(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),$(["h","hh"],function(a,b,c){b[Ed]=r(a),j(c).bigHour=!0}),$("hmm",function(a,b,c){var d=a.length-2;b[Ed]=r(a.substr(0,d)),b[Fd]=r(a.substr(d)),j(c).bigHour=!0}),$("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Ed]=r(a.substr(0,d)),b[Fd]=r(a.substr(d,2)),b[Gd]=r(a.substr(e)),j(c).bigHour=!0}),$("Hmm",function(a,b,c){var d=a.length-2;b[Ed]=r(a.substr(0,d)),b[Fd]=r(a.substr(d))}),$("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Ed]=r(a.substr(0,d)),b[Fd]=r(a.substr(d,2)),b[Gd]=r(a.substr(e))});var ie=/[ap]\.?m?\.?/i,je=M("Hours",!0);R("m",["mm",2],0,"minute"),J("minute","m"),W("m",nd),W("mm",nd,jd),$(["m","mm"],Fd);var ke=M("Minutes",!1);R("s",["ss",2],0,"second"),J("second","s"),W("s",nd),W("ss",nd,jd),$(["s","ss"],Gd);var le=M("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),W("S",qd,id),W("SS",qd,jd),W("SSS",qd,kd);var me;for(me="SSSS";me.length<=9;me+="S")W(me,td);for(me="S";me.length<=9;me+="S")$(me,nc);var ne=M("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var oe=o.prototype;oe.add=ae,oe.calendar=jb,oe.clone=kb,oe.diff=rb,oe.endOf=Db,oe.format=vb,oe.from=wb,oe.fromNow=xb,oe.to=yb,oe.toNow=zb,oe.get=P,oe.invalidAt=Mb,oe.isAfter=lb,oe.isBefore=mb,oe.isBetween=nb,oe.isSame=ob,oe.isSameOrAfter=pb,oe.isSameOrBefore=qb,oe.isValid=Kb,oe.lang=ce,oe.locale=Ab,oe.localeData=Bb,oe.max=Xd,oe.min=Wd,oe.parsingFlags=Lb,oe.set=P,oe.startOf=Cb,oe.subtract=be,oe.toArray=Hb,oe.toObject=Ib,oe.toDate=Gb,oe.toISOString=ub,oe.toJSON=Jb,oe.toString=tb,oe.unix=Fb,oe.valueOf=Eb,oe.creationData=Nb,oe.year=Vd,oe.isLeapYear=sa,oe.weekYear=Pb,oe.isoWeekYear=Qb,oe.quarter=oe.quarters=Vb,oe.month=ga,oe.daysInMonth=ha,oe.week=oe.weeks=Zb,oe.isoWeek=oe.isoWeeks=$b,oe.weeksInYear=Sb,oe.isoWeeksInYear=Rb,oe.date=ee,oe.day=oe.days=ec,oe.weekday=fc,oe.isoWeekday=gc,oe.dayOfYear=hc,oe.hour=oe.hours=je,oe.minute=oe.minutes=ke,oe.second=oe.seconds=le,oe.millisecond=oe.milliseconds=ne,oe.utcOffset=Ta,oe.utc=Va,oe.local=Wa,oe.parseZone=Xa,oe.hasAlignedHourOffset=Ya,oe.isDST=Za,oe.isDSTShifted=$a,oe.isLocal=_a,oe.isUtcOffset=ab,oe.isUtc=bb,oe.isUTC=bb,oe.zoneAbbr=oc,oe.zoneName=pc,oe.dates=u("dates accessor is deprecated. Use date instead.",ee),oe.months=u("months accessor is deprecated. Use month instead",ga),oe.years=u("years accessor is deprecated. Use year instead",Vd),oe.zone=u("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Ua);var pe=oe,qe={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},re={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},se="Invalid date",te="%d",ue=/\d{1,2}/,ve={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},we=A.prototype;we._calendar=qe,we.calendar=sc,we._longDateFormat=re,we.longDateFormat=tc,we._invalidDate=se,we.invalidDate=uc,we._ordinal=te,we.ordinal=vc,we._ordinalParse=ue,we.preparse=wc,we.postformat=wc,we._relativeTime=ve,we.relativeTime=xc,we.pastFuture=yc,we.set=y,we.months=ca,we._months=Ld,we.monthsShort=da,we._monthsShort=Md,we.monthsParse=ea,we._monthsRegex=Od,we.monthsRegex=ja,we._monthsShortRegex=Nd,we.monthsShortRegex=ia,we.week=Wb,we._week=de,we.firstDayOfYear=Yb,we.firstDayOfWeek=Xb,we.weekdays=ac,we._weekdays=fe,we.weekdaysMin=cc,we._weekdaysMin=he,we.weekdaysShort=bc,we._weekdaysShort=ge,we.weekdaysParse=dc,we.isPM=lc,we._meridiemParse=ie,we.meridiem=mc,E("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===r(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=u("moment.lang is deprecated. Use moment.locale instead.",E),a.langData=u("moment.langData is deprecated. Use moment.localeData instead.",H);var xe=Math.abs,ye=Qc("ms"),ze=Qc("s"),Ae=Qc("m"),Be=Qc("h"),Ce=Qc("d"),De=Qc("w"),Ee=Qc("M"),Fe=Qc("y"),Ge=Sc("milliseconds"),He=Sc("seconds"),Ie=Sc("minutes"),Je=Sc("hours"),Ke=Sc("days"),Le=Sc("months"),Me=Sc("years"),Ne=Math.round,Oe={s:45,m:45,h:22,d:26,M:11},Pe=Math.abs,Qe=Na.prototype;Qe.abs=Gc,Qe.add=Ic,Qe.subtract=Jc,Qe.as=Oc,Qe.asMilliseconds=ye,Qe.asSeconds=ze,Qe.asMinutes=Ae,Qe.asHours=Be,Qe.asDays=Ce,Qe.asWeeks=De,Qe.asMonths=Ee,Qe.asYears=Fe,Qe.valueOf=Pc,Qe._bubble=Lc,Qe.get=Rc,Qe.milliseconds=Ge,Qe.seconds=He,Qe.minutes=Ie,Qe.hours=Je,Qe.days=Ke,Qe.weeks=Tc,Qe.months=Le,Qe.years=Me,Qe.humanize=Xc,Qe.toISOString=Yc,Qe.toString=Yc,Qe.toJSON=Yc,Qe.locale=Ab,Qe.localeData=Bb,Qe.toIsoString=u("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Yc),Qe.lang=ce,R("X",0,0,"unix"),R("x",0,0,"valueOf"),W("x",ud),W("X",xd),$("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),$("x",function(a,b,c){c._d=new Date(r(a))}),a.version="2.12.0",b(Ja),a.fn=pe,a.min=La,a.max=Ma,a.now=Yd,a.utc=h,a.unix=qc,a.months=Bc,a.isDate=d,a.locale=E,a.invalid=l,a.duration=cb,a.isMoment=p,a.weekdays=Dc,a.parseZone=rc,a.localeData=H,a.isDuration=Oa,a.monthsShort=Cc,a.weekdaysMin=Fc,a.defineLocale=F,a.updateLocale=G,a.locales=I,a.weekdaysShort=Ec,a.normalizeUnits=K,a.relativeTimeThreshold=Wc,a.prototype=pe;var Re=a;return Re}); -------------------------------------------------------------------------------- /update-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # service discontinued 3 | #curl -X POST -s --data-urlencode "js_code=$(cat eventcontrol.js)" --output eventcontrol.min.js.$$ 'http://marijnhaverbeke.nl/uglifyjs?utf8=1&download=eventcontrol.min.js' 4 | if which uglifyjs >/dev/null 2>&1; then 5 | uglifyjs -o eventcontrol.min.js eventcontrol.js 6 | git add eventcontrol.min.js 7 | git commit -m "Updated eventcontrol.min.js" 8 | else 9 | echo "Install uglifyjs (npm install -g uglify-js)" 10 | exit 1 11 | fi 12 | git checkout gh-pages 13 | git merge -s recursive -X theirs --commit --no-edit master 14 | git checkout master 15 | --------------------------------------------------------------------------------