Skip to content

Commit 3289db0

Browse files
committed
simplify css/html in options
+ deduplicate "a"
1 parent 7d253df commit 3289db0

File tree

7 files changed

+56
-127
lines changed

7 files changed

+56
-127
lines changed

edit/edit.css

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ body {
99
height: 100vh;
1010
}
1111

12-
a {
13-
color: var(--fg);
14-
transition: color .5s;
15-
}
16-
a:hover {
17-
color: #666;
18-
}
19-
2012
#global-progress {
2113
position: fixed;
2214
height: 4px;

global.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ body:lang(zh-HK) {
5858
font-family: Arial, 'Microsoft JhengHei UI', 'Microsoft JhengHei', system-ui, sans-serif;
5959
}
6060

61+
a {
62+
color: var(--fg);
63+
transition: color .15s;
64+
}
65+
a:hover {
66+
color: var(--c40);
67+
}
6168
a.icon { text-decoration: none; }
6269

6370
button {

install-usercss/install-usercss.css

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@ body {
44
height: 100vh;
55
}
66

7-
a {
8-
color: var(--fg);
9-
transition: color .5s;
10-
}
11-
12-
a:hover {
13-
color: var(--c40);
14-
}
15-
167
img.icon {
178
height: 1.4em;
189
vertical-align: middle;

options.html

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,18 @@
4444

4545
<script src="options/options-sync.js"></script>
4646
<script src="js/themer.js"></script> <!-- must be last in HEAD to avoid FOUC -->
47-
<template data-id="body">
48-
<div id="options-header">
49-
<div id="options-title" i18n="+optionsHeading">
50-
<div id="options-close-icon">
51-
<i class=i-close></i>
52-
</div>
53-
</div>
54-
</div>
47+
<template data-id="body">
5548

56-
<div id="options">
49+
<header>
50+
<img src="/images/icon/128.png" width="32" height="32">
51+
<h1 i18n="optionsHeading"></h1>
52+
<i class=i-close tabindex="0"></i>
53+
</header>
5754

58-
<div class="options-wrapper">
55+
<main>
5956

6057
<div class="block" id="updates">
61-
<h1 i18n="optionsCustomizeUpdate"></h1>
58+
<h2 i18n="optionsCustomizeUpdate"></h2>
6259
<div class="items swap">
6360
<label>
6461
<span i18n="optionsUpdateInterval" data-clickable="0"></span>
@@ -72,7 +69,7 @@ <h1 i18n="optionsCustomizeUpdate"></h1>
7269
</div>
7370

7471
<div class="block sync-options">
75-
<h1 i18n="optionsCustomizeSync"></h1>
72+
<h2 i18n="optionsCustomizeSync"></h2>
7673
<div class="items swap">
7774
<label>
7875
<span class="sync-status"></span>
@@ -109,7 +106,7 @@ <h1 i18n="optionsCustomizeSync"></h1>
109106
</div>
110107

111108
<div class="block">
112-
<h1 i18n="stylePreferSchemeLabel"></h1>
109+
<h2 i18n="stylePreferSchemeLabel"></h2>
113110
<div class="items no-stretch">
114111
<label class="radio-wrapper" i18n="+preferSchemeDark">
115112
<input type="radio" value="dark" name="schemeSwitcher.enabled">
@@ -134,7 +131,7 @@ <h1 i18n="stylePreferSchemeLabel"></h1>
134131
</div>
135132

136133
<div class="block">
137-
<h1 i18n="optionsCustomizeIcon"></h1>
134+
<h2 i18n="optionsCustomizeIcon"></h2>
138135
<div class="items no-stretch">
139136
<label>
140137
<span class="radio-wrapper" i18n="+optionsIconAuto">
@@ -166,7 +163,7 @@ <h1 i18n="optionsCustomizeIcon"></h1>
166163
</div>
167164

168165
<div class="block">
169-
<h1 i18n="optionsCustomizeBadge"></h1>
166+
<h2 i18n="optionsCustomizeBadge"></h2>
170167
<div class="items swap">
171168
<label>
172169
<span i18n="prefShowBadge"></span>
@@ -184,7 +181,7 @@ <h1 i18n="optionsCustomizeBadge"></h1>
184181
</div>
185182

186183
<div class="block">
187-
<h1 i18n="optionsCustomizePopup"></h1>
184+
<h2 i18n="optionsCustomizePopup"></h2>
188185
<div class="items swap">
189186
<label>
190187
<span i18n="optionsPopupWidth"></span>
@@ -206,7 +203,7 @@ <h1 i18n="optionsCustomizePopup"></h1>
206203
</div>
207204

208205
<div class="block">
209-
<h1 i18n="styleEditor"></h1>
206+
<h2 i18n="styleEditor"></h2>
210207
<div class="items swap">
211208
<label>
212209
<span i18n="popupOpenEditInWindow">
@@ -229,7 +226,7 @@ <h1 i18n="styleEditor"></h1>
229226
</div>
230227

231228
<div class="block">
232-
<h1 i18n="styleManager"></h1>
229+
<h2 i18n="styleManager"></h2>
233230
<div class="items swap">
234231
<label>
235232
<span i18n="manageNewUI"></span>
@@ -260,7 +257,7 @@ <h1 i18n="styleManager"></h1>
260257
</div>
261258

262259
<div class="block" id="advanced">
263-
<h1 i18n="optionsAdvanced"></h1>
260+
<h2 i18n="optionsAdvanced"></h2>
264261
<div class="items swap">
265262
<label>
266263
<span i18n="optionsAdvancedStyleViaXhr">
@@ -306,18 +303,19 @@ <h1 i18n="optionsAdvanced"></h1>
306303
</div>
307304

308305
<div class="block">
309-
<h1 i18n="cm_theme"></h1>
306+
<h2 i18n="cm_theme"></h2>
310307
<div class="items no-stretch" i18n="optionsStylusThemes"></div>
311308
</div>
312-
</div>
313309

314-
<div class="block" id="actions">
310+
</main>
311+
312+
<footer>
315313
<button id="reset" i18n="optionsResetButton, title:optionsReset"></button>
316314
<button id="shortcuts" i18n="shortcuts, title:shortcutsNote"></button>
317315
<button id="manage" i18n="confirmClose"></button>
318-
</div>
319-
</div>
320-
</template>
316+
</footer>
317+
318+
</template>
321319
</head>
322320

323321
<body id="stylus-options">

options/options.css

Lines changed: 25 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
html {
1+
:root {
22
display: flex;
33
align-items: center;
44
justify-content: center;
55
height: 100vh;
66
background: none;
7+
--pad: 1rem;
8+
--pad05: calc(.5 * var(--pad));
79
--value-cell-w: 6ch;
810
}
911

@@ -23,81 +25,32 @@ body.scaleout {
2325
animation: scaleout .25s ease-in-out;
2426
}
2527

26-
#options {
28+
main {
2729
background: var(--bg);
2830
display: flex;
2931
flex-direction: column;
30-
overflow: hidden;
31-
}
32-
33-
.options-wrapper {
3432
overflow-y: auto;
3533
}
3634

37-
a {
38-
color: var(--fg);
39-
transition: color .5s;
40-
}
41-
42-
a:hover {
43-
color: var(--c40);
44-
}
45-
46-
a:hover i,
47-
i:hover {
48-
color: var(--fg);
49-
}
50-
5135
.clickable {
5236
text-decoration: underline dotted;
5337
cursor: pointer;
5438
}
5539

56-
#options-close-icon i {
57-
color: var(--c40);
58-
transition: color .5s;
59-
}
60-
61-
#options-close-icon:hover i {
62-
color: var(--fg);
63-
}
64-
65-
#options-close-icon {
66-
display: inline-flex;
67-
cursor: pointer;
68-
position: absolute;
69-
right: 6px;
70-
top: 6px;
71-
}
72-
73-
#options-close-icon i {
74-
height: 20px;
75-
width: 20px;
76-
}
77-
78-
#options-title {
40+
header {
7941
font-weight: bold;
8042
background-color: var(--accent-3);
81-
padding: .75rem 26px .75rem calc(30% + 4px);
82-
font-size: 22px;
83-
letter-spacing: .5px;
84-
position: relative;
85-
min-height: 42px;
86-
box-sizing: border-box;
87-
border-bottom: 1px solid var(--c40);
43+
padding: var(--pad);
44+
display: flex;
45+
align-items: center;
46+
border-bottom: 1px solid hsla(0, 0%, 50%, .2);
8847
}
89-
90-
#options-title::before {
91-
content: "";
92-
width: 0;
93-
height: 0;
94-
padding: 0 32px 32px 0;
95-
background: url(/images/icon/32.png);
96-
position: absolute;
97-
left: 26px;
98-
top: 0;
99-
bottom: 0;
100-
margin: auto;
48+
header h1 {
49+
flex: 1 0;
50+
margin: 0 var(--pad05);
51+
}
52+
header i:hover {
53+
color: var(--accent-1);
10154
}
10255

10356
.firefox .chromium-only,
@@ -113,18 +66,14 @@ label.chromium-only > :first-child::after {
11366
.block {
11467
display: flex;
11568
align-items: center;
116-
margin: 1em 0;
117-
border-bottom: 1px dotted var(--c80);
118-
padding: 0 16px .75em;
69+
padding: var(--pad05) var(--pad);
11970
position: relative;
12071
}
121-
122-
.options-wrapper .block:last-child {
123-
margin-bottom: 0;
124-
border-bottom: none;
72+
.block:nth-last-child(n + 2) {
73+
border-bottom: 1px dotted var(--c80);
12574
}
12675

127-
h1 {
76+
h2 {
12877
flex: 0 0 8em;
12978
margin: 0;
13079
font-size: 120%;
@@ -213,17 +162,18 @@ label.disabled,
213162
opacity: .5;
214163
}
215164

216-
#actions {
165+
footer {
217166
justify-content: center;
218-
padding: .5em 1em 1em;
219-
background-color: rgba(0, 0, 0, .05);
167+
padding: var(--pad05) var(--pad);
168+
background-color: var(--c90);
220169
margin: 0;
221170
border-top: 1px solid var(--c60);
222171
border-bottom: none;
172+
display: flex;
223173
}
224174

225-
#actions button {
226-
margin: .5em 1em 0 0;
175+
footer button {
176+
margin: 0 .25em;
227177
}
228178

229179
[data-cmd="check-updates"] button {

options/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (FIREFOX && 'update' in (chrome.commands || {})) {
2525
$('#shortcuts').classList.remove('chromium-only');
2626
}
2727
// actions
28-
$('#options-close-icon').onclick = () => {
28+
$('header i').onclick = () => {
2929
top.dispatchEvent(new CustomEvent('closeOptions'));
3030
};
3131
$('#manage').onclick = () => {

popup/popup.css

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,6 @@ body > div:not(#installed):not(#message-box):not(.colorpicker-popup) {
7878
height: auto;
7979
}
8080

81-
a {
82-
color: var(--fg);
83-
transition: color .1s;
84-
}
85-
86-
a:hover {
87-
color: var(--c40);
88-
}
89-
9081
#installed {
9182
max-height: 445px;
9283
overflow-y: auto;

0 commit comments

Comments
 (0)