Quest Table - Kappa Mod

Adds a column to quest tables that show whether task is Kappa or not

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Quest Table - Kappa Mod
// @namespace    quest-eft-gamepedia
// @version      0.21
// @description  Adds a column to quest tables that show whether task is Kappa or not
// @author       PlatinumLyfe
// @match        https://escapefromtarkov.gamepedia.com/Quests
// @match        https://escapefromtarkov.fandom.com/wiki/Quests
// @grant        GM_addStyle
// @grant        GM_addElement
// @grant        GM_xmlhttpRequest
// @grant        none
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// ==/UserScript==

(function() {
    // We find the quests tables on the Quests page (there is one table for each trader)
    $('.mw-parser-output .wikitable').each(function(idx, itm) { 
        // In each Table we:

        // Add a column heading for Kappa AFTER Quest
        $(itm).find('tr:nth-child(2) th:first-child').after('<th>Kappa</th>');

        // Find each row in the table ('tr' aka tablerow element)
        $(itm).find('tr').each(function (idxi, tr) {

            // Find each table header cell in the tablerow
            $(tr).find('th').each(function(id, th) {
                var thx = $(th);

                if (!thx.attr('colspan')) {
                    // If this isn't a cell that has a column span
                    thx.find('a').each(function(i, a) {
                        // Find each hyperlink (so we can get the subpages off the wiki)
                        window.jQuery.get($(a).attr('href')).then(function (data) {
                            // Load the sub-pages for each task and find the table on the right that has whether it is kappa or not
                            thx.after($('<td>' + $(data).find('.mw-parser-output .va-infobox-group:nth-child(3) tr:last-child .va-infobox-content').html() + '</td>'));
                            // We insert it into the table
                        });
                    });
                } else if (thx.attr('colspan') == 10) {
                    // If this is the big column span cell that says things like "Prapor's quests", "Therapists Quests", etc.
                    // We need to make it go one bigger to accomodate the added Kappa cells
                    thx.attr('colspan', '11');
                }
            });
        });
    });
})();