Greasy Fork

TvShowTime.com - Torrent SearchLink

Adds icon for searching tpb for episode

目前为 2016-12-29 提交的版本。查看 最新版本

// ==UserScript==
// @name         TvShowTime.com - Torrent SearchLink
// @namespace    codedevotion
// @version      0.1
// @description  Adds icon for searching tpb for episode
// @author       Kwickell
// @match        http://www.tvshowtime.com/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  $(document).ready(function(){
    // Shows
    var $shows = $('body').find('.posters-list > li');

    $shows.each(function(i,o){
      parseShow(o);
    });
  });

  function parseShow(show){
    var title = $(show).find('.episode-details > a').html();
    if(title){
      title = title.replace(/[^\w\s]/gi, '');
    }
    var episode = $(show).find('.episode-details > h2 > a').html();
    var epTitle = encodeURIComponent(title + ' ' + episode);
    // The url to point to
    var url = 'https://thepiratebay.org/search/'+epTitle + '/0/99/0';

    var button = '<a href="' + url + '" target="_blank" class="popover-link " title="" data-original-title="Search for trntz">'+
        '<i class="icon-tvst-putio_circle"></i>'+
        '</a>';

    $(show).find('.nav').prepend(button);
  }
})();