PageSourceSearch

https://obecrusinov.cz/template/rusinov_nove/assets/js/bootstrap-datepicker.js

js obecrusinov.cz collected 2026-10-03 00:15:03 UTC 104,768 bytes, 2,058 lines download raw bytes

vendor: 4,302 bytes, lines 1-134
1/*!
2 * Datepicker for Bootstrap v1.6.0-dev (https://github.com/eternicode/bootstrap-datepicker)
3 *
4 * Copyright 2012 Stefan Petre
5 * Improvements by Andrew Rowls
6 * Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
7 */(function (factory) {
8    if (typeof define === "function" && define.amd) {
9        define(["jquery"], factory);
10    } else if (typeof exports === 'object') {
11        factory(require('jquery'));
12    } else {
13        factory(jQuery);
14    }
15}(function ($, undefined) {
16
17    function UTCDate() {
18        return new Date(Date.UTC.apply(Date, arguments));
19    }
20    function UTCToday() {
21        var today = new Date();
22        return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
23    }
24    function isUTCEquals(date1, date2) {
25        return (
26                date1.getUTCFullYear() === date2.getUTCFullYear() &&
27                date1.getUTCMonth() === date2.getUTCMonth() &&
28                date1.getUTCDate() === date2.getUTCDate()
29                );
30    }
31    function alias(method) {
32        return function () {
33            return this[method].apply(this, arguments);
34        };
35    }
36    function isValidDate(d) {
37        return d && !isNaN(d.getTime());
38    }
39
40    var DateArray = (function () {
41        var extras = {
42            get: function (i) {
43                return this.slice(i)[0];
44            },
45            contains: function (d) {
46                // Array.indexOf is not cross-browser;
47                // $.inArray doesn't work with Dates
48                var val = d && d.valueOf();
49                for (var i = 0, l = this.length; i < l; i++)
50                    if (this[i].valueOf() === val)
51                        return i;
52                return -1;
53            },
54            remove: function (i) {
55                this.splice(i, 1);
56            },
57            replace: function (new_array) {
58                if (!new_array)
59                    return;
60                if (!$.isArray(new_array))
61                    new_array = [new_array];
62                this.clear();
63                this.push.apply(this, new_array);
64            },
65            clear: function () {
66                this.length = 0;
67            },
68            copy: function () {
69                var a = new DateArray();
70                a.replace(this);
71                return a;
72            }
73        };
74
75        return function () {
76            var a = [];
77            a.push.apply(a, arguments);
78            $.extend(a, extras);
79            return a;
80        };
81    })();
82
83
84    // Picker object
85
86    var Datepicker = function (element, options) {
87        $(element).data('datepicker', this);
88        this._process_options(options);
89
90        this.dates = new DateArray();
91        this.viewDate = this.o.defaultViewDate;
92        this.focusDate = null;
93
94        this.element = $(element);
95        this.isInline = false;
96        this.isInput = this.element.is('input');
97        this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
98        this.hasInput = this.component && this.element.find('input').length;
99        if (this.component && this.component.length === 0)
100            this.component = false;
101
102        this.picker = $(DPGlobal.template);
103
104        // Checking templates and inserting
105        if (this._check_template(this.o.templates.leftArrow)) {
106            this.picker.find('.prev').html(this.o.templates.leftArrow);
107        }
108        if (this._check_template(this.o.templates.rightArrow)) {
109            this.picker.find('.next').html(this.o.templates.rightArrow);
110        }
111
112        this._buildEvents();
113        this._attachEvents();
114
115        if (this.isInline) {
116            this.picker.addClass('datepicker-inline').appendTo(this.element);
117        }
118        else {
119            this.picker.addClass('datepicker-dropdown dropdown-menu');
120        }
121
122        if (this.o.rtl) {
123            this.picker.addClass('datepicker-rtl');
124        }
125
126        this.viewMode = this.o.startView;
127
128        if (this.o.calendarWeeks)
129            this.picker.find('thead .datepicker-title, tfoot .today, tfoot .clear')
130                    .attr('colspan', function (i, val) {
131                        return parseInt(val) + 1;
132                    });
133
134        this._allow_update = false;
135
136        this.setStartDate(this._o.startDate);
137        this.setEndDate(this._o.endDate);
138        this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
139        this.setDaysOfWeekHighlighted(this.o.daysOfWeekHighlighted);
140        this.setDatesDisabled(this.o.datesDisabled);
141
142        this.fillDow();
143        this.fillMonths();
144
145        this._allow_update = true;
146
147        this.update();
148        this.showMode();
149
150        if (this.isInline) {
151            this.show();
152        }
153    };
154
155    Datepicker.prototype = {
156        constructor: Datepicker,
157        _resolveViewName: function (view, default_value) {
158            if (view === 0 || view === 'days' || view === 'month') {
159                return 0;
160            }
161            if (view === 1 || view === 'months' || view === 'year') {
162                return 1;
163            }
164            if (view === 2 || view === 'years' || view === 'decade') {
165                return 2;
166            }
167            if (view === 3 || view === 'decades' || view === 'century') {
168                return 3;
169            }
170            if (view === 4 || view === 'centuries' || view === 'millennium') {
171                return 4;
172            }
173            return default_value === undefined ? false : default_value;
174        },
175        _check_template: function (tmp) {
176            try {
177                // If empty
178                if (tmp === undefined || tmp === "") {
179                    return false;
180                }
181                // If no html, everything ok
182                if ((tmp.match(/[<>]/g) || []).length <= 0) {
183                    return true;
184                }
185                // Checking if html is fine
186                var jDom = $(tmp);
187                return jDom.length > 0;
188            }
189            catch (ex) {
190                return false;
191            }
192        },
193        _process_options: function (opts) {
194            // Store raw options for reference
195            this._o = $.extend({}, this._o, opts);
196            // Processed options
197            var o = this.o = $.extend({}, this._o);
198
199            // Check if "de-DE" style date is available, if not language should
200            // fallback to 2 letter code eg "de"
201            var lang = o.language;
202            if (!dates[lang]) {
203                lang = lang.split('-')[0];
204                if (!dates[lang])
205                    lang = defaults.language;
206            }
207            o.language = lang;
208
209            // Retrieve view index from any aliases
210            o.startView = this._resolveViewName(o.startView, 0);
211            o.minViewMode = this._resolveViewName(o.minViewMode, 0);
212            o.maxViewMode = this._resolveViewName(o.maxViewMode, 4);
213
214            // Check that the start view is between min and max
215            o.startView = Math.min(o.startView, o.maxViewMode);
216            o.startView = Math.max(o.startView, o.minViewMode);
217
218            // true, false, or Number > 0
219            if (o.multidate !== true) {
220                o.multidate = Number(o.multidate) || false;
221                if (o.multidate !== false)
222                    o.multidate = Math.max(0, o.multidate);
223            }
224            o.multidateSeparator = String(o.multidateSeparator);
225
226            o.weekStart %= 7;
227            o.weekEnd = (o.weekStart + 6) % 7;
228
229            var format = DPGlobal.parseFormat(o.format);
230            if (o.startDate !== -Infinity) {
231                if (!!o.startDate) {
232                    if (o.startDate instanceof Date)
233                        o.startDate = this._local_to_utc(this._zero_time(o.startDate));
234                    else
235                        o.startDate = DPGlobal.parseDate(o.startDate, format, o.language, o.assumeNearbyYear);
236                }
237                else {
238                    o.startDate = -Infinity;
239                }
240            }
241            if (o.endDate !== Infinity) {
242                if (!!o.endDate) {
243                    if (o.endDate instanceof Date)
244                        o.endDate = this._local_to_utc(this._zero_time(o.endDate));
245                    else
246                        o.endDate = DPGlobal.parseDate(o.endDate, format, o.language, o.assumeNearbyYear);
247                }
248                else {
249                    o.endDate = Infinity;
250                }
251            }
252
253            o.daysOfWeekDisabled = o.daysOfWeekDisabled || [];
254            if (!$.isArray(o.daysOfWeekDisabled))
255                o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
256            o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function (d) {
257                return parseInt(d, 10);
258            });
259
260            o.daysOfWeekHighlighted = o.daysOfWeekHighlighted || [];
261            if (!$.isArray(o.daysOfWeekHighlighted))
262                o.daysOfWeekHighlighted = o.daysOfWeekHighlighted.split(/[,\s]*/);
263            o.daysOfWeekHighlighted = $.map(o.daysOfWeekHighlighted, function (d) {
264                return parseInt(d, 10);
265            });
266
267            o.datesDisabled = o.datesDisabled || [];
268            if (!$.isArray(o.datesDisabled)) {
269                var datesDisabled = [];
270                datesDisabled.push(DPGlobal.parseDate(o.datesDisabled, format, o.language, o.assumeNearbyYear));
271                o.datesDisabled = datesDisabled;
272            }
273            o.datesDisabled = $.map(o.datesDisabled, function (d) {
274                return DPGlobal.parseDate(d, format, o.language, o.assumeNearbyYear);
275            });
276
277            var plc = String(o.orientation).toLowerCase().split(/\s+/g),
278                    _plc = o.orientation.toLowerCase();
279            plc = $.grep(plc, function (word) {
280                return /^auto|left|right|top|bottom$/.test(word);
281            });
282            o.orientation = {x: 'auto', y: 'auto'};
283            if (!_plc || _plc === 'auto')
284                ; // no action
285            else if (plc.length === 1) {
286                switch (plc[0]) {
287                    case 'top':
288                    case 'bottom':
289                        o.orientation.y = plc[0];
290                        break;
291                    case 'left':
292                    case 'right':
293                        o.orientation.x = plc[0];
294                        break;
295                }
296            }
297            else {
298                _plc = $.grep(plc, function (word) {
299                    return /^left|right$/.test(word);
300                });
301                o.orientation.x = _plc[0] || 'auto';
302
303                _plc = $.grep(plc, function (word) {
304                    return /^top|bottom$/.test(word);
305                });
306                o.orientation.y = _plc[0] || 'auto';
307            }
308            if (o.defaultViewDate) {
309                var year = o.defaultViewDate.year || new Date().getFullYear();
vendor: 22,276 bytes, lines 310-748
310                var month = o.defaultViewDate.month || 0;
311                var day = o.defaultViewDate.day || 1;
312                o.defaultViewDate = UTCDate(year, month, day);
313            } else {
314                o.defaultViewDate = UTCToday();
315            }
316            o.showOnFocus = o.showOnFocus !== undefined ? o.showOnFocus : true;
317            o.zIndexOffset = o.zIndexOffset !== undefined ? o.zIndexOffset : 10;
318        },
319        _events: [],
320        _secondaryEvents: [],
321        _applyEvents: function (evs) {
322            for (var i = 0, el, ch, ev; i < evs.length; i++) {
323                el = evs[i][0];
324                if (evs[i].length === 2) {
325                    ch = undefined;
326                    ev = evs[i][1];
327                }
328                else if (evs[i].length === 3) {
329                    ch = evs[i][1];
330                    ev = evs[i][2];
331                }
332                el.on(ev, ch);
333            }
334        },
335        _unapplyEvents: function (evs) {
336            for (var i = 0, el, ev, ch; i < evs.length; i++) {
337                el = evs[i][0];
338                if (evs[i].length === 2) {
339                    ch = undefined;
340                    ev = evs[i][1];
341                }
342                else if (evs[i].length === 3) {
343                    ch = evs[i][1];
344                    ev = evs[i][2];
345                }
346                el.off(ev, ch);
347            }
348        },
349        _buildEvents: function () {
350            var events = {
351                keyup: $.proxy(function (e) {
352                    if ($.inArray(e.keyCode, [27, 37, 39, 38, 40, 32, 13, 9]) === -1)
353                        this.update();
354                }, this),
355                keydown: $.proxy(this.keydown, this),
356                paste: $.proxy(this.paste, this)
357            };
358
359            if (this.o.showOnFocus === true) {
360                events.focus = $.proxy(this.show, this);
361            }
362
363            if (this.isInput) { // single input
364                this._events = [
365                    [this.element, events]
366                ];
367            }
368            else if (this.component && this.hasInput) { // component: input + button
369                this._events = [
370                    // For components that are not readonly, allow keyboard nav
371                    [this.element.find('input'), events],
372                    [this.component, {
373                            click: $.proxy(this.show, this)
374                        }]
375                ];
376            }
377            else if (this.element.is('div')) {  // inline datepicker
378                this.isInline = true;
379            }
380            else {
381                this._events = [
382                    [this.element, {
383                            click: $.proxy(this.show, this)
384                        }]
385                ];
386            }
387            this._events.push(
388                    // Component: listen for blur on element descendants
389                            [this.element, '*', {
390                                    blur: $.proxy(function (e) {
391                                        this._focused_from = e.target;
392                                    }, this)
393                                }],
394                            // Input: listen for blur on element
395                                    [this.element, {
396                                            blur: $.proxy(function (e) {
397                                                this._focused_from = e.target;
398                                            }, this)
399                                        }]
400                                    );
401
402                            if (this.o.immediateUpdates) {
403                                // Trigger input updates immediately on changed year/month
404                                this._events.push([this.element, {
405                                        'changeYear changeMonth': $.proxy(function (e) {
406                                            this.update(e.date);
407                                        }, this)
408                                    }]);
409                            }
410
411                            this._secondaryEvents = [
412                                [this.picker, {
413                                        click: $.proxy(this.click, this)
414                                    }],
415                                [$(window), {
416                                        resize: $.proxy(this.place, this)
417                                    }],
418                                [$(document), {
419                                        mousedown: $.proxy(function (e) {
420                                            // Clicked outside the datepicker, hide it
421                                            if (!(
422                                                    this.element.is(e.target) ||
423                                                    this.element.find(e.target).length ||
424                                                    this.picker.is(e.target) ||
425                                                    this.picker.find(e.target).length ||
426                                                    this.picker.hasClass('datepicker-inline')
427                                                    )) {
428                                                this.hide();
429                                            }
430                                        }, this)
431                                    }]
432                            ];
433                        },
434                        _attachEvents: function () {
435                            this._detachEvents();
436                            this._applyEvents(this._events);
437                        },
438                        _detachEvents: function () {
439                            this._unapplyEvents(this._events);
440                        },
441                        _attachSecondaryEvents: function () {
442                            this._detachSecondaryEvents();
443                            this._applyEvents(this._secondaryEvents);
444                        },
445                        _detachSecondaryEvents: function () {
446                            this._unapplyEvents(this._secondaryEvents);
447                        },
448                        _trigger: function (event, altdate) {
449                            var date = altdate || this.dates.get(-1),
450                                    local_date = this._utc_to_local(date);
451
452                            this.element.trigger({
453                                type: event,
454                                date: local_date,
455                                dates: $.map(this.dates, this._utc_to_local),
456                                format: $.proxy(function (ix, format) {
457                                    if (arguments.length === 0) {
458                                        ix = this.dates.length - 1;
459                                        format = this.o.format;
460                                    }
461                                    else if (typeof ix === 'string') {
462                                        format = ix;
463                                        ix = this.dates.length - 1;
464                                    }
465                                    format = format || this.o.format;
466                                    var date = this.dates.get(ix);
467                                    return DPGlobal.formatDate(date, format, this.o.language);
468                                }, this)
469                            });
470                        },
471                        show: function () {
472                            if (this.element.attr('readonly') && this.o.enableOnReadonly === false)
473                                return;
474                            if (!this.isInline)
475                                this.picker.appendTo(this.o.container);
476                            this.place();
477                            this.picker.show();
478                            this._attachSecondaryEvents();
479                            this._trigger('show');
480                            if ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && this.o.disableTouchKeyboard) {
481                                $(this.element).blur();
482                            }
483                            return this;
484                        },
485                        hide: function () {
486                            if (this.isInline)
487                                return this;
488                            if (!this.picker.is(':visible'))
489                                return this;
490                            this.focusDate = null;
491                            this.picker.hide().detach();
492                            this._detachSecondaryEvents();
493                            this.viewMode = this.o.startView;
494                            this.showMode();
495
496                            if (
497                                    this.o.forceParse &&
498                                    (
499                                            this.isInput && this.element.val() ||
500                                            this.hasInput && this.element.find('input').val()
501                                            )
502                                    )
503                                this.setValue();
504                            this._trigger('hide');
505                            return this;
506                        },
507                        remove: function () {
508                            this.hide();
509                            this._detachEvents();
510                            this._detachSecondaryEvents();
511                            this.picker.remove();
512                            delete this.element.data().datepicker;
513                            if (!this.isInput) {
514                                delete this.element.data().date;
515                            }
516                            return this;
517                        },
518                        paste: function (evt) {
519                            var dateString;
520                            if (evt.originalEvent.clipboardData && evt.originalEvent.clipboardData.types
521                                    && $.inArray('text/plain', evt.originalEvent.clipboardData.types) !== -1) {
522                                dateString = evt.originalEvent.clipboardData.getData('text/plain');
523                            }
524                            else if (window.clipboardData) {
525                                dateString = window.clipboardData.getData('Text');
526                            }
527                            else {
528                                return;
529                            }
530                            this.setDate(dateString);
531                            this.update();
532                            evt.preventDefault();
533                        },
534                        _utc_to_local: function (utc) {
535                            return utc && new Date(utc.getTime() + (utc.getTimezoneOffset() * 60000));
536                        },
537                        _local_to_utc: function (local) {
538                            return local && new Date(local.getTime() - (local.getTimezoneOffset() * 60000));
539                        },
540                        _zero_time: function (local) {
541                            return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());
542                        },
543                        _zero_utc_time: function (utc) {
544                            return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate()));
545                        },
546                        getDates: function () {
547                            return $.map(this.dates, this._utc_to_local);
548                        },
549                        getUTCDates: function () {
550                            return $.map(this.dates, function (d) {
551                                return new Date(d);
552                            });
553                        },
554                        getDate: function () {
555                            return this._utc_to_local(this.getUTCDate());
556                        },
557                        getUTCDate: function () {
558                            var selected_date = this.dates.get(-1);
559                            if (typeof selected_date !== 'undefined') {
560                                return new Date(selected_date);
561                            } else {
562                                return null;
563                            }
564                        },
565                        clearDates: function () {
566                            var element;
567                            if (this.isInput) {
568                                element = this.element;
569                            } else if (this.component) {
570                                element = this.element.find('input');
571                            }
572
573                            if (element) {
574                                element.val('');
575                            }
576
577                            this.update();
578                            this._trigger('changeDate');
579
580                            if (this.o.autoclose) {
581                                this.hide();
582                            }
583                        },
584                        setDates: function () {
585                            var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
586                            this.update.apply(this, args);
587                            this._trigger('changeDate');
588                            this.setValue();
589                            return this;
590                        },
591                        setUTCDates: function () {
592                            var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
593                            this.update.apply(this, $.map(args, this._utc_to_local));
594                            this._trigger('changeDate');
595                            this.setValue();
596                            return this;
597                        },
598                        setDate: alias('setDates'),
599                        setUTCDate: alias('setUTCDates'),
600                        setValue: function () {
601                            var formatted = this.getFormattedDate();
602                            if (!this.isInput) {
603                                if (this.component) {
604                                    this.element.find('input').val(formatted);
605                                }
606                            }
607                            else {
608                                this.element.val(formatted);
609                            }
610                            return this;
611                        },
612                        getFormattedDate: function (format) {
613                            if (format === undefined)
614                                format = this.o.format;
615
616                            var lang = this.o.language;
617                            return $.map(this.dates, function (d) {
618                                return DPGlobal.formatDate(d, format, lang);
619                            }).join(this.o.multidateSeparator);
620                        },
621                        getStartDate: function () {
622                            return this.o.startDate;
623                        },
624                        setStartDate: function (startDate) {
625                            this._process_options({startDate: startDate});
626                            this.update();
627                            this.updateNavArrows();
628                            return this;
629                        },
630                        getEndDate: function () {
631                            return this.o.endDate;
632                        },
633                        setEndDate: function (endDate) {
634                            this._process_options({endDate: endDate});
635                            this.update();
636                            this.updateNavArrows();
637                            return this;
638                        },
639                        setDaysOfWeekDisabled: function (daysOfWeekDisabled) {
640                            this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
641                            this.update();
642                            this.updateNavArrows();
643                            return this;
644                        },
645                        setDaysOfWeekHighlighted: function (daysOfWeekHighlighted) {
646                            this._process_options({daysOfWeekHighlighted: daysOfWeekHighlighted});
647                            this.update();
648                            return this;
649                        },
650                        setDatesDisabled: function (datesDisabled) {
651                            this._process_options({datesDisabled: datesDisabled});
652                            this.update();
653                            this.updateNavArrows();
654                        },
655                        place: function () {
656                            if (this.isInline)
657                                return this;
658                            var calendarWidth = this.picker.outerWidth(),
659                                    calendarHeight = this.picker.outerHeight(),
660                                    visualPadding = 10,
661                                    container = $(this.o.container),
662                                    windowWidth = container.width(),
663                                    scrollTop = this.o.container === 'body' ? $(document).scrollTop() : container.scrollTop(),
664                                    appendOffset = container.offset();
665
666                            var parentsZindex = [];
667                            this.element.parents().each(function () {
668                                var itemZIndex = $(this).css('z-index');
669                                if (itemZIndex !== 'auto' && itemZIndex !== 0)
670                                    parentsZindex.push(parseInt(itemZIndex));
671                            });
672                            var zIndex = Math.max.apply(Math, parentsZindex) + this.o.zIndexOffset;
673                            var offset = this.component ? this.component.parent().offset() : this.element.offset();
674                            var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
675                            var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
676                            var left = offset.left - appendOffset.left,
677                                    top = offset.top - appendOffset.top;
678
679                            if (this.o.container !== 'body') {
680                                top += scrollTop;
681                            }
682
683                            this.picker.removeClass(
684                                    'datepicker-orient-top datepicker-orient-bottom ' +
685                                    'datepicker-orient-right datepicker-orient-left'
686                                    );
687
688                            if (this.o.orientation.x !== 'auto') {
689                                this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
690                                if (this.o.orientation.x === 'right')
691                                    left -= calendarWidth - width;
692                            }
693                            // auto x orientation is best-placement: if it crosses a window
694                            // edge, fudge it sideways
695                            else {
696                                if (offset.left < 0) {
697                                    // component is outside the window on the left side. Move it into visible range
698                                    this.picker.addClass('datepicker-orient-left');
699                                    left -= offset.left - visualPadding;
700                                } else if (left + calendarWidth > windowWidth) {
701                                    // the calendar passes the widow right edge. Align it to component right side
702                                    this.picker.addClass('datepicker-orient-right');
703                                    left += width - calendarWidth;
704                                } else {
705                                    // Default to left
706                                    this.picker.addClass('datepicker-orient-left');
707                                }
708                            }
709
710                            // auto y orientation is best-situation: top or bottom, no fudging,
711                            // decision based on which shows more of the calendar
712                            var yorient = this.o.orientation.y,
713                                    top_overflow;
714                            if (yorient === 'auto') {
715                                top_overflow = -scrollTop + top - calendarHeight;
716                                yorient = top_overflow < 0 ? 'bottom' : 'top';
717                            }
718
719                            this.picker.addClass('datepicker-orient-' + yorient);
720                            if (yorient === 'top')
721                                top -= calendarHeight + parseInt(this.picker.css('padding-top'));
722                            else
723                                top += height;
724
725                            if (this.o.rtl) {
726                                var right = windowWidth - (left + width);
727                                this.picker.css({
728                                    top: top,
729                                    right: right,
730                                    zIndex: zIndex
731                                });
732                            } else {
733                                this.picker.css({
734                                    top: top,
735                                    left: left,
736                                    zIndex: zIndex
737                                });
738                            }
739                            return this;
740                        },
741                        _allow_update: true,
742                        update: function () {
743                            if (!this._allow_update)
744                                return this;
745
746                            var oldDates = this.dates.copy(),
747                                    dates = [],
748                                    fromArgs = false;
749                            if (arguments.length) {
750                                $.each(arguments, $.proxy(function (i, date) {
751                                    if (date instanceof Date)
752                                        date = this._local_to_utc(date);
753                                    dates.push(date);
754                                }, this));
755                                fromArgs = true;
756                            }
757                            else {
758                                dates = this.isInput
759                                        ? this.element.val()
760                                        : this.element.data('date') || this.element.find('input').val();
761                                if (dates && this.o.multidate)
762                                    dates = dates.split(this.o.multidateSeparator);
763                                else
764                                    dates = [dates];
765                                delete this.element.data().date;
766                            }
767
768                            dates = $.map(dates, $.proxy(function (date) {
769                                return DPGlobal.parseDate(date, this.o.format, this.o.language, this.o.assumeNearbyYear);
770                            }, this));
771                            dates = $.grep(dates, $.proxy(function (date) {
772                                return (
773                                        !this.dateWithinRange(date) ||
774                                        !date
775                                        );
776                            }, this), true);
777                            this.dates.replace(dates);
778
779                            if (this.dates.length)
780                                this.viewDate = new Date(this.dates.get(-1));
781                            else if (this.viewDate < this.o.startDate)
782                                this.viewDate = new Date(this.o.startDate);
783                            else if (this.viewDate > this.o.endDate)
784                                this.viewDate = new Date(this.o.endDate);
785                            else
786                                this.viewDate = this.o.defaultViewDate;
787
788                            if (fromArgs) {
789                                // setting date by clicking
790                                this.setValue();
791                            }
792                            else if (dates.length) {
793                                // setting date by typing
794                                if (String(oldDates) !== String(this.dates))
795                                    this._trigger('changeDate');
796                            }
797                            if (!this.dates.length && oldDates.length)
798                                this._trigger('clearDate');
799
800                            this.fill();
801                            this.element.change();
802                            return this;
803                        },
804                        fillDow: function () {
805                            var dowCnt = this.o.weekStart,
806                                    html = '<tr>';
807                            if (this.o.calendarWeeks) {
808                                this.picker.find('.datepicker-days .datepicker-switch')
809                                        .attr('colspan', function (i, val) {
810                                            return parseInt(val) + 1;
811                                        });
812                                html += '<th class="cw">&#160;</th>';
813                            }
814                            while (dowCnt < this.o.weekStart + 7) {
815                                html += '<th class="dow">' + dates[this.o.language].daysMin[(dowCnt++) % 7] + '</th>';
816                            }
817                            html += '</tr>';
818                            this.picker.find('.datepicker-days thead').append(html);
819                        },
820                        fillMonths: function () {
821                            var html = '',
822                                    i = 0;
823                            while (i < 12) {
824                                html += '<span class="month">' + dates[this.o.language].monthsShort[i++] + '</span>';
825                            }
826                            this.picker.find('.datepicker-months td').html(html);
827                        },
828                        setRange: function (range) {
829                            if (!range || !range.length)
830                                delete this.range;
831                            else
832                                this.range = $.map(range, function (d) {
833                                    return d.valueOf();
834                                });
835                            this.fill();
836                        },
837                        getClassNames: function (date) {
838                            var cls = [],
839                                    year = this.viewDate.getUTCFullYear(),
840                                    month = this.viewDate.getUTCMonth(),
841                                    today = new Date();
842                            if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)) {
843                                cls.push('old');
844                            }
845                            else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)) {
846                                cls.push('new');
847                            }
848                            if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
849                                cls.push('focused');
850                            // Compare internal UTC date with local today, not UTC today
851                            if (this.o.todayHighlight &&
852                                    date.getUTCFullYear() === today.getFullYear() &&
853                                    date.getUTCMonth() === today.getMonth() &&
854                                    date.getUTCDate() === today.getDate()) {
855                                cls.push('today');
856                            }
857                            if (this.dates.contains(date) !== -1)
858                                cls.push('active');
859                            if (!this.dateWithinRange(date) || this.dateIsDisabled(date)) {
860                                cls.push('disabled');
861                            }
862                            if ($.inArray(date.getUTCDay(), this.o.daysOfWeekHighlighted) !== -1) {
863                                cls.push('highlighted');
864                            }
865
866                            if (this.range) {
867                                if (date > this.range[0] && date < this.range[this.range.length - 1]) {
868                                    cls.push('range');
869                                }
870                                if ($.inArray(date.valueOf(), this.range) !== -1) {
871                                    cls.push('selected');
872                                }
873                                if (date.valueOf() === this.range[0]) {
874                                    cls.push('range-start');
875                                }
876                                if (date.valueOf() === this.range[this.range.length - 1]) {
877                                    cls.push('range-end');
878                                }
879                            }
880                            return cls;
881                        },
882                        _fill_yearsView: function (selector, cssClass, factor, step, currentYear, startYear, endYear, callback) {
883                            var html, view, year, steps, startStep, endStep, thisYear, i, classes, tooltip, before;
884
885                            html = '';
886                            view = this.picker.find(selector);
887                            year = parseInt(currentYear / factor, 10) * factor;
888                            startStep = parseInt(startYear / step, 10) * step;
889                            endStep = parseInt(endYear / step, 10) * step;
890                            steps = $.map(this.dates, function (d) {
891                                return parseInt(d.getUTCFullYear() / step, 10) * step;
892                            });
893
894                            view.find('.datepicker-switch').text(year + '-' + (year + step * 9));
895
896                            thisYear = year - step;
897                            for (i = -1; i < 11; i += 1) {
898                                classes = [cssClass];
899                                tooltip = null;
900
901                                if (i === -1) {
902                                    classes.push('old');
903                                } else if (i === 10) {
904                                    classes.push('new');
905                                }
906                                if ($.inArray(thisYear, steps) !== -1) {
907                                    classes.push('active');
908                                }
909                                if (thisYear < startStep || thisYear > endStep) {
910                                    classes.push('disabled');
911                                }
912
913                                if (callback !== $.noop) {
914                                    before = callback(new Date(thisYear, 0, 1));
915                                    if (before === undefined) {
916                                        before = {};
917                                    } else if (typeof (before) === 'boolean') {
918                                        before = {enabled: before};
919                                    } else if (typeof (before) === 'string') {
920                                        before = {classes: before};
921                                    }
922                                    if (before.enabled === false) {
923                                        classes.push('disabled');
924                                    }
925                                    if (before.classes) {
926                                        classes = classes.concat(before.classes.split(/\s+/));
927                                    }
928                                    if (before.tooltip) {
929                                        tooltip = before.tooltip;
930                                    }
931                                }
932
933                                html += '<span class="' + classes.join(' ') + '"' + (tooltip ? ' title="' + tooltip + '"' : '') + '>
933' + thisYear + '</span>';
934                                thisYear += step;
935                            }
936                            view.find('td').html(html);
937                        },
938                        fill: function () {
939                            var d = new Date(this.viewDate),
940                                    year = d.getUTCFullYear(),
941                                    month = d.getUTCMonth(),
942                                    startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
943                                    startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
944                                    endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
945                                    endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
946                                    todaytxt = dates[this.o.language].today || dates['en'].today || '',
947                                    cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
948                                    titleFormat = dates[this.o.language].titleFormat || dates['en'].titleFormat,
949                                    tooltip,
950                                    before;
951                            if (isNaN(year) || isNaN(month))
952                                return;
953                            this.picker.find('.datepicker-days .datepicker-switch')
954                                    .text(DPGlobal.formatDate(d, titleFormat, this.o.language));
955                            this.picker.find('tfoot .today')
956                                    .text(todaytxt)
957                                    .toggle(this.o.todayBtn !== false);
958                            this.picker.find('tfoot .clear')
959                                    .text(cleartxt)
960                                    .toggle(this.o.clearBtn !== false);
961                            this.picker.find('thead .datepicker-title')
962                                    .text(this.o.title)
963                                    .toggle(this.o.title !== '');
964                            this.updateNavArrows();
965                            this.fillMonths();
966                            var prevMonth = UTCDate(year, month - 1, 28),
967                                    day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
968                            prevMonth.setUTCDate(day);
969                            prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7) % 7);
970                            var nextMonth = new Date(prevMonth);
971                            if (prevMonth.getUTCFullYear() < 100) {
972                                nextMonth.setUTCFullYear(prevMonth.getUTCFullYear());
973                            }
974                            nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
975                            nextMonth = nextMonth.valueOf();
976                            var html = [];
977                            var clsName;
978                            while (prevMonth.valueOf() < nextMonth) {
979                                if (prevMonth.getUTCDay() === this.o.weekStart) {
980                                    html.push('<tr>');
981                                    if (this.o.calendarWeeks) {
982                                        // ISO 8601: First week contains first thursday.
983                                        // ISO also states week starts on Monday, but we can be more abstract here.
984                                        var
985                                                // Start of current week: based on weekstart/current date
986                                                ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
987                                                // Thursday of this week
988                                                th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
989                                                // First Thursday of year, year from thursday
990                                                yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay()) % 7 * 864e5),
991                                                // Calendar week: ms between thursdays, div ms per day, div 7 days
992                                                calWeek = (th - yth) / 864e5 / 7 + 1;
993                                        html.push('<td class="cw">' + calWeek + '</td>');
994
995                                    }
996                                }
997                                clsName = this.getClassNames(prevMonth);
998                                clsName.push('day');
999
1000                                if (this.o.beforeShowDay !== $.noop) {
1001                                    before = this.o.beforeShowDay(this._utc_to_local(prevMonth));
1002                                    if (before === undefined)
1003                                        before = {};
1004                                    else if (typeof (before) === 'boolean')
1005                                        before = {enabled: before};
1006                                    else if (typeof (before) === 'string')
1007                                        before = {classes: before};
1008                                    if (before.enabled === false)
1009                                        clsName.push('disabled');
1010                                    if (before.classes)
1011                                        clsName = clsName.concat(before.classes.split(/\s+/));
1012                                    if (before.tooltip)
1013                                        tooltip = before.tooltip;
1014                                }
1015
1016                                clsName = $.unique(clsName);
1017                                html.push('<td class="' + clsName.join(' ') + '"' + (tooltip ? ' title="' + tooltip + '"' : '') + '>
1017' + prevMonth.getUTCDate() + '</td>');
1018                                tooltip = null;
1019                                if (prevMonth.getUTCDay() === this.o.weekEnd) {
1020                                    html.push('</tr>');
1021                                }
1022                                prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);
1023                            }
1024                            this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
1025
1026                            var months = this.picker.find('.datepicker-months')
1027                                    .find('.datepicker-switch')
1028                                    .text(this.o.maxViewMode < 2 ? 'Months' : year)
1029                                    .end()
1030                                    .find('span').removeClass('active');
1031
1032                            $.each(this.dates, function (i, d) {
1033                                if (d.getUTCFullYear() === year)
1034                                    months.eq(d.getUTCMonth()).addClass('active');
1035                            });
1036
1037                            if (year < startYear || year > endYear) {
1038                                months.addClass('disabled');
1039                            }
1040                            if (year === startYear) {
1041                                months.slice(0, startMonth).addClass('disabled');
1042                            }
1043                            if (year === endYear) {
1044                                months.slice(endMonth + 1).addClass('disabled');
1045                            }
1046
1047                            if (this.o.beforeShowMonth !== $.noop) {
1048                                var that = this;
1049                                $.each(months, function (i, month) {
1050                                    if (!$(month).hasClass('disabled')) {
1051                                        var moDate = new Date(year, i, 1);
1052                                        var before = that.o.beforeShowMonth(moDate);
1053                                        if (before === false)
1054                                            $(month).addClass('disabled');
1055                                    }
1056                                });
1057                            }
1058
1059                            // Generating decade/years picker
1060                            this._fill_yearsView(
1061                                    '.datepicker-years',
1062                                    'year',
1063                                    10,
1064                                    1,
1065                                    year,
1066                                    startYear,
1067                                    endYear,
1068                                    this.o.beforeShowYear
1069                                    );
1070
1071                            // Generating century/decades picker
1072                            this._fill_yearsView(
1073                                    '.datepicker-decades',
1074                                    'decade',
1075                                    100,
1076                                    10,
1077                                    year,
1078                                    startYear,
1079                                    endYear,
1080                                    this.o.beforeShowDecade
1081                                    );
1082
1083                            // Generating millennium/centuries picker
1084                            this._fill_yearsView(
1085                                    '.datepicker-centuries',
1086                                    'century',
1087                                    1000,
1088                                    100,
1089                                    year,
1090                                    startYear,
1091                                    endYear,
1092                                    this.o.beforeShowCentury
1093                                    );
1094                        },
1095                        updateNavArrows: function () {
1096                            if (!this._allow_update)
1097                                return;
1098
1099                            var d = new Date(this.viewDate),
1100                                    year = d.getUTCFullYear(),
1101                                    month = d.getUTCMonth();
1102                            switch (this.viewMode) {
1103                                case 0:
1104                                    if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()) {
1105                                        this.picker.find('.prev').css({visibility: 'hidden'});
1106                                    }
1107                                    else {
1108                                        this.picker.find('.prev').css({visibility: 'visible'});
1109                                    }
1110                                    if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()) {
1111                                        this.picker.find('.next').css({visibility: 'hidden'});
1112                                    }
1113                                    else {
1114                                        this.picker.find('.next').css({visibility: 'visible'});
1115                                    }
1116                                    break;
1117                                case 1:
1118                                case 2:
1119                                case 3:
1120                                case 4:
1121                                    if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() || this.o.maxViewMode < 2) {
1122                                        this.picker.find('.prev').css({visibility: 'hidden'});
1123                                    }
1124                                    else {
1125                                        this.picker.find('.prev').css({visibility: 'visible'});
1126                                    }
1127                                    if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() || this.o.maxViewMode < 2) {
1128                                        this.picker.find('.next').css({visibility: 'hidden'});
1129                                    }
1130                                    else {
1131                                        this.picker.find('.next').css({visibility: 'visible'});
1132                                    }
1133                                    break;
1134                            }
1135                        },
1136                        click: function (e) {
1137                            
1138                            e.preventDefault();
1139                            e.stopPropagation();
1140
1141                            var target, dir, day, year, month;
1142                            target = $(e.target);
1143                           
1144
1145                            // Clicked on the switch
1146                            if (target.hasClass('datepicker-switch')) {
1147                                this.showMode(1);
1148                            }
1149
1150                            // Clicked on prev or next
1151
1152                            if (target.closest('.prev').length > 0) {
1153
1154                                dir = DPGlobal.modes[this.viewMode].navStep *  (-1);
1155                                if (this.viewMode === 0) {
1156                                    this.viewDate = this.moveMonth(this.viewDate, dir);
1157                                    this._trigger('changeMonth', this.viewDate);
1158                                } else {
1159                                    this.viewDate = this.moveYear(this.viewDate, dir);
1160                                    if (this.viewMode === 1) {
1161                                        this._trigger('changeYear', this.viewDate);
1162                                    }
1163                                }
1164                                this.fill();
1165                            }
1166                            
1167                            if (target.closest('.next').length > 0) {
1168
1169                                dir = DPGlobal.modes[this.viewMode].navStep * (1);
1170                                if (this.viewMode === 0) {
1171                                    this.viewDate = this.moveMonth(this.viewDate, dir);
1172                                    this._trigger('changeMonth', this.viewDate);
1173                                } else {
1174                                    this.viewDate = this.moveYear(this.viewDate, dir);
1175                                    if (this.viewMode === 1) {
1176                                        this._trigger('changeYear', this.viewDate);
1177                                    }
1178                                }
1179                                this.fill();
1180                            }
1181
1182                            // Clicked on today button
1183                            if (target.hasClass('today')) {
1184                                this.showMode(-2);
1185                                this._setDate(UTCToday(), this.o.todayBtn === 'linked' ? null : 'view');
1186                            }
1187
1188                            // Clicked on clear button
1189                            if (target.hasClass('clear')) {
1190                                this.clearDates();
1191                            }
1192
1193                            if (!target.hasClass('disabled')) {
1194                                // Clicked on a day
1195                                if (target.hasClass('day')) {
1196                                    day = parseInt(target.text(), 10) || 1;
1197                                    year = this.viewDate.getUTCFullYear();
1198                                    month = this.viewDate.getUTCMonth();
1199
1200                                    // From last month
1201                                    if (target.hasClass('old')) {
1202                                        if (month === 0) {
1203                                            month = 11;
1204                                            year = year - 1;
1205                                        } else {
1206                                            month = month - 1;
1207                                        }
1208                                    }
1209
1210                                    // From next month
1211                                    if (target.hasClass('new')) {
1212                                        if (month === 11) {
1213                                            month = 0;
1214                                            year = year + 1;
1215                                        } else {
1216                                            month = month + 1;
1217                                        }
1218                                    }
1219                                    this._setDate(UTCDate(year, month, day));
1220                                }
1221
1222                                // Clicked on a month
1223                                if (target.hasClass('month')) {
1224                                    this.viewDate.setUTCDate(1);
1225                                    day = 1;
1226                                    month = target.parent().find('span').index(target);
1227                                    year = this.viewDate.getUTCFullYear();
1228                                    this.viewDate.setUTCMonth(month);
1229                                    this._trigger('changeMonth', this.viewDate);
1230                                    if (this.o.minViewMode === 1) {
1231                                        this._setDate(UTCDate(year, month, day));
1232                                        this.showMode();
1233                                    } else {
1234                                        this.showMode(-1);
1235                                    }
1236                                    this.fill();
1237                                }
1238
1239                                // Clicked on a year
1240                                if (target.hasClass('year')
1241                                        || target.hasClass('decade')
1242                                        || target.hasClass('century')) {
1243                                    this.viewDate.setUTCDate(1);
1244
1245                                    day = 1;
1246                                    month = 0;
1247                                    year = parseInt(target.text(), 10) || 0;
1248                                    this.viewDate.setUTCFullYear(year);
1249
1250                                    if (target.hasClass('year')) {
1251                                        this._trigger('changeYear', this.viewDate);
1252                                        if (this.o.minViewMode === 2) {
1253                                            this._setDate(UTCDate(year, month, day));
1254                                        }
1255                                    }
1256                                    if (target.hasClass('decade')) {
1257                                        this._trigger('changeDecade', this.viewDate);
1258                                        if (this.o.minViewMode === 3) {
1259                                            this._setDate(UTCDate(year, month, day));
1260                                        }
1261                                    }
1262                                    if (target.hasClass('century')) {
1263                                        this._trigger('changeCentury', this.viewDate);
1264                                        if (this.o.minViewMode === 4) {
1265                                            this._setDate(UTCDate(year, month, day));
1266                                        }
1267                                    }
1268
1269                                    this.showMode(-1);
1270                                    this.fill();
1271                                }
1272                            }
1273
1274                            if (this.picker.is(':visible') && this._focused_from) {
1275                                $(this._focused_from).focus();
1276                            }
1277                            delete this._focused_from;
1278                        },
1279                        _toggle_multidate: function (date) {
1280                            var ix = this.dates.contains(date);
1281                            if (!date) {
1282                                this.dates.clear();
1283                            }
1284
1285                            if (ix !== -1) {
1286                                if (this.o.multidate === true || this.o.multidate > 1 || this.o.toggleActive) {
1287                                    this.dates.remove(ix);
1288                                }
1289                            } else if (this.o.multidate === false) {
1290                                this.dates.clear();
1291                                this.dates.push(date);
1292                            }
1293                            else {
1294                                this.dates.push(date);
1295                            }
1296
1297                            if (typeof this.o.multidate === 'number')
1298                                while (this.dates.length > this.o.multidate)
1299                                    this.dates.remove(0);
1300                        },
1301                        _setDate: function (date, which) {
1302                            if (!which || which === 'date')
1303                                this._toggle_multidate(date && new Date(date));
1304                            if (!which || which === 'view')
1305                                this.viewDate = date && new Date(date);
1306
1307                            this.fill();
1308                            this.setValue();
1309                            if (!which || which !== 'view') {
1310                                this._trigger('changeDate');
1311                            }
1312                            var element;
1313                            if (this.isInput) {
1314                                element = this.element;
1315                            }
1316                            else if (this.component) {
1317                                element = this.element.find('input');
1318                            }
1319                            if (element) {
1320                                element.change();
1321                            }
1322                            if (this.o.autoclose && (!which || which === 'date')) {
1323                                this.hide();
1324                            }
1325                        },
1326                        moveDay: function (date, dir) {
1327                            var newDate = new Date(date);
1328                            newDate.setUTCDate(date.getUTCDate() + dir);
1329
1330                            return newDate;
1331                        },
1332                        moveWeek: function (date, dir) {
1333                            return this.moveDay(date, dir * 7);
1334                        },
1335                        moveMonth: function (date, dir) {
1336                            if (!isValidDate(date))
1337                                return this.o.defaultViewDate;
1338                            if (!dir)
1339                                return date;
1340                            var new_date = new Date(date.valueOf()),
1341                                    day = new_date.getUTCDate(),
vendor: 18,618 bytes, lines 1342-1693
1342                                    month = new_date.getUTCMonth(),
1343                                    mag = Math.abs(dir),
1344                                    new_month, test;
1345                            dir = dir > 0 ? 1 : -1;
1346                            if (mag === 1) {
1347                                test = dir === -1
1348                                        // If going back one month, make sure month is not current month
1349                                        // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
1350                                        ? function () {
1351                                            return new_date.getUTCMonth() === month;
1352                                        }
1353                                // If going forward one month, make sure month is as expected
1354                                // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
1355                                : function () {
1356                                    return new_date.getUTCMonth() !== new_month;
1357                                };
1358                                new_month = month + dir;
1359                                new_date.setUTCMonth(new_month);
1360                                // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
1361                                if (new_month < 0 || new_month > 11)
1362                                    new_month = (new_month + 12) % 12;
1363                            }
1364                            else {
1365                                // For magnitudes >1, move one month at a time...
1366                                for (var i = 0; i < mag; i++)
1367                                    // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
1368                                    new_date = this.moveMonth(new_date, dir);
1369                                // ...then reset the day, keeping it in the new month
1370                                new_month = new_date.getUTCMonth();
1371                                new_date.setUTCDate(day);
1372                                test = function () {
1373                                    return new_month !== new_date.getUTCMonth();
1374                                };
1375                            }
1376                            // Common date-resetting loop -- if date is beyond end of month, make it
1377                            // end of month
1378                            while (test()) {
1379                                new_date.setUTCDate(--day);
1380                                new_date.setUTCMonth(new_month);
1381                            }
1382                            return new_date;
1383                        },
1384                        moveYear: function (date, dir) {
1385                            return this.moveMonth(date, dir * 12);
1386                        },
1387                        moveAvailableDate: function (date, dir, fn) {
1388                            do {
1389                                date = this[fn](date, dir);
1390
1391                                if (!this.dateWithinRange(date))
1392                                    return false;
1393
1394                                fn = 'moveDay';
1395                            }
1396                            while (this.dateIsDisabled(date));
1397
1398                            return date;
1399                        },
1400                        weekOfDateIsDisabled: function (date) {
1401                            return $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1;
1402                        },
1403                        dateIsDisabled: function (date) {
1404                            return (
1405                                    this.weekOfDateIsDisabled(date) ||
1406                                    $.grep(this.o.datesDisabled, function (d) {
1407                                        return isUTCEquals(date, d);
1408                                    }).length > 0
1409                                    );
1410                        },
1411                        dateWithinRange: function (date) {
1412                            return date >= this.o.startDate && date <= this.o.endDate;
1413                        },
1414                        keydown: function (e) {
1415                            if (!this.picker.is(':visible')) {
1416                                if (e.keyCode === 40 || e.keyCode === 27) { // allow down to re-show picker
1417                                    this.show();
1418                                    e.stopPropagation();
1419                                }
1420                                return;
1421                            }
1422                            var dateChanged = false,
1423                                    dir, newViewDate,
1424                                    focusDate = this.focusDate || this.viewDate;
1425                            switch (e.keyCode) {
1426                                case 27: // escape
1427                                    if (this.focusDate) {
1428                                        this.focusDate = null;
1429                                        this.viewDate = this.dates.get(-1) || this.viewDate;
1430                                        this.fill();
1431                                    }
1432                                    else
1433                                        this.hide();
1434                                    e.preventDefault();
1435                                    e.stopPropagation();
1436                                    break;
1437                                case 37: // left
1438                                case 38: // up
1439                                case 39: // right
1440                                case 40: // down
1441                                    if (!this.o.keyboardNavigation || this.o.daysOfWeekDisabled.length === 7)
1442                                        break;
1443                                    dir = e.keyCode === 37 || e.keyCode === 38 ? -1 : 1;
1444                                    if (e.ctrlKey) {
1445                                        newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear');
1446
1447                                        if (newViewDate)
1448                                            this._trigger('changeYear', this.viewDate);
1449                                    }
1450                                    else if (e.shiftKey) {
1451                                        newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth');
1452
1453                                        if (newViewDate)
1454                                            this._trigger('changeMonth', this.viewDate);
1455                                    }
1456                                    else if (e.keyCode === 37 || e.keyCode === 39) {
1457                                        newViewDate = this.moveAvailableDate(focusDate, dir, 'moveDay');
1458                                    }
1459                                    else if (!this.weekOfDateIsDisabled(focusDate)) {
1460                                        newViewDate = this.moveAvailableDate(focusDate, dir, 'moveWeek');
1461                                    }
1462                                    if (newViewDate) {
1463                                        this.focusDate = this.viewDate = newViewDate;
1464                                        this.setValue();
1465                                        this.fill();
1466                                        e.preventDefault();
1467                                    }
1468                                    break;
1469                                case 13: // enter
1470                                    if (!this.o.forceParse)
1471                                        break;
1472                                    focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;
1473                                    if (this.o.keyboardNavigation) {
1474                                        this._toggle_multidate(focusDate);
1475                                        dateChanged = true;
1476                                    }
1477                                    this.focusDate = null;
1478                                    this.viewDate = this.dates.get(-1) || this.viewDate;
1479                                    this.setValue();
1480                                    this.fill();
1481                                    if (this.picker.is(':visible')) {
1482                                        e.preventDefault();
1483                                        e.stopPropagation();
1484                                        if (this.o.autoclose)
1485                                            this.hide();
1486                                    }
1487                                    break;
1488                                case 9: // tab
1489                                    this.focusDate = null;
1490                                    this.viewDate = this.dates.get(-1) || this.viewDate;
1491                                    this.fill();
1492                                    this.hide();
1493                                    break;
1494                            }
1495                            if (dateChanged) {
1496                                if (this.dates.length)
1497                                    this._trigger('changeDate');
1498                                else
1499                                    this._trigger('clearDate');
1500                                var element;
1501                                if (this.isInput) {
1502                                    element = this.element;
1503                                }
1504                                else if (this.component) {
1505                                    element = this.element.find('input');
1506                                }
1507                                if (element) {
1508                                    element.change();
1509                                }
1510                            }
1511                        },
1512                        showMode: function (dir) {
1513                            if (dir) {
1514                                this.viewMode = Math.max(this.o.minViewMode, Math.min(this.o.maxViewMode, this.viewMode + dir));
1515                            }
1516                            this.picker
1517                                    .children('div')
1518                                    .hide()
1519                                    .filter('.datepicker-' + DPGlobal.modes[this.viewMode].clsName)
1520                                    .show();
1521                            this.updateNavArrows();
1522                        }
1523                    };
1524
1525                    var DateRangePicker = function (element, options) {
1526                        $(element).data('datepicker', this);
1527                        this.element = $(element);
1528                        this.inputs = $.map(options.inputs, function (i) {
1529                            return i.jquery ? i[0] : i;
1530                        });
1531                        delete options.inputs;
1532
1533                        datepickerPlugin.call($(this.inputs), options)
1534                                .on('changeDate', $.proxy(this.dateUpdated, this));
1535
1536                        this.pickers = $.map(this.inputs, function (i) {
1537                            return $(i).data('datepicker');
1538                        });
1539                        this.updateDates();
1540                    };
1541                    DateRangePicker.prototype = {
1542                        updateDates: function () {
1543                            this.dates = $.map(this.pickers, function (i) {
1544                                return i.getUTCDate();
1545                            });
1546                            this.updateRanges();
1547                        },
1548                        updateRanges: function () {
1549                            var range = $.map(this.dates, function (d) {
1550                                return d.valueOf();
1551                            });
1552                            $.each(this.pickers, function (i, p) {
1553                                p.setRange(range);
1554                            });
1555                        },
1556                        dateUpdated: function (e) {
1557                            // `this.updating` is a workaround for preventing infinite recursion
1558                            // between `changeDate` triggering and `setUTCDate` calling.  Until
1559                            // there is a better mechanism.
1560                            if (this.updating)
1561                                return;
1562                            this.updating = true;
1563
1564                            var dp = $(e.target).data('datepicker');
1565
1566                            if (typeof (dp) === "undefined") {
1567                                return;
1568                            }
1569
1570                            var new_date = dp.getUTCDate(),
1571                                    i = $.inArray(e.target, this.inputs),
1572                                    j = i - 1,
1573                                    k = i + 1,
1574                                    l = this.inputs.length;
1575                            if (i === -1)
1576                                return;
1577
1578                            $.each(this.pickers, function (i, p) {
1579                                if (!p.getUTCDate())
1580                                    p.setUTCDate(new_date);
1581                            });
1582
1583                            if (new_date < this.dates[j]) {
1584                                // Date being moved earlier/left
1585                                while (j >= 0 && new_date < this.dates[j]) {
1586                                    this.pickers[j--].setUTCDate(new_date);
1587                                }
1588                            }
1589                            else if (new_date > this.dates[k]) {
1590                                // Date being moved later/right
1591                                while (k < l && new_date > this.dates[k]) {
1592                                    this.pickers[k++].setUTCDate(new_date);
1593                                }
1594                            }
1595                            this.updateDates();
1596
1597                            delete this.updating;
1598                        },
1599                        remove: function () {
1600                            $.map(this.pickers, function (p) {
1601                                p.remove();
1602                            });
1603                            delete this.element.data().datepicker;
1604                        }
1605                    };
1606
1607                    function opts_from_el(el, prefix) {
1608                        // Derive options from element data-attrs
1609                        var data = $(el).data(),
1610                                out = {}, inkey,
1611                                replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');
1612                        prefix = new RegExp('^' + prefix.toLowerCase());
1613                        function re_lower(_, a) {
1614                            return a.toLowerCase();
1615                        }
1616                        for (var key in data)
1617                            if (prefix.test(key)) {
1618                                inkey = key.replace(replace, re_lower);
1619                                out[inkey] = data[key];
1620                            }
1621                        return out;
1622                    }
1623
1624                    function opts_from_locale(lang) {
1625                        // Derive options from locale plugins
1626                        var out = {};
1627                        // Check if "de-DE" style date is available, if not language should
1628                        // fallback to 2 letter code eg "de"
1629                        if (!dates[lang]) {
1630                            lang = lang.split('-')[0];
1631                            if (!dates[lang])
1632                                return;
1633                        }
1634                        var d = dates[lang];
1635                        $.each(locale_opts, function (i, k) {
1636                            if (k in d)
1637                                out[k] = d[k];
1638                        });
1639                        return out;
1640                    }
1641
1642                    var old = $.fn.datepicker;
1643                    var datepickerPlugin = function (option) {
1644                        var args = Array.apply(null, arguments);
1645                        args.shift();
1646                        var internal_return;
1647                        this.each(function () {
1648                            var $this = $(this),
1649                                    data = $this.data('datepicker'),
1650                                    options = typeof option === 'object' && option;
1651                            if (!data) {
1652                                var elopts = opts_from_el(this, 'date'),
1653                                        // Preliminary otions
1654                                        xopts = $.extend({}, defaults, elopts, options),
1655                                        locopts = opts_from_locale(xopts.language),
1656                                        // Options priority: js args, data-attrs, locales, defaults
1657                                        opts = $.extend({}, defaults, locopts, elopts, options);
1658                                if ($this.hasClass('input-daterange') || opts.inputs) {
1659                                    $.extend(opts, {
1660                                        inputs: opts.inputs || $this.find('input').toArray()
1661                                    });
1662                                    data = new DateRangePicker(this, opts);
1663                                }
1664                                else {
1665                                    data = new Datepicker(this, opts);
1666                                }
1667                                $this.data('datepicker', data);
1668                            }
1669                            if (typeof option === 'string' && typeof data[option] === 'function') {
1670                                internal_return = data[option].apply(data, args);
1671                            }
1672                        });
1673
1674                        if (
1675                                internal_return === undefined ||
1676                                internal_return instanceof Datepicker ||
1677                                internal_return instanceof DateRangePicker
1678                                )
1679                            return this;
1680
1681                        if (this.length > 1)
1682                            throw new Error('Using only allowed for the collection of a single element (' + option + ' function)');
1683                        else
1684                            return internal_return;
1685                    };
1686                    $.fn.datepicker = datepickerPlugin;
1687
1688                    var defaults = $.fn.datepicker.defaults = {
1689                        assumeNearbyYear: false,
1690                        autoclose: false,
1691                        beforeShowDay: $.noop,
1692                        beforeShowMonth: $.noop,
1693                        beforeShowYear: $.noop,
1694                        beforeShowDecade: $.noop,
1695                        beforeShowCentury: $.noop,
1696                        calendarWeeks: false,
1697                        clearBtn: false,
1698                        toggleActive: false,
1699                        daysOfWeekDisabled: [],
1700                        daysOfWeekHighlighted: [],
1701                        datesDisabled: [],
1702                        endDate: Infinity,
1703                        forceParse: true,
1704                        format: 'mm/dd/yyyy',
1705                        keyboardNavigation: true,
1706                        language: 'en',
1707                        minViewMode: 0,
1708                        maxViewMode: 4,
1709                        multidate: false,
1710                        multidateSeparator: ',',
1711                        orientation: "auto",
1712                        rtl: false,
1713                        startDate: -Infinity,
1714                        startView: 0,
1715                        todayBtn: false,
1716                        todayHighlight: false,
1717                        weekStart: 0,
1718                        disableTouchKeyboard: false,
1719                        enableOnReadonly: true,
1720                        container: 'body',
1721                        immediateUpdates: false,
1722                        title: '',
1723                        templates: {
1724                            leftArrow: '<span class="glyphicon glyphicon-arrow-left"></span>',
1725                            rightArrow: '<span class="glyphicon glyphicon-arrow-right"></span>'
1726                        }
1727                    };
1728                    var locale_opts = $.fn.datepicker.locale_opts = [
1729                        'format',
1730                        'rtl',
1731                        'weekStart'
1732                    ];
1733                    $.fn.datepicker.Constructor = Datepicker;
1734                    var dates = $.fn.datepicker.dates = {
1735                        en: {
1736                            days: ["neděle", "pondělí", "úterý", "středa", "čtvrtek", "pátek", "sobota"],
1737                            daysShort: ["NE", "PO", "ÚT", "ST", "ČT", "PÁ", "SO"],
1738                            daysMin: ["NE", "PO", "ÚT", "ST", "ČT", "PÁ", "SO"],
1739                            months: ["leden", "únor", "březen", "duben", "květen", "červen", "červenec", "srpen", "září", "říjen", "listopad", "prosinec"],
1740                            monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
1741                            today: "dnes",
1742                            clear: "Clear",
1743                            titleFormat: "MM yyyy"
1744                        }
1745                    };
1746
1747                    var DPGlobal = {
1748                        modes: [
1749                            {
1750                                clsName: 'days',
1751                                navFnc: 'Month',
1752                                navStep: 1
1753                            },
1754                            {
1755                                clsName: 'months',
1756                                navFnc: 'FullYear',
1757                                navStep: 1
1758                            },
1759                            {
1760                                clsName: 'years',
1761                                navFnc: 'FullYear',
1762                                navStep: 10
1763                            },
1764                            {
1765                                clsName: 'decades',
1766                                navFnc: 'FullDecade',
1767                                navStep: 100
1768                            },
1769                            {
1770                                clsName: 'centuries',
1771                                navFnc: 'FullCentury',
1772                                navStep: 1000
1773                            }],
1774                        isLeapYear: function (year) {
1775                            return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
1776                        },
1777                        getDaysInMonth: function (year, month) {
1778                            return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
1779                        },
1780                        validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
1781                        nonpunctuation: /[^ -\/:-@\u5e74\u6708\u65e5\[-`{-~\t\n\r]+/g,
1782                        parseFormat: function (format) {
1783                            if (typeof format.toValue === 'function' && typeof format.toDisplay === 'function')
1784                                return format;
1785                            // IE treats \0 as a string end in inputs (truncating the value),
1786                            // so it's a bad format delimiter, anyway
1787                            var separators = format.replace(this.validParts, '\0').split('\0'),
1788                                    parts = format.match(this.validParts);
1789                            if (!separators || !separators.length || !parts || parts.length === 0) {
1790                                throw new Error("Invalid date format.");
1791                            }
1792                            return {separators: separators, parts: parts};
1793                        },
1794                        parseDate: function (date, format, language, assumeNearby) {
1795                            if (!date)
1796                                return undefined;
1797                            if (date instanceof Date)
1798                                return date;
1799                            if (typeof format === 'string')
1800                                format = DPGlobal.parseFormat(format);
1801                            if (format.toValue)
1802                                return format.toValue(date, format, language);
1803                            var part_re = /([\-+]\d+)([dmwy])/,
1804                                    parts = date.match(/([\-+]\d+)([dmwy])/g),
1805                                    fn_map = {
1806                                        d: 'moveDay',
1807                                        m: 'moveMonth',
1808                                        w: 'moveWeek',
1809                                        y: 'moveYear'
1810                                    },
1811                            dateAliases = {
1812                                yesterday: '-1d',
1813                                today: '+0d',
1814                                tomorrow: '+1d'
1815                            },
1816                            part, dir, i, fn;
vendor: 12,409 bytes, lines 1817-2042
1817                            if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) {
1818                                date = new Date();
1819                                for (i = 0; i < parts.length; i++) {
1820                                    part = part_re.exec(parts[i]);
1821                                    dir = parseInt(part[1]);
1822                                    fn = fn_map[part[2]];
1823                                    date = Datepicker.prototype[fn](date, dir);
1824                                }
1825                                return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
1826                            }
1827
1828                            if (typeof dateAliases[date] !== 'undefined') {
1829                                date = dateAliases[date];
1830                                parts = date.match(/([\-+]\d+)([dmwy])/g);
1831
1832                                if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) {
1833                                    date = new Date();
1834                                    for (i = 0; i < parts.length; i++) {
1835                                        part = part_re.exec(parts[i]);
1836                                        dir = parseInt(part[1]);
1837                                        fn = fn_map[part[2]];
1838                                        date = Datepicker.prototype[fn](date, dir);
1839                                    }
1840
1841                                    return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
1842                                }
1843                            }
1844
1845                            parts = date && date.match(this.nonpunctuation) || [];
1846                            date = new Date();
1847
1848                            function applyNearbyYear(year, threshold) {
1849                                if (threshold === true)
1850                                    threshold = 10;
1851
1852                                // if year is 2 digits or less, than the user most likely is trying to get a recent century
1853                                if (year < 100) {
1854                                    year += 2000;
1855                                    // if the new year is more than threshold years in advance, use last century
1856                                    if (year > ((new Date()).getFullYear() + threshold)) {
1857                                        year -= 100;
1858                                    }
1859                                }
1860
1861                                return year;
1862                            }
1863
1864                            var parsed = {},
1865                                    setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
1866                                    setters_map = {
1867                                        yyyy: function (d, v) {
1868                                            return d.setUTCFullYear(assumeNearby ? applyNearbyYear(v, assumeNearby) : v);
1869                                        },
1870                                        yy: function (d, v) {
1871                                            return d.setUTCFullYear(assumeNearby ? applyNearbyYear(v, assumeNearby) : v);
1872                                        },
1873                                        m: function (d, v) {
1874                                            if (isNaN(d))
1875                                                return d;
1876                                            v -= 1;
1877                                            while (v < 0)
1878                                                v += 12;
1879                                            v %= 12;
1880                                            d.setUTCMonth(v);
1881                                            while (d.getUTCMonth() !== v)
1882                                                d.setUTCDate(d.getUTCDate() - 1);
1883                                            return d;
1884                                        },
1885                                        d: function (d, v) {
1886                                            return d.setUTCDate(v);
1887                                        }
1888                                    },
1889                            val, filtered;
1890                            setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
1891                            setters_map['dd'] = setters_map['d'];
1892                            date = UTCToday();
1893                            var fparts = format.parts.slice();
1894                            // Remove noop parts
1895                            if (parts.length !== fparts.length) {
1896                                fparts = $(fparts).filter(function (i, p) {
1897                                    return $.inArray(p, setters_order) !== -1;
1898                                }).toArray();
1899                            }
1900                            // Process remainder
1901                            function match_part() {
1902                                var m = this.slice(0, parts[i].length),
1903                                        p = parts[i].slice(0, m.length);
1904                                return m.toLowerCase() === p.toLowerCase();
1905                            }
1906                            if (parts.length === fparts.length) {
1907                                var cnt;
1908                                for (i = 0, cnt = fparts.length; i < cnt; i++) {
1909                                    val = parseInt(parts[i], 10);
1910                                    part = fparts[i];
1911                                    if (isNaN(val)) {
1912                                        switch (part) {
1913                                            case 'MM':
1914                                                filtered = $(dates[language].months).filter(match_part);
1915                                                val = $.inArray(filtered[0], dates[language].months) + 1;
1916                                                break;
1917                                            case 'M':
1918                                                filtered = $(dates[language].monthsShort).filter(match_part);
1919                                                val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
1920                                                break;
1921                                        }
1922                                    }
1923                                    parsed[part] = val;
1924                                }
1925                                var _date, s;
1926                                for (i = 0; i < setters_order.length; i++) {
1927                                    s = setters_order[i];
1928                                    if (s in parsed && !isNaN(parsed[s])) {
1929                                        _date = new Date(date);
1930                                        setters_map[s](_date, parsed[s]);
1931                                        if (!isNaN(_date))
1932                                            date = _date;
1933                                    }
1934                                }
1935                            }
1936                            return date;
1937                        },
1938                        formatDate: function (date, format, language) {
1939                            if (!date)
1940                                return '';
1941                            if (typeof format === 'string')
1942                                format = DPGlobal.parseFormat(format);
1943                            if (format.toDisplay)
1944                                return format.toDisplay(date, format, language);
1945                            var val = {
1946                                d: date.getUTCDate(),
1947                                D: dates[language].daysShort[date.getUTCDay()],
1948                                DD: dates[language].days[date.getUTCDay()],
1949                                m: date.getUTCMonth() + 1,
1950                                M: dates[language].monthsShort[date.getUTCMonth()],
1951                                MM: dates[language].months[date.getUTCMonth()],
1952                                yy: date.getUTCFullYear().toString().substring(2),
1953                                yyyy: date.getUTCFullYear()
1954                            };
1955                            val.dd = (val.d < 10 ? '0' : '') + val.d;
1956                            val.mm = (val.m < 10 ? '0' : '') + val.m;
1957                            date = [];
1958                            var seps = $.extend([], format.separators);
1959                            for (var i = 0, cnt = format.parts.length; i <= cnt; i++) {
1960                                if (seps.length)
1961                                    date.push(seps.shift());
1962                                date.push(val[format.parts[i]]);
1963                            }
1964                            return date.join('');
1965                        },
1966                        headTemplate: '<thead>' +
1967                                '<tr>' +
1968                                '<th colspan="7" class="datepicker-title"></th>' +
1969                                '</tr>' +
1970                                '<tr>' +
1971                                '<th class="prev"><span class="glyphicon glyphicon-arrow-left"></span></th>' +
1972                                '<th colspan="5" class="datepicker-switch"></th>' +
1973                                '<th class="next"><span class="glyphicon glyphicon-arrow-right"></span></th>' +
1974                                '</tr>' +
1975                                '</thead>',
1976                        contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
1977                        footTemplate: '<tfoot>' +
1978                                '<tr>' +
1979                                '<th colspan="7" class="today"></th>' +
1980                                '</tr>' +
1981                                '<tr>' +
1982                                '<th colspan="7" class="clear"></th>' +
1983                                '</tr>' +
1984                                '</tfoot>'
1985                    };
1986                    DPGlobal.template = '<div class="datepicker">' +
1987                            '<div class="datepicker-days">' +
1988                            '<table class=" table-condensed">' +
1989                            DPGlobal.headTemplate +
1990                            '<tbody></tbody>' +
1991                            DPGlobal.footTemplate +
1992                            '</table>' +
1993                            '</div>' +
1994                            '<div class="datepicker-months">' +
1995                            '<table class="table-condensed">' +
1996                            DPGlobal.headTemplate +
1997                            DPGlobal.contTemplate +
1998                            DPGlobal.footTemplate +
1999                            '</table>' +
2000                            '</div>' +
2001                            '<div class="datepicker-years">' +
2002                            '<table class="table-condensed">' +
2003                            DPGlobal.headTemplate +
2004                            DPGlobal.contTemplate +
2005                            DPGlobal.footTemplate +
2006                            '</table>' +
2007                            '</div>' +
2008                            '<div class="datepicker-decades">' +
2009                            '<table class="table-condensed">' +
2010                            DPGlobal.headTemplate +
2011                            DPGlobal.contTemplate +
2012                            DPGlobal.footTemplate +
2013                            '</table>' +
2014                            '</div>' +
2015                            '<div class="datepicker-centuries">' +
2016                            '<table class="table-condensed">' +
2017                            DPGlobal.headTemplate +
2018                            DPGlobal.contTemplate +
2019                            DPGlobal.footTemplate +
2020                            '</table>' +
2021                            '</div>' +
2022                            '</div>';
2023
2024                    $.fn.datepicker.DPGlobal = DPGlobal;
2025
2026
2027                    /* DATEPICKER NO CONFLICT
2028                     * =================== */
2029
2030                    $.fn.datepicker.noConflict = function () {
2031                        $.fn.datepicker = old;
2032                        return this;
2033                    };
2034
2035                    /* DATEPICKER VERSION
2036                     * =================== */
2037                    $.fn.datepicker.version = '1.6.0-dev';
2038
2039                    /* DATEPICKER DATA-API
2040                     * ================== */
2041
2042                    $(document).on(
2043                            'focus.datepicker.data-api click.datepicker.data-api',
2044                            '[data-provide="datepicker"]',
2045                            function (e) {
2046                                var $this = $(this);
2047                                if ($this.data('datepicker'))
2048                                    return;
2049                                e.preventDefault();
2050                                // component click requires us to explicitly show it
2051                                datepickerPlugin.call($this, 'show');
2052                            }
2053                    );
2054                    $(function () {
2055                        datepickerPlugin.call($('[data-provide="datepicker-inline"]'));
2056                    });
2057
2058                }));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.