Skip to content

Commit

Permalink
Display "N/A" for count if we're not logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
vBm committed Jul 23, 2014
1 parent efbcabb commit 9485f5a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions remaining.episodes.followshows.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ $.ajax({
url: "http://followshows.com/home/watchlist",
cache: false,
}).done(function(data) {
var totalEpisodes = [];
$(data).find('.stats').each(function() {
totalEpisodes.push(parseInt($(this).text().match(/\d+/)[0], 10));
});
var totalEpisodesSum = totalEpisodes.reduce(function(a, b) {
return a + b;
});
$('.addic7ed').text(totalEpisodesSum);
var totalEpisodesSum, totalEpisodes = [];
if ($(data).find('.stats').size() !== 0 ) {
$(data).find('.stats').each(function() {
totalEpisodes.push(parseInt($(this).text().match(/\d+/)[0], 10));
});
totalEpisodesSum = totalEpisodes.reduce(function(a, b) {
return a + b;
});
$('.addic7ed').text(totalEpisodesSum);
} else {
$('.addic7ed').text('N/A');
}
});

0 comments on commit 9485f5a

Please sign in to comment.