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 235235 menu . firstElementChild . addEventListener ( "click" , menuOnClick ) ;
236236 }
237237 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+ } ) ;
238251} ) ( ) ;
Original file line number Diff line number Diff line change 2424
2525 {%- if metadata.version_or_latest == "latest" -%}
2626 < 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 ">
2828 {{ "link" | fas }} Permalink
2929 </ a >
3030 </ li >
You can’t perform that action at this time.
0 commit comments