ageverification.dev — Abbreviation Helper

Document is almost unreadable with all its acronyms and abbreviations

当前为 2025-07-27 提交的版本,查看 最新版本

// ==UserScript==
// @name         ageverification.dev — Abbreviation Helper
// @namespace    fabulous.cupcake.jp.net
// @version      2025.07.27.1
// @description  Document is almost unreadable with all its acronyms and abbreviations
// @author       FabulousCupcake
// @match        https://ageverification.dev/Technical%20Specification/architecture-and-technical-specifications/
// @grant        none
// ==/UserScript==

const ABBREVS = [
    ["AP", "Attestation Provider"],
    ["ARF", "Architecture and Reference Framework"],
    ["AV app", "Age Verification App"],
    ["AVI", "Age Verification App Instance"],
    ["AVAP", "Age Verification App Provider"],
    ["CA", "Certificate Authority"],
    ["DG CNECT", "Directorate General Network, Content and Technology"],
    ["eIDAS", "Electronic Identification, Authentication and Trust Services"],
    ["EU", "European Union"],
    ["EUDI", "European Digital Identity"],
    ["EUDIW /EUDI Wallet", "European Digital Identity Wallet"],
    ["LoA", "Level of Assurance"],
    ["U", "User"],
    ["RP", "Relying Party"],
    ["T-Scy", "Scytáles & T-Systems Age consortium"],
    ["WB", "Web Browser (or web app)"],
    ["ZKP", "Zero Knowledge Proof"],

    ["ETSI", "European Telecommunications Standards Institute"],
];

const applyAbbreviationHints = (string) => {
    let result = string;
    ABBREVS.forEach(a => {
        const [abbr, title] = a;
        const el = `<abbr title="${title}">${abbr}</abbr>`;
        const pattern = new RegExp(`([ (])${abbr}([ .,;?!)])`, "g");
        result = result.replaceAll(pattern, `$1${el}$2`);
    });

    return result;
}

const processAllParagraphs = () => {
    const paragraphs = Array.from(document.querySelectorAll(`article p`));
    paragraphs.forEach(p => {
        p.innerHTML = applyAbbreviationHints(p.innerHTML)
    });
}

const main = () => {
    processAllParagraphs();
}

main();