This repository was archived by the owner on Nov 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -139,20 +139,22 @@ $(function() {
139
139
$ ( link ) . html ( $ ( link ) . html ( ) . replace ( / ^ ( i n i t | s u b s c r i p t ) / , '<span class="identifier">$1</span>' ) ) ;
140
140
141
141
// expand the hashed item on page load
142
- var hash = link . href . substring ( link . href . lastIndexOf ( '#' ) ) ;
142
+ var hash = link . href . substring ( link . href . lastIndexOf ( '#' ) ) . replace ( '#comment-' , '#' ) ;
143
143
if ( hash == location . hash ) link . click ( ) ;
144
144
} ) ;
145
145
146
146
// add toggle actions to all toggle links
147
147
$ ( '.toggle-link' ) . click ( function ( ) {
148
- var hash = $ ( this ) [ 0 ] . href . substring ( $ ( this ) [ 0 ] . href . lastIndexOf ( '#' ) + 1 ) ;
148
+ var hash = '#' + $ ( this ) [ 0 ] . href . substring ( $ ( this ) [ 0 ] . href . lastIndexOf ( '#' ) + 1 ) . replace ( / ^ c o m m e n t - / , '' ) ;
149
149
150
150
if ( ! $ ( this ) . nextAll ( '.collapse' ) . hasClass ( 'in' ) ) {
151
151
// only set the hash if we're opening this toggle item
152
- location . hash = hash ;
152
+ if ( history . pushState ) history . pushState ( null , null , hash ) ;
153
+ else location . hash = hash ;
153
154
} else if ( location . hash == hash ) {
154
155
// and clear the hash if we're closing the currently hashed item
155
- location . hash = '' ;
156
+ if ( history . pushState ) history . pushState ( null , null , '' ) ;
157
+ else location . hash = '' ;
156
158
}
157
159
} ) ;
158
160
You can’t perform that action at this time.
0 commit comments