From fc28cca3651ecfe839adfbf9c9d277d4c843a0c3 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 25 Jan 2026 21:52:50 +0500 Subject: [PATCH] . --- .../pages/marketing/MarketingAnalysis.vue | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/views/pages/marketing/MarketingAnalysis.vue b/src/views/pages/marketing/MarketingAnalysis.vue index 30df7d4..a664e1b 100644 --- a/src/views/pages/marketing/MarketingAnalysis.vue +++ b/src/views/pages/marketing/MarketingAnalysis.vue @@ -551,7 +551,7 @@ { const handleRowClick = (competitor) => { if (competitor.website) { - window.open(competitor.website, '_blank', 'noopener,noreferrer'); + let url = competitor.website.trim(); + // If URL doesn't start with http:// or https://, add https:// + if (!url.match(/^https?:\/\//i)) { + url = 'https://' + url; + } + window.open(url, '_blank', 'noopener,noreferrer'); } }; +const getFullUrl = (url) => { + if (!url) return ''; + const trimmed = url.trim(); + // If URL doesn't start with http:// or https://, add https:// + if (!trimmed.match(/^https?:\/\//i)) { + return 'https://' + trimmed; + } + return trimmed; +}; + const formatWebsite = (url) => { if (!url) return ''; + const trimmed = url.trim(); try { - const urlObj = new URL(url); - return urlObj.hostname.replace('www.', ''); + // If it's already a full URL, parse it + if (trimmed.match(/^https?:\/\//i)) { + const urlObj = new URL(trimmed); + return urlObj.hostname.replace('www.', ''); + } + // Otherwise, just return the domain part (before first /) + const domain = trimmed.split('/')[0]; + return domain.replace('www.', ''); } catch { - return url; + // If parsing fails, return as is (might be just domain name) + return trimmed.split('/')[0].replace('www.', ''); } };