comments, forum posts: add 'Copy Link' action to '...' menu.
Add a 'Copy Link' action to forum posts and comments. This copies the full link to the clipboard. The 'Copy ID' action copies just the DText shortlink (comment #XXX or forum #XXX).
This commit is contained in:
@@ -118,6 +118,15 @@ Utility.splitWords = function(string) {
|
||||
return words(string, /\S+/g);
|
||||
}
|
||||
|
||||
Utility.copyToClipboard = async function(text, message = "Copied!") {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
Utility.notice(message);
|
||||
} catch (error) {
|
||||
Utility.error("Couldn't copy to clipboard");
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.selectEnd = function() {
|
||||
return this.each(function() {
|
||||
this.focus();
|
||||
|
||||
Reference in New Issue
Block a user