FollowShows Remaining

Show a number of remaining episodes to watch

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name        FollowShows Remaining
// @namespace   followshows
// @description Show a number of remaining episodes to watch
// @icon        http://followshows.com/favicon.ico
// @author      vBm <[email protected]>
// @oujs:author vBm
// @license     The MIT License (MIT)
// @supportURL  https://github.com/vBm/snippets/issues
// @include     http://followshows.com/user/*
// @version     4.3
// @date        17/03/2015
// @grant       none
// ==/UserScript==

$('#stats').append(
	$('<div>').append(
		$('<span>').attr({
			class: 'addic7ed'
		}),
		$('<div>').attr({
			class: 'title'
		}).css(
			'cursor', 'pointer'
		).click(
			function() {
				prompt('Total count:', textPrep());
			}
		).text('EPISODES TO WATCH')
	)
);

function textPrep() {
	var numbers = $('#stats').text().match(/\d+/g),
	shows = numbers[0],
	watched = numbers[3],
	remain = numbers[4];
	return 'FollowShows stats: ' + shows + ' shows || ' + watched + ' episodes watched || ' + remain + ' episodes to watch';
}

if (!$('a.btn-follow-user').attr('user')) {
	$.ajax({
		url: '//' + document.location.hostname + '/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');
}