document.addEventListener("DOMContentLoaded", function() { const augmentedPaymentLinks = ["buygoods.com/secure/"] .sort(function(a,b) { return b.length - a.length }) .map(function(url) { return new RegExp("^https?://(.+\\.)?" + url, "i") }) for (let el of document.getElementsByTagName("A")) { const href = el.getAttribute("href") if (!href || href === "#") { continue } for (let url of augmentedPaymentLinks) { if (!url.test(href)) { continue } const params = [] for (const entry of [ [ "external_order_id", "e59515dd83eab25769fa13504eadb3dc" ], [ "external_order_id2", "24" ], [ "external_order_id3", "i" ], [ "external_order_id4", "gluco6.com" ], ]) { if (new RegExp("[?|&]" + entry[0] + "=", "i").test(href)) { continue } params.push(entry.join("=")) } if (!params.length) { continue } const glue = href.includes("?") ? "&" : "?" el.setAttribute("href", href + glue + params.join("&")) } } })