Interactive interface for browsing global, full-resolution satellite imagery
Set correct min and max for hour and min time rollers - Set the correct min and max in util.rollDate - Adjust width of hour and min rollers in timeline - Change tab index of focus-guard-2 element
ZachTRice76d11aac4123
diff --git a/web/css/timeline.css b/web/css/timeline.cssindex 5cae37a60..8104eb12d 100644--- a/web/css/timeline.css+++ b/web/css/timeline.css@@ -160,6 +160,11 @@ g.plot rect.data-bar-invisible {max-width: 35px;}+#timeline-header #input-wrapper-hour,+#timeline-header #input-wrapper-minute {+ width: 36px;+}+#timeline-header input {height: 40px;color: #fff;diff --git a/web/index.html b/web/index.htmlindex db1fbc880..90e330b4a 100644--- a/web/index.html+++ b/web/index.html@@ -141,7 +141,7 @@ Licensed under the NASA Open Source Agreement, Version 1.3 (http://opensource.gs</svg></div></div>- <div id="focus-guard-2" class="focus-guard" tabindex="5"></div>+ <div id="focus-guard-2" class="focus-guard" tabindex="7"></div><div id="time-buttons-group" class=""><div id="timeline-zoom"><a class="zoom-btn" id="zoom-minutes">Minutes</a>diff --git a/web/js/date/timeline-input.js b/web/js/date/timeline-input.jsindex 0aea0b9b0..2af3730a8 100644--- a/web/js/date/timeline-input.js+++ b/web/js/date/timeline-input.js@@ -204,7 +204,7 @@ export function timelineInput(models, config, ui) {// TODO: Cleanupvar validateInput = function (event) {var kc = event.keyCode || event.which;- var entered = (kc === 13) || (kc === 9);+ var entered = (kc === 13) || (kc === 9); // carriage return or horizontal tabif (event.type === 'focusout' || entered) {if (entered) {event.preventDefault();@@ -257,14 +257,14 @@ export function timelineInput(models, config, ui) {}break;case 'hour-input-group':- if ((newInput > 23) && (newInput < 0)) {+ if ((newInput >= 0) && (newInput <= 23)) {selectedDateObj = new Date((new Date(model.selected)).setUTCHours(newInput));}break;case 'minute-input-group':- if ((newInput > 59) && (newInput < 0)) {+ if ((newInput >= 0) && (newInput <= 59)) {selectedDateObj = new Date((new Date(model.selected)).setUTCMinutes(newInput));@@ -371,7 +371,9 @@ export function timelineInput(models, config, ui) {}// Disable arrows if nothing before/after selection- if (nd > util.today()) {+ if (model.selectedZoom === 4 && nd > util.now()) {+ $incrementBtn.addClass('button-disabled');+ } else if (nd > util.today()) {$incrementBtn.addClass('button-disabled');} else {$incrementBtn.removeClass('button-disabled');@@ -548,7 +550,7 @@ export function timelineInput(models, config, ui) {$('#focus-guard-1').on('focus', function () {- $('#day-input-group')+ $('#minute-input-group').focus().select();});diff --git a/web/js/util/util.js b/web/js/util/util.jsindex 8300a2972..45f53a42a 100644--- a/web/js/util/util.js+++ b/web/js/util/util.js@@ -412,11 +412,11 @@ export default (function (self) {};self.minDate = function () {- return new Date(Date.UTC(1000, 0, 1));+ return new Date(Date.UTC(1000, 0, 1, 0, 0));};self.maxDate = function () {- return new Date(Date.UTC(3000, 11, 31));+ return new Date(Date.UTC(3000, 11, 30, 23, 59));};self.rollRange = function (date, interval, minDate, maxDate) {@@ -428,17 +428,17 @@ export default (function (self) {var firstMinute = new Date(Date.UTC(y, m, 1, 0, 0));var lastMinute = new Date(Date.UTC(y, m, self.daysInMonth(date), 23, 59));first = new Date(Math.max(firstMinute, minDate))- .getUTCDate();+ .getUTCMinutes();last = new Date(Math.min(lastMinute, maxDate))- .getUTCDate();+ .getUTCMinutes();break;case 'hour':var firstHour = new Date(Date.UTC(y, m, 1, 0));var lastHour = new Date(Date.UTC(y, m, self.daysInMonth(date), 23));first = new Date(Math.max(firstHour, minDate))- .getUTCDate();+ .getUTCHours();last = new Date(Math.min(lastHour, maxDate))- .getUTCDate();+ .getUTCHours();break;case 'day':var firstDay = new Date(Date.UTC(y, m, 1));@@ -484,10 +484,10 @@ export default (function (self) {var year = date.getUTCFullYear();switch (interval) {case 'minute':- minute = self.roll(minute + amount, min, max);+ minute = self.roll(minute + amount, 0, 59);break;case 'hour':- hour = self.roll(hour + amount, min, max);+ hour = self.roll(hour + amount, 0, 23);break;case 'day':day = self.roll(day + amount, min, max);