From c40a787868ebaba6be5bedd71343c33c2212d6d9 Mon Sep 17 00:00:00 2001 From: vBm Date: Mon, 28 Jul 2014 08:42:21 +0200 Subject: [PATCH] Don't try to calcaulate remaining number of shows if we're not on our profile --- remaining.episodes.followshows.user.js | 42 ++++++++++++++------------ 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/remaining.episodes.followshows.user.js b/remaining.episodes.followshows.user.js index 68b9f22..77978f9 100644 --- a/remaining.episodes.followshows.user.js +++ b/remaining.episodes.followshows.user.js @@ -7,8 +7,8 @@ // @oujs:author vBm // @supportURL https://github.com/vBm/snippets/issues // @include http://followshows.com/user/* -// @version 2 -// @date 22/07/2014 +// @version 3 +// @date 28/07/2014 // @grant none // ==/UserScript== @@ -23,20 +23,24 @@ $('#stats').append( ) ); -$.ajax({ - url: "http://followshows.com/home/watchlist", - cache: false, -}).done(function(data) { - 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'); - } -}); +if (!$('a.btn-follow-user').attr('user')) { + $.ajax({ + url: "http://followshows.com/home/watchlist", + cache: false, + }).done(function(data) { + 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'); + } + }); +} else { + $('.addic7ed').text('N/A'); +}