Skip to content

Commit

Permalink
Pass domainName to createDefaultCard
Browse files Browse the repository at this point in the history
  • Loading branch information
zer0kool committed Aug 21, 2024
1 parent 56525fd commit 4a8f604
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fetchOrigin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand All @@ -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";
Expand Down Expand Up @@ -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 `
<div class="card originData" id="${siteName}">
Expand Down

0 comments on commit 4a8f604

Please sign in to comment.