Auto merge of #8839 - Serial-ATA:copy-lint-name, r=xFrednet
Add copy lint name button changelog: Documentation: Add a *copy lint name*-button to Clippy's lint list closes #7959
This commit is contained in:
commit
6f8d18fe69
@ -490,6 +490,9 @@ Otherwise, have a great day =^.^=
|
||||
<div class="panel-title-name">
|
||||
<span>{{lint.id}}</span>
|
||||
<a href="#{{lint.id}}" class="anchor label label-default" ng-click="open[lint.id] = true; $event.stopPropagation()">¶</a>
|
||||
<a href="" id="clipboard-{{lint.id}}" class="anchor label label-default" ng-click="copyToClipboard(lint); $event.stopPropagation()">
|
||||
📋
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="panel-title-addons">
|
||||
|
@ -258,6 +258,27 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
$scope.copyToClipboard = function (lint) {
|
||||
const clipboard = document.getElementById("clipboard-" + lint.id);
|
||||
if (clipboard) {
|
||||
let resetClipboardTimeout = null;
|
||||
let resetClipboardIcon = clipboard.innerHTML;
|
||||
|
||||
function resetClipboard() {
|
||||
resetClipboardTimeout = null;
|
||||
clipboard.innerHTML = resetClipboardIcon;
|
||||
}
|
||||
|
||||
navigator.clipboard.writeText("clippy::" + lint.id);
|
||||
|
||||
clipboard.innerHTML = "✓";
|
||||
if (resetClipboardTimeout !== null) {
|
||||
clearTimeout(resetClipboardTimeout);
|
||||
}
|
||||
resetClipboardTimeout = setTimeout(resetClipboard, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
// Get data
|
||||
$scope.open = {};
|
||||
$scope.loading = true;
|
||||
|
Loading…
Reference in New Issue
Block a user