r/piracyArchive Auto Base64 Decoder - reddit

Automatically Decode Base64 encoded links on reddit r/piracyArchive

目前為 2023-06-26 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         r/piracyArchive Auto Base64 Decoder - reddit
// @namespace    http://tampermonkey.net/
// @version      1.0.4
// @description  Automatically Decode Base64 encoded links on reddit r/piracyArchive
// @author       KloudEZ_Support
// @match        *://**/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=reddit.com
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';
    const base64Regex = /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{20,})$/g

    setInterval(() => {
        const pTags = document.querySelectorAll('p')


        pTags.forEach(pTag => {
            const pTagText = pTag.innerText.split(/\s+/);

            pTagText.forEach(text => {
                if (base64Regex.test(text)) {
                    pTag.innerText = pTag.innerText.replace(text, atob(text));
                    const txt = pTag.innerText.split("\n");
                    const links = [];
                    txt.forEach(link => {
                        links.push("<div style='border: 1px dashed #e6e6e6;padding: 10px;background-image: linear-gradient(45deg, rgba(199,199,199,.25) 25%, rgba(227,227,227,.25) 25%, rgba(227,227,227,.25) 50%, rgba(199,199,199,.25) 50%, rgba(199,199,199,.25) 75%, rgba(227,227,227,.25) 75%, rgba(227,227,227,.25) 100%);background-size: 40px 40px'><a href='" + link + "'>" + link + "</a></div>");
                    });
                    pTag.outerHTML = links.join("\n");
                }
            });
        }


                     )
    }, 200)

    setInterval(() => {
        const h1Tags = document.querySelectorAll('h1')


        h1Tags.forEach(h1Tag => {
            const h1TagText = h1Tag.innerText.split(/\s+/);

            h1TagText.forEach(text => {
                if (base64Regex.test(text)) {
                    h1Tag.innerText = h1Tag.innerText.replace(text, atob(text));
                    const txt = h1Tag.innerText.split("\n");
                    const links = [];
                    txt.forEach(link => {
                        links.push("<a href='" + link + "'>" + link + "</a>");
                    });
                    h1Tag.outerHTML = links.join("\n");
                }
            });
        }


                     )
    }, 200)

    setInterval(() => {
        const h3Tags = document.querySelectorAll('h3')


        h3Tags.forEach(h3Tag => {
            const h3TagText = h3Tag.innerText.split(/\s+/);

            h3TagText.forEach(text => {
                if (base64Regex.test(text)) {
                    h3Tag.innerText = h3Tag.innerText.replace(text, atob(text));
                    const txt = h3Tag.innerText.split("\n");
                    const links = [];
                    txt.forEach(link => {
                        links.push("<a href='" + link + "'>" + link + "</a>");
                    });
                    h3Tag.outerHTML = links.join("\n");
                }
            });
        }


                     )
    }, 200)

setInterval(() => {
        const h2Tags = document.querySelectorAll('h2')


        h2Tags.forEach(h2Tag => {
            const h2TagText = h2Tag.innerText.split(/\s+/);

            h2TagText.forEach(text => {
                if (base64Regex.test(text)) {
                    h2Tag.innerText = h2Tag.innerText.replace(text, atob(text));
                    const txt = h2Tag.innerText.split("\n");
                    const links = [];
                    txt.forEach(link => {
                        links.push("<a href='" + link + "'>" + link + "</a>");
                    });
                    h2Tag.outerHTML = links.join("\n");
                }
            });
        }


                     )
    }, 200)

setInterval(() => {
        const h4Tags = document.querySelectorAll('h4')


        h4Tags.forEach(h4Tag => {
            const h4TagText = h4Tag.innerText.split(/\s+/);

            h4TagText.forEach(text => {
                if (base64Regex.test(text)) {
                    h4Tag.innerText = h4Tag.innerText.replace(text, atob(text));
                    const txt = h4Tag.innerText.split("\n");
                    const links = [];
                    txt.forEach(link => {
                        links.push("<a href='" + link + "'>" + link + "</a>");
                    });
                    h4Tag.outerHTML = links.join("\n");
                }
            });
        }


                     )
    }, 200)

})();