Greasy Fork

Trakt Downloader

Trakt.tv Watchlist download buttons.

目前为 2016-03-15 提交的版本。查看 最新版本

// ==UserScript==
// @name         Trakt Downloader
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Trakt.tv Watchlist download buttons.
// @author       Tusk
// @match        https://trakt.tv/*
// @grant        none
// @require      https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.12.0/moment.min.js
// ==/UserScript==
/* jshint -W097 */
'use strict';

$('.actions').each(function(index) {
    var $this = $(this),
        $grid_item = $this.parents('.grid-item'),
        name_of_item = $grid_item.find('h3').text(),
        released = $grid_item.data('released'),
        has_movie = $grid_item.find('.collect').hasClass('selected'),
        release_date = moment($grid_item.data('released'));

    if(!has_movie && released && release_date <= moment()) {
        $(this).append('<a href="https://kat.cr/usearch/' + name_of_item + ' 720p/?field=time_add&sorder=desc" target="_blank"><img src="http://teachingresources.grantadesign.com/images/icons/icon-circle-arrow-down_grey.png" style="width: 25px;height: 25px;margin-top:-5px;" /></a>');
    }
});