Added option, if file is downloadable, copy the URL to clipboard

This commit is contained in:
ckcr4lyf 2019-08-27 17:32:35 +08:00
parent f72d26b9da
commit 437729d3f3
3 changed files with 24 additions and 1 deletions

View File

@ -134,6 +134,11 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
name: globalize.translate('Download'),
id: 'download'
});
commands.push({
name: globalize.translate('CopyStreamURL'),
id: 'copy-stream'
});
}
var canEdit = itemHelper.canEdit(user, item);
@ -305,6 +310,22 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
getResolveFunction(getResolveFunction(resolve, id), id)();
});
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();
try {
document.execCommand('copy');
} catch (err) {
}
document.body.removeChild(textArea);
getResolveFunction(resolve, id)();
break;
case 'editsubtitles':
require(['subtitleEditor'], function (subtitleEditor) {
subtitleEditor.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));

View File

@ -452,5 +452,6 @@
"HeaderPassword": "Password",
"HeaderPasswordReset": "Password Reset",
"HeaderPaths": "Paths",
"HeaderPendingInvitations": "Pending Invitations"
"HeaderPendingInvitations": "Pending Invitations",
"CopyStreamURL": "Copy Stream URL"
}

View File

@ -160,6 +160,7 @@
"Connect": "Connect",
"ContinueWatching": "Continue watching",
"Continuing": "Continuing",
"CopyStreamURL": "Copy Stream URL",
"CriticRating": "Critic rating",
"CustomDlnaProfilesHelp": "Create a custom profile to target a new device or override a system profile.",
"DateAdded": "Date added",