1
0
Fork 0
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:
Thibault Nocchi 2020-02-01 17:26:03 +01:00
parent 254c69b2f1
commit 74530fe4d9

View file

@ -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":