History

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

Fixes #1199.

Simon Legner committed 5 years ago

Commit c0ddcf31 parent cd6664a4 files · +17 −0Browse files

Unified · Split

4 files
  1. assets/javascripts/app/shortcuts.coffee +3 −0
  2. assets/javascripts/news.json +4 −0
  3. assets/javascripts/templates/pages/help_tmpl.coffee +3 −0
  4. assets/javascripts/views/content/entry_page.coffee +7 −0
assets/javascripts/app/shortcuts.coffee+3−0
@@ -149,6 +149,9 @@ class app.Shortcuts · 148 unmodified lines
149 when 40149 when 40
150 @trigger 'altDown'150 @trigger 'altDown'
151 false151 false
152 when 67
153 @trigger 'altC'
154 false
152 when 68155 when 68
153 @trigger 'altD'156 @trigger 'altD'
154 false157 false
assets/javascripts/news.json+4−0
@@ -1,4 +1,8 @@
1[1[
2 [
3 "2021-04-29",
4 "Added <code class=\"_label\">alt + c</code> shortcut to copy URL of original page."
5 ],
2 [6 [
3 "2021-02-26",7 "2021-02-26",
4 "New documentation: <a href=\"/react_bootstrap/\">React Bootstrap</a>"8 "New documentation: <a href=\"/react_bootstrap/\">React Bootstrap</a>"
assets/javascripts/templates/pages/help_tmpl.coffee+3−0
@@ -130,6 +130,9 @@ app.templates.helpPage = -> · 129 unmodified lines
130 </dl>130 </dl>
131 <h3 class="_shortcuts-title">Miscellaneous</h3>131 <h3 class="_shortcuts-title">Miscellaneous</h3>
132 <dl class="_shortcuts-dl">132 <dl class="_shortcuts-dl">
133 <dt class="_shortcuts-dt">
134 <code class="_shortcut-code">alt + c</code>
135 <dd class="_shortcuts-dd">Copy URL of original page
133 <dt class="_shortcuts-dt">136 <dt class="_shortcuts-dt">
134 <code class="_shortcut-code">alt + o</code>137 <code class="_shortcut-code">alt + o</code>
135 <dd class="_shortcuts-dd">Open original page138 <dd class="_shortcuts-dd">Open original page
assets/javascripts/views/content/entry_page.coffee+7−0
@@ -6,6 +6,7 @@ class app.views.EntryPage extends app.View · 5 unmodified lines
6 click: 'onClick'6 click: 'onClick'
7 7
8 @shortcuts:8 @shortcuts:
9 altC: 'onAltC'
9 altO: 'onAltO'10 altO: 'onAltO'
10 11
11 @routes:12 @routes:
@@ -153,6 +154,12 @@ class app.views.EntryPage extends app.View · 141 unmodified lines
153 setTimeout (-> target.className = '_pre-clip'), 2000154 setTimeout (-> target.className = '_pre-clip'), 2000
154 return155 return
155 156
157 onAltC: =>
158 return unless link = @find('._attribution:last-child ._attribution-link')
159 console.log(link.href + location.hash)
160 navigator.clipboard.writeText(link.href + location.hash)
161 return
162
156 onAltO: =>163 onAltO: =>
157 return unless link = @find('._attribution:last-child ._attribution-link')164 return unless link = @find('._attribution:last-child ._attribution-link')
158 @delay -> $.popup(link.href + location.hash)165 @delay -> $.popup(link.href + location.hash)