Merge pull request #396 from Abbe98/book-download-btn

Move download action to major button for books (itemdetailspage)
This commit is contained in:
Anthony Lavado 2019-08-14 16:05:52 -04:00 committed by GitHub
commit e20f7e02ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 1 deletions

View File

@ -133,7 +133,8 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
}
}
if (item.CanDownload && appHost.supports('filedownload')) {
// Books are promoted to major download Button and therefor excluded in the context menu
if ((item.CanDownload && appHost.supports('filedownload')) && item.Type !== "Book") {
commands.push({
name: globalize.translate('Download'),
id: 'download'

View File

@ -323,6 +323,10 @@ define(["loading", "appRouter", "layoutManager", "connectionManager", "cardBuild
} else itemBirthLocation.classList.add("hide");
setPeopleHeader(page, item), loading.hide()
if (item.Type === "Book") {
hideAll(page, "btnDownload", true);
}
try {
require(["focusManager"], function(focusManager) {
[".btnResume", ".btnPlay"].every(function (cls) {
@ -1174,6 +1178,17 @@ define(["loading", "appRouter", "layoutManager", "connectionManager", "cardBuild
reload(self, view, params)
}
function onDownloadClick() {
require(['fileDownloader'], function (fileDownloader) {
var downloadHref = apiClient.getItemDownloadUrl(currentItem.Id);
fileDownloader.download([{
url: downloadHref,
itemId: currentItem.Id,
serverId: currentItem.serverId
}]);
});
}
function onMoreCommandsClick() {
var button = this;
apiClient.getCurrentUser().then(function(user) {
@ -1223,6 +1238,7 @@ define(["loading", "appRouter", "layoutManager", "connectionManager", "cardBuild
bindAll(view, ".btnCancelSeriesTimer", "click", onCancelSeriesTimerClick);
bindAll(view, ".btnCancelTimer", "click", onCancelTimerClick);
bindAll(view, ".btnDeleteItem", "click", onDeleteClick);
bindAll(view, ".btnDownload", "click", onDownloadClick);
view.querySelector(".btnMoreCommands i").innerHTML = "";
view.querySelector(".trackSelections").addEventListener("submit", onTrackSelectionsSubmit);
view.querySelector(".btnSplitVersions").addEventListener("click", function() {

View File

@ -71,6 +71,17 @@
<span>${ButtonPlay}</span>
</button>
<button is="emby-button" type="button" class="button-flat btnDownload hide detailButton-mobile">
<div class="detailButton-mobile-content">
<i class="md-icon detailButton-mobile-icon">&#xe884;</i>
<div class="detailButton-mobile-text">${ButtonDownload}</div>
</div>
</button>
<button is="emby-button" type="button" class="raised btnDownload hide detailButton">
<span>${ButtonDownload}</span>
</button>
<button is="emby-button" type="button" class="button-flat btnPlayTrailer hide detailButton-mobile">
<div class="detailButton-mobile-content">
<i class="md-icon detailButton-mobile-icon">&#xE8DA;</i>