|
265 | 265 | _applyEvents: function(evs){
|
266 | 266 | for (var i=0, el, ch, ev; i<evs.length; i++){
|
267 | 267 | el = evs[i][0];
|
268 |
| - if (evs[i].length == 2){ |
| 268 | + if (evs[i].length === 2){ |
269 | 269 | ch = undefined;
|
270 | 270 | ev = evs[i][1];
|
271 | 271 | }
|
272 |
| - else if (evs[i].length == 3){ |
| 272 | + else if (evs[i].length === 3){ |
273 | 273 | ch = evs[i][1];
|
274 | 274 | ev = evs[i][2];
|
275 | 275 | }
|
|
279 | 279 | _unapplyEvents: function(evs){
|
280 | 280 | for (var i=0, el, ev, ch; i<evs.length; i++){
|
281 | 281 | el = evs[i][0];
|
282 |
| - if (evs[i].length == 2){ |
| 282 | + if (evs[i].length === 2){ |
283 | 283 | ch = undefined;
|
284 | 284 | ev = evs[i][1];
|
285 | 285 | }
|
286 |
| - else if (evs[i].length == 3){ |
| 286 | + else if (evs[i].length === 3){ |
287 | 287 | ch = evs[i][1];
|
288 | 288 | ev = evs[i][2];
|
289 | 289 | }
|
|
393 | 393 | ix = this.dates.length - 1;
|
394 | 394 | format = this.o.format;
|
395 | 395 | }
|
396 |
| - else if (typeof ix == 'string'){ |
| 396 | + else if (typeof ix === 'string'){ |
397 | 397 | format = ix;
|
398 | 398 | ix = this.dates.length - 1;
|
399 | 399 | }
|
|
537 | 537 | scrollTop = $window.scrollTop();
|
538 | 538 |
|
539 | 539 | var zIndex = parseInt(this.element.parents().filter(function() {
|
540 |
| - return $(this).css('z-index') != 'auto'; |
| 540 | + return $(this).css('z-index') !== 'auto'; |
541 | 541 | }).first().css('z-index'))+10;
|
542 | 542 | var offset = this.component ? this.component.parent().offset() : this.element.offset();
|
543 | 543 | var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
|
|
686 | 686 | year = this.viewDate.getUTCFullYear(),
|
687 | 687 | month = this.viewDate.getUTCMonth(),
|
688 | 688 | today = new Date();
|
689 |
| - if (date.getUTCFullYear() < year || (date.getUTCFullYear() == year && date.getUTCMonth() < month)) { |
| 689 | + if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)) { |
690 | 690 | cls.push('old');
|
691 |
| - } else if (date.getUTCFullYear() > year || (date.getUTCFullYear() == year && date.getUTCMonth() > month)) { |
| 691 | + } else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)) { |
692 | 692 | cls.push('new');
|
693 | 693 | }
|
694 | 694 | if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
|
695 | 695 | cls.push('focused');
|
696 | 696 | // Compare internal UTC date with local today, not UTC today
|
697 | 697 | if (this.o.todayHighlight &&
|
698 |
| - date.getUTCFullYear() == today.getFullYear() && |
699 |
| - date.getUTCMonth() == today.getMonth() && |
700 |
| - date.getUTCDate() == today.getDate()) { |
| 698 | + date.getUTCFullYear() === today.getFullYear() && |
| 699 | + date.getUTCMonth() === today.getMonth() && |
| 700 | + date.getUTCDate() === today.getDate()) { |
701 | 701 | cls.push('today');
|
702 | 702 | }
|
703 | 703 | if (this.dates.contains(date) !== -1)
|
|
710 | 710 | if (date > this.range[0] && date < this.range[this.range.length-1]){
|
711 | 711 | cls.push('range');
|
712 | 712 | }
|
713 |
| - if ($.inArray(date.valueOf(), this.range) != -1){ |
| 713 | + if ($.inArray(date.valueOf(), this.range) !== -1){ |
714 | 714 | cls.push('selected');
|
715 | 715 | }
|
716 | 716 | }
|
|
746 | 746 | var html = [];
|
747 | 747 | var clsName;
|
748 | 748 | while(prevMonth.valueOf() < nextMonth) {
|
749 |
| - if (prevMonth.getUTCDay() == this.o.weekStart) { |
| 749 | + if (prevMonth.getUTCDay() === this.o.weekStart) { |
750 | 750 | html.push('<tr>');
|
751 | 751 | if(this.o.calendarWeeks){
|
752 | 752 | // ISO 8601: First week contains first thursday.
|
|
785 | 785 |
|
786 | 786 | clsName = $.unique(clsName);
|
787 | 787 | html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>');
|
788 |
| - if (prevMonth.getUTCDay() == this.o.weekEnd) { |
| 788 | + if (prevMonth.getUTCDay() === this.o.weekEnd) { |
789 | 789 | html.push('</tr>');
|
790 | 790 | }
|
791 | 791 | prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
|
|
799 | 799 | .find('span').removeClass('active');
|
800 | 800 |
|
801 | 801 | $.each(this.dates, function(i, d){
|
802 |
| - if (d.getUTCFullYear() == year) |
| 802 | + if (d.getUTCFullYear() === year) |
803 | 803 | months.eq(d.getUTCMonth()).addClass('active');
|
804 | 804 | });
|
805 | 805 |
|
806 | 806 | if (year < startYear || year > endYear) {
|
807 | 807 | months.addClass('disabled');
|
808 | 808 | }
|
809 |
| - if (year == startYear) { |
| 809 | + if (year === startYear) { |
810 | 810 | months.slice(0, startMonth).addClass('disabled');
|
811 | 811 | }
|
812 |
| - if (year == endYear) { |
| 812 | + if (year === endYear) { |
813 | 813 | months.slice(endMonth+1).addClass('disabled');
|
814 | 814 | }
|
815 | 815 |
|
|
878 | 878 | e.preventDefault();
|
879 | 879 | var target = $(e.target).closest('span, td, th'),
|
880 | 880 | year, month, day;
|
881 |
| - if (target.length == 1) { |
| 881 | + if (target.length === 1) { |
882 | 882 | switch(target[0].nodeName.toLowerCase()) {
|
883 | 883 | case 'th':
|
884 | 884 | switch(target[0].className) {
|
|
887 | 887 | break;
|
888 | 888 | case 'prev':
|
889 | 889 | case 'next':
|
890 |
| - var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1); |
| 890 | + var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1); |
891 | 891 | switch(this.viewMode){
|
892 | 892 | case 0:
|
893 | 893 | this.viewDate = this.moveMonth(this.viewDate, dir);
|
|
907 | 907 | date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
|
908 | 908 |
|
909 | 909 | this.showMode(-2);
|
910 |
| - var which = this.o.todayBtn == 'linked' ? null : 'view'; |
| 910 | + var which = this.o.todayBtn === 'linked' ? null : 'view'; |
911 | 911 | this._setDate(date, which);
|
912 | 912 | break;
|
913 | 913 | case 'clear':
|
|
964 | 964 | month -= 1;
|
965 | 965 | }
|
966 | 966 | } else if (target.is('.new')) {
|
967 |
| - if (month == 11) { |
| 967 | + if (month === 11) { |
968 | 968 | month = 0;
|
969 | 969 | year += 1;
|
970 | 970 | } else {
|
|
993 | 993 | else{
|
994 | 994 | this.dates.push(date);
|
995 | 995 | }
|
996 |
| - if (typeof this.o.multidate == 'number') |
| 996 | + if (typeof this.o.multidate === 'number') |
997 | 997 | while (this.dates.length > this.o.multidate)
|
998 | 998 | this.dates.remove(0);
|
999 | 999 | },
|
1000 | 1000 |
|
1001 | 1001 | _setDate: function(date, which){
|
1002 |
| - if (!which || which == 'date') |
| 1002 | + if (!which || which === 'date') |
1003 | 1003 | this._toggle_multidate(date && new Date(date));
|
1004 |
| - if (!which || which == 'view') |
| 1004 | + if (!which || which === 'view') |
1005 | 1005 | this.viewDate = date && new Date(date);
|
1006 | 1006 |
|
1007 | 1007 | this.fill();
|
|
1016 | 1016 | if (element) {
|
1017 | 1017 | element.change();
|
1018 | 1018 | }
|
1019 |
| - if (this.o.autoclose && (!which || which == 'date')) { |
| 1019 | + if (this.o.autoclose && (!which || which === 'date')) { |
1020 | 1020 | this.hide();
|
1021 | 1021 | }
|
1022 | 1022 | },
|
|
1030 | 1030 | mag = Math.abs(dir),
|
1031 | 1031 | new_month, test;
|
1032 | 1032 | dir = dir > 0 ? 1 : -1;
|
1033 |
| - if (mag == 1){ |
1034 |
| - test = dir == -1 |
| 1033 | + if (mag === 1){ |
| 1034 | + test = dir === -1 |
1035 | 1035 | // If going back one month, make sure month is not current month
|
1036 | 1036 | // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
|
1037 |
| - ? function(){ return new_date.getUTCMonth() == month; } |
| 1037 | + ? function(){ return new_date.getUTCMonth() === month; } |
1038 | 1038 | // If going forward one month, make sure month is as expected
|
1039 | 1039 | // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
|
1040 |
| - : function(){ return new_date.getUTCMonth() != new_month; }; |
| 1040 | + : function(){ return new_date.getUTCMonth() !== new_month; }; |
1041 | 1041 | new_month = month + dir;
|
1042 | 1042 | new_date.setUTCMonth(new_month);
|
1043 | 1043 | // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
|
|
1051 | 1051 | // ...then reset the day, keeping it in the new month
|
1052 | 1052 | new_month = new_date.getUTCMonth();
|
1053 | 1053 | new_date.setUTCDate(day);
|
1054 |
| - test = function(){ return new_month != new_date.getUTCMonth(); }; |
| 1054 | + test = function(){ return new_month !== new_date.getUTCMonth(); }; |
1055 | 1055 | }
|
1056 | 1056 | // Common date-resetting loop -- if date is beyond end of month, make it
|
1057 | 1057 | // end of month
|
|
1072 | 1072 |
|
1073 | 1073 | keydown: function(e){
|
1074 | 1074 | if (this.picker.is(':not(:visible)')){
|
1075 |
| - if (e.keyCode == 27) // allow escape to hide and re-show picker |
| 1075 | + if (e.keyCode === 27) // allow escape to hide and re-show picker |
1076 | 1076 | this.show();
|
1077 | 1077 | return;
|
1078 | 1078 | }
|
|
1093 | 1093 | case 37: // left
|
1094 | 1094 | case 39: // right
|
1095 | 1095 | if (!this.o.keyboardNavigation) break;
|
1096 |
| - dir = e.keyCode == 37 ? -1 : 1; |
| 1096 | + dir = e.keyCode === 37 ? -1 : 1; |
1097 | 1097 | if (e.ctrlKey){
|
1098 | 1098 | newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
|
1099 | 1099 | newViewDate = this.moveYear(focusDate, dir);
|
|
1118 | 1118 | case 38: // up
|
1119 | 1119 | case 40: // down
|
1120 | 1120 | if (!this.o.keyboardNavigation) break;
|
1121 |
| - dir = e.keyCode == 38 ? -1 : 1; |
| 1121 | + dir = e.keyCode === 38 ? -1 : 1; |
1122 | 1122 | if (e.ctrlKey){
|
1123 | 1123 | newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
|
1124 | 1124 | newViewDate = this.moveYear(focusDate, dir);
|
|
1230 | 1230 | new_date = dp.getUTCDate(),
|
1231 | 1231 | i = $.inArray(e.target, this.inputs),
|
1232 | 1232 | l = this.inputs.length;
|
1233 |
| - if (i == -1) return; |
| 1233 | + if (i === -1) |
| 1234 | + return; |
1234 | 1235 |
|
1235 | 1236 | $.each(this.pickers, function(i, p){
|
1236 | 1237 | if (!p.getUTCDate())
|
|
1302 | 1303 | this.each(function () {
|
1303 | 1304 | var $this = $(this),
|
1304 | 1305 | data = $this.data('datepicker'),
|
1305 |
| - options = typeof option == 'object' && option; |
| 1306 | + options = typeof option === 'object' && option; |
1306 | 1307 | if (!data) {
|
1307 | 1308 | var elopts = opts_from_el(this, 'date'),
|
1308 | 1309 | // Preliminary otions
|
|
1320 | 1321 | $this.data('datepicker', (data = new Datepicker(this, opts)));
|
1321 | 1322 | }
|
1322 | 1323 | }
|
1323 |
| - if (typeof option == 'string' && typeof data[option] == 'function') { |
| 1324 | + if (typeof option === 'string' && typeof data[option] === 'function') { |
1324 | 1325 | internal_return = data[option].apply(data, args);
|
1325 | 1326 | if (internal_return !== undefined)
|
1326 | 1327 | return false;
|
|
1452 | 1453 | while (v<0) v += 12;
|
1453 | 1454 | v %= 12;
|
1454 | 1455 | d.setUTCMonth(v);
|
1455 |
| - while (d.getUTCMonth() != v) |
| 1456 | + while (d.getUTCMonth() !== v) |
1456 | 1457 | d.setUTCDate(d.getUTCDate()-1);
|
1457 | 1458 | return d;
|
1458 | 1459 | },
|
|
1464 | 1465 | date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
|
1465 | 1466 | var fparts = format.parts.slice();
|
1466 | 1467 | // Remove noop parts
|
1467 |
| - if (parts.length != fparts.length) { |
| 1468 | + if (parts.length !== fparts.length) { |
1468 | 1469 | fparts = $(fparts).filter(function(i,p){
|
1469 | 1470 | return $.inArray(p, setters_order) !== -1;
|
1470 | 1471 | }).toArray();
|
|
1473 | 1474 | function match_part(){
|
1474 | 1475 | var m = this.slice(0, parts[i].length),
|
1475 | 1476 | p = parts[i].slice(0, m.length);
|
1476 |
| - return m == p; |
| 1477 | + return m === p; |
1477 | 1478 | }
|
1478 |
| - if (parts.length == fparts.length) { |
| 1479 | + if (parts.length === fparts.length) { |
1479 | 1480 | var cnt;
|
1480 | 1481 | for (i=0, cnt = fparts.length; i < cnt; i++) {
|
1481 | 1482 | val = parseInt(parts[i], 10);
|
|
0 commit comments