TraktTvNumberOfElements

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

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 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();
}