1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #754 from ThibaultNocchi/copy_url_firefox_fix

Clipboard API & fallback method to copy stream URL
This commit is contained in:
Anthony Lavado 2020-02-09 03:07:24 -05:00 committed by GitHub
commit 0d0f210c6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 14 deletions

View file

@ -32,6 +32,7 @@
- [bilde2910](https://github.com/bilde2910)
- [Daniel Hartung](https://github.com/dhartung)
- [Ryan Hartzell](https://github.com/ryan-hartzell)
- [Thibault Nocchi](https://github.com/ThibaultNocchi)
# Emby Contributors

View file

@ -346,6 +346,11 @@ 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 textArea = document.createElement("textarea");
textArea.value = downloadHref;
document.body.appendChild(textArea);
@ -356,13 +361,10 @@ define(["apphost", "globalize", "connectionManager", "itemHelper", "appRouter",
toast(globalize.translate("CopyStreamURLSuccess"));
});
} else {
console.error("Failed to copy to clipboard");
require(["toast"], function (toast) {
toast(globalize.translate("CopyStreamURLError"));
});
prompt(globalize.translate("CopyStreamURL"), downloadHref);
}
document.body.removeChild(textArea);
});
getResolveFunction(resolve, id)();
break;
case "editsubtitles":