Skip to content

Commit f282b43

Browse files
committed
[mv3] Move hostname label to top of popup panel
Related commit in uBO: - b8cfa38 Additionally, render internationalized domain names in pretty Unicode instead of ugly punycode.
1 parent 5874312 commit f282b43

File tree

6 files changed

+39
-25
lines changed

6 files changed

+39
-25
lines changed

platform/mv3/extension/_locales/en/messages.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
"message": "Privacy policy",
5252
"description": "Link to privacy policy on GitHub (English)"
5353
},
54-
"popupPowerSwitchInfo": {
55-
"message": "Disable/enable uBO Lite for this site",
56-
"description": "Tooltip for the main power button in the popup panel"
54+
"popupFilteringModeLabel": {
55+
"message": "filtering mode",
56+
"description": "Label in the popup panel for the current filtering mode"
5757
},
5858
"popupTipDashboard": {
5959
"message": "Open the dashboard",

platform/mv3/extension/about.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<div class="li"><span><a href="https://github.com/chrismsimpson/Metropolis" target="_blank">Metropolis font family</a> by <a href="https://github.com/chrismsimpson">Chris Simpson</a></span></div>
3232
<div class="li"><span><a href="https://github.com/rsms/inter" target="_blank">Inter font family</a> by <a href="https://github.com/rsms">Rasmus Andersson</a></span></div>
3333
<div class="li"><span><a href="https://fontawesome.com/" target="_blank">FontAwesome font family</a> by <a href="https://github.com/davegandy">Dave Gandy</a></span></div>
34+
<div class="li"><span><a href="https://github.com/mathiasbynens/punycode.js" target="_blank">Punycode.js</a> by <a href="https://github.com/mathiasbynens">Mathias Bynens</a></span></div>
3435
</div>
3536
</div>
3637

platform/mv3/extension/css/popup.css

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ a {
3434

3535
#main {
3636
align-self: flex-start;
37+
display: flex;
38+
flex-direction: column;
3739
max-width: 340px;
3840
min-width: var(--popup-main-min-width);
3941
}
@@ -47,13 +49,33 @@ hr {
4749
padding: 0;
4850
}
4951

52+
#hostname {
53+
align-items: center;
54+
background-color: var(--popup-toolbar-surface);
55+
display: flex;
56+
justify-content: center;
57+
min-height: calc(var(--font-size) * 3);
58+
padding: 0 var(--popup-gap-extra-thin);
59+
text-align: center;
60+
word-break: break-all;
61+
}
62+
#hostname > span {
63+
word-break: break-all;
64+
}
65+
#hostname > span + span {
66+
font-weight: 600;
67+
}
68+
5069
#filteringModeText {
51-
background-color: var(--surface-2);
5270
color: var(--ink-3);
53-
display: flex;
54-
padding: var(--default-gap-xsmall);
71+
margin: var(--default-gap-small);
72+
margin-top: 0;
73+
text-align: center;
5574
text-transform: lowercase;
5675
}
76+
#filteringModeText > span {
77+
color: var(--accent-surface-1);
78+
}
5779
#filteringModeText > span:nth-of-type(2) {
5880
display: none;
5981
}
@@ -68,9 +90,9 @@ hr {
6890
}
6991

7092
.filteringModeSlider {
71-
height: 32px;
72-
margin: 8px;
73-
width: 128px;
93+
align-self: center;
94+
margin: var(--popup-gap);
95+
width: calc(var(--popup-main-min-width) - 1em);
7496
}
7597

7698
.rulesetTools {
@@ -101,17 +123,6 @@ hr {
101123
body.needReload #refresh {
102124
visibility: visible;
103125
}
104-
#hostname {
105-
font-size: var(--font-size-larger);
106-
margin: var(--popup-gap) var(--popup-gap-thin);
107-
text-align: center;
108-
}
109-
#hostname > span {
110-
word-break: break-all;
111-
}
112-
#hostname > span + span {
113-
font-weight: 600;
114-
}
115126

116127
#rulesetStats {
117128
padding: 0 var(--popup-gap-thin);
@@ -141,7 +152,7 @@ body.needReload #refresh {
141152
}
142153

143154
.toolRibbon {
144-
align-items: start;
155+
align-items: center;
145156
background-color: var(--popup-toolbar-surface);
146157
display: grid;
147158
grid-auto-columns: 1fr;

platform/mv3/extension/js/popup.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434

3535
import { dom, qs$ } from './dom.js';
3636
import { i18n$ } from './i18n.js';
37+
import punycode from './punycode.js';
3738

3839
/******************************************************************************/
3940

@@ -300,7 +301,7 @@ async function init() {
300301

301302
setFilteringMode(popupPanelData.level);
302303

303-
dom.text('#hostname', tabHostname);
304+
dom.text('#hostname', punycode.toUnicode(tabHostname));
304305

305306
const parent = qs$('#rulesetStats');
306307
for ( const details of popupPanelData.rulesetDetails || [] ) {

platform/mv3/extension/popup.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
<link rel="stylesheet" href="css/default.css">
88
<link rel="stylesheet" href="css/common.css">
99
<link rel="stylesheet" href="css/fa-icons.css">
10-
<link rel="stylesheet" href="css/popup.css">
1110
<link rel="stylesheet" href="css/filtering-mode.css">
11+
<link rel="stylesheet" href="css/popup.css">
1212
<title data-i18n="extName"></title>
1313
</head>
1414

1515
<body class="loading" data-section="">
1616
<div id="main">
17-
<div id="filteringModeText"><span>_</span><span></span></div>
17+
<div id="hostname"><span></span>&shy;<span></span></div>
1818
<!-- -------- -->
1919
<div class="filteringModeSlider">
2020
<div class="filteringModeButton"><div></div></div>
@@ -23,8 +23,8 @@
2323
<span data-level="2"></span>
2424
<span data-level="3"></span>
2525
</div>
26-
<div id="hostname"><span></span>&shy;<span></span></div>
2726
<!-- -------- -->
27+
<div id="filteringModeText"><label data-i18n="popupFilteringModeLabel">_</label><br><span>_</span><span></span></div>
2828
<div class="toolRibbon pageTools">
2929
<span></span>
3030
<span></span>

tools/make-mv3.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ cp src/css/fa-icons.css $DES/css/
5555
cp src/js/dom.js $DES/js/
5656
cp src/js/fa-icons.js $DES/js/
5757
cp src/js/i18n.js $DES/js/
58+
cp src/lib/punycode.js $DES/js/
5859

5960
cp LICENSE.txt $DES/
6061

0 commit comments

Comments
 (0)