diff --git a/src/components/itemcontextmenu.js b/src/components/itemcontextmenu.js index 6bc81f62b2..2a985b026a 100644 --- a/src/components/itemcontextmenu.js +++ b/src/components/itemcontextmenu.js @@ -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' diff --git a/src/controllers/itemdetailpage.js b/src/controllers/itemdetailpage.js index abfdcc459f..31d5a0eb22 100644 --- a/src/controllers/itemdetailpage.js +++ b/src/controllers/itemdetailpage.js @@ -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() { diff --git a/src/itemdetails.html b/src/itemdetails.html index 2335feb3ef..5b78b12976 100644 --- a/src/itemdetails.html +++ b/src/itemdetails.html @@ -71,6 +71,17 @@ ${ButtonPlay} + + + +