Greasy Fork

Greasy Fork is available in English.

RARBG Filters for Movies and TV Shows [BETA]

Additional filters

当前为 2017-05-11 提交的版本,查看 最新版本

// ==UserScript==
// @name         RARBG Filters for Movies and TV Shows [BETA]
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  Additional filters
// @author       Kxmode
// @match        *://rarbg.to/*
// @grant        none
// @require      https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// ==/UserScript==

$(document).ready(function() {

    // TODO: Configuration possibility
    var showMoviesTVFilters = true;

    /* TODO: Filter Form [BETA]
    $("body").prepend("<style data-purpose='additional-styles-min-pricing-tampermonkey-script'>\n" +
                     ".header-huge                  { height: 280px; }\n" +
                     ".scope-sales .header-title    { margin-top: 80px; }\n" +
                     ".fancy-input                  { position: relative; background: #222; vertical-align: middle; margin: 15px 0 0 19px; padding: 5px 0; }\n" +
                     ".fancy-input input            { width: 100px; color: #9fbbcb; border: 1px solid #778c98; border-radius: 2px; background: 0 0; line-height: 16px; -webkit-appearance: none; -moz-appearance: none; appearance: none; font-weight: 400 }\n" +
                     ".fancy-input input::-webkit-input-placeholder { /* Chrome/Opera/Safari * / color: #9fbbcb; }\n" +
                     ".fancy-input input::-moz-placeholder { /* Firefox 19+ * / color: #9fbbcb; } \n" +
                     ".fancy-input input:-ms-input-placeholder { /* IE 10+ * /  color: #9fbbcb; } \n" +
                     ".fancy-input input:-moz-placeholder { /* Firefox 18- * /  color: #9fbbcb; } \n" +
                     ".fancy-input label            { line-height: 24px; color: #9fbbcb; padding-right: 20px; } \n" +
                     ".fancy-input span             { margin-top: -4px; color: #fff; background: rgba(60,96,145,.8); border-color: #778c98; line-height: 28px; padding: 0 12px; margin-left: 15px; }\n" +
                     ".fancy-input span:hover       { color: #fff; background: #4873a7; border-color: #4873a7; }\n" +
                     "</style>");

    $("#js-filters").append("<div class='clearfix'></div><div class='fancy-input text-center'><label>Min USD Filter:</label><input type='text' name='minprice' class='mindata' placeholder='X.XX'><span class='btn btn-sm jQmpFilter'>Update</span></div>");
    */

    // Iterates through line items
    $.each($(".lista a"), function(index, value) {
        var title = $(this).attr("title");

        /*
        * BEGIN: NON-CATEGORY =================================================================================================
        */

        // This section hides the icons [TODO: make this a form checkbox filter]
        $(".lista2t tr td:nth-of-type(1)").remove();

        /*
        * BEGIN: MOVIES AND TV =================================================================================================
        */

        if (showMoviesTVFilters)
        {
            // Skips torrents without titles
            if (title !== undefined)
            {
                // This section hides torrents with IMDB ratings equal to or lower than minRating [TODO: make this a form input filter]
                var minRating = 6.5;
                // Loop through every span tag inside the lista class anchor tag
                $.each($("span"), function(index, value) {
                    var ratings = $(this).text();
                    var imdb = ratings.indexOf("IMDB: ") + 6;
                    // Continue if this span has IMDB rating information
                    if (ratings !== undefined && imdb !== -1)
                    {
                        var rateValue = parseFloat(ratings.substring(imdb,ratings.length-3));
                        // Continue if this IMDB rating is a number
                        if (!isNaN(rateValue))
                        {
                            // Continue if the torrent's rating is equal to or less than the minRating
                            if (rateValue <= minRating)
                            {
                                $(this).parents(".lista2").remove();
                            }
                        }
                    }
                });
                // This section hides low-quality KORSUB torrents [TODO: make this a form checkbox filter]
                if (parseInt(title.indexOf("KORSUB")) > 0)
                {
                    $(this).parents(".lista2").remove();
                }
            }
        }

    });

    /*
    TODO: Filter counter [ALPHA]
    $(".container-sales").prepend("<div class='sales-section table-sales' id='min-usd-totals'>\n" +
                                  "<div class='pre-table-title' style='font-size: 15px;'>\n" +
                                  "<strong>357 products shown\n" +
                                  "<span class='pull-right'>135 products hidden</span>\n" +
                                  "</strong>\n" +
                                  "</div>\n" +
                                  "</div>");
    */
});