Skip to content

Commit

Permalink
Generated dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
acrobat committed May 6, 2016
1 parent a297976 commit f4df9ac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 62 deletions.
80 changes: 20 additions & 60 deletions dist/js/bootstrap-datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@
this.focusDate = null;

this.element = $(element);
this.isInline = false;
this.isInput = this.element.is('input');
this.inputField = this.isInput ? this.element : this.element.find('input');
this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
this.hasInput = this.component && this.element.find('input').length;
this.hasInput = this.component && this.inputField.length;
if (this.component && this.component.length === 0)
this.component = false;
this.isInline = !this.component && this.element.is('div');

this.picker = $(DPGlobal.template);

Expand Down Expand Up @@ -269,9 +270,9 @@

o.datesDisabled = o.datesDisabled||[];
if (!$.isArray(o.datesDisabled)) {
var datesDisabled = [];
datesDisabled.push(DPGlobal.parseDate(o.datesDisabled, format, o.language, o.assumeNearbyYear));
o.datesDisabled = datesDisabled;
o.datesDisabled = [
o.datesDisabled
];
}
o.datesDisabled = $.map(o.datesDisabled,function(d){
return DPGlobal.parseDate(d, format, o.language, o.assumeNearbyYear);
Expand Down Expand Up @@ -369,15 +370,12 @@
else if (this.component && this.hasInput) { // component: input + button
this._events = [
// For components that are not readonly, allow keyboard nav
[this.element.find('input'), events],
[this.inputField, events],
[this.component, {
click: $.proxy(this.show, this)
}]
];
}
else if (this.element.is('div')){ // inline datepicker
this.isInline = true;
}
else {
this._events = [
[this.element, {
Expand Down Expand Up @@ -425,7 +423,7 @@
this.element.find(e.target).length ||
this.picker.is(e.target) ||
this.picker.find(e.target).length ||
this.picker.hasClass('datepicker-inline')
this.isInline
)){
this.hide();
}
Expand Down Expand Up @@ -472,8 +470,7 @@
},

show: function(){
var element = this.component ? this.element.find('input') : this.element;
if (element.attr('readonly') && this.o.enableOnReadonly === false)
if (this.inputField.prop('disabled') || (this.inputField.prop('readonly') && this.o.enableOnReadonly === false))
return;
if (!this.isInline)
this.picker.appendTo(this.o.container);
Expand All @@ -488,23 +485,15 @@
},

hide: function(){
if (this.isInline)
return this;
if (!this.picker.is(':visible'))
if (this.isInline || !this.picker.is(':visible'))
return this;
this.focusDate = null;
this.picker.hide().detach();
this._detachSecondaryEvents();
this.viewMode = this.o.startView;
this.showMode();

if (
this.o.forceParse &&
(
this.isInput && this.element.val() ||
this.hasInput && this.element.find('input').val()
)
)
if (this.o.forceParse && this.inputField.val())
this.setValue();
this._trigger('hide');
return this;
Expand Down Expand Up @@ -576,15 +565,8 @@
},

clearDates: function(){
var element;
if (this.isInput) {
element = this.element;
} else if (this.component) {
element = this.element.find('input');
}

if (element) {
element.val('');
if (this.inputField) {
this.inputField.val('');
}

this.update();
Expand Down Expand Up @@ -616,14 +598,7 @@

setValue: function(){
var formatted = this.getFormattedDate();
if (!this.isInput){
if (this.component){
this.element.find('input').val(formatted);
}
}
else {
this.element.val(formatted);
}
this.inputField.val(formatted);
return this;
},

Expand Down Expand Up @@ -783,7 +758,7 @@
else {
dates = this.isInput
? this.element.val()
: this.element.data('date') || this.element.find('input').val();
: this.element.data('date') || this.inputField.val();
if (dates && this.o.multidate)
dates = dates.split(this.o.multidateSeparator);
else
Expand Down Expand Up @@ -1034,7 +1009,6 @@
// Calendar week: ms between thursdays, div ms per day, div 7 days
calWeek = (th - yth) / 864e5 / 7 + 1;
html.push('<td class="cw">'+ calWeek +'</td>');

}
}
clsName = this.getClassNames(prevMonth);
Expand Down Expand Up @@ -1359,15 +1333,8 @@
if (!which || which !== 'view') {
this._trigger('changeDate');
}
var element;
if (this.isInput){
element = this.element;
}
else if (this.component){
element = this.element.find('input');
}
if (element){
element.change();
if (this.inputField){
this.inputField.change();
}
if (this.o.autoclose && (!which || which === 'date')){
this.hide();
Expand Down Expand Up @@ -1568,15 +1535,8 @@
this._trigger('changeDate');
else
this._trigger('clearDate');
var element;
if (this.isInput){
element = this.element;
}
else if (this.component){
element = this.element.find('input');
}
if (element){
element.change();
if (this.inputField){
this.inputField.change();
}
}
},
Expand Down Expand Up @@ -2056,7 +2016,7 @@
};
DPGlobal.template = '<div class="datepicker">'+
'<div class="datepicker-days">'+
'<table class=" table-condensed">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
'<tbody></tbody>'+
DPGlobal.footTemplate+
Expand Down
Loading

0 comments on commit f4df9ac

Please sign in to comment.