Skip to content

Commit

Permalink
fix #1779: move url port to the tail part
Browse files Browse the repository at this point in the history
  • Loading branch information
tophf committed May 22, 2024
1 parent acb1407 commit f13e9b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 0 additions & 4 deletions popup/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,6 @@ a:hover i {
[subdomain]:nth-last-child(n + 3)::after {
content: "."
}
/* "forward slash" before path ("this URL") */
.write-style-link:not([subdomain])::before {
content: "\200b/"
}
/* :hover style */
.breadcrumbs.url\(\) > a,
/* :hover or :focus on "this URL" sets class="url()" */
Expand Down
7 changes: 4 additions & 3 deletions popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,10 @@ function makeExtCrumbs(crumbs, url) {
}

function makeWebCrumbs(crumbs, url) {
const i = url.indexOf('://');
const host = i < 0 ? url : url.slice(i + 3, url.indexOf('/', i + 3));
const tail = i < 0 ? '' : url.slice(i + 3 + host.length + 1);
const u = new URL(url);
const h = u.hostname; // stripping user:pwd@ and :port
const host = h || url;
const tail = h && (u.port ? ':' + u.port : '') + u.pathname + u.search + u.hash;
for (let domain, d, j = 0; // show `tld` part only if it's the entire host e.g. localhost
(domain = host.slice(j)) && ((d = domain.split('.'))[1] || !j);) {
d = d[2] ? d[0] : domain; // kinda strip the public suffix lol
Expand Down

0 comments on commit f13e9b6

Please sign in to comment.