From 4a8f604da2876e11dbc90beeffba5278abf897b8 Mon Sep 17 00:00:00 2001 From: zer0kool Date: Tue, 20 Aug 2024 21:10:05 -0700 Subject: [PATCH] Pass domainName to createDefaultCard --- fetchOrigin.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fetchOrigin.js b/fetchOrigin.js index b6c8e6c..3b3ae3d 100644 --- a/fetchOrigin.js +++ b/fetchOrigin.js @@ -93,6 +93,10 @@ function process(formFactor, origin) { const data = buildCard(labeledMetrics, origin, network, dates); } +function extractDomainName(origin) { + return origin.replace(/^https?:\/\//, '').split('.')[1]; +} + function buildCard(labeledMetrics, origin, network, dates) { network = network ?? "default"; const favicon = `https://${origin}/favicon.ico`; @@ -102,7 +106,7 @@ function buildCard(labeledMetrics, origin, network, dates) { const domainName = extractDomainName(origin); // Ensure domainName is defined here if (network === "default") { - const card = createDefaultCard(cardTitle, favicon, siteName, sumId, phoneId, desktopId, tabletId, dates, domainName); + const card = createDefaultCard(cardTitle, favicon, siteName, sumId, phoneId, desktopId, tabletId, dates, origin, domainName); // Pass domainName to createDefaultCard document.querySelector('#cruxorigin #app').insertAdjacentHTML("afterbegin", card); setupRemoveCardAction(siteName); document.querySelector("#cruxorigin #loading").style.display = "none"; @@ -140,10 +144,6 @@ function generateIds(siteName, network) { }; } -function extractDomainName(origin) { - return origin.replace(/^https?:\/\//, '').split('.')[1]; -} - function createDefaultCard(cardTitle, favicon, siteName, sumId, phoneId, desktopId, tabletId, dates, origin, domainName) { return `