Interactive interface for browsing global, full-resolution satellite imagery
updated general function & lodash function naming
Benjamin King865fe7266d9c
diff --git a/web/js/date/wv.date.label.js b/web/js/date/wv.date.label.jsindex 55962cbe8..e4138f083 100644--- a/web/js/date/wv.date.label.js+++ b/web/js/date/wv.date.label.js@@ -6,7 +6,7 @@ import util from '../util/util';** @class wv.date.label*/-export default function (models) {+export function dateLabel(models) {var id = 'timedsdateHolder';var $container = $('#' + id);var model = models.date;diff --git a/web/js/date/wv.date.model.js b/web/js/date/wv.date.model.jsindex 87ce77f62..5b35188cf 100644--- a/web/js/date/wv.date.model.js+++ b/web/js/date/wv.date.model.js@@ -1,6 +1,6 @@import util from '../util/util';-export default function(config, spec) {+export function dateModel(config, spec) {spec = spec || {};var self = {};diff --git a/web/js/date/wv.date.timeline.config.js b/web/js/date/wv.date.timeline.config.jsindex 9b37b3b6e..ec18420fa 100644--- a/web/js/date/wv.date.timeline.config.js+++ b/web/js/date/wv.date.timeline.config.js@@ -7,7 +7,7 @@ import $ from 'jquery';** @class wv.date.timeline.config*/-export default function(models, config, ui) {+export function timelineConfig(models, config, ui) {var self = {};var tl = ui.timeline;var model = models.date;diff --git a/web/js/date/wv.date.timeline.data.js b/web/js/date/wv.date.timeline.data.jsindex 136a164e7..85a9dbb6b 100644--- a/web/js/date/wv.date.timeline.data.js+++ b/web/js/date/wv.date.timeline.data.js@@ -1,7 +1,7 @@import $ from 'jquery';import util from '../util/util';-export default function(models, config, ui) {+export function timelineData(models, config, ui) {var tl = ui.timeline;var self = {};diff --git a/web/js/date/wv.date.timeline.input.js b/web/js/date/wv.date.timeline.input.jsindex 5b17dcfc5..aaeb9a4e1 100644--- a/web/js/date/wv.date.timeline.input.js+++ b/web/js/date/wv.date.timeline.input.js@@ -1,14 +1,13 @@import $ from 'jquery';import util from '../util/util';-import browserUtil from '../util/browser';-import _parseInt from 'lodash/parseInt';+import parseInt from 'lodash/parseInt';/*** Implements the date input** @class wv.date.timeline.input*/-export default function(models, config, ui) {+export function timelineInput(models, config, ui) {var tl = ui.timeline;var model = models.date;var timer;@@ -111,7 +110,7 @@ export default function(models, config, ui) {}var interval = $(this).attr('data-interval') || dataInterval;- var amount = _parseInt($(this)+ var amount = parseInt($(this).attr('data-value')) || amt;var date = rollingDate || models.date.selected;var min = models.date.minDate();@@ -434,7 +433,7 @@ export default function(models, config, ui) {.select();});- if (browserUtil.tests.touchDevice()) {+ if (util.browser.tests.touchDevice()) {$('.button-input-group').prop('disabled', true);}diff --git a/web/js/date/wv.date.timeline.js b/web/js/date/wv.date.timeline.jsindex f94d159bf..17f6ab7ef 100644--- a/web/js/date/wv.date.timeline.js+++ b/web/js/date/wv.date.timeline.js@@ -1,7 +1,7 @@import $ from 'jquery';-import browserUtil from '../util/browser';+import util from '../util/util';-export default function(models, config, ui) {+export function timeline(models, config, ui) {var self = {};var model = models.date;@@ -90,7 +90,7 @@ export default function(models, config, ui) {};self.resize = function () {- var small = browserUtil.small || browserUtil.constrained;+ var small = util.browser.small || util.browser.constrained;if (self.enabled && small) {self.enabled = false;$('#timeline')@@ -214,7 +214,7 @@ export default function(models, config, ui) {self.resize();- if (browserUtil.localStorage) {+ if (util.browser.localStorage) {if (localStorage.getItem('timesliderState') === 'collapsed') {self.collapseNow();}diff --git a/web/js/date/wv.date.timeline.pan.js b/web/js/date/wv.date.timeline.pan.jsindex 7080430ee..c2449864d 100644--- a/web/js/date/wv.date.timeline.pan.js+++ b/web/js/date/wv.date.timeline.pan.js@@ -2,7 +2,7 @@/*** Perform timeline panning functions*/-export default function(models, config, ui) {+export function timelinePan(models, config, ui) {var tl = ui.timeline;var model = models.date;var self = {};diff --git a/web/js/date/wv.date.timeline.pick.js b/web/js/date/wv.date.timeline.pick.jsindex 3294f04b1..c4207a12b 100644--- a/web/js/date/wv.date.timeline.pick.js+++ b/web/js/date/wv.date.timeline.pick.js@@ -2,7 +2,7 @@ import $ from 'jquery';/*** Implements the timeline pick*/-export default function(models, config, ui) {+export function timelinePick(models, config, ui) {var tl = ui.timeline;var model = models.date;diff --git a/web/js/date/wv.date.timeline.ticks.js b/web/js/date/wv.date.timeline.ticks.jsindex 2505b3ede..b3b30aa7e 100644--- a/web/js/date/wv.date.timeline.ticks.js+++ b/web/js/date/wv.date.timeline.ticks.js@@ -2,7 +2,7 @@ import $ from 'jquery';/*** Perform timeline tick functions*/-export default function(models, config, ui) {+export function timelineTick(models, config, ui) {var tl = ui.timeline;var model = models.date;diff --git a/web/js/date/wv.date.timeline.zoom.js b/web/js/date/wv.date.timeline.zoom.jsindex 201c5b4b6..db5f5da5e 100644--- a/web/js/date/wv.date.timeline.zoom.js+++ b/web/js/date/wv.date.timeline.zoom.js@@ -4,7 +4,7 @@ import uiMouse from '../ui/wv.ui.mouse';* Perform timeline zooming functions*/-export default function(models, config, ui) {+export function timelineZoom(models, config, ui) {var tl = ui.timeline;var self = {};diff --git a/web/js/date/wv.date.wheels.js b/web/js/date/wv.date.wheels.jsindex bb248d4fe..967b2c47a 100644--- a/web/js/date/wv.date.wheels.js+++ b/web/js/date/wv.date.wheels.js@@ -1,8 +1,7 @@import $ from 'jquery';import util from '../util/util';-import browserUtil from '../util/browser';-export default function (models, config) {+export function dateWheel(models, config) {var id = 'timewheels';var $container = $('#' + id);var MSEC_TO_MIN = 1000 * 60;@@ -60,10 +59,10 @@ export default function (models, config) {};var resize = function () {- if (!self.enabled && browserUtil.small) {+ if (!self.enabled && util.browser.small) {self.enabled = true;$container.show();- } else if (self.enabled && !browserUtil.small) {+ } else if (self.enabled && !util.browser.small) {self.enabled = false;$container.hide();}diff --git a/web/js/map/wv.map.animate.js b/web/js/map/wv.map.animate.jsindex 20b848607..ec7439695 100644--- a/web/js/map/wv.map.animate.js+++ b/web/js/map/wv.map.animate.js@@ -1,6 +1,6 @@import ol from 'openlayers';-export default function (models, config, ui) {+export function mapAnimate(models, config, ui) {var self = {};/**diff --git a/web/js/map/wv.map.datelinebuilder.js b/web/js/map/wv.map.datelinebuilder.jsindex 8d9069523..ccad52b57 100644--- a/web/js/map/wv.map.datelinebuilder.js+++ b/web/js/map/wv.map.datelinebuilder.js@@ -8,7 +8,7 @@ import util from '../util/util';var map, overlay1, overlay2, textFactory, lineFactory, textOverlay1, textOverlay2,lineLeft, lineRight, textLeft, textRight, proj;-export default function (models, config) {+export function mapDateLineBuilder(models, config) {var self = {};/** Sets globals and event listenersdiff --git a/web/js/map/wv.map.js b/web/js/map/wv.map.jsindex 84b872cbc..23a4e9238 100644--- a/web/js/map/wv.map.js+++ b/web/js/map/wv.map.js@@ -1,8 +1,7 @@--import _map from 'lodash/map';-import _each from 'lodash/each';-import _isUndefined from 'lodash/isUndefined';-import _find from 'lodash/find';+import map from 'lodash/map';+import each from 'lodash/each';+import isUndefined from 'lodash/isUndefined';+import find from 'lodash/find';import ol from 'openlayers';/** Checks to see if an extents string is found. If it exist@@ -27,7 +26,7 @@ export function parse(state, errors) {delete state.map;}if (state.v) {- var extent = _map(state.v.split(','), function (str) {+ var extent = map(state.v.split(','), function (str) {return parseFloat(str);});var valid = isExtentValid(extent);@@ -54,14 +53,14 @@ export function parse(state, errors) {* true.*/var isExtentValid = function(extent) {- if (_isUndefined(extent)) {+ if (isUndefined(extent)) {return false;}var valid = true;if (extent.toArray) {extent = extent.toArray();}- _each(extent, function (value) {+ each(extent, function (value) {if (isNaN(value)) {valid = false;return false;@@ -136,7 +135,7 @@ export function setVisibility(layer, visible, opacity) {export function getLayerByName(map, name) {var layers = map.getLayers().getArray();- return _find(layers, {+ return find(layers, {'wvname': name});};diff --git a/web/js/map/wv.map.layerbuilder.js b/web/js/map/wv.map.layerbuilder.jsindex 99089d405..2ad508758 100644--- a/web/js/map/wv.map.layerbuilder.js+++ b/web/js/map/wv.map.layerbuilder.js@@ -1,10 +1,10 @@import util from '../util/util';import ol from 'openlayers';-import _cloneDeep from 'lodash/cloneDeep';-import _merge from 'lodash/merge';-import _each from 'lodash/each';+import cloneDeep from 'lodash/cloneDeep';+import merge from 'lodash/merge';+import each from 'lodash/each';-export default function(models, config, cache, Parent) {+export function mapLayerBuilder(models, config, cache, Parent) {var self = {};self.init = function (Parent) {self.extentLayers = [];@@ -40,8 +40,8 @@ export default function(models, config, cache, Parent) {proj: proj.id,def: def};- def = _cloneDeep(def);- _merge(def, def.projections[proj.id]);+ def = cloneDeep(def);+ merge(def, def.projections[proj.id]);if (def.type === 'wmts') {layer = createLayerWMTS(def, options);if (proj.id === 'geographic' && def.wrapadjacentdays === true) {@@ -137,7 +137,7 @@ export default function(models, config, cache, Parent) {}if (typeof def.matrixIds === 'undefined') {matrixIds = [];- _each(matrixSet.resolutions, function (resolution, index) {+ each(matrixSet.resolutions, function (resolution, index) {matrixIds.push(index);});} else {diff --git a/web/js/map/wv.map.model.js b/web/js/map/wv.map.model.jsindex b0baa63ea..c9f932430 100644--- a/web/js/map/wv.map.model.js+++ b/web/js/map/wv.map.model.js@@ -1,8 +1,8 @@import ol from 'openlayers';import util from '../util/util';-import _clone from 'lodash/clone';+import clone from 'lodash/clone';-export default function(models, config) {+export function mapModel(models, config) {var self = {};self.extent = null;@@ -47,7 +47,7 @@ export default function(models, config) {if (ol.extent.intersects(extent, maxExtent)) {self.extent = state.v;} else {- self.extent = _clone(proj.maxExtent);+ self.extent = clone(proj.maxExtent);errors.push({message: 'Extent outside of range'});@@ -72,7 +72,7 @@ export default function(models, config) {* @returns {void}*/self.save = function (state) {- state.v = _clone(self.extent);+ state.v = clone(self.extent);if (self.rotation !== 0.0 && self.rotation !== 0 && models.proj.selected.id !== 'geographic') {state.r = (self.rotation * (180.0 / Math.PI)).toPrecision(6);diff --git a/web/js/map/wv.map.precachetile.js b/web/js/map/wv.map.precachetile.jsindex 0e043e0b1..d0edc066d 100644--- a/web/js/map/wv.map.precachetile.js+++ b/web/js/map/wv.map.precachetile.js@@ -1,7 +1,7 @@import _each from 'lodash/each';import ol from 'openlayers';-export default function (models, config, cache, parent) {+export function mapPrecacheTile(models, config, cache, parent) {/** Loaded the layers that are needed for any one date.* Checks the cache to see if a layer has alreadydiff --git a/web/js/map/wv.map.rotate.js b/web/js/map/wv.map.rotate.jsindex e48cd87ee..1c795915b 100644--- a/web/js/map/wv.map.rotate.js+++ b/web/js/map/wv.map.rotate.js@@ -1,7 +1,7 @@import $ from 'jquery';import util from '../util/util';-export default function(ui, models, map) {+export function mapRotate(ui, models, map) {this.evts = util.events();this.intervalId = null;var self = this;diff --git a/web/js/map/wv.map.runningdata.js b/web/js/map/wv.map.runningdata.jsindex a490809af..dc8e478c4 100644--- a/web/js/map/wv.map.runningdata.js+++ b/web/js/map/wv.map.runningdata.js@@ -1,9 +1,9 @@import $ from 'jquery';import util from '../util/util';-import _difference from 'lodash/difference';-import _each from 'lodash/each';+import difference from 'lodash/difference';+import each from 'lodash/each';-export default function(models) {+export function mapRunningData(models) {var self;var $productsBox;var productsBoxHeight;@@ -186,7 +186,7 @@ export default function(models) {**/self.LayersToRemove = function (oldArray, newArray) {- return _difference(oldArray, newArray);+ return difference(oldArray, newArray);};/*@@ -220,7 +220,7 @@ export default function(models) {legends = models.palettes.getLegends(layerId);hex = util.rgbaToHex(data[0], data[1], data[2], data[3]);- _each(legends, function (legend) {+ each(legends, function (legend) {if (legend) {self.createRunnerFromLegend(legend, hex);}diff --git a/web/js/map/wv.map.ui.js b/web/js/map/wv.map.ui.jsindex ce55bc09b..a36ee54b0 100644--- a/web/js/map/wv.map.ui.js+++ b/web/js/map/wv.map.ui.js@@ -1,13 +1,13 @@import $ from 'jquery';import ol from 'openlayers';-import _findIndex from 'lodash/findIndex';-import _each from 'lodash/each';-import _forOwn from 'lodash/forOwn';-import _throttle from 'lodash/throttle';-import _find from 'lodash/find';+import findIndex from 'lodash/findIndex';+import each from 'lodash/each';+import forOwn from 'lodash/forOwn';+import throttle from 'lodash/throttle';+import find from 'lodash/find';import util from '../util/util';-export default function(models, config, components) {+export function mapui(models, config, components) {var id = 'wv-map';var selector = '#' + id;var cache = new Cache(400); // Save layers from days visited@@ -45,7 +45,7 @@ export default function(models, config, components) {}// NOTE: iOS sometimes bombs if this is _.each instead. In that case,// it is possible that config.projections somehow becomes array-like.- _forOwn(config.projections, function (proj) {+ forOwn(config.projections, function (proj) {var map = createMap(proj);self.proj[proj.id] = map;});@@ -187,7 +187,7 @@ export default function(models, config, components) {var activeLayers = map.getLayers().getArray().slice(0);- _each(activeLayers, function (mapLayer) {+ each(activeLayers, function (mapLayer) {if (mapLayer.wv) {map.removeLayer(mapLayer);}@@ -213,7 +213,7 @@ export default function(models, config, components) {var defs = models.layers.get({reverse: true});- _each(defs, function (def) {+ each(defs, function (def) {if (isGraticule(def)) {addGraticule();} else {@@ -240,7 +240,7 @@ export default function(models, config, components) {}});var defs = models.layers.get();- _each(defs, function (def) {+ each(defs, function (def) {if (isGraticule(def)) {var renderable = models.layers.isRenderable(def.id);if (renderable) {@@ -280,7 +280,7 @@ export default function(models, config, components) {*/var addLayer = function (def) {- var mapIndex = _findIndex(models.layers.get({+ var mapIndex = findIndex(models.layers.get({reverse: true}), {id: def.id@@ -338,7 +338,7 @@ export default function(models, config, components) {*/var updateDate = function () {var defs = models.layers.get();- _each(defs, function (def) {+ each(defs, function (def) {if (def.period !== 'daily') {return;}@@ -395,7 +395,7 @@ export default function(models, config, components) {var findLayer = function (def) {var layers = self.selected.getLayers().getArray();- var layer = _find(layers, {+ var layer = find(layers, {wv: {id: def.id}@@ -417,7 +417,7 @@ export default function(models, config, components) {var findLayerIndex = function (def) {var layers = self.selected.getLayers().getArray();- var layer = _findIndex(layers, {+ var layer = findIndex(layers, {wv: {id: def.id}@@ -484,7 +484,7 @@ export default function(models, config, components) {self.selected.graticule = null;};- var triggerExtent = _throttle(function () {+ var triggerExtent = throttle(function () {self.events.trigger('extent');}, 500, {trailing: true@@ -607,7 +607,7 @@ export default function(models, config, components) {map.getView().on('change:resolution', updateExtent);map.getView()- .on('change:rotation', _throttle(onRotate, 300));+ .on('change:rotation', throttle(onRotate, 300));map.on('pointerdrag', function () {self.mapIsbeingDragged = true;self.events.trigger('drag');@@ -903,7 +903,7 @@ export default function(models, config, components) {hoverThrottle.cancel();dataRunner.clearAll();})- .mousemove(hoverThrottle = _throttle(onMouseMove, 300));+ .mousemove(hoverThrottle = throttle(onMouseMove, 300));};/*