From dcf6281afb525759fd8b8d4fbd1ef9af58ad9e24 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Thu, 17 Oct 2013 17:23:37 -0700 Subject: [PATCH] spotlight: Advance to next item if an ad fails to load. --- r2/r2/public/static/js/spotlight.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/r2/r2/public/static/js/spotlight.js b/r2/r2/public/static/js/spotlight.js index 7a6671734..d4ee26815 100644 --- a/r2/r2/public/static/js/spotlight.js +++ b/r2/r2/public/static/js/spotlight.js @@ -54,9 +54,6 @@ r.spotlight.requestPromo = function() { type: "POST", url: '/api/request_promo', timeout: 1000, - error: function() { - $('.organic-listing').hide() - }, data: { 'srnames': this.srnames, 'r': r.config.post_site @@ -128,7 +125,9 @@ r.spotlight._advance = function(dir) { }, 200) this.lineup.pos = nextPos - $.when($next).done(_.bind(function($next) { + + var $nextLoad = $.when($next) + $nextLoad.always(_.bind(function($next) { clearTimeout(showWorking) if (this.lineup.pos != nextPos) { @@ -136,7 +135,7 @@ r.spotlight._advance = function(dir) { return } - if (!$next) { + if ($nextLoad.isRejected() || !$next) { if (this.lineup.length > 1) { this._advance(dir || 1) return