Mail recievers

Adds recievers to your mail inbox

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

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

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         Mail recievers
// @namespace    http://tampermonkey.net/
// @version      2024-11-03
// @description  Adds recievers to your mail inbox
// @author       You
// @match        https://www.warzone.com/Discussion/MyMail*
// @grant        none
// ==/UserScript==

(function() {
    let rows = document.getElementsByClassName("region")[0].tBodies[0].rows;
    for (let row of Array.from(rows).slice(1)) {
        processRow(row);
    }

    async function processRow(row) {
        let children = row.cells[0].children;
        if (children) {
            let url = children[0].href;
            let toLine = "\nsend to: " + await getNames(url);
            children[2].innerText += toLine;
        }
    }

    async function getNames(url) {
        let parser = new DOMParser();
        let names = [];
        let doc = await fetch(url).then(reply => reply.text()).then(text => parser.parseFromString(text, 'text/html'));
        let cell = doc.getElementsByTagName("Table")[0].rows[0].cells[0];
        for (let child of Array.from(cell.children).slice(2)){
            if (child.tagName == "BR") break;
            names.push(child.innerText.trim());
        }
        return names.join(", ");
    }
})();