Messages Count

Shows how many messages the current conversation has

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Messages Count
// @namespace    http://tampermonkey.net/
// @license      GPLv3
// @version      2025-08-12
// @description  Shows how many messages the current conversation has
// @author       none
// @match        https://redacted.sh/inbox.php?action=viewconv&id=*
// @icon         none
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // ##### Message Count ####

    // Function to add the messages label after the last message
    function insertAfter(referenceNode, newNode) {
        referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
    }

    // Get the number of messages
    var amountmsgs = document.querySelectorAll('.inbox_message').length;

    // Create the label to be added
    var msgslabel = document.createElement("h3");
    msgslabel.innerHTML = `Messages: ${amountmsgs}`;

    // Find the last message
    var ibmessages = document.querySelectorAll(".inbox_message");
    var lastmsg = ibmessages[ibmessages.length -1];
    // Add the label
    insertAfter(lastmsg, msgslabel);

    // #### Scroll to bottom automatically ####
    document.getElementById("messageform").scrollIntoView();
})();