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:
commit
0d0f210c6a
2 changed files with 17 additions and 14 deletions
|
@ -32,6 +32,7 @@
|
||||||
- [bilde2910](https://github.com/bilde2910)
|
- [bilde2910](https://github.com/bilde2910)
|
||||||
- [Daniel Hartung](https://github.com/dhartung)
|
- [Daniel Hartung](https://github.com/dhartung)
|
||||||
- [Ryan Hartzell](https://github.com/ryan-hartzell)
|
- [Ryan Hartzell](https://github.com/ryan-hartzell)
|
||||||
|
- [Thibault Nocchi](https://github.com/ThibaultNocchi)
|
||||||
|
|
||||||
# Emby Contributors
|
# Emby Contributors
|
||||||
|
|
||||||
|
|
|
@ -346,23 +346,25 @@ 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");
|
var textArea = document.createElement("textarea");
|
||||||
require(["toast"], function (toast) {
|
textArea.value = downloadHref;
|
||||||
toast(globalize.translate("CopyStreamURLError"));
|
document.body.appendChild(textArea);
|
||||||
});
|
textArea.focus();
|
||||||
}
|
textArea.select();
|
||||||
|
if (document.execCommand("copy")) {
|
||||||
document.body.removeChild(textArea);
|
require(["toast"], function (toast) {
|
||||||
|
toast(globalize.translate("CopyStreamURLSuccess"));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
prompt(globalize.translate("CopyStreamURL"), downloadHref);
|
||||||
|
}
|
||||||
|
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