TraktTvNumberOfElements

Display the number of Shows on the progress page(s)

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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        TraktTvNumberOfElements
// @namespace   notableTieView
// @description Display the number of Shows on the progress page(s)
// @include    http://trakt.tv/users/*/progress
// @include    http://trakt.tv/users/*/progress**
// @require  https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=19641
// @version     1.1
// @grant       GM_addStyle
// ==/UserScript==

waitForKeyElements('#progress-wrapper div.container', execute);

function execute() {
  var foundShows = 0;
  paginationLis = $('.pagination-bottom ul.pagination li');
  n = paginationLis.length;
  numPages = n - 2;
  if ((paginationLis.length > 0) && !(paginationLis.eq(n - 1).hasClass('disabled'))) {
    ref = $(paginationLis).eq(n - 2).children().eq(0).attr('href');
    $.ajax({
      url: ref,
      success: function (responseData) {
        res = responseData;
        foundShows = $(res).find('.container').eq(3).children('div').length - 1;
      },
      async: false
    });
  } else {
    foundShows = $('#progress-wrapper>.container>div').length - 1; // the last div is pagination
  }
  numShows = foundShows;
  if (numPages > 0) {
    numShows = 60 * (numPages - 1) + foundShows;
  }
  $('#progress-wrapper div.container').prepend('<h1>'.concat(numShows).concat(' Shows</h1>'));
  $('#huckster-content-page').remove();
}