{I" class:ETI"ProcessedAsset; FI"logical_path; TI"*datepicker/js/bootstrap-datepicker.js; FI" pathname; TI"f/Users/gregwoods/Source/twice_baked/tb_core/app/assets/libs/datepicker/js/bootstrap-datepicker.js; FI"content_type; TI"application/javascript; TI" mtime; Tl+ĐsPI"length; Ti_I"digest; TI"%1a731f62f9a6e05bcf87d910b13ea1d3; FI"source; TI"_/* ========================================================= * bootstrap-datepicker.js * http://www.eyecon.ro/bootstrap-datepicker * ========================================================= * Copyright 2012 Stefan Petre * Improvements by Andrew Rowls * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================= */ !function( $ ) { function UTCDate(){ return new Date(Date.UTC.apply(Date, arguments)); } // Picker object var Datepicker = function(element, options) { var that = this; this.element = $(element); this.language = options.language||this.element.data('date-language')||"en"; this.language = this.language in dates ? this.language : "en"; this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy'); this.picker = $(DPGlobal.template) .appendTo('body') .on({ click: $.proxy(this.click, this) }); this.isInput = this.element.is('input'); this.component = this.element.is('.date') ? this.element.find('.add-on') : false; this.hasInput = this.component && this.element.find('input').length; if(this.component && this.component.length === 0) this.component = false; if (this.isInput) { this.element.on({ focus: $.proxy(this.show, this), keyup: $.proxy(this.update, this), keydown: $.proxy(this.keydown, this) }); } else { if (this.component && this.hasInput){ // For components that are not readonly, allow keyboard nav this.element.find('input').on({ focus: $.proxy(this.show, this), keyup: $.proxy(this.update, this), keydown: $.proxy(this.keydown, this) }); this.component.on('click', $.proxy(this.show, this)); } else { this.element.on('click', $.proxy(this.show, this)); } } $(document).on('mousedown', function (e) { // Clicked outside the datepicker, hide it if ($(e.target).closest('.datepicker').length == 0) { that.hide(); } }); this.autoclose = false; if ('autoclose' in options) { this.autoclose = options.autoclose; } else if ('dateAutoclose' in this.element.data()) { this.autoclose = this.element.data('date-autoclose'); } this.keyboardNavigation = true; if ('keyboardNavigation' in options) { this.keyboardNavigation = options.keyboardNavigation; } else if ('dateKeyboardNavigation' in this.element.data()) { this.keyboardNavigation = this.element.data('date-keyboard-navigation'); } switch(options.startView || this.element.data('date-start-view')){ case 2: case 'decade': this.viewMode = this.startViewMode = 2; break; case 1: case 'year': this.viewMode = this.startViewMode = 1; break; case 0: case 'month': default: this.viewMode = this.startViewMode = 0; break; } this.weekStart = ((options.weekStart||this.element.data('date-weekstart')||dates[this.language].weekStart||0) % 7); this.weekEnd = ((this.weekStart + 6) % 7); this.startDate = -Infinity; this.endDate = Infinity; this.setStartDate(options.startDate||this.element.data('date-startdate')); this.setEndDate(options.endDate||this.element.data('date-enddate')); this.fillDow(); this.fillMonths(); this.update(); this.showMode(); }; Datepicker.prototype = { constructor: Datepicker, show: function(e) { this.picker.show(); this.height = this.component ? this.component.outerHeight() : this.element.outerHeight(); this.update(); this.place(); $(window).on('resize', $.proxy(this.place, this)); if (e ) { e.stopPropagation(); e.preventDefault(); } this.element.trigger({ type: 'show', date: this.date }); }, hide: function(e){ this.picker.hide(); $(window).off('resize', this.place); this.viewMode = this.startViewMode; this.showMode(); if (!this.isInput) { $(document).off('mousedown', this.hide); } if (e && e.currentTarget.value) this.setValue(); this.element.trigger({ type: 'hide', date: this.date }); }, setValue: function() { var formatted = DPGlobal.formatDate(this.date, this.format, this.language); if (!this.isInput) { if (this.component){ this.element.find('input').prop('value', formatted); } this.element.data('date', formatted); } else { this.element.prop('value', formatted); } }, setStartDate: function(startDate){ this.startDate = startDate||-Infinity; if (this.startDate !== -Infinity) { this.startDate = DPGlobal.parseDate(this.startDate, this.format, this.language); } this.update(); this.updateNavArrows(); }, setEndDate: function(endDate){ this.endDate = endDate||Infinity; if (this.endDate !== Infinity) { this.endDate = DPGlobal.parseDate(this.endDate, this.format, this.language); } this.update(); this.updateNavArrows(); }, place: function(){ var zIndex = parseInt(this.element.parents().filter(function() { return $(this).css('z-index') != 'auto'; }).first().css('z-index'))+10; var offset = this.component ? this.component.offset() : this.element.offset(); this.picker.css({ top: offset.top + this.height, left: offset.left, zIndex: zIndex }); }, update: function(){ this.date = DPGlobal.parseDate( this.isInput ? this.element.prop('value') : this.element.data('date') || this.element.find('input').prop('value'), this.format, this.language ); if (this.date < this.startDate) { this.viewDate = new Date(this.startDate); } else if (this.date > this.endDate) { this.viewDate = new Date(this.endDate); } else { this.viewDate = new Date(this.date); } this.fill(); }, fillDow: function(){ var dowCnt = this.weekStart; var html = '