Interactive interface for browsing global, full-resolution satellite imagery
Loading indicator shows up if Worldview takes longer than 2 seconds to start
Mike McGannd9f239c127c2
diff --git a/src/js/Worldview/Indicator.js b/src/js/Worldview/Indicator.jsindex 6149ccd33..1484b58b4 100644--- a/src/js/Worldview/Indicator.js+++ b/src/js/Worldview/Indicator.js@@ -1,10 +1,10 @@/** NASA Worldview- *+ ** This code was originally developed at NASA/Goddard Space Flight Center for- * the Earth Science Data and Information System (ESDIS) project.+ * the Earth Science Data and Information System (ESDIS) project.*- * Copyright (C) 2013 United States Government as represented by the+ * Copyright (C) 2013 United States Government as represented by the* Administrator of the National Aeronautics and Space Administration.* All Rights Reserved.*/@@ -13,30 +13,30 @@ Worldview.namespace("Indicator");/*** Displays an indicator on the screen.- *- * The indicator has an image and text associated with it. Use show to+ *+ * The indicator has an image and text associated with it. Use show to* display and hide to remove. Example:- *+ ** Worldview.Indicator.show("Please Wait", "images/wait.png");- *+ ** Only one indicator can be visibile at a time. If show is called while* another indicator is already active, it will be replaced.- *+ ** @module Worldview* @class Indicator* @static*/$(function() {-+var ns = Worldview.Indicator;-+/*** Shows the indicator with a message and an icon. If another indicator* is already active, this call will replace the other one.- *+ ** @method show* @static- *+ ** @param message {string} The message to display* @param icon {string} URL to the icon to display*/@@ -54,26 +54,26 @@ $(function() {"<div id='indicator' class='message'>",message,"</div>"- ].join("\n"));+ ].join("\n"));}};-+/*** Hides the indicator. If no indicator is displayed, this method does* nothing.- *+ ** @method hide* @static*/ns.hide = function() {$("#indicator").remove();};-+/*** Displays a "Searching" indicator. This is a convenience method for:- *+ ** Worldview.Indicator.show("Searching", "images/activity.gif")- *+ ** @method searching* @static*/@@ -81,17 +81,21 @@ $(function() {ns.show("Searching ECHO for Data", "images/activity.gif");};+ ns.loading = function() {+ ns.show("Loading", "images/activity.gif");+ };+/**- * Displays a "No data available" indicator. This is a convenience method+ * Displays a "No data available" indicator. This is a convenience method* for:- *+ ** Worldview.Indicator.show("No data available", "images/red-x.svg")- *+ ** @method noData* @static*/ns.noData = function() {ns.show("No Data Avaialble", "images/red-x.svg");- };-+ };+});diff --git a/src/js/main.js b/src/js/main.jsindex c60b89b09..c81e2bce8 100644--- a/src/js/main.js+++ b/src/js/main.js@@ -1,6 +1,7 @@$(function() {// Initialize "static" varsvar log = Logging.getLogger();+ var loaded = false;var entryPoint = function() {@@ -23,6 +24,7 @@ $(function() {// Initialize "static" vars// Place any resources that should be completely loaded before// starting up the UIWorldview.Preloader([+ "images/activity.gif",{ id: "config", type:"json",src: "data/config.json?v=" + Worldview.BUILD_NONCE },// FIXME: Projection cache HACK@@ -46,13 +48,19 @@ $(function() {// Initialize "static" vars"images/close-red-x.png","images/collapseDown.png","images/expandUp.png",- "images/activity.gif","images/wv-icons.svg","images/wv-logo.svg"]).execute(onLoad);+ setTimeout(function() {+ if ( !loaded ) {+ Worldview.Indicator.loading();+ }+ }, 2000);};var onLoad = function(queue) {+ loaded = true;+ Worldview.Indicator.hide();try {var config = queue.getResult("config");// FIXME: Projection cache HACK