From a3d0a1e340b69e1418277521b29f01d0e59efcdf Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 14 Aug 2017 21:15:29 +0300 Subject: [PATCH] popup: simplify breadcrumbs; fix 1st word underline in FF --- popup/popup.css | 14 -------------- popup/popup.js | 7 ++++--- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/popup/popup.css b/popup/popup.css index 892755ac..758bd584 100644 --- a/popup/popup.css +++ b/popup/popup.css @@ -251,11 +251,6 @@ body.blocked .actions > .left-gutter { margin-left: .6ex } -.write-style-link::before, -.write-style-link::after { - font-size: 12px -} - .write-style-link::before { content: "\00ad"; /* "soft" hyphen */ } @@ -277,15 +272,6 @@ body.blocked .actions > .left-gutter { text-decoration: none } -/* use just the subdomain name instead of the full domain name */ -.breadcrumbs > .write-style-link[subdomain]:not(:nth-last-child(2)) { - font-size: 0 -} - -.breadcrumbs > .write-style-link[subdomain]:not(:nth-last-child(2))::before { - content: attr(subdomain); -} - /* "dot" after each subdomain name */ .breadcrumbs > .write-style-link[subdomain]::after { content: "." diff --git a/popup/popup.js b/popup/popup.js index d89d53e5..4552b0a6 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -148,18 +148,19 @@ function initPopup(url) { // For domain const domains = BG.getDomains(url); for (const domain of domains) { + const numParts = domain.length - domain.replace(/\./g, '').length + 1; // Don't include TLD - if (domains.length > 1 && !domain.includes('.')) { + if (domains.length > 1 && numParts === 1) { continue; } const domainLink = template.writeStyle.cloneNode(true); Object.assign(domainLink, { href: 'edit.html?domain=' + encodeURIComponent(domain), - textContent: domain, + textContent: numParts > 2 ? domain.split('.')[0] : domain, title: `domain("${domain}")`, onclick: handleEvent.openLink, }); - domainLink.setAttribute('subdomain', domain.substring(0, domain.indexOf('.'))); + domainLink.setAttribute('subdomain', numParts > 1 ? 'true' : ''); matchTargets.appendChild(domainLink); }