This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / appview / pages / templates / repo / fragments / permalinkShortcut.html
807 B 22 lines
1{{ define "repo/fragments/permalinkShortcutScript" }} 2 {{ $path := . }} 3 <script> 4 (() => { 5 const abortController = new AbortController(); 6 const scriptEl = document.currentScript; 7 document.addEventListener('keydown', (e) => { 8 if(e.key === 'y' && !e.ctrlKey && !e.metaKey && !e.altKey) { 9 if(e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return; 10 const permalinkUrl = '{{ $path }}' + window.location.hash; 11 window.location.href = permalinkUrl; 12 } 13 }, {signal: abortController.signal}); 14 15 document.body.addEventListener('htmx:beforeCleanupElement', (e) => { 16 if(e.target === scriptEl) { 17 abortController.abort(); 18 } 19 }, {signal: abortController.signal}); 20 })(); 21 </script> 22{{ end }}