Interactive interface for browsing global, full-resolution satellite imagery
fix linting and formatting errors caused by incorrect eslintrc conditions #1118
Benjamin King696a224d0849
diff --git a/.eslintrc b/.eslintrcindex 7d699f968..d8b485e30 100644--- a/.eslintrc+++ b/.eslintrc@@ -59,7 +59,8 @@"space-before-function-paren": "off","react/no-danger": "warn","react/prop-types": "warn",- "react/no-did-update-set-state": "warn"+ "react/no-did-update-set-state": "warn",+ "react/no-render-return-value": "warn"}}]diff --git a/web/js/animation/gif.js b/web/js/animation/gif.jsindex f41a5d0e8..2368580b9 100644--- a/web/js/animation/gif.js+++ b/web/js/animation/gif.js@@ -1,61 +1,61 @@-import $ from "jquery";-import "jquery-jcrop";-import React from "react";-import ReactDOM from "react-dom";-import GifStream from "./gif-stream";-import lodashFind from "lodash/find";-import lodashEach from "lodash/each";-import lodashRound from "lodash/round";-import lodashThrottle from "lodash/throttle";-import lodashCapitalize from "lodash/capitalize";-import canvg from "canvg-browser";-import FileSaver from "file-saver";-import googleAnalytics from "../components/util/google-analytics";-import GifResSelection from "../components/animation-widget/gif-panel";+import $ from 'jquery';+import 'jquery-jcrop';+import React from 'react';+import ReactDOM from 'react-dom';+import GifStream from './gif-stream';+import lodashFind from 'lodash/find';+import lodashEach from 'lodash/each';+import lodashRound from 'lodash/round';+import lodashThrottle from 'lodash/throttle';+import lodashCapitalize from 'lodash/capitalize';+import canvg from 'canvg-browser';+import FileSaver from 'file-saver';+import googleAnalytics from '../components/util/google-analytics';+import GifResSelection from '../components/animation-widget/gif-panel';import {imageUtilGetLayerOpacities,imageUtilCalculateResolution,imageUtilGetLayers,imageUtilGetCoordsFromPixelValues,imageUtilGetConversionFactor-} from "../image/util";-import util from "../util/util";-import wvui from "../ui/ui";-import uiIndicator from "../ui/indicator";+} from '../image/util';+import util from '../util/util';+import wvui from '../ui/ui';+import uiIndicator from '../ui/indicator';const gifStream = new GifStream();const conversionConstant = 3.6; // we are saying that the gif compresses each total by about 3.6xconst maxGifSize = 250;const GRATICULE_WARNING =- "The graticule layer cannot be used to take a snapshot. Would you " +- "like to hide this layer?";+ 'The graticule layer cannot be used to take a snapshot. Would you ' ++ 'like to hide this layer?';const PALETTE_WARNING =- "One or more layers on the map have been modified (changed palette, " +- "thresholds, etc.). These modifications cannot be used to take a " +- "snapshot. Would you like to temporarily revert to the original " +- "layer(s)?";+ 'One or more layers on the map have been modified (changed palette, ' ++ 'thresholds, etc.). These modifications cannot be used to take a ' ++ 'snapshot. Would you like to temporarily revert to the original ' ++ 'layer(s)?';const ROTATE_WARNING =- "Image may not be downloaded when rotated. Would you like to reset rotation?";+ 'Image may not be downloaded when rotated. Would you like to reset rotation?';const resolutionsGeo = {values: [- { value: "0.125", text: "30m" },- { value: "0.25", text: "60m" },- { value: "0.5", text: "125m" },- { value: "1", text: "250m" },- { value: "2", text: "500m" },- { value: "4", text: "1km" },- { value: "20", text: "5km" },- { value: "40", text: "10km" }+ { value: '0.125', text: '30m' },+ { value: '0.25', text: '60m' },+ { value: '0.5', text: '125m' },+ { value: '1', text: '250m' },+ { value: '2', text: '500m' },+ { value: '4', text: '1km' },+ { value: '20', text: '5km' },+ { value: '40', text: '10km' }]};const resolutionsPolar = {values: [- { value: "1", text: "250m" },- { value: "2", text: "500m" },- { value: "4", text: "1km" },- { value: "20", text: "5km" },- { value: "40", text: "10km" }+ { value: '1', text: '250m' },+ { value: '2', text: '500m' },+ { value: '4', text: '1km' },+ { value: '20', text: '5km' },+ { value: '40', text: '10km' }]};@@ -96,20 +96,20 @@ export function animationGif(models, config, ui) {*/self.init = function() {var options;- models.anim.events.on("gif-click", setImageCoords);- panelCase = document.createElement("div");- panelCase.className = "gif-dialog";+ models.anim.events.on('gif-click', setImageCoords);+ panelCase = document.createElement('div');+ panelCase.className = 'gif-dialog';throttleSetDownloadButton = lodashThrottle(setDownloadButtonClass, 300, {trailing: true});options = {- resolution: "1",+ resolution: '1',onSelectionChange: onSelectionChange,onClick: getGif,valid: true,resolutions:- models.proj.selected.id === "geographic"+ models.proj.selected.id === 'geographic'? resolutionsGeo: resolutionsPolar,onCheck: onchecked,@@ -128,8 +128,8 @@ export function animationGif(models, config, ui) {var state = animModel.rangeState;if (models.date.maxZoom < 4) {- startDate = state.startDate.split("T")[0];- endDate = state.endDate.split("T")[0];+ startDate = state.startDate.split('T')[0];+ endDate = state.endDate.split('T')[0];} else {startDate = state.startDate;endDate = state.endDate;@@ -138,7 +138,7 @@ export function animationGif(models, config, ui) {return {resolution: resolution,resolutions:- models.proj.selected.id === "geographic"+ models.proj.selected.id === 'geographic'? resolutionsGeo: resolutionsPolar,valid: fileSizeValid(),@@ -157,7 +157,7 @@ export function animationGif(models, config, ui) {if (!animationCoordinates) return;var numDays, stateObj, dimensions, isGeoProjection;- isGeoProjection = models.proj.selected.id === "geographic";+ isGeoProjection = models.proj.selected.id === 'geographic';resolution = selectedRes;stateObj = animModel.rangeState;numDays = util.getNumberOfDays(@@ -208,14 +208,14 @@ export function animationGif(models, config, ui) {var setDownloadButtonClass = function() {var $iconCase;var boo;- $iconCase = $(".wv-dl-gif-bt-case");+ $iconCase = $('.wv-dl-gif-bt-case');if (!$iconCase.length) return;boo = fileSizeValid();- if (!boo && !$iconCase.hasClass("disabled")) {- $iconCase.addClass("disabled");- } else if (boo && $iconCase.hasClass("disabled")) {- $iconCase.removeClass("disabled");+ if (!boo && !$iconCase.hasClass('disabled')) {+ $iconCase.addClass('disabled');+ } else if (boo && $iconCase.hasClass('disabled')) {+ $iconCase.removeClass('disabled');}};@@ -247,30 +247,30 @@ export function animationGif(models, config, ui) {loader = uiIndicator.loading();build = function(stamp, dateStamp, stampHeight) {var buildProgressBar = function() {- $progress = $("<progress />") // display progress for GIF creation- .attr("class", "wv-gif-progress");+ $progress = $('<progress />') // display progress for GIF creation+ .attr('class', 'wv-gif-progress');wvui.getDialog().append($progress).dialog({// dialog for progress- title: "Collecting Images...",+ title: 'Collecting Images...',width: 300,height: 100});- $progress.attr("value", 0);+ $progress.attr('value', 0);};var onGifProgress = function(captureProgress) {- $("#timeline-footer").removeClass("wv-anim-active");- models.anim.rangeState.state = "off";+ $('#timeline-footer').removeClass('wv-anim-active');+ models.anim.rangeState.state = 'off';if (!progressing) {buildProgressBar();progressing = true;uiIndicator.hide(loader);- $progress.parent().dialog("option", "title", "Creating GIF..."); // set dialog title+ $progress.parent().dialog('option', 'title', 'Creating GIF...'); // set dialog title}- $progress.attr("value", captureProgress / 100); // before value set, it is in indeterminate state+ $progress.attr('value', captureProgress / 100); // before value set, it is in indeterminate state};imageArra = getImageArray(startDate, endDate, interval);@@ -288,20 +288,20 @@ export function animationGif(models, config, ui) {waterMarkHeight: stamp.height,waterMark: stampHeight > 20 ? stamp : null,waterMarkWidth: stamp.width,- fontSize: dateStamp.fontSize + "px",+ fontSize: dateStamp.fontSize + 'px',textXCoordinate: dateStamp.x,textYCoordinate: dateStamp.y, // date location based on DimensionstextAlign: dateStamp.align, // If textXCoordinate is null this takes precedence- textBaseline: "top", // If textYCoordinate is null this takes precedence- fontColor: "#fff",- fontWeight: "300",- fontFamily: "Open Sans, sans-serif",+ textBaseline: 'top', // If textYCoordinate is null this takes precedence+ fontColor: '#fff',+ fontWeight: '300',+ fontFamily: 'Open Sans, sans-serif',progressCallback: onGifProgress,showFrameText: stampHeight > 20,extraLastFrameDelay: 1000,- text: "",+ text: '',stroke: {- color: "#000",+ color: '#000',pixels: dateStamp.fontSize * 0.05},pause: 1@@ -311,7 +311,7 @@ export function animationGif(models, config, ui) {};stampProps = getStampProps(stampWidthRatio, breakPointOne, stampWidth);newImage = svgToPng(- "brand/images/wv-logo-w-shadow.svg",+ 'brand/images/wv-logo-w-shadow.svg',stampProps.stampHeight);@@ -320,7 +320,7 @@ export function animationGif(models, config, ui) {var svgToPng = function(svgURL, stampHeight) {var newImage;- var canvasEl = document.createElement("canvas");+ var canvasEl = document.createElement('canvas');var canvgOptions = {log: false,ignoreMouse: true,@@ -328,7 +328,7 @@ export function animationGif(models, config, ui) {};canvg(canvasEl, svgURL, canvgOptions);newImage = new Image();- newImage.src = canvasEl.toDataURL("image/png");+ newImage.src = canvasEl.toDataURL('image/png');newImage.width = canvasEl.width;newImage.height = canvasEl.height;@@ -349,7 +349,7 @@ export function animationGif(models, config, ui) {lastRequestedDimensions.h > stampHeight * 1.5? lodashRound(stampHeight * 0.65): 0;- dateStamp.align = "left";+ dateStamp.align = 'left';dateStamp.x = imgWidth * 0.01;dateStamp.y = imgHeight - (dateStamp.fontSize + imgHeight * 0.01) - 4;} else {@@ -367,7 +367,7 @@ export function animationGif(models, config, ui) {: 0;dateStamp.y = imgHeight - (dateStamp.fontSize + imgHeight * 0.01) - 4;dateStamp.x = imgWidth * 0.01;- dateStamp.align = "left";+ dateStamp.align = 'left';}return { stampHeight: stampHeight, dateStamp: dateStamp };};@@ -392,7 +392,7 @@ export function animationGif(models, config, ui) {});if (models.palettes.inUse()) {wvui.ask({- header: "Notice",+ header: 'Notice',message: PALETTE_WARNING,onOk: function() {models.palettes.clear();@@ -403,15 +403,15 @@ export function animationGif(models, config, ui) {}if (lodashFind(layers, {- id: "Graticule"+ id: 'Graticule'}) &&- models.proj.selected.id === "geographic"+ models.proj.selected.id === 'geographic') {wvui.ask({- header: "Notice",+ header: 'Notice',message: GRATICULE_WARNING,onOk: function() {- models.layers.setVisibility("Graticule", false);+ models.layers.setVisibility('Graticule', false);self.getGif();}});@@ -419,7 +419,7 @@ export function animationGif(models, config, ui) {}if (ui.map.selected.getView().getRotation() !== 0.0) {wvui.ask({- header: "Reset rotation?",+ header: 'Reset rotation?',message: ROTATE_WARNING,onOk: function() {resetRotation();@@ -429,7 +429,7 @@ export function animationGif(models, config, ui) {});return;}- googleAnalytics.event("Animation", "Click", "Create GIF");+ googleAnalytics.event('Animation', 'Click', 'Create GIF');self.createGIF();};@@ -472,7 +472,7 @@ export function animationGif(models, config, ui) {**/var getDimensions = function(lonlat, proj, res) {- var conversionFactor = proj === "geographic" ? 0.002197 : 256;+ var conversionFactor = proj === 'geographic' ? 0.002197 : 256;return [Math.round(Math.abs(lonlat[1][0] - lonlat[0][0]) / conversionFactor / Number(res)@@ -520,8 +520,8 @@ export function animationGif(models, config, ui) {host = config.features.imageDownload.host;path = config.parameters.imagegen || config.features.imageDownload.path;} else {- host = "https://gibs.earthdata.nasa.gov";- path = "image-download";+ host = 'https://gibs.earthdata.nasa.gov';+ path = 'image-download';}while (current <= toDate) {@@ -537,30 +537,30 @@ export function animationGif(models, config, ui) {opacities = imageUtilGetLayerOpacities(products);url = util.format(host +- "/" ++ '/' +path +- "?{1}&extent={2}&epsg={3}&layers={4}&opacities={5}&worldfile=false&format=image/jpeg&width={6}&height={7}",- "TIME={1}",+ '?{1}&extent={2}&epsg={3}&layers={4}&opacities={5}&worldfile=false&format=image/jpeg&width={6}&height={7}',+ 'TIME={1}',lonlat[0][0] +- "," ++ ',' +lonlat[0][1] +- "," ++ ',' +lonlat[1][0] +- "," ++ ',' +lonlat[1][1],epsg,- layers.join(","),- opacities.join(","),+ layers.join(','),+ opacities.join(','),imgWidth,imgHeight);src = util.format(url, strDate);a.push({src: src,- text: showDates ? strDate : "",+ text: showDates ? strDate : '',delay: 1000 / interval});- if (ui.anim.ui.getInterval() === "minute") {+ if (ui.anim.ui.getInterval() === 'minute') {intervalAmount = 10;} else {intervalAmount = 1;@@ -591,11 +591,11 @@ export function animationGif(models, config, ui) {var headerMsg ="<h3 class='wv-data-unavailable-header'>GIF Not Available</h3>";var bodyMsg =- "Too many frames were selected. Please request less than 40 frames if you would like to generate a GIF";+ 'Too many frames were selected. Please request less than 40 frames if you would like to generate a GIF';var callback = function() {- $("#timeline-footer").toggleClass("wv-anim-active");+ $('#timeline-footer').toggleClass('wv-anim-active');};- wvui.notify(headerMsg + bodyMsg, "Notice", 600, callback);+ wvui.notify(headerMsg + bodyMsg, 'Notice', 600, callback);};/*@@ -629,13 +629,13 @@ export function animationGif(models, config, ui) {*/var onGifComplete = function(obj) {// callback function for when image is finished- $("#timeline-footer").removeClass("wv-anim-active");- models.anim.rangeState.state = "off";+ $('#timeline-footer').removeClass('wv-anim-active');+ models.anim.rangeState.state = 'off';if (!obj.error) {const blob = obj.blob;$progress.remove();progressing = false;- var animatedImage = document.createElement("img");+ var animatedImage = document.createElement('img');const blobURL = URL.createObjectURL(blob);animatedImage.src = blobURL;animatedImage.width =@@ -647,7 +647,7 @@ export function animationGif(models, config, ui) {? window.innerHeight - 120: lastRequestedDimensions.h;var dlURL = util.format(- "nasa-worldview-{1}-to-{2}.gif",+ 'nasa-worldview-{1}-to-{2}.gif',animModel.rangeState.startDate,animModel.rangeState.endDate);@@ -655,71 +655,71 @@ export function animationGif(models, config, ui) {// Create download link and apply button CSSvar $download = $(- "<button><span class=ui-button-text>Download</span></button>"+ '<button><span class=ui-button-text>Download</span></button>')- .attr("class", "wv-button")+ .attr('class', 'wv-button').hover(function() {- $(this).addClass("ui-state-hover");+ $(this).addClass('ui-state-hover');},function() {- $(this).removeClass("ui-state-hover");+ $(this).removeClass('ui-state-hover');}).click(function(e) {e.preventDefault();FileSaver.saveAs(blob, dlURL);- googleAnalytics.event("Animation", "Download", "GIF", downloadSize);+ googleAnalytics.event('Animation', 'Download', 'GIF', downloadSize);});var $catalog ="<div class='gif-results-dialog' style='height: " +animatedImage.height +"px; min-height: 210px;' >" +- "<div>" +- "<div><b>" +- "Size: " +- "</b></div>" +- "<div>" ++ '<div>' ++ '<div><b>' ++ 'Size: ' ++ '</b></div>' ++ '<div>' +downloadSize +- " MB" +- "</div>" +- "</div>" +- "<div>" +- "<div><b>" +- "Speed: " +- "</b></div>" +- "<div>" ++ ' MB' ++ '</div>' ++ '</div>' ++ '<div>' ++ '<div><b>' ++ 'Speed: ' ++ '</b></div>' ++ '<div>' +animModel.rangeState.speed +- " fps" +- "</div>" +- "</div>" +- "<div>" +- "<div><b>" +- "Date Range: " +- "</b></div>" +- "<div>" ++ ' fps' ++ '</div>' ++ '</div>' ++ '<div>' ++ '<div><b>' ++ 'Date Range: ' ++ '</b></div>' ++ '<div>' +animModel.rangeState.startDate +- "</div>" +- "<div>" +- " - " +- "</div>" +- "<div>" ++ '</div>' ++ '<div>' ++ ' - ' ++ '</div>' ++ '<div>' +animModel.rangeState.endDate +- "</div>" +- "</div>" +- "<div>" +- "<div><b>" +- "Increments: " +- "</b></div>" +- "<div>" ++ '</div>' ++ '</div>' ++ '<div>' ++ '<div><b>' ++ 'Increments: ' ++ '</b></div>' ++ '<div>' +lodashCapitalize(ui.anim.widget.getIncrements()) +- "</div>" +- "</div>" +- "</div>";- var $dialogBodyCase = $("<div></div>");- $dialogBodyCase.addClass("gif-results-dialog-case clearfix");- $dialogBodyCase.css("padding", "10px 0");+ '</div>' ++ '</div>' ++ '</div>';+ var $dialogBodyCase = $('<div></div>');+ $dialogBodyCase.addClass('gif-results-dialog-case clearfix');+ $dialogBodyCase.css('padding', '10px 0');$dialogBodyCase.append(animatedImage);$dialogBodyCase.append($catalog);// calculate the offset of the dialog position based on image size to display it properly@@ -727,11 +727,11 @@ export function animationGif(models, config, ui) {var posWidth = (lastRequestedDimensions.w * 1) / window.innerWidth;var posHeight = (lastRequestedDimensions.h * 50) / window.innerHeight;var atString =- "center-" ++ 'center-' +posWidth.toFixed() +- "% center-" ++ '% center-' +posHeight.toFixed() +- "%";+ '%';// Create a dialog over the view and place the image therevar $imgDialog = wvui@@ -739,20 +739,20 @@ export function animationGif(models, config, ui) {.append($dialogBodyCase).append($download);$imgDialog.dialog({- dialogClass: "wv-panel wv-gif-results",- title: "Your GIF",+ dialogClass: 'wv-panel wv-gif-results',+ title: 'Your GIF',width: animatedImage.width + 204,resizable: false,maxWidth: window.innerWidth,maxHeight: window.innerHeight,close: function() {- $imgDialog.find("img").remove();- models.anim.rangeState.state = "on";- $("#timeline-footer").toggleClass("wv-anim-active");+ $imgDialog.find('img').remove();+ models.anim.rangeState.state = 'on';+ $('#timeline-footer').toggleClass('wv-anim-active');},position: {// based on image size- my: "center center",+ my: 'center center',at: atString,of: window}@@ -761,12 +761,12 @@ export function animationGif(models, config, ui) {var headerMsg ="<h3 class='wv-data-unavailable-header'>GIF Not Available</h3>";var bodyMsg =- "One or more of the frames requested was unable to be processed";+ 'One or more of the frames requested was unable to be processed';uiIndicator.hide(loader);var callback = function() {- $("#timeline-footer").toggleClass("wv-anim-active");+ $('#timeline-footer').toggleClass('wv-anim-active');};- wvui.notify(headerMsg + bodyMsg, "Notice", 600, callback);+ wvui.notify(headerMsg + bodyMsg, 'Notice', 600, callback);}};@@ -786,24 +786,24 @@ export function animationGif(models, config, ui) {$dialogBox = wvui.getDialog();$dialogBox.html(panelCase);$dialogBox.css({- paddingBottom: "10px"+ paddingBottom: '10px'});$dialogBox.dialog({- dialogClass: "wv-panel wv-image",- title: "Create An Animated GIF",- height: "auto",+ dialogClass: 'wv-panel wv-image',+ title: 'Create An Animated GIF',+ height: 'auto',width: width,minHeight: 40,minWidth: 287,resizable: false,show: {- effect: "slide",- direction: "right"+ effect: 'slide',+ direction: 'right'},position: {- my: "left top",- at: "right+10 top",- of: $(".jcrop-tracker")+ my: 'left top',+ at: 'right+10 top',+ of: $('.jcrop-tracker')},close: onCloseSelector@@ -812,11 +812,11 @@ export function animationGif(models, config, ui) {};var onCloseSelector = function() {- $("#wv-map").insertAfter("#productsHolder"); // retain map element before disabling jcrop+ $('#wv-map').insertAfter('#productsHolder'); // retain map element before disabling jcropjcropAPI.destroy();- $("#timeline-footer").toggleClass("wv-anim-active");- if (models.proj.selected.id === "geographic") {- ui.map.events.trigger("selectiondone");+ $('#timeline-footer').toggleClass('wv-anim-active');+ if (models.proj.selected.id === 'geographic') {+ ui.map.events.trigger('selectiondone');}};@@ -866,11 +866,11 @@ export function animationGif(models, config, ui) {**/var removeCrop = function() {- $("#wv-map").insertAfter("#productsHolder"); // retain map element before disabling jcrop+ $('#wv-map').insertAfter('#productsHolder'); // retain map element before disabling jcropanimationCoordinates = undefined;jcropAPI.destroy();- if (models.proj.selected.id === "geographic") {- ui.map.events.trigger("selectiondone");+ if (models.proj.selected.id === 'geographic') {+ ui.map.events.trigger('selectiondone');}};@@ -909,10 +909,10 @@ export function animationGif(models, config, ui) {if ($dialog) {$parent = $dialog.parent();$parent.position({- my: "left top",- at: "right+10 top",- collision: "flipfit",- of: $(".jcrop-tracker")+ my: 'left top',+ at: 'right+10 top',+ collision: 'flipfit',+ of: $('.jcrop-tracker')});}};@@ -936,7 +936,7 @@ export function animationGif(models, config, ui) {var fontSize = Math.abs(width / 4); // Font size is 25% widthfontSize = fontSize < 30 ? 30 : fontSize > 100 ? 100 : fontSize; // Set max and min font-size- $el.css("font-size", fontSize);+ $el.css('font-size', fontSize);};var onBoundingBoxChange = function(c, $dialog, $dlButton) {@@ -984,14 +984,14 @@ export function animationGif(models, config, ui) {];}- if (models.proj.selected.id === "geographic") {- ui.map.events.trigger("selecting");+ if (models.proj.selected.id === 'geographic') {+ ui.map.events.trigger('selecting');}starterWidth = previousCoords[0] - previousCoords[2];// Start the image cropping. Show the dialog- $("#wv-map").Jcrop(+ $('#wv-map').Jcrop({- bgColor: "black",+ bgColor: 'black',bgOpacity: 0.3,fullScreen: true,setSelect: previousCoords,@@ -1020,15 +1020,15 @@ export function animationGif(models, config, ui) {$dlButton ="<div class='wv-dl-gif-bt-case'>" +"<i class='fa fa-download'>" +- "</div>";+ '</div>';jcropAPI = this;- $("#timeline-footer").toggleClass("wv-anim-active");+ $('#timeline-footer').toggleClass('wv-anim-active');$dialog = getSelectorDialog(342);- $tracker = this.ui.selection.find(".jcrop-tracker");+ $tracker = this.ui.selection.find('.jcrop-tracker');$tracker.append($dlButton);- $dlButton = $(".wv-dl-gif-bt-case i");+ $dlButton = $('.wv-dl-gif-bt-case i');setIconFontSize($dlButton, starterWidth);- $dlButton.on("click", getGif);+ $dlButton.on('click', getGif);});diff --git a/web/js/components/animation-widget/gif-panel.js b/web/js/components/animation-widget/gif-panel.jsindex 9961470f7..a88aa779b 100644--- a/web/js/components/animation-widget/gif-panel.js+++ b/web/js/components/animation-widget/gif-panel.js@@ -2,7 +2,7 @@ import React from 'react';import SelectionList from '../util/selector';import { GifPanelGrid } from './gif-panel-grid';import Button from '../util/button';-import {Checkbox} from '../util/checkbox';+import { Checkbox } from '../util/checkbox';import PropTypes from 'prop-types';/*@@ -36,13 +36,13 @@ export default class GifPanel extends React.Component {render() {return (<div className="animation-gif-dialog-wrapper">- <div className='gif-selector-case'>+ <div className="gif-selector-case">{this.props.firstLabel}<SelectionList- id='gif-resolution'+ id="gif-resolution"optionArray={this.state.resolutions}value={this.state.resolution}- optionName='resolution'+ optionName="resolution"onChange={this.handleChange.bind(this)}/></div>@@ -60,16 +60,16 @@ export default class GifPanel extends React.Component {/><ButtononClick={this.props.onClick}- text='Create GIF'+ text="Create GIF"valid={this.state.valid}/><Checkboxid="wv-checkbox-gif"classNames="wv-checkbox-gif"- title='Check box to remove dates from Animating GIF'+ title="Check box to remove dates from Animating GIF"checked={this.props.checked}onCheck={this.props.onCheck}- label='Include Date Stamps'+ label="Include Date Stamps"/></div>);diff --git a/web/js/components/date-selector/date-selector.js b/web/js/components/date-selector/date-selector.jsindex d7e5e4ead..082067216 100644--- a/web/js/components/date-selector/date-selector.js+++ b/web/js/components/date-selector/date-selector.js@@ -1,7 +1,7 @@-import React from "react";-import PropTypes from "prop-types";-import DateInputColumn from "./input";-import util from "../../util/util";+import React from 'react';+import PropTypes from 'prop-types';+import DateInputColumn from './input';+import util from '../../util/util';/** A react component, is a draggable svg@@ -68,11 +68,11 @@ class DateSelector extends React.Component {today={new Date()}date={this.state.date}type="hour"- inputId={this.props.idSuffix ? "hour-" + this.props.idSuffix : ""}+ inputId={this.props.idSuffix ? 'hour-' + this.props.idSuffix : ''}height={this.props.height}width={this.props.width}updateDate={this.updateDate.bind(this)}- value={util.pad(this.state.date.getUTCHours(), 2, "0")}+ value={util.pad(this.state.date.getUTCHours(), 2, '0')}tabIndex={4}focused={this.state.tab === 4}nextTab={this.nextTab.bind(this)}@@ -91,8 +91,8 @@ class DateSelector extends React.Component {height={this.props.height}width={this.props.width}updateDate={this.updateDate.bind(this)}- value={util.pad(this.state.date.getUTCMinutes(), 2, "0")}- inputId={this.props.idSuffix ? "minute-" + this.props.idSuffix : ""}+ value={util.pad(this.state.date.getUTCMinutes(), 2, '0')}+ inputId={this.props.idSuffix ? 'minute-' + this.props.idSuffix : ''}tabIndex={5}focused={this.state.tab === 5}nextTab={this.nextTab.bind(this)}@@ -119,7 +119,7 @@ class DateSelector extends React.Component {height={this.props.height}width={this.props.width}updateDate={this.updateDate.bind(this)}- inputId={this.props.idSuffix ? "year-" + this.props.idSuffix : ""}+ inputId={this.props.idSuffix ? 'year-' + this.props.idSuffix : ''}tabIndex={1}focused={this.state.tab === 1}nextTab={this.nextTab.bind(this)}@@ -135,7 +135,7 @@ class DateSelector extends React.Component {date={this.state.date}value={util.monthStringArray[this.state.date.getUTCMonth()]}type="month"- inputId={this.props.idSuffix ? "month-" + this.props.idSuffix : ""}+ inputId={this.props.idSuffix ? 'month-' + this.props.idSuffix : ''}height={this.props.height}width={this.props.width}updateDate={this.updateDate.bind(this)}@@ -156,9 +156,9 @@ class DateSelector extends React.Component {height={this.props.height}width={this.props.width}updateDate={this.updateDate.bind(this)}- value={util.pad(this.state.date.getUTCDate(), 2, "0")}+ value={util.pad(this.state.date.getUTCDate(), 2, '0')}tabIndex={3}- inputId={this.props.idSuffix ? "day-" + this.props.idSuffix : ""}+ inputId={this.props.idSuffix ? 'day-' + this.props.idSuffix : ''}focused={this.state.tab === 3}nextTab={this.nextTab.bind(this)}maxDate={this.props.maxDate}diff --git a/web/js/components/date-selector/input.js b/web/js/components/date-selector/input.jsindex 5b63c0767..349a968c4 100644--- a/web/js/components/date-selector/input.js+++ b/web/js/components/date-selector/input.js@@ -1,6 +1,6 @@-import React from "react";-import PropTypes from "prop-types";-import util from "../../util/util";+import React from 'react';+import PropTypes from 'prop-types';+import util from '../../util/util';/** A react component, is a draggable svg@@ -30,9 +30,9 @@ class DateInputColumn extends React.Component {var size;var type;type = this.props.type;- if (type === "year") {- size = "4";- } else if (type === "day") {+ if (type === 'year') {+ size = '4';+ } else if (type === 'day') {size = 2;} else {size = 3;@@ -70,26 +70,26 @@ class DateInputColumn extends React.Component {this.onClickDown();return;}- if (e.type === "focusout" || entered) {- if (this.props.type === "year" || this.props.type === "day") {+ if (e.type === 'focusout' || entered) {+ if (this.props.type === 'year' || this.props.type === 'day') {if (!((keyCode >= 48 && keyCode <= 57) || entered || keyCode === 8)) {return;}}switch (this.props.type) {- case "year":+ case 'year':newDate = this.yearValidation(value);break;- case "month":+ case 'month':newDate = this.monthValidation(value);break;- case "day":+ case 'day':newDate = this.dayValidation(value);break;- case "hour":+ case 'hour':newDate = this.hourValidation(value);break;- case "minute":+ case 'minute':newDate = this.minuteValidation(value);break;}@@ -107,7 +107,7 @@ class DateInputColumn extends React.Component {}}onClickUp() {- if (this.props.type === "minute") {+ if (this.props.type === 'minute') {this.rollDate(10);} else {this.rollDate(1);@@ -117,7 +117,7 @@ class DateInputColumn extends React.Component {});}onClickDown() {- if (this.props.type === "minute") {+ if (this.props.type === 'minute') {this.rollDate(-10);} else {this.rollDate(-1);@@ -232,8 +232,8 @@ class DateInputColumn extends React.Component {render() {return (<div- className={"input-wrapper" + " input-wrapper-" + this.props.type}- style={this.state.valid ? {} : { borderColor: "#ff0000" }}+ className={'input-wrapper' + ' input-wrapper-' + this.props.type}+ style={this.state.valid ? {} : { borderColor: '#ff0000' }}><divonClick={this.onClickUp.bind(this)}@@ -259,7 +259,7 @@ class DateInputColumn extends React.Component {onKeyDown={this.onKeyPress.bind(this) /* currently not working */}onChange={this.onChange.bind(this)}style={- this.props.fontSize ? { fontSize: this.props.fontSize + "px" } : {}+ this.props.fontSize ? { fontSize: this.props.fontSize + 'px' } : {}}step={this.props.step}onBlur={this.blur.bind(this)}diff --git a/web/js/components/layer/row.js b/web/js/components/layer/row.jsindex 2dd452033..f95e24639 100644--- a/web/js/components/layer/row.js+++ b/web/js/components/layer/row.js@@ -1,7 +1,7 @@-import React from "react";-import PropTypes from "prop-types";-import { ListGroup, ListGroupItem } from "reactstrap";-import util from "../../util/util.js";+import React from 'react';+import PropTypes from 'prop-types';+import { ListGroup, ListGroupItem } from 'reactstrap';+import util from '../../util/util.js';/*** A single layer search result row@@ -67,81 +67,81 @@ class LayerRow extends React.Component {*/dateRangeText(layer) {var startDate, startDateId, endDate, endDateId;- var dateRange = "";+ var dateRange = '';if (layer.startDate) {startDate = util.parseDate(layer.startDate);- if (layer.period === "subdaily") {+ if (layer.period === 'subdaily') {startDate =startDate.getDate() +- " " ++ ' ' +util.giveMonth(startDate) +- " " ++ ' ' +startDate.getFullYear() +- " " +- util.pad(startDate.getHours(), 2, "0") +- ":" +- util.pad(startDate.getMinutes(), 2, "0");- } else if (layer.period === "yearly") {+ ' ' ++ util.pad(startDate.getHours(), 2, '0') ++ ':' ++ util.pad(startDate.getMinutes(), 2, '0');+ } else if (layer.period === 'yearly') {startDate = startDate.getFullYear();- } else if (layer.period === "monthly") {- startDate = util.giveMonth(startDate) + " " + startDate.getFullYear();+ } else if (layer.period === 'monthly') {+ startDate = util.giveMonth(startDate) + ' ' + startDate.getFullYear();} else {startDate =startDate.getDate() +- " " ++ ' ' +util.giveMonth(startDate) +- " " ++ ' ' +startDate.getFullYear();}- if (layer.id) startDateId = layer.id + "-startDate";+ if (layer.id) startDateId = layer.id + '-startDate';if (layer.endDate) {endDate = util.parseDate(layer.endDate);- if (layer.period === "subdaily") {+ if (layer.period === 'subdaily') {endDate =endDate.getDate() +- " " ++ ' ' +util.giveMonth(endDate) +- " " ++ ' ' +endDate.getFullYear() +- " " +- util.pad(endDate.getHours(), 2, "0") +- ":" +- util.pad(endDate.getMinutes(), 2, "0");- } else if (layer.period === "yearly") {+ ' ' ++ util.pad(endDate.getHours(), 2, '0') ++ ':' ++ util.pad(endDate.getMinutes(), 2, '0');+ } else if (layer.period === 'yearly') {endDate = new Date(endDate.setFullYear(endDate.getFullYear() - 1));endDate = endDate.getFullYear();- } else if (layer.period === "monthly") {+ } else if (layer.period === 'monthly') {endDate = new Date(endDate.setMonth(endDate.getMonth() - 1));- endDate = util.giveMonth(endDate) + " " + endDate.getFullYear();+ endDate = util.giveMonth(endDate) + ' ' + endDate.getFullYear();} else {if (layer.dateRanges &&- layer.dateRanges.slice(-1)[0].dateInterval !== "1"+ layer.dateRanges.slice(-1)[0].dateInterval !== '1') {endDate = new Date(endDate.setTime(endDate.getTime() - 86400000));}endDate =endDate.getDate() +- " " ++ ' ' +util.giveMonth(endDate) +- " " ++ ' ' +endDate.getFullYear();}} else {- endDate = "Present";+ endDate = 'Present';}- if (layer.id) endDateId = layer.id + "-endDate";+ if (layer.id) endDateId = layer.id + '-endDate';dateRange ='Temporal coverage: <span class="layer-date-start" id=' +startDateId +- ">" ++ '>' +startDate +'</span> - <span class="layer-end-date" id=' +endDateId +- ">" ++ '>' +endDate +- "</span>";+ '</span>';}return dateRange;@@ -183,7 +183,7 @@ class LayerRow extends React.Component {// check for any overlapvar previousEnd = util.parseDate(previous.endDate);// Add dateInterval- if (previous.dateInterval > 1 && period === "daily") {+ if (previous.dateInterval > 1 && period === 'daily') {previousEnd = new Date(previousEnd.setTime(previousEnd.getTime() +@@ -191,13 +191,13 @@ class LayerRow extends React.Component {));}- if (period === "monthly") {+ if (period === 'monthly') {previousEnd = new Date(previousEnd.setMonth(previousEnd.getMonth() + (previous.dateInterval - 1)));- } else if (period === "yearly") {+ } else if (period === 'yearly') {previousEnd = new Date(previousEnd.setFullYear(previousEnd.getFullYear() + (previous.dateInterval - 1)@@ -246,7 +246,7 @@ class LayerRow extends React.Component {var { layer } = this.props;var { title, description, subtitle, metadata } = layer;var listItems;- var headerClass = "layers-all-header has-checkbox";+ var headerClass = 'layers-all-header has-checkbox';if (layer.dateRanges && layer.dateRanges.length > 1) {let firstDateRange = true;@@ -262,47 +262,47 @@ class LayerRow extends React.Component {let listItemStartDate;let listItemEndDate;- if (layer.period === "subdaily") {+ if (layer.period === 'subdaily') {listItemStartDate =startDate.getDate() +- " " ++ ' ' +util.giveMonth(startDate) +- " " ++ ' ' +startDate.getFullYear() +- " " +- util.pad(startDate.getHours(), 2, "0") +- ":" +- util.pad(startDate.getMinutes(), 2, "0");+ ' ' ++ util.pad(startDate.getHours(), 2, '0') ++ ':' ++ util.pad(startDate.getMinutes(), 2, '0');listItemEndDate =endDate.getDate() +- " " ++ ' ' +util.giveMonth(endDate) +- " " ++ ' ' +endDate.getDate() +- " " ++ ' ' +util.giveMonth(endDate) +- " " ++ ' ' +endDate.getFullYear() +- " " +- util.pad(endDate.getHours(), 2, "0") +- ":" +- util.pad(endDate.getMinutes(), 2, "0");+ ' ' ++ util.pad(endDate.getHours(), 2, '0') ++ ':' ++ util.pad(endDate.getMinutes(), 2, '0');if (firstDateRange) {if (layer.endDate === undefined) {- listItemEndDate = "Present";+ listItemEndDate = 'Present';}firstDateRange = false;}return (- <ListGroupItem key={l.startDate + " - " + l.endDate}>- {listItemStartDate + " - " + listItemEndDate}+ <ListGroupItem key={l.startDate + ' - ' + l.endDate}>+ {listItemStartDate + ' - ' + listItemEndDate}</ListGroupItem>);- } else if (layer.period === "yearly") {- if (l.dateInterval === "1" && l.startDate === l.endDate) {+ } else if (layer.period === 'yearly') {+ if (l.dateInterval === '1' && l.startDate === l.endDate) {listItemStartDate = startDate.getFullYear();return (@@ -312,7 +312,7 @@ class LayerRow extends React.Component {);} else {listItemStartDate = startDate.getFullYear();- if (l.dateInterval !== "1") {+ if (l.dateInterval !== '1') {listItemEndDate = new Date(endDate.setFullYear(endDate.getFullYear() - 1 + l.dateInterval@@ -323,21 +323,21 @@ class LayerRow extends React.Component {if (firstDateRange) {if (layer.endDate === undefined) {- listItemEndDate = "Present";+ listItemEndDate = 'Present';}firstDateRange = false;}return (<ListGroupItem key={l.startDate}>- {listItemStartDate + " - " + listItemEndDate}+ {listItemStartDate + ' - ' + listItemEndDate}</ListGroupItem>);}- } else if (layer.period === "monthly") {- if (l.dateInterval === "1" && l.startDate === l.endDate) {+ } else if (layer.period === 'monthly') {+ if (l.dateInterval === '1' && l.startDate === l.endDate) {listItemStartDate =- util.giveMonth(startDate) + " " + startDate.getFullYear();+ util.giveMonth(startDate) + ' ' + startDate.getFullYear();return (<ListGroupItem key={l.startDate}>@@ -346,50 +346,50 @@ class LayerRow extends React.Component {);} else {listItemStartDate =- util.giveMonth(startDate) + " " + startDate.getFullYear();- if (l.dateInterval !== "1") {+ util.giveMonth(startDate) + ' ' + startDate.getFullYear();+ if (l.dateInterval !== '1') {listItemEndDate = new Date(endDate.setMonth(endDate.getMonth() - 1 + l.dateInterval));}listItemEndDate =- util.giveMonth(endDate) + " " + endDate.getFullYear();+ util.giveMonth(endDate) + ' ' + endDate.getFullYear();if (firstDateRange) {if (layer.endDate === undefined) {- listItemEndDate = "Present";+ listItemEndDate = 'Present';}firstDateRange = false;}return (<ListGroupItem key={l.startDate}>- {listItemStartDate + " - " + listItemEndDate}+ {listItemStartDate + ' - ' + listItemEndDate}</ListGroupItem>);}} else if (layer.period) {- if (l.dateInterval === "1" && l.startDate === l.endDate) {+ if (l.dateInterval === '1' && l.startDate === l.endDate) {let listItemStartDate =startDate.getDate() +- " " ++ ' ' +util.giveMonth(startDate) +- " " ++ ' ' +startDate.getFullYear();return (- <ListGroupItem key={l.startDate + " - " + l.endDate}>+ <ListGroupItem key={l.startDate + ' - ' + l.endDate}>{listItemStartDate}</ListGroupItem>);} else {let listItemStartDate =startDate.getDate() +- " " ++ ' ' +util.giveMonth(startDate) +- " " ++ ' ' +startDate.getFullYear();- if (l.dateInterval !== "1") {+ if (l.dateInterval !== '1') {listItemEndDate = new Date(endDate.setTime(endDate.getTime() - 86400000 + l.dateInterval * 86400000@@ -398,21 +398,21 @@ class LayerRow extends React.Component {}listItemEndDate =endDate.getDate() +- " " ++ ' ' +util.giveMonth(endDate) +- " " ++ ' ' +endDate.getFullYear();if (firstDateRange) {if (layer.endDate === undefined) {- listItemEndDate = "Present";+ listItemEndDate = 'Present';}firstDateRange = false;}return (- <ListGroupItem key={l.startDate + " - " + l.endDate}>- {listItemStartDate + " - " + listItemEndDate}+ <ListGroupItem key={l.startDate + ' - ' + l.endDate}>+ {listItemStartDate + ' - ' + listItemEndDate}</ListGroupItem>);}@@ -420,7 +420,7 @@ class LayerRow extends React.Component {});}}- if (checked) headerClass += " checked";+ if (checked) headerClass += ' checked';return (<div className="layers-all-layer">@@ -438,46 +438,46 @@ class LayerRow extends React.Component {</div>{isMetadataExpanded &&metadata && (- <div className="source-metadata visible">- {layer.startDate && (- <p className="layer-date-range">- <span- dangerouslySetInnerHTML={{- __html: this.dateRangeText(layer)- }}- />- {layer.dateRanges &&+ <div className="source-metadata visible">+ {layer.startDate && (+ <p className="layer-date-range">+ <span+ dangerouslySetInnerHTML={{+ __html: this.dateRangeText(layer)+ }}+ />+ {layer.dateRanges &&layer.dateRanges.length > 1 &&dateRanges.overlap === false && (- <a- id="layer-date-ranges-button"- title="View all date ranges"- className="layer-date-ranges-button"- onClick={e => this.toggleDateRanges(e)}- >- {" "}- <sup>*View Dates</sup>- </a>- )}- </p>- )}- {isDateRangesExpanded && (- <div className="layer-date-wrap">- <p>Date Ranges:</p>- <ListGroup className="layer-date-ranges">- {listItems}- </ListGroup>- </div>- )}- <div dangerouslySetInnerHTML={{ __html: metadata }} />- <div- className="metadata-more"- onClick={e => this.toggleMetadataButtons(e)}- >- <span className="ellipsis up">^</span>+ <a+ id="layer-date-ranges-button"+ title="View all date ranges"+ className="layer-date-ranges-button"+ onClick={e => this.toggleDateRanges(e)}+ >+ {' '}+ <sup>*View Dates</sup>+ </a>+ )}+ </p>+ )}+ {isDateRangesExpanded && (+ <div className="layer-date-wrap">+ <p>Date Ranges:</p>+ <ListGroup className="layer-date-ranges">+ {listItems}+ </ListGroup></div>+ )}+ <div dangerouslySetInnerHTML={{ __html: metadata }} />+ <div+ className="metadata-more"+ onClick={e => this.toggleMetadataButtons(e)}+ >+ <span className="ellipsis up">^</span></div>- )}+ </div>+ )}</div>);}diff --git a/web/js/components/tooltip/tooltip.js b/web/js/components/tooltip/tooltip.jsindex d292b45f4..e91f933a7 100644--- a/web/js/components/tooltip/tooltip.js+++ b/web/js/components/tooltip/tooltip.js@@ -33,12 +33,24 @@ class Tooltip extends React.Component {<divonMouseEnter={this.mouseOver.bind(this)}onMouseLeave={this.mouseOut.bind(this)}- className="wv-tooltip-case">+ className="wv-tooltip-case"+ ><span>{this.props.text}</span>- <div className="wv-tooltip" style={(this.state.hovered) ? {visibility: 'visible'} : {}} >+ <div+ className="wv-tooltip"+ style={this.state.hovered ? { visibility: 'visible' } : {}}+ ><ul>{this.props.dataArray.map((dataEl, i) => {- return <li key={'tooltip-' + dataEl + '-' + i} id={dataEl} onClick={this.onClick.bind(this, dataEl)}>{dataEl}</li>;+ return (+ <li+ key={'tooltip-' + dataEl + '-' + i}+ id={dataEl}+ onClick={this.onClick.bind(this, dataEl)}+ >+ {dataEl}+ </li>+ );})}</ul></div>diff --git a/web/js/components/util/button.js b/web/js/components/util/button.jsindex 7a63345a6..022b72f2f 100644--- a/web/js/components/util/button.js+++ b/web/js/components/util/button.js@@ -36,6 +36,7 @@ Button.defaultProps = {};Button.propTypes = {onClick: PropTypes.func,+ style: PropTypes.object,id: PropTypes.string,valid: PropTypes.bool,className: PropTypes.string,diff --git a/web/js/image/panel.js b/web/js/image/panel.jsindex 61a2a51ca..b6645ad3d 100644--- a/web/js/image/panel.js+++ b/web/js/image/panel.js@@ -1,13 +1,13 @@-import $ from "jquery";-import "jquery-ui/button";-import "jquery-ui/dialog";-import olProj from "ol/proj";-import ImageResSelection from "../components/image-panel/select";-import googleAnalytics from "../components/util/google-analytics";-import util from "../util/util";-import wvui from "../ui/ui";-import React from "react";-import ReactDOM from "react-dom";+import $ from 'jquery';+import 'jquery-ui/button';+import 'jquery-ui/dialog';+import olProj from 'ol/proj';+import ImageResSelection from '../components/image-panel/select';+import googleAnalytics from '../components/util/google-analytics';+import util from '../util/util';+import wvui from '../ui/ui';+import React from 'react';+import ReactDOM from 'react-dom';import {imageUtilCalculateResolution,@@ -15,42 +15,42 @@ import {imageUtilGetCoordsFromPixelValues,imageUtilGetLayers,imageUtilGetConversionFactor-} from "./util";+} from './util';const resolutionsGeo = {values: [- { value: "0.125", text: "30m" },- { value: "0.25", text: "60m" },- { value: "0.5", text: "125m" },- { value: "1", text: "250m" },- { value: "2", text: "500m" },- { value: "4", text: "1km" },- { value: "20", text: "5km" },- { value: "40", text: "10km" }+ { value: '0.125', text: '30m' },+ { value: '0.25', text: '60m' },+ { value: '0.5', text: '125m' },+ { value: '1', text: '250m' },+ { value: '2', text: '500m' },+ { value: '4', text: '1km' },+ { value: '20', text: '5km' },+ { value: '40', text: '10km' }]};const resolutionsPolar = {values: [- { value: "1", text: "250m" },- { value: "2", text: "500m" },- { value: "4", text: "1km" },- { value: "20", text: "5km" },- { value: "40", text: "10km" }+ { value: '1', text: '250m' },+ { value: '2', text: '500m' },+ { value: '4', text: '1km' },+ { value: '20', text: '5km' },+ { value: '40', text: '10km' }]};const fileTypesGeo = {values: [- { value: "image/jpeg", text: "JPEG" },- { value: "image/png", text: "PNG" },- { value: "image/geotiff", text: "GeoTIFF" },- { value: "image/kmz", text: "KMZ" }+ { value: 'image/jpeg', text: 'JPEG' },+ { value: 'image/png', text: 'PNG' },+ { value: 'image/geotiff', text: 'GeoTIFF' },+ { value: 'image/kmz', text: 'KMZ' }]};const fileTypesPolar = {values: [- { value: "image/jpeg", text: "JPEG" },- { value: "image/png", text: "PNG" },- { value: "image/geotiff", text: "GeoTIFF" }+ { value: 'image/jpeg', text: 'JPEG' },+ { value: 'image/png', text: 'PNG' },+ { value: 'image/geotiff', text: 'GeoTIFF' }]};@@ -61,17 +61,17 @@ export function imagePanel(models, ui, config, dialogConfig) {var url;var alignTo = config.alignTo;var coords;- var resolution = "1";+ var resolution = '1';var lastZoom = -1;var htmlElements;var host;var path;- var containerId = "wv-image-button";+ var containerId = 'wv-image-button';var id = containerId;// state items as global varsvar lonlats;- var imgWorldfile = "false";- var imgFormat = "image/jpeg";+ var imgWorldfile = 'false';+ var imgFormat = 'image/jpeg';var imgWidth;var imgHeight;var imgRes;@@ -83,19 +83,19 @@ export function imagePanel(models, ui, config, dialogConfig) {host = config.features.imageDownload.host;path = config.parameters.imagegen || config.features.imageDownload.path;} else {- host = "http://map2.vis.earthdata.nasa.gov";- path = "imagegen/index.php";+ host = 'http://map2.vis.earthdata.nasa.gov';+ path = 'imagegen/index.php';}- url = host + "/" + path + "?";+ url = host + '/' + path + '?';if (config.parameters.imagegen) {- util.warn("Redirecting image download to: " + url);+ util.warn('Redirecting image download to: ' + url);}var init = function() {var options;checkConfig();- htmlElements = document.createElement("div");+ htmlElements = document.createElement('div');setProjectionGlobals();options = {resolution: resolution,@@ -108,11 +108,14 @@ export function imagePanel(models, ui, config, dialogConfig) {fileTypes: fileTypes};- self.reactComponent = renderPanel(options, htmlElements);- models.proj.events.on("select", setProjectionGlobals);+ self.reactComponent = ReactDOM.render(+ React.createElement(ImageResSelection, options),+ htmlElements+ );+ models.proj.events.on('select', setProjectionGlobals);};var setProjectionGlobals = function() {- var isGeoProjection = models.proj.selected.id === "geographic";+ var isGeoProjection = models.proj.selected.id === 'geographic';var curZoom = Math.round(ui.map.selected.getView().getZoom());imgRes = imageUtilCalculateResolution(curZoom,@@ -139,13 +142,13 @@ export function imagePanel(models, ui, config, dialogConfig) {host = config.features.imageDownload.host;path = config.parameters.imagegen || config.features.imageDownload.path;} else {- host = "http://map2.vis.earthdata.nasa.gov";- path = "imagegen/index.php";+ host = 'http://map2.vis.earthdata.nasa.gov';+ path = 'imagegen/index.php';}- url = host + "/" + path + "?";+ url = host + '/' + path + '?';if (config.parameters.imagegen) {- util.warn("Redirecting image download to: " + url);+ util.warn('Redirecting image download to: ' + url);}};var getUpdatedProps = function() {@@ -162,12 +165,6 @@ export function imagePanel(models, ui, config, dialogConfig) {fileType: imgFormat};};- var renderPanel = function(options, mountEl) {- return ReactDOM.render(- React.createElement(ImageResSelection, options),- mountEl- );- };var updatePanel = function(options) {self.reactComponent.setState(options);};@@ -178,7 +175,7 @@ export function imagePanel(models, ui, config, dialogConfig) {*/self.show = function() {alignTo = {- id: "wv-image-button"+ id: 'wv-image-button'};container = document.getElementById(containerId);@@ -186,14 +183,14 @@ export function imagePanel(models, ui, config, dialogConfig) {throw new Error("Error: element '" + containerId + "' not found!");}- container.setAttribute("class", "imagedownload");+ container.setAttribute('class', 'imagedownload');var $dialog = wvui.getDialog().html(htmlElements);$dialog.dialog(dialogConfig);// $("#wv-image-resolution").buttonset();// $("#wv-image-format").buttonset();- $("#wv-image-download-button").button();- $(".ui-dialog").zIndex(600);+ $('#wv-image-download-button').button();+ $('.ui-dialog').zIndex(600);$(window).resize(setPosition);// Auto-set default resolution to map's current zoom level; round it@@ -203,7 +200,7 @@ export function imagePanel(models, ui, config, dialogConfig) {// preserve their existing settingsif (curZoom !== lastZoom) {lastZoom = curZoom;- let isGeoProjection = models.proj.selected.id === "geographic";+ let isGeoProjection = models.proj.selected.id === 'geographic';imgRes = imageUtilCalculateResolution(curZoom,isGeoProjection,@@ -213,13 +210,13 @@ export function imagePanel(models, ui, config, dialogConfig) {}wvui.positionDialog($dialog, {- my: "right top",- at: "right bottom+5",- of: "#wv-image-button"+ my: 'right top',+ at: 'right bottom+5',+ of: '#wv-image-button'});- $dialog.dialog("open");+ $dialog.dialog('open');- $(".wv-image-coords").show();+ $('.wv-image-coords').show();};self.update = function(c) {@@ -240,8 +237,8 @@ export function imagePanel(models, ui, config, dialogConfig) {lonlats = imageUtilGetCoordsFromPixelValues(pixels, map);- geolonlat1 = olProj.transform(lonlats[0], crs, "EPSG:4326");- geolonlat2 = olProj.transform(lonlats[1], crs, "EPSG:4326");+ geolonlat1 = olProj.transform(lonlats[0], crs, 'EPSG:4326');+ geolonlat2 = olProj.transform(lonlats[1], crs, 'EPSG:4326');minLon = geolonlat1[0];maxLon = geolonlat2[0];@@ -287,10 +284,10 @@ export function imagePanel(models, ui, config, dialogConfig) {topRightCoordinates) {if (x2 - x1 < 150) {- bottomLeftCoordinates = "";- topRightCoordinates = "";+ bottomLeftCoordinates = '';+ topRightCoordinates = '';}- $("#wv-image-top")+ $('#wv-image-top').css({left: x1 - 10,top: y1 - 20,@@ -298,7 +295,7 @@ export function imagePanel(models, ui, config, dialogConfig) {}).html(topRightCoordinates);- $("#wv-image-bottom")+ $('#wv-image-bottom').css({left: x1,top: y2,@@ -327,12 +324,12 @@ export function imagePanel(models, ui, config, dialogConfig) {};var setPosition = function() {- var offset = $("#" + alignTo.id).offset();+ var offset = $('#' + alignTo.id).offset();var left =offset.left +- parseInt($("#" + alignTo.id).css("width")) -- parseInt($("#" + id).css("width"));- $("#" + id).css("left", left + "px");+ parseInt($('#' + alignTo.id).css('width')) -+ parseInt($('#' + id).css('width'));+ $('#' + id).css('left', left + 'px');};var createDownloadURL = function(@@ -349,21 +346,21 @@ export function imagePanel(models, ui, config, dialogConfig) {time.setUTCHours(0, 0, 0, 0);layers = imageUtilGetLayers(products, models.proj.selected.id);// Julian date, padded with two zeros (to ensure the julian date is always in DDD format).- jStart = util.parseDateUTC(time.getUTCFullYear() + "-01-01");- jDate = "00" + (1 + Math.ceil((time.getTime() - jStart) / 86400000));- dlURL += "TIME=" + time.getUTCFullYear() + jDate.substr(jDate.length - 3);+ jStart = util.parseDateUTC(time.getUTCFullYear() + '-01-01');+ jDate = '00' + (1 + Math.ceil((time.getTime() - jStart) / 86400000));+ dlURL += 'TIME=' + time.getUTCFullYear() + jDate.substr(jDate.length - 3);dlURL +=- "&extent=" ++ '&extent=' +lonlats[0][0] +- "," ++ ',' +lonlats[0][1] +- "," ++ ',' +lonlats[1][0] +- "," ++ ',' +lonlats[1][1];- dlURL += "&epsg=" + epsg;- dlURL += "&layers=" + layers.join(",");- dlURL += "&opacities=" + opacities.join(",");+ dlURL += '&epsg=' + epsg;+ dlURL += '&layers=' + layers.join(',');+ dlURL += '&opacities=' + opacities.join(',');return dlURL;};@@ -384,32 +381,32 @@ export function imagePanel(models, ui, config, dialogConfig) {imageUtilGetLayerOpacities(products),url);- googleAnalytics.event("Image Download", "Click", "Download");+ googleAnalytics.event('Image Download', 'Click', 'Download');util.metrics(- "lc=" ++ 'lc=' +encodeURIComponent(dlURL +- "&worldfile=" ++ '&worldfile=' +imgWorldfile +- "&format=" ++ '&format=' +imgFormat +- "&width=" ++ '&width=' +imgWidth +- "&height=" ++ '&height=' +imgHeight));window.open(dlURL +- "&worldfile=" ++ '&worldfile=' +imgWorldfile +- "&format=" ++ '&format=' +imgFormat +- "&width=" ++ '&width=' +imgWidth +- "&height=" ++ '&height=' +imgHeight,- "_blank"+ '_blank');};diff --git a/web/js/link/ui.js b/web/js/link/ui.jsindex 2d4def974..2bab53e4a 100644--- a/web/js/link/ui.js+++ b/web/js/link/ui.js@@ -1,32 +1,32 @@-import $ from "jquery";-import "jquery-ui/button";-import "jquery-ui/dialog";-import "icheck";-import lodashThrottle from "lodash/throttle";-import React from "react";-import ReactDOM from "react-dom";-import Clipboard from "clipboard";-import Share from "../components/share/share";-import googleAnalytics from "../components/util/google-analytics";+import $ from 'jquery';+import 'jquery-ui/button';+import 'jquery-ui/dialog';+import 'icheck';+import lodashThrottle from 'lodash/throttle';+import React from 'react';+import ReactDOM from 'react-dom';+import Clipboard from 'clipboard';+import Share from '../components/share/share';+import googleAnalytics from '../components/util/google-analytics';-import util from "../util/util";-import wvui from "../ui/ui";+import util from '../util/util';+import wvui from '../ui/ui';export function linkUi(models, config) {var self = {};- var id = "wv-link-button";- var selector = "#" + id;+ var id = 'wv-link-button';+ var selector = '#' + id;var $button, $label;- var clipboard = new Clipboard(".copy-btn");+ var clipboard = new Clipboard('.copy-btn');var init = function() {- $button = $("<input></input>")- .attr("type", "checkbox")- .attr("id", "wv-link-button-check");- $label = $("<label></label>")- .attr("for", "wv-link-button-check")- .attr("title", "Share this map");- var $icon = $("<i></i>").addClass("fa fa-share-square-o fa-2x");+ $button = $('<input></input>')+ .attr('type', 'checkbox')+ .attr('id', 'wv-link-button-check');+ $label = $('<label></label>')+ .attr('for', 'wv-link-button-check')+ .attr('title', 'Share this map');+ var $icon = $('<i></i>').addClass('fa fa-share-square-o fa-2x');$label.append($icon);$(selector).append($label);$(selector).append($button);@@ -35,15 +35,15 @@ export function linkUi(models, config) {text: false}).click(function() {- var checked = $("#wv-link-button-check").prop("checked");- googleAnalytics.event("Link", "Click", "Share link Button");+ var checked = $('#wv-link-button-check').prop('checked');+ googleAnalytics.event('Link', 'Click', 'Share link Button');if (checked) {self.show();} else {wvui.closeDialog();}});- models.link.events.on("update", replaceHistoryState);+ models.link.events.on('update', replaceHistoryState);};// Calls toQueryString to fetch updated state and returns URL@@ -51,9 +51,9 @@ export function linkUi(models, config) {function() {if (util.browser.history) {window.history.replaceState(- "",- "@OFFICIAL_NAME@",- "?" + models.link.toQueryString()+ '',+ '@OFFICIAL_NAME@',+ '?' + models.link.toQueryString());}},@@ -67,14 +67,14 @@ export function linkUi(models, config) {// Facebook: https://developers.facebook.com/docs/sharing/reference/share-dialog#redirectvar facebookUrlParams = function(appId, href, redirectUri, display) {return (- "https://www.facebook.com/dialog/share?" +- "app_id=" ++ 'https://www.facebook.com/dialog/share?' ++ 'app_id=' +encodeURIComponent(appId) +- "&href=" ++ '&href=' +encodeURIComponent(href) +- "&redirect_uri=" ++ '&redirect_uri=' +encodeURIComponent(redirectUri) +- "&display=" ++ '&display=' +encodeURIComponent(display));};@@ -82,10 +82,10 @@ export function linkUi(models, config) {// Twitter: https://dev.twitter.com/web/tweet-button/parameters#web-intent-examplevar twitterUrlParams = function(url, text) {return (- "https://twitter.com/intent/tweet?" +- "url=" ++ 'https://twitter.com/intent/tweet?' ++ 'url=' +encodeURIComponent(url) +- "&text=" ++ '&text=' +encodeURIComponent(text));};@@ -93,10 +93,10 @@ export function linkUi(models, config) {// Reddit: https://www.reddit.com/r/nasa/submit?url=[URL]&title=[TITLE]var redditUrlParams = function(url, title) {return (- "https://www.reddit.com/r/nasa/submit?" +- "url=" ++ 'https://www.reddit.com/r/nasa/submit?' ++ 'url=' +encodeURIComponent(url) +- "&title=" ++ '&title=' +encodeURIComponent(title));};@@ -104,27 +104,27 @@ export function linkUi(models, config) {// Email: mailto:?subject=[SUBJECT]&body=[BODY]var emailUrlParams = function(subject, body) {return (- "mailto:?" +- "subject=" ++ 'mailto:?' ++ 'subject=' +encodeURIComponent(subject) +- "&body=" ++ '&body=' +encodeURIComponent(body));};var getSharelink = function(type, url) {- var shareMessage = "Check out what I found in NASA Worldview!";- var twMessage = "Check out what I found in #NASAWorldview -";- var emailBody = shareMessage + " - " + url;+ var shareMessage = 'Check out what I found in NASA Worldview!';+ var twMessage = 'Check out what I found in #NASAWorldview -';+ var emailBody = shareMessage + ' - ' + url;switch (type) {- case "twitter":+ case 'twitter':return twitterUrlParams(url, twMessage);- case "facebook":- return facebookUrlParams("121285908450463", url, url, "popup");- case "reddit":+ case 'facebook':+ return facebookUrlParams('121285908450463', url, url, 'popup');+ case 'reddit':return redditUrlParams(url, shareMessage);- case "email":+ case 'email':return emailUrlParams(shareMessage, emailBody);}return undefined;@@ -138,10 +138,10 @@ export function linkUi(models, config) {var promise = models.link.shorten();// If a short link can be generated, replace the full link.- if (type === "twitter" || type === "email") {+ if (type === 'twitter' || type === 'email') {win = window;- if (type === "twitter") {- win = window.open("", "_blank");+ if (type === 'twitter') {+ win = window.open('', '_blank');}promise.done(function(result) {@@ -153,11 +153,11 @@ export function linkUi(models, config) {.fail(function() {href = getSharelink(type, shareLink);openPromisedSocial(href, win);- console.warn("Unable to shorten URL, full link generated.");+ console.warn('Unable to shorten URL, full link generated.');});} else {href = getSharelink(type, shareLink);- window.open(href, "_blank");+ window.open(href, '_blank');}};@@ -169,23 +169,29 @@ export function linkUi(models, config) {"<input type='text' value='' name='permalink_content' id='permalink_content' readonly/>" +"<span class='input-group-button hide-icon' data-balloon-visible data-tooltip='Copied!' data-tooltip-pos='up' data-tooltip-length='xsmall'>" +"<button title='Copy to clipboard' class='copy-btn' data-clipboard-target='#permalink_content'>COPY</button>" +- "</span>" +- "</div>";+ '</span>' ++ '</div>';if (config.features.urlShortening) {item +="<span autofocus></span><div id='wv-link-shorten'>" +"<input type='checkbox' value='' id='wv-link-shorten-check' />" +"<label id='wv-link-shorten-label' for='wv-link-shorten-check'>Shorten link</label>" +- "</div>";+ '</div>';}- item += "</div>";+ item += '</div>';- var dialogWidth = "300";+ var dialogWidth = '300';if (util.browser.small) {- dialogWidth = "242";+ dialogWidth = '242';}- var Widget = self.initWidget();+ var Widget = React.createElement(Share, {+ clickFunction: clickFunction,+ fbLink: '#',+ twLink: '#',+ rdLink: '#',+ emailLink: '#'+ });// Render Dialog Box Contentself.reactComponent = ReactDOM.render(Widget, $dialog[0]);@@ -193,64 +199,64 @@ export function linkUi(models, config) {// If selected during the animation, the cursor will go to the// end of the input boxvar updateLink = function() {- $("#permalink_content").val(models.link.get());- $("#wv-link-shorten-check").iCheck("uncheck");- $("#permalink_content").focus();- $("#permalink_content").select();+ $('#permalink_content').val(models.link.get());+ $('#wv-link-shorten-check').iCheck('uncheck');+ $('#permalink_content').focus();+ $('#permalink_content').select();};- models.link.events.on("update", updateLink);+ models.link.events.on('update', updateLink);$dialog.dialog({- dialogClass: "wv-panel wv-link-panel",- title: "Copy link to share:",+ dialogClass: 'wv-panel wv-link-panel',+ title: 'Copy link to share:',show: {- effect: "slide",- direction: "up"+ effect: 'slide',+ direction: 'up'},width: dialogWidth,- height: "auto",+ height: 'auto',minHeight: 10,draggable: false,resizable: false,autoOpen: false})- .on("dialogcreate", $dialog.prepend(item))- .on("dialogclose", function() {- $("#wv-link-button-check").prop("checked", false);- $button.button("refresh");- models.link.events.off("update", updateLink);+ .on('dialogcreate', $dialog.prepend(item))+ .on('dialogclose', function() {+ $('#wv-link-button-check').prop('checked', false);+ $button.button('refresh');+ models.link.events.off('update', updateLink);});if (util.browser.small) {wvui.positionDialog($dialog, {- my: "right top",- at: "right-58 bottom+5",- of: "#wv-toolbar"+ my: 'right top',+ at: 'right-58 bottom+5',+ of: '#wv-toolbar'});} else {wvui.positionDialog($dialog, {- my: "right top",- at: "right bottom+5",+ my: 'right top',+ at: 'right bottom+5',of: $label});}- $(".ui-dialog").zIndex(600);+ $('.ui-dialog').zIndex(600);- $("#permalink_content").val(models.link.get());- $dialog.dialog("open");+ $('#permalink_content').val(models.link.get());+ $dialog.dialog('open');setTimeout(updateLink, 500);- $("#wv-link-shorten-check").on("change", function() {- var checked = $("#wv-link-shorten-check").prop("checked");+ $('#wv-link-shorten-check').on('change', function() {+ var checked = $('#wv-link-shorten-check').prop('checked');if (checked) {var promise = models.link.shorten();- googleAnalytics.event("Link", "Check", "Shorten");- $("#permalink_content").val("Please wait...");+ googleAnalytics.event('Link', 'Check', 'Shorten');+ $('#permalink_content').val('Please wait...');promise.done(function(result) {if (result.status_code === 200) {- $("#permalink_content").val(result.data.url);+ $('#permalink_content').val(result.data.url);} else {error(result.status_code, result.status_txt);}@@ -259,48 +265,38 @@ export function linkUi(models, config) {error(textStatus, errorThrown);});} else {- $("#permalink_content").val(models.link.get());- googleAnalytics.event("Link", "Check", "Lengthen");+ $('#permalink_content').val(models.link.get());+ googleAnalytics.event('Link', 'Check', 'Lengthen');}- $("#permalink_content").focus();- $("#permalink_content").select();+ $('#permalink_content').focus();+ $('#permalink_content').select();});var error = function() {- console.warn("Unable to shorten URL");+ console.warn('Unable to shorten URL');console.warn.apply(console, arguments);wvui.notify(- "Unable to shorten the permalink at this time. " +- "Please try again later."+ 'Unable to shorten the permalink at this time. ' ++ 'Please try again later.');};- $("#wv-link-shorten-check").prop("checked", false);+ $('#wv-link-shorten-check').prop('checked', false);- clipboard.on("success", function(e) {+ clipboard.on('success', function(e) {e.clearSelection();- $(".wv-link .input-group-button").removeClass("hide-icon");+ $('.wv-link .input-group-button').removeClass('hide-icon');setTimeout(function() {- $(".wv-link .input-group-button").addClass("hide-icon");+ $('.wv-link .input-group-button').addClass('hide-icon');}, 1000);});- clipboard.on("error", function(e) {- console.error("Link could not be copied!");- console.error("Action:", e.action);- console.error("Trigger:", e.trigger);- });- };-- self.initWidget = function() {- return React.createElement(Share, {- clickFunction: clickFunction,- fbLink: "#",- twLink: "#",- rdLink: "#",- emailLink: "#"+ clipboard.on('error', function(e) {+ console.error('Link could not be copied!');+ console.error('Action:', e.action);+ console.error('Trigger:', e.trigger);});};diff --git a/web/js/map/datelinebuilder.js b/web/js/map/datelinebuilder.jsindex a01da6f57..c2d362e5b 100644--- a/web/js/map/datelinebuilder.js+++ b/web/js/map/datelinebuilder.js@@ -103,10 +103,11 @@ export function mapDateLineBuilder(models, config) {overlay: overlay,tooltip: tooltip};- return ReactDOM.render(+ var component = ReactDOM.render(React.createElement(ReactComponent, props),reactCase);+ return component;};/*