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;
|
break;
|
||||||
case "copy-stream":
|
case "copy-stream":
|
||||||
var downloadHref = apiClient.getItemDownloadUrl(itemId);
|
var downloadHref = apiClient.getItemDownloadUrl(itemId);
|
||||||
var textArea = document.createElement("textarea");
|
navigator.clipboard.writeText(downloadHref).then(function () {
|
||||||
textArea.value = downloadHref;
|
|
||||||
document.body.appendChild(textArea);
|
|
||||||
textArea.focus();
|
|
||||||
textArea.select();
|
|
||||||
if (document.execCommand("copy")) {
|
|
||||||
require(["toast"], function (toast) {
|
require(["toast"], function (toast) {
|
||||||
toast(globalize.translate("CopyStreamURLSuccess"));
|
toast(globalize.translate("CopyStreamURLSuccess"));
|
||||||
});
|
});
|
||||||
} else {
|
}, function () {
|
||||||
console.error("Failed to copy to clipboard");
|
console.error("Failed to copy to clipboard");
|
||||||
require(["toast"], function (toast) {
|
require(["toast"], function (toast) {
|
||||||
toast(globalize.translate("CopyStreamURLError"));
|
toast(globalize.translate("CopyStreamURLError"));
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
document.body.removeChild(textArea);
|
|
||||||
getResolveFunction(resolve, id)();
|
getResolveFunction(resolve, id)();
|
||||||
break;
|
break;
|
||||||
case "editsubtitles":
|
case "editsubtitles":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue