r/piracyArchive Auto Base64 Decoder - reddit

Automatically Decode Base64 encoded links on reddit r/piracyArchive

当前为 2023-06-26 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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)

})();