4chan Session ID Unbreaker

Tries to detect and un-break Session IDs posted on 4chan

Stan na 25-02-2024. Zobacz najnowsza wersja.

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         4chan Session ID Unbreaker
// @license      GPLv3
// @namespace    https://boards.4chan.org/
// @version      1.0
// @description  Tries to detect and un-break Session IDs posted on 4chan
// @author       ceodoe
// @match        https://boards.4chan.org/*/thread/*
// @match        https://boards.4chan.org/*/res/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=4chan.org
// @grant        none
// ==/UserScript==

function parsePosts() {
    let posts = document.querySelectorAll("blockquote.postMessage");
    for(let i = 0; i < posts.length; i++) {
        if(posts[i].getAttribute("data-4SIDU-parsed") !== "1") {
            let idStartIndex = posts[i].innerText.indexOf("05");
            if(idStartIndex > -1) {
                let id = posts[i].innerText.substring(idStartIndex).replace(/[^A-Fa-f0-9]/g, "").substring(0, 66);
                let html = `
                    <div style="margin-top: 1em; border-top: 1px solid; padding: 0.5em;">
                        <span style="color: #66cc33; font-weight: bold;">Session ID:</span> ${id}
                    </div>
                `;

                posts[i].insertAdjacentHTML("beforeend", html);
                posts[i].setAttribute("data-4SIDU-parsed", "1");
            }
        }
    }
}

let observer = new MutationObserver(function(event) {
    parsePosts();
});

observer.observe(document.querySelector("div.thread"), {childList: true});

parsePosts();