popup: simplify breadcrumbs; fix 1st word underline in FF

This commit is contained in:
tophf 2017-08-14 21:15:29 +03:00
parent ede1187b31
commit a3d0a1e340
2 changed files with 4 additions and 17 deletions

View File

@ -251,11 +251,6 @@ body.blocked .actions > .left-gutter {
margin-left: .6ex margin-left: .6ex
} }
.write-style-link::before,
.write-style-link::after {
font-size: 12px
}
.write-style-link::before { .write-style-link::before {
content: "\00ad"; /* "soft" hyphen */ content: "\00ad"; /* "soft" hyphen */
} }
@ -277,15 +272,6 @@ body.blocked .actions > .left-gutter {
text-decoration: none 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 */ /* "dot" after each subdomain name */
.breadcrumbs > .write-style-link[subdomain]::after { .breadcrumbs > .write-style-link[subdomain]::after {
content: "." content: "."

View File

@ -148,18 +148,19 @@ function initPopup(url) {
// For domain // For domain
const domains = BG.getDomains(url); const domains = BG.getDomains(url);
for (const domain of domains) { for (const domain of domains) {
const numParts = domain.length - domain.replace(/\./g, '').length + 1;
// Don't include TLD // Don't include TLD
if (domains.length > 1 && !domain.includes('.')) { if (domains.length > 1 && numParts === 1) {
continue; continue;
} }
const domainLink = template.writeStyle.cloneNode(true); const domainLink = template.writeStyle.cloneNode(true);
Object.assign(domainLink, { Object.assign(domainLink, {
href: 'edit.html?domain=' + encodeURIComponent(domain), href: 'edit.html?domain=' + encodeURIComponent(domain),
textContent: domain, textContent: numParts > 2 ? domain.split('.')[0] : domain,
title: `domain("${domain}")`, title: `domain("${domain}")`,
onclick: handleEvent.openLink, onclick: handleEvent.openLink,
}); });
domainLink.setAttribute('subdomain', domain.substring(0, domain.indexOf('.'))); domainLink.setAttribute('subdomain', numParts > 1 ? 'true' : '');
matchTargets.appendChild(domainLink); matchTargets.appendChild(domainLink);
} }