mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Clipboard API fallback for when browser doesn't support navigator.clipboard
This commit is contained in:
parent
290f6d32ba
commit
52e39e792f
1 changed files with 11 additions and 6 deletions
|
@ -346,11 +346,7 @@ define(["apphost", "globalize", "connectionManager", "itemHelper", "appRouter",
|
|||
break;
|
||||
case "copy-stream":
|
||||
var downloadHref = apiClient.getItemDownloadUrl(itemId);
|
||||
navigator.clipboard.writeText(downloadHref).then(function () {
|
||||
require(["toast"], function (toast) {
|
||||
toast(globalize.translate("CopyStreamURLSuccess"));
|
||||
});
|
||||
}, function () {
|
||||
var textareaCopy = function () {
|
||||
var textArea = document.createElement("textarea");
|
||||
textArea.value = downloadHref;
|
||||
document.body.appendChild(textArea);
|
||||
|
@ -364,7 +360,16 @@ define(["apphost", "globalize", "connectionManager", "itemHelper", "appRouter",
|
|||
prompt(globalize.translate("CopyStreamURL"), downloadHref);
|
||||
}
|
||||
document.body.removeChild(textArea);
|
||||
});
|
||||
};
|
||||
if (navigator.clipboard === undefined) {
|
||||
textareaCopy();
|
||||
} else {
|
||||
navigator.clipboard.writeText(downloadHref).then(function () {
|
||||
require(["toast"], function (toast) {
|
||||
toast(globalize.translate("CopyStreamURLSuccess"));
|
||||
});
|
||||
}, textareaCopy);
|
||||
}
|
||||
getResolveFunction(resolve, id)();
|
||||
break;
|
||||
case "editsubtitles":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue