Új hozzászólás Aktív témák

  • nevemfel

    senior tag

    válasz Archttila #10115 üzenetére

    Nálam ez a kód működik:

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    </head>
    <body>
    <a href="https://dereferer.me/?https://www.imdb.com/title/tt1448754/">Link 1</a>
    <script>
    (function () {
    'use strict';
    const REPLACEMENTS = {
    'dereferer.link': {
    pattern: /^https?:\/\/(?:www\.)?dereferer\.link\/\?(.+:\/\/.+)/,
    noreferrer: true,
    },
    'dereferer.me': {
    pattern: /^https?:\/\/(?:www\.)?dereferer\.me\/\?(.+:\/\/.+)/,
    noreferrer: true,
    },
    };
    for (const el of document.querySelectorAll('a')) {
    for (const [name, repl] of Object.entries(REPLACEMENTS)) {
    const match = repl.pattern.exec(el.href);
    if (match) {
    const origUrl = match[1];
    console.debug(`Dereferer Remover (${name}): replacing ${el.href} -> ${origUrl}`);
    el.href = origUrl;
    if (repl.noreferrer) {
    el.rel = 'noreferrer';
    }
    }
    }
    }
    }());
    </script>
    </body>
    </html>

Új hozzászólás Aktív témák

Hirdetés