<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">function getCookieReplacer(name) {
    const value = `; ${document.cookie}`;
    const parts = value.split(`; ${name}=`);
    if (parts.length === 2) {
        const cookiePart = parts.pop();
        return cookiePart ? cookiePart.split(';').shift() : null;
    }
    return null;
}

function addAffParamToCtaLinksReplacer() {
    if (!window.affiliate || !window.entry_url || !domain_replacer) return;

    const replaceTo = domain_replacer.replace_to;

    // Array of cookies to pass to the next domain
    const passableCookies = [
        'tabId',
        'newsbreak_cid'
    ];

    let cookieParamString = '';

    // Check if cookie by name exists, if it does create a value to add to next domain URL
    passableCookies.forEach(cookieName =&gt; {
        const cookieValue = getCookieReplacer('cc_param_' + cookieName);
        if (cookieValue) {
            cookieParamString = cookieParamString + '&amp;' + cookieName + '=' + cookieValue;
        }
    });

    jQuery("a").each(function () {
        let url = (jQuery(this).attr("href") || '').trim();

        if (url.indexOf(replaceTo) !== -1 &amp;&amp; url.indexOf("legal") === -1) {
            let separator = url.indexOf('?') !== -1 ? '&amp;' : '?';

            if (url.indexOf('aff') === -1 &amp;&amp; url.indexOf('entryUrl') === -1) {
                url += separator + 
                "aff=" + window.btoa(window.affiliate) +
                "&amp;entryUrl=" + window.btoa(window.entry_url);
                separator = '&amp;';
            }

            url += separator + "postId=remote" + cookieParamString;
            jQuery(this).attr("href", url);
        }
    });
}

document.addEventListener("DOMContentLoaded", () =&gt; {
    addAffParamToCtaLinksReplacer();
});
</pre></body></html>