Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Fixed some JS and jquery syntax

Edmond Lee59c2758231a8
diff --git a/web/js/ui/wv.ui.indicator.js b/web/js/ui/wv.ui.indicator.js
index a2fb01a31..e5d1eddb9 100644
--- a/web/js/ui/wv.ui.indicator.js
+++ b/web/js/ui/wv.ui.indicator.js
@@ -25,8 +25,8 @@ wv.ui.indicator = wv.ui.indicator || (function() {
var init = function() {
$indicator = $("<div></div>")
.attr("id", "indicator");
- $icon = $("<img></img>");
- $message = $("<span></span");
+ $icon = $("<img />");
+ $message = $("<span></span>");
$indicator.append($icon).append($message).hide();
$("body").append($indicator);
diff --git a/web/js/ui/wv.ui.info.js b/web/js/ui/wv.ui.info.js
index cf574ef49..58ef05cee 100644
--- a/web/js/ui/wv.ui.info.js
+++ b/web/js/ui/wv.ui.info.js
@@ -18,7 +18,7 @@ wv.ui = wv.ui || {};
wv.ui.info = wv.ui.info || (function(ui, config) {
var selector = "#wv-info-button";
- var $button = $("<input></input>")
+ var $button = $("<input />")
.attr("type", "checkbox")
.attr("id", "wv-info-button-check");
var $label = $("<label></label>")
@@ -111,7 +111,7 @@ wv.ui.info = wv.ui.info || (function(ui, config) {
ui.tour.start();
});
- $("#wv-toolbar input:not(#wv-info-button-check)")
+ $("#wv-toolbar").find("input:not(#wv-info-button-check)")
.prop("checked", false)
.button("refresh");
$menuItems.show("slide", { direction: "up" });
@@ -122,7 +122,7 @@ wv.ui.info = wv.ui.info || (function(ui, config) {
}
$menuItems.hide();
$("#wv-info-button-check").prop("checked", false);
- $("#wv-info-button label").removeClass("ui-state-hover");
+ $("#wv-info-button").find("label").removeClass("ui-state-hover");
$button.button("refresh");
$("body").off("click", clickOut).off("touchstart", clickOut);
};
diff --git a/web/js/ui/wv.ui.js b/web/js/ui/wv.ui.js
index 96174ab37..73f42a6e3 100644
--- a/web/js/ui/wv.ui.js
+++ b/web/js/ui/wv.ui.js
@@ -31,8 +31,7 @@ wv.ui = (function(self) {
* @method error
* @static
*
- * @param {string} message Message to display to the end user.
- * @param {exception} cause The exception object that caused the error
+ * @param {Exception} cause The exception object that caused the error
*/
self.error = function() {
console.error.apply(console, arguments);
@@ -56,7 +55,7 @@ wv.ui = (function(self) {
* @method notify
* @static
*
- * @param {string} The message to display to the user.
+ * @param {string} message The message to display to the user.
*
* @param [title="Notice"] {string} Title for the dialog box.
*/
@@ -187,7 +186,7 @@ wv.ui = (function(self) {
return getComponent(marker || "wv-menu", closeMenu);
};
- self.closeDialog = function(marker) {
+ self.closeDialog = function() {
self.close();
};
diff --git a/web/js/ui/wv.ui.mouse.js b/web/js/ui/wv.ui.mouse.js
index 48a35e88c..06cc9e66a 100644
--- a/web/js/ui/wv.ui.mouse.js
+++ b/web/js/ui/wv.ui.mouse.js
@@ -37,9 +37,9 @@ wv.ui.mouse.click = wv.ui.mouse.click || function($element, callback) {
};
var withinClickDistance = function(event) {
- targetX = event.clientX;
- targetY = event.clientY;
- distance = Math.sqrt(Math.pow(startX - targetX, 2) +
+ var targetX = event.clientX;
+ var targetY = event.clientY;
+ var distance = Math.sqrt(Math.pow(startX - targetX, 2) +
Math.pow(startY - targetY, 2));
return distance <= self.sensitivity;
};
diff --git a/web/js/util/wv.util.browser.js b/web/js/util/wv.util.browser.js
index 8ec92464e..369396637 100644
--- a/web/js/util/wv.util.browser.js
+++ b/web/js/util/wv.util.browser.js
@@ -52,7 +52,7 @@ wv.util.browser = wv.util.browser || (function() {
* value will be null.
*
* @attribute version
- * @type Integer
+ * @type Number
*/
self.version = null;
@@ -161,11 +161,7 @@ wv.util.browser = wv.util.browser || (function() {
return true;
}
// IE 11
- if ( navigator.appName === "Netscape" &&
- /Trident/.test(navigator.userAgent) ) {
- return true;
- }
- return false;
+ return navigator.appName === "Netscape" && /Trident/.test(navigator.userAgent);
};
self.tests.firefox = function() {
@@ -190,15 +186,11 @@ wv.util.browser = wv.util.browser || (function() {
if ( self.tests.safari() && self.tests.safariVersion() <= 6 ) {
return false;
}
- if ( self.tests.ie() ) {
- return false;
- }
- return true;
+ return !self.tests.ie();
};
self.tests.webWorkers = function() {
- if ( !self.tests.window("Worker") ) { return false; }
- return true;
+ return self.tests.window("Worker");
};
self.tests.localStorage = function() {
@@ -217,10 +209,7 @@ wv.util.browser = wv.util.browser || (function() {
};
self.tests.history = function() {
- if ( window.history && window.history.replaceState ) {
- return true;
- }
- return false;
+ return window.history && window.history.replaceState;
};
init();
@@ -445,13 +434,11 @@ if (!String.prototype.endsWith) {
// Set the div height
function setHeight($body) {
- var nua = navigator.userAgent;
if (navigator.userAgent.match(/(iPad|iPhone|iPod touch);.*CPU.*OS 6_\d/i)){
var new_height = $(window).height();
// if mobileSafari 6 add +60px
new_height += 60;
- $('#app').css('min-height', 0 );
- $('#app').css('height', new_height );
+ $('#app').css('min-height', 0).css('height', new_height);
}
else {
$("#app, .ui-mobile, .ui-mobile .ui-page").css("min-height", 0);
diff --git a/web/js/util/wv.util.js b/web/js/util/wv.util.js
index db45f082c..0ef4de154 100644
--- a/web/js/util/wv.util.js
+++ b/web/js/util/wv.util.js
@@ -37,7 +37,7 @@ wv.util = (function(self) {
};
self.repeat = function(value, length) {
- result = "";
+ var result = "";
for ( var i = 0; i < length; i++ ) {
result += value;
}
@@ -81,7 +81,7 @@ wv.util = (function(self) {
queryString = queryString.substring(1);
}
var parameters = queryString.split("&");
- result = {};
+ var result = {};
for ( var i = 0; i < parameters.length; i++ ) {
var index = parameters[i].indexOf("=");
var key = parameters[i].substring(0, index);
@@ -242,7 +242,7 @@ wv.util = (function(self) {
newDate.setUTCFullYear(newDate.getUTCFullYear() + amount);
break;
default:
- throw new Error("[dateAdd] Invalid interval: " + inverval);
+ throw new Error("[dateAdd] Invalid interval: " + interval);
}
return newDate;
};
@@ -416,7 +416,7 @@ wv.util = (function(self) {
* @method error
* @static
* @param {string} message Message to display to the end user.
- * @param {exception} cause The exception object that caused the error
+ * @param {Exception} cause The exception object that caused the error
*/
self.error = function(message, cause) {
wv.ui.error(message, cause);
@@ -455,7 +455,7 @@ wv.util = (function(self) {
*
* @class wv.util.ajaxCache
* @constructor
- * @param {Integer} [spec.size] maximum number of items to store in the
+ * @param {Number} [spec.size] maximum number of items to store in the
* cache.
* @param {Object} [spec.options] options to pass to jscache on setItem.
*
diff --git a/web/js/util/wv.util.load.js b/web/js/util/wv.util.load.js
index d51fa2e99..b812fb636 100644
--- a/web/js/util/wv.util.load.js
+++ b/web/js/util/wv.util.load.js
@@ -21,7 +21,7 @@ wv.util.load = wv.util.load || (function() {
var indicatorId = null;
self.config = function(root, attr, url) {
- promise = $.Deferred();
+ var promise = $.Deferred();
// If a request is already outstanding, chain to that one
if ( configPromises[url]) {
configPromises[url].done(promise.resolve).fail(promise.reject);
diff --git a/web/js/wv.debug.js b/web/js/wv.debug.js
index 6c6d607cc..b056a39e2 100644
--- a/web/js/wv.debug.js
+++ b/web/js/wv.debug.js
@@ -190,10 +190,7 @@ wv.debug.layers = wv.debug.layers || function(ui, models, config) {
if ( type === "dataDownload" && layer.product ) {
return true;
}
- if ( type === "layers" ) {
- return true;
- }
- return false;
+ return type === "layers";
};
var initLayers = function() {