Filter Requests by Category

Adds a dropdown to filter the requests search by category.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Filter Requests by Category
// @namespace    pxgamer
// @version      0.3
// @description  Adds a dropdown to filter the requests search by category.
// @author       pxgamer
// @include      *kat.cr/request/search/*
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

(function() {
    'use strict';

    // Allows you to save your last used value over tabs.
    var saveVal = false;

    $('.buttonsline.floatleft').append(' <select class="sortReqsOpt" style="vertical-align: middle;letter-spacing: 0px; width: 160px !important;"><option value="All">All</option><option value="Movies">Movies</option><option value="TV">TV</option><option value="Music">Music</option><option value="Games">Games</option><option value="Applications">Applications</option><option value="Books">Books</option><option value="Anime">Anime</option><option value="Other">Other</option><option value="XXX">XXX</option><option value="Unassigned">Unassigned</option></select> <button class="siteButton bigButton sortReqs">Filter</button>');

    $('.sortReqs').on('click', function() {
        $('.request-item.ideaBox').show();
        GM_setValue('filterReqType', $('.sortReqsOpt').val());
        if ($('.sortReqsOpt').val() != 'All') {
            $('h6.lightgrey a[href^="/request/popular/"]').each(function() {
                if ($(this).text() != $('.sortReqsOpt').val()) {
                    $(this).parent().parent().parent().hide();
                }
            });
        }
    });

    if (saveVal) {
        var fType = GM_getValue('filterReqType', 'All');
        $('.request-item.ideaBox').show();
        if (fType != 'All') {
            $('h6.lightgrey a[href^="/request/popular/"]').each(function() {
                if ($(this).text() != fType) {
                    $(this).parent().parent().parent().hide();
                }
            });
        }
    }
})();