File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 235
235
menu . firstElementChild . addEventListener ( "click" , menuOnClick ) ;
236
236
}
237
237
document . documentElement . addEventListener ( "keydown" , menuKeyDown ) ;
238
+ document . documentElement . addEventListener ( "keydown" , function ( ev ) {
239
+ if ( ev . key == "y" ) {
240
+ let permalink = document . getElementById ( "permalink" ) ;
241
+ if ( document . location . hash != "" ) {
242
+ permalink . href += "#" + document . location . hash ;
243
+ }
244
+ // Note: It would be nicer to do history.replaceState here and avoid a page load
245
+ // (that's what GitHub does), but the permalink goes through a redirect, so you wind up
246
+ // with a weird URL like:
247
+ // http://localhost:3000/crate/regex/1.3.1/target-redirect/x86_64-unknown-linux-gnu/regex/index.html
248
+ permalink . click ( ) ;
249
+ }
250
+ } ) ;
238
251
} ) ( ) ;
Original file line number Diff line number Diff line change 24
24
25
25
{%- if metadata.version_or_latest == "latest" -%}
26
26
< li class ="pure-menu-item ">
27
- < a href ="{{permalink_path | safe}} " class ="pure-menu-link description " title ="Get a link to this specific version ">
27
+ < a href ="{{permalink_path | safe}} " class ="pure-menu-link description " id =" permalink " title ="Get a link to this specific version ">
28
28
{{ "link" | fas }} Permalink
29
29
</ a >
30
30
</ li >
You can’t perform that action at this time.
0 commit comments