mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Moved URL copy to Clipboard API method
This commit is contained in:
parent
254c69b2f1
commit
74530fe4d9
1 changed files with 3 additions and 10 deletions
|
@ -346,23 +346,16 @@ define(["apphost", "globalize", "connectionManager", "itemHelper", "appRouter",
|
|||
break;
|
||||
case "copy-stream":
|
||||
var downloadHref = apiClient.getItemDownloadUrl(itemId);
|
||||
var textArea = document.createElement("textarea");
|
||||
textArea.value = downloadHref;
|
||||
document.body.appendChild(textArea);
|
||||
textArea.focus();
|
||||
textArea.select();
|
||||
if (document.execCommand("copy")) {
|
||||
navigator.clipboard.writeText(downloadHref).then(function () {
|
||||
require(["toast"], function (toast) {
|
||||
toast(globalize.translate("CopyStreamURLSuccess"));
|
||||
});
|
||||
} else {
|
||||
}, function () {
|
||||
console.error("Failed to copy to clipboard");
|
||||
require(["toast"], function (toast) {
|
||||
toast(globalize.translate("CopyStreamURLError"));
|
||||
});
|
||||
}
|
||||
|
||||
document.body.removeChild(textArea);
|
||||
});
|
||||
getResolveFunction(resolve, id)();
|
||||
break;
|
||||
case "editsubtitles":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue