Shortcut to copy URL of original page (alt + C)

Fixes #1199.
pull/1536/head
Simon Legner 4 years ago
parent cd6664a460
commit c0ddcf3469

@ -149,6 +149,9 @@ class app.Shortcuts
when 40
@trigger 'altDown'
false
when 67
@trigger 'altC'
false
when 68
@trigger 'altD'
false

@ -1,4 +1,8 @@
[
[
"2021-04-29",
"Added <code class=\"_label\">alt + c</code> shortcut to copy URL of original page."
],
[
"2021-02-26",
"New documentation: <a href=\"/react_bootstrap/\">React Bootstrap</a>"

@ -130,6 +130,9 @@ app.templates.helpPage = ->
</dl>
<h3 class="_shortcuts-title">Miscellaneous</h3>
<dl class="_shortcuts-dl">
<dt class="_shortcuts-dt">
<code class="_shortcut-code">alt + c</code>
<dd class="_shortcuts-dd">Copy URL of original page
<dt class="_shortcuts-dt">
<code class="_shortcut-code">alt + o</code>
<dd class="_shortcuts-dd">Open original page

@ -6,6 +6,7 @@ class app.views.EntryPage extends app.View
click: 'onClick'
@shortcuts:
altC: 'onAltC'
altO: 'onAltO'
@routes:
@ -153,6 +154,12 @@ class app.views.EntryPage extends app.View
setTimeout (-> target.className = '_pre-clip'), 2000
return
onAltC: =>
return unless link = @find('._attribution:last-child ._attribution-link')
console.log(link.href + location.hash)
navigator.clipboard.writeText(link.href + location.hash)
return
onAltO: =>
return unless link = @find('._attribution:last-child ._attribution-link')
@delay -> $.popup(link.href + location.hash)

Loading…
Cancel
Save