diff --git a/src/404.html b/src/404.html index f5d2ef4cf..1ca4e9a88 100644 --- a/src/404.html +++ b/src/404.html @@ -7,7 +7,8 @@ require.config({ paths: { 'google-analytics': '//www.google-analytics.com/analytics', - 'analytics': 'js/components/analytics' + 'analytics': 'js/components/analytics', + 'jquery': '//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min' }, map: { 'analytics': { diff --git a/src/500.html b/src/500.html index c0a88357d..00d926adf 100644 --- a/src/500.html +++ b/src/500.html @@ -7,7 +7,8 @@ require.config({ paths: { 'google-analytics': '//www.google-analytics.com/analytics', - 'analytics': 'js/components/analytics' + 'analytics': 'js/components/analytics', + 'jquery': '//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min' }, map: { 'analytics': { diff --git a/src/js/apps/discovery/main.js b/src/js/apps/discovery/main.js index 1d71111b4..84c36d289 100644 --- a/src/js/apps/discovery/main.js +++ b/src/js/apps/discovery/main.js @@ -81,7 +81,7 @@ define(['config', 'module'], function(config, module) { } }).fail(function () { - app.redirect('/500.html'); + app.redirect('500.html'); }); }).fail(function() { @@ -90,7 +90,7 @@ define(['config', 'module'], function(config, module) { return } // if we failed loading, retry *once again* (and give up eventually) - app.reload('/404.html'); + app.reload('404.html'); }); }); diff --git a/src/js/mixins/discovery_bootstrap.js b/src/js/mixins/discovery_bootstrap.js index 72cf0367c..4131221c8 100644 --- a/src/js/mixins/discovery_bootstrap.js +++ b/src/js/mixins/discovery_bootstrap.js @@ -80,6 +80,7 @@ define([ // XXX:rca - solve this better, through config var beehive = this.getBeeHive(); var dynConf = this.getObject('DynamicConfig'); + var timeout = 3000; var defer = $.Deferred(); @@ -103,7 +104,8 @@ define([ pendingReqs--; if (pendingReqs <= 0) defer.resolve(retVal); }, - type: 'GET' + type: 'GET', + timeout: timeout - 1 }; var redirect_uri = location.origin + location.pathname; @@ -125,17 +127,16 @@ define([ }); setTimeout(function() { - if (defer.state() == 'resolved') - return; - defer.reject(); - }, - 3000); + if (defer.state() === 'resolved') { + return; + } + defer.reject(); + }, timeout); } else { setTimeout(function() { - defer.resolve({}), - 1 - }); + defer.resolve({}); + }, 1); } return defer; }, diff --git a/src/js/services/api.js b/src/js/services/api.js index b1517bdce..8e885c400 100644 --- a/src/js/services/api.js +++ b/src/js/services/api.js @@ -143,9 +143,13 @@ define([ context: {request: request, api: self }, timeout: this.defaultTimeoutInMs, headers: {}, - cache: true, // do not generate _ parameters (let browser cache responses), + cache: true // do not generate _ parameters (let browser cache responses), }; + if (options.timeout) { + opts.timeout = options.timeout; + } + if (this.clientVersion) { opts.headers['X-BB-Api-Client-Version'] = this.clientVersion; }