Skip to content

Commit 1ff6071

Browse files
committed
UI adjustments for better mobile experience (thanks Bram Pitoyo for suggestions).
1 parent 1596978 commit 1ff6071

3 files changed

Lines changed: 129 additions & 49 deletions

File tree

src/ui/popup.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ body {
4141

4242
}
4343

44+
45+
.mobile #top {
46+
height: 3.5em;
47+
}
48+
.mobile #top a {
49+
padding: .5em .5em;
50+
background-size: 80%;
51+
}
52+
4453
#top > .spacer {
4554
flex-grow: 1;
4655
display: block;

src/ui/ui.css

Lines changed: 119 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -16,51 +16,112 @@ body {
1616
display: none !important;
1717
}
1818

19-
@media (max-width: 100mm) {
20-
body {
21-
background-size: 4em !important;
22-
padding-right: 0 !important;
23-
}
24-
25-
.presets {
26-
width: 0;
27-
}
19+
@media (max-width: 100mm) {
20+
body {
21+
background-size: 4em !important;
22+
padding-right: 0 !important;
23+
}
24+
25+
#sites .presets {
26+
width: 0 !important;
27+
padding: 0 !important;
28+
margin: 0 !important;
29+
padding-bottom: 1em !important;
30+
}
31+
32+
#presets .presets input.preset {
33+
min-width: 5em;
34+
}
2835

29-
.presets input.preset {
36+
#sites .presets input.preset {
3037
min-width: 0 !important;
3138
background-color: none !important;
32-
margin-bottom: 0;
33-
margin-top: 1mm;
39+
margin-top: 0;
3440
font-weight: bold;
41+
}
42+
43+
44+
#sites .customizing input.preset:checked {
45+
margin-left: 0;
46+
}
47+
48+
#presets .presets input.preset + label {
49+
font-size: 60%;
50+
position: absolute !important;
51+
text-align: right;
52+
padding: 0 !important;
53+
margin: 0 !important;
54+
display: block !important;
55+
width: 5.5em !important;
56+
z-index: 1000;
57+
top: 1em;
58+
left: 4em !important;
59+
text-shadow: 1px 1px white, -1px -1px white;
3560
}
36-
.presets input.temp {
37-
position: static;
61+
62+
#sites .presets input.preset:checked + label {
63+
z-index: 1000;
64+
font-size: 60%;
65+
top: 3em;
66+
left: -3em !important;
67+
margin: 0 !important;
68+
padding: 0 !important;
69+
text-align: center !important;
70+
display: block !important;
71+
position: absolute;
72+
width: 10em !important;
73+
overflow: visible !important;
3874
}
39-
.presets label.preset {
40-
font-size: 50%;
41-
top: -1mm;
42-
left: 0;
43-
margin: 0;
44-
padding: 0;
45-
text-align: center;
46-
text-shadow: 0 0 4px #ff8;
47-
position: absolute;
48-
overflow: visible;
75+
76+
.presets input.preset:checked ~ input.temp {
77+
left: 1.5em;
78+
pointer-events: none;
4979
}
5080

51-
td.presets {
52-
white-space: nowrap !important;
53-
vertical-align: bottom;
54-
}
55-
.url {
56-
white-space: wrap;
57-
word-break: break-all;
58-
font-size: 75%;
59-
letter-spacing: -0.2mm;
81+
.customizing input.preset:checked ~ input.temp {
82+
pointer-events: all !important;
83+
z-index: 1000;
84+
top: 1.5em;
85+
right: -1em;
86+
padding: 1em;
87+
}
88+
89+
.customizer-controls fieldset {
90+
padding-top: 3em !important;
91+
}
92+
93+
.customizer-controls fieldset legend {
94+
top: 2em;
95+
}
6096

97+
#sites .customizing input.preset:checked + label {
98+
text-align:right !important;
99+
padding-right: 1em !important;
100+
right: 1em !important;
101+
left: auto !important;
102+
top: 3.5em;
103+
pointer-events: none;
104+
}
105+
106+
td.presets {
107+
white-space: nowrap !important;
108+
vertical-align: bottom;
109+
border: 1px solid black;
110+
}
111+
.url > span > span {
112+
white-space: wrap;
113+
word-break: break-all;
114+
letter-spacing: -0.2mm;
115+
font-size: 80%;
61116
}
62117

63-
}
118+
}
119+
120+
#sites .customizing .presets {
121+
padding-bottom: 0 !important;
122+
margin-bottom: 0 !important;
123+
}
124+
64125

65126
input[type="text"] {
66127
border: 1px solid;
@@ -88,7 +149,8 @@ input[type="checkbox"] {
88149
border: none;
89150
font-size: 1em;
90151
}
91-
.sites > tr.site:hover, .sites > tr.sites:active {
152+
html:not(.mobile) .sites > tr.site:hover,
153+
html:not(.mobile) .sites > tr.sites:active {
92154
background: #abf;
93155
}
94156
.sites > tr:nth-child(even) {background: #fff}
@@ -97,7 +159,7 @@ input[type="checkbox"] {
97159
.site .url {
98160
padding: 0 0 0 0.5em;
99161
color: #ccc;
100-
vertical-align: middle;
162+
vertical-align: top;
101163
}
102164
.site .url .protocol { display: none }
103165

@@ -140,15 +202,16 @@ input[type="checkbox"] {
140202
}
141203

142204
input.https-only {
143-
font-size: 1em;
205+
font-size: 100%;
144206
appearance: none;
145207
-webkit-appearance: none;
146208
-moz-appearance: none;
147209
background: url(/img/ui-http64.png) no-repeat center;
148210
background-size: 1.5em;
149-
width: 1.5em;
150-
height: 1.5em;
151-
margin: 0 0 -0.13em 0.13em;
211+
background-position: bottom;
212+
width: 2em;
213+
height: 2em;
214+
margin: -.25em 0;
152215
padding:0;
153216
cursor: pointer;
154217
}
@@ -202,7 +265,9 @@ span.preset {
202265
margin: 0 .5em 0.13em .5em;
203266
}
204267

205-
input.preset:active, input.preset:focus, input.preset:hover {
268+
html:not(.mobile) input.preset:active,
269+
html:not(.mobile) input.preset:focus,
270+
html:not(.mobile) input.preset:hover {
206271
background-color: #ff8;
207272
border-radius: .5em;
208273
}
@@ -303,12 +368,13 @@ button.options {
303368

304369
}
305370

371+
/* uncomment me if we want to restore inline preset configuration
306372
.preset:hover input.preset:checked ~ .options {
307373
display: block;
308374
opacity: 1;
309375
bottom: 0.38em;
310-
311376
}
377+
*/
312378
input.preset[value="T_TRUSTED"] {
313379
background-image: url(/img/ui-temp64.png);
314380
}
@@ -332,6 +398,7 @@ input.temp {
332398
padding: 0;
333399
border: 0;
334400
opacity: 0;
401+
outline: none;
335402
background: url(/img/ui-clock64.png) no-repeat center;
336403
background-size: 60%;
337404
width: 1.5em;
@@ -347,15 +414,19 @@ input.temp + label {
347414
display: none;
348415
}
349416

417+
input.temp + label {
418+
display: none;
419+
}
420+
350421
input.preset:checked ~ input.temp {
351422
opacity: .5;
352423
right: .5em;
353424
pointer-events: all;
354425
}
355-
.presets input.preset:checked ~ input.temp:checked {
356-
opacity: 1 !important;
357-
background-size: 100%;
358426

427+
.presets input.preset:checked ~ input.temp:checked {
428+
opacity: 1 !important;
429+
background-size: 100%;
359430
}
360431

361432
.customizing input.preset:checked, #presets input.preset:checked, .customizer fieldset {
@@ -404,7 +475,7 @@ span.cap.needed {
404475

405476
fieldset {
406477
border: 0;
407-
padding: 1.5em 0.5em 0.5em 0.5em;
478+
padding: 2em 0.5em 0.5em 0.5em;
408479
margin: 0;
409480
position: relative;
410481
}
@@ -416,8 +487,8 @@ legend {
416487
.customizer legend {
417488
font-size: 0.75em;
418489
position: absolute;
419-
top: 0.25em;
420-
left: 1em;
490+
top: 1em;
491+
left: 2em;
421492
}
422493

423494
#presets .https-only {

src/ui/ui.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ var UI = (() => {
199199
<span class="preset">
200200
<input id="preset" class="preset" type="radio" name="preset"><label for="preset" class="preset">PRESET</label>
201201
<button class="options tiny">⚙</button>
202-
<input id="temp" class="temp" type="checkbox"><label for="temp">Temporary</input>
202+
<input id="temp" class="temp" type="checkbox"><label for="temp">Temporary</label></input>
203203
</span>
204204
</td>
205205

0 commit comments

Comments
 (0)