File tree Expand file tree Collapse file tree 2 files changed +53
-4
lines changed Expand file tree Collapse file tree 2 files changed +53
-4
lines changed Original file line number Diff line number Diff line change 1
1
: root {
2
+ --nav-gap : 15px ;
2
3
--covered : green;
3
4
--uncovered : # bf616a ;
4
5
--background : # ffffff ;
5
6
--topbar-background : # f6f8fa ;
6
7
--topbar-border : # d0d7de ;
7
8
--topbar-color : # 2e3440 ;
9
+ --topbar-hover-color : # afb8c133 ;
8
10
--select-background : # d8dee9 ;
9
11
--select-border : # d0d7de ;
10
12
--select-color : # 2e3440 ;
@@ -58,11 +60,12 @@ body {
58
60
# legend {
59
61
display : flex;
60
62
align-items : center;
63
+ margin-right : auto;
61
64
}
62
65
63
66
# nav ,
64
67
# legend span {
65
- margin-left : 15 px ;
68
+ margin-left : var ( --nav-gap ) ;
66
69
color : var (--topbar-color ) !important ;
67
70
}
68
71
@@ -93,16 +96,36 @@ select {
93
96
padding : 4px 24px 4px 8px ;
94
97
}
95
98
96
- # legend span {
99
+ # legend > span {
100
+ padding : 2px 4px ;
101
+ border-radius : 2px ;
102
+ }
103
+
104
+ a .incremental {
105
+ display : flex;
106
+ background : var (--topbar-hover-color );
97
107
padding : 2px 4px ;
98
108
border-radius : 2px ;
109
+ box-shadow : inset 0 0 0 1px var (--topbar-hover-color );
110
+ color : var (--topbar-color );
111
+ text-decoration : none;
112
+ align-items : center;
113
+ }
114
+
115
+ a .incremental : hover {
116
+ background : transparent;
117
+ box-shadow : inset 0 0 0 1px var (--topbar-hover-color );
118
+ }
119
+
120
+ a .incremental : active {
121
+ transform : translateY (1px );
99
122
}
100
123
101
124
input [type = "checkbox" ] {
102
125
height : 0 ;
103
126
width : 0 ;
104
127
visibility : hidden;
105
- margin-left : auto ;
128
+ margin-left : var ( --nav-gap ) ;
106
129
}
107
130
108
131
label {
@@ -114,6 +137,7 @@ label {
114
137
display : block;
115
138
position : relative;
116
139
margin-right : 15px ;
140
+ margin-right : var (--nav-gap );
117
141
}
118
142
119
143
label : after {
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ function main() {
29
29
return
30
30
}
31
31
32
-
32
+ configureIncrementalButton ( )
33
33
configureSelectFix ( )
34
34
configureTheme ( )
35
35
configureCodeBlocks ( )
@@ -40,6 +40,31 @@ function main() {
40
40
document . documentElement . style . setProperty ( 'opacity' , '1' )
41
41
}
42
42
43
+ function configureIncrementalButton ( ) {
44
+ let url = window . location . href
45
+ let isInc = url . includes ( '-inc.html' )
46
+
47
+ let link = document . createElement ( 'a' )
48
+ link . classList = 'incremental'
49
+ link . classList . add ( 'hljs-selector-id' )
50
+
51
+ if ( isInc ) {
52
+ link . title = 'Toggle to absolute coverage'
53
+ link . href = url . replace ( '-inc.html' , '.html' )
54
+ } else {
55
+ link . title = 'Toggle to incremental coverage'
56
+ link . href = url . replace ( '.html' , '-inc.html' )
57
+ }
58
+
59
+ link . innerHTML = `
60
+ <span style="color: var(--covered);">↑</span>
61
+ <span style="color: var(--uncovered);">↓</span>
62
+ <span style="margin-left: 2px;">${ isInc ? 'inc' : 'abs' } </span>
63
+ `
64
+
65
+ document . querySelector ( '#topbar' ) . appendChild ( link )
66
+ }
67
+
43
68
function configureSelectFix ( ) {
44
69
document . getElementById ( 'files' ) . addEventListener ( 'change' , ( e ) => {
45
70
document . querySelectorAll ( '.file' ) . forEach ( ( el ) => el . style . display = 'none' )
You can’t perform that action at this time.
0 commit comments