Scryfall Deck Cat

Cat maker ))

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Scryfall Deck Cat
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Cat maker ))
// @author       kaur
// @match        https://scryfall.com/*/decks*
// @icon         https://www.google.com/s2/favicons?domain=scryfall.com
// @grant        none
// @license MIT 
// ==/UserScript==

var thStyles = {
    "backgroundColor": "#2B253A",
    "padding": "6px 0px 6px 10px",
    "color": "#fff"
};

var tableStyles = {
    "max-width": "100%",
    "width": "100%",
    "margin-left": "0"
};

$(".control-panel-table thead").addClass("catless_table"); //добавление класса первой шапке
$(".control-panel-table > tbody > tr").each(function() { //перебор строк таблицы
    var deckLink = $(this).find("td:first > a"); // ищем строку с названием колоды
    var CategoryName = deckLink.text(); // преобразуем в текст
    CategoryName=CategoryName.substring(CategoryName.lastIndexOf("[") + 1,CategoryName.lastIndexOf("]")); //обрезаем категорию по квадратным скобкам

    if (CategoryName!="") {
        if (!$("*").is("."+CategoryName.toLowerCase()+"_table")) { //проверяем наличие категории, если нет - создаем
            $(".catless_table").before("<thead class='"+CategoryName.toLowerCase()+"_table'><tr><th>["+CategoryName+"] Deck</th> <th>Colors</th> <th>Owner</th> <th>Last Updated</th> <th></th></tr></thead> <tbody></tbody>");
        }
        $("."+CategoryName.toLowerCase()+"_table + tbody").append(this); //аппенд строки в соответствующей категории
    }
    $(".control-panel-table").css(tableStyles);
    $(".control-panel-table th").css(thStyles);//стили заголовков
    //очистка названий колод от категорий
    var new_deckLink = deckLink.html().replace("["+CategoryName+"]","");
    deckLink.html(new_deckLink);
});