hide the empty "..." menu button on BoxSet detail pages for guests
Cette révision appartient à :
@@ -338,6 +338,29 @@
|
||||
return guestStatePromise;
|
||||
}
|
||||
|
||||
function hideEmptyMoreButtonOnBoxSet() {
|
||||
var button = document.querySelector(".btnMoreCommands.detailButton");
|
||||
if (!button) {
|
||||
return;
|
||||
}
|
||||
|
||||
var itemId = parseItemIdFromUrl() || findItemIdInDocument();
|
||||
var id = itemId ? itemId.toLowerCase() : "";
|
||||
var type =
|
||||
id && Object.prototype.hasOwnProperty.call(itemTypeCache, id)
|
||||
? itemTypeCache[id]
|
||||
: null;
|
||||
|
||||
if (type === "boxset") {
|
||||
button.setAttribute("data-sharelinks-hidden-boxset", "1");
|
||||
button.style.setProperty("display", "none", "important");
|
||||
} else if (button.getAttribute("data-sharelinks-hidden-boxset") === "1") {
|
||||
// Route changed away from a BoxSet page (SPA navigation): restore it.
|
||||
button.removeAttribute("data-sharelinks-hidden-boxset");
|
||||
button.style.removeProperty("display");
|
||||
}
|
||||
}
|
||||
|
||||
function hideBlockedGuestMenuItems() {
|
||||
var nodes = document.querySelectorAll(".actionSheetMenuItem");
|
||||
Array.prototype.forEach.call(nodes, function (node) {
|
||||
@@ -382,11 +405,24 @@
|
||||
hideGuestControls();
|
||||
hideBlockedGuestMenuItems();
|
||||
|
||||
var pageItemId = parseItemIdFromUrl() || findItemIdInDocument();
|
||||
if (pageItemId && isItemGuid(pageItemId)) {
|
||||
var id = pageItemId.toLowerCase();
|
||||
if (
|
||||
!Object.prototype.hasOwnProperty.call(itemTypeCache, id) &&
|
||||
!itemTypeInFlight[id]
|
||||
) {
|
||||
itemTypeInFlight[id] = fetchItemType(id); // populates itemTypeCache, then calls scheduleWork()
|
||||
}
|
||||
}
|
||||
hideEmptyMoreButtonOnBoxSet();
|
||||
|
||||
// UX-only lockdown: the guest user's real access boundary is still the
|
||||
// server-side policy and item tags. This just keeps the web client out
|
||||
// of the user's way, while still letting the guest browse into the
|
||||
// shared tree (series -> season -> episode) when the server says the
|
||||
// item is visible to them.
|
||||
|
||||
if (!context.allowedItemId) {
|
||||
return;
|
||||
}
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur