document.addEventListener('DOMContentLoaded', function () {
const replacements = {
'Affiliate Dashboard': 'Referral Dashboard',
'Affiliate URLs': 'Referral Links',
'Your Affiliate Link': 'Your Referral Link',
'Share this link to earn commissions.': 'Share this tracked link to earn from referrals.',
'Custom Link Generator': 'Custom Referral Link Generator',
'Create Custom Link': 'Create Referral Link'
};
function replaceText(node) {
if (node.nodeType === Node.TEXT_NODE) {
let text = node.nodeValue;
Object.keys(replacements).forEach(function (original) {
if (text.includes(original)) {
text = text.replaceAll(original, replacements[original]);
}
});
node.nodeValue = text;
return;
}
node.childNodes.forEach(replaceText);
}
function runReplacements() {
const targets = document.querySelectorAll(
'.affwp-affiliate-dashboard, .affwp-affiliate-area, .affwp-tab-content, .affwp-tab-wrapper, .affwp-affiliate-dashboard-tab'
);
targets.forEach(replaceText);
}
runReplacements();
setTimeout(runReplacements, 500);
setTimeout(runReplacements, 1500);
});