30
30
.headerlink {
31
31
font-size : 50% ;
32
32
}
33
- .fields {
34
- display : none;
35
- }
36
33
nav .menu {
37
34
line-height : 2
38
35
}
@@ -205,12 +202,12 @@ <h4>
205
202
</ tr >
206
203
{% endif %}{% endfor %}
207
204
</ tbody > </ table >
208
- < a href ="# " class ="toggle-fields "> Toggle Fields</ a >
209
205
</ div >
210
206
</ div >
211
207
</ div >
212
208
{% endif %}
213
- < div class ="container fields " id ="{{ pname }}-{{ register.name }}-fields ">
209
+ < details class ="fields " id ="{{ pname }}-{{ register.name }}-fields ">
210
+ < summary > Toggle fields</ summary >
214
211
{% for field in register.fields %}
215
212
< div class ="row ">
216
213
< div class ="col-sm-10 ">
235
232
</ div >
236
233
</ div >
237
234
{% endfor %}
238
- </ div >
235
+ </ details >
239
236
</ div >
240
237
</ div >
241
238
{% endfor %}
@@ -257,27 +254,18 @@ <h4>
257
254
document . querySelectorAll ( '.registers' ) . forEach ( el => el . open = false )
258
255
e . preventDefault ( )
259
256
} )
260
- $ ( '.fieldlink' ) . click ( function ( e ) {
261
- $ ( this ) . parents ( ".container" ) . first ( ) . siblings ( ".fields" ) . show ( ) ;
262
- } ) ;
263
- $ ( '.toggle-fields' ) . click ( function ( e ) {
264
- $ ( this ) . parents ( ".container" ) . first ( ) . siblings ( ".fields" ) . toggle ( ) ;
265
- e . preventDefault ( ) ;
266
- } ) ;
267
- if ( window . location . hash ?. includes ( ":" ) ) {
268
- const hash = window . location . hash ;
269
- const [ peripheral , register , field ] = hash . substr ( 1 ) . split ( ":" , 3 )
270
- if ( document . getElementById ( `${ peripheral } -registers` ) ) {
257
+ function locationHashChanged ( ) {
258
+ const [ peripheral , register , field ] = window . location . hash . substr ( 1 ) . split ( ":" , 3 )
259
+ if ( register && document . getElementById ( `${ peripheral } -registers` ) ) {
271
260
document . getElementById ( `${ peripheral } -registers` ) . open = true
272
261
}
273
- if ( field ) {
274
- $ ( '#' + peripheral + '-' + register + '-fields' ) . show ( 0 , function ( ) {
275
- window . location . hash = hash
276
- } )
277
- } else {
278
- window . location . hash = hash
262
+ if ( field && document . getElementById ( `${ peripheral } -${ register } -fields` ) ) {
263
+ document . getElementById ( `${ peripheral } -${ register } -fields` ) . open = true
279
264
}
265
+ window . location . hash = window . location . hash
280
266
}
267
+ window . addEventListener ( "hashchange" , locationHashChanged )
268
+ locationHashChanged ( )
281
269
$ ( function ( ) {
282
270
$ ( '[data-toggle="popover"]' ) . popover ( )
283
271
} )
0 commit comments