File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -490,6 +490,9 @@ <h2 class="panel-title">
490490 < div class ="panel-title-name ">
491491 < span > {{lint.id}}</ span >
492492 < a href ="#{{lint.id}} " class ="anchor label label-default " ng-click ="open[lint.id] = true; $event.stopPropagation() "> ¶</ a >
493+ < a href ="" id ="clipboard-{{lint.id}} " class ="anchor label label-default " ng-click ="copyToClipboard(lint); $event.stopPropagation() ">
494+ 📋
495+ </ a >
493496 </ div >
494497
495498 < div class ="panel-title-addons ">
Original file line number Diff line number Diff line change 258258 return true ;
259259 }
260260
261+ $scope . copyToClipboard = function ( lint ) {
262+ const clipboard = document . getElementById ( "clipboard-" + lint . id ) ;
263+ if ( clipboard ) {
264+ let resetClipboardTimeout = null ;
265+ let resetClipboardIcon = clipboard . innerHTML ;
266+
267+ function resetClipboard ( ) {
268+ resetClipboardTimeout = null ;
269+ clipboard . innerHTML = resetClipboardIcon ;
270+ }
271+
272+ navigator . clipboard . writeText ( "clippy::" + lint . id ) ;
273+
274+ clipboard . innerHTML = "✓" ;
275+ if ( resetClipboardTimeout !== null ) {
276+ clearTimeout ( resetClipboardTimeout ) ;
277+ }
278+ resetClipboardTimeout = setTimeout ( resetClipboard , 1000 ) ;
279+ }
280+ }
281+
261282 // Get data
262283 $scope . open = { } ;
263284 $scope . loading = true ;
You can’t perform that action at this time.
0 commit comments