mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Disallow block padding
This commit is contained in:
parent
454b81a037
commit
5e1b6acffe
126 changed files with 2 additions and 2127 deletions
|
@ -13,10 +13,8 @@ import 'css!./multiSelect';
|
|||
let currentSelectionCommandsPanel;
|
||||
|
||||
function hideSelections() {
|
||||
|
||||
const selectionCommandsPanel = currentSelectionCommandsPanel;
|
||||
if (selectionCommandsPanel) {
|
||||
|
||||
selectionCommandsPanel.parentNode.removeChild(selectionCommandsPanel);
|
||||
currentSelectionCommandsPanel = null;
|
||||
|
||||
|
@ -24,7 +22,6 @@ import 'css!./multiSelect';
|
|||
selectedElements = [];
|
||||
const elems = document.querySelectorAll('.itemSelectionPanel');
|
||||
for (let i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
const parent = elems[i].parentNode;
|
||||
parent.removeChild(elems[i]);
|
||||
parent.classList.remove('withMultiSelect');
|
||||
|
@ -33,13 +30,11 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function onItemSelectionPanelClick(e, itemSelectionPanel) {
|
||||
|
||||
// toggle the checkbox, if it wasn't clicked on
|
||||
if (!dom.parentWithClass(e.target, 'chkItemSelect')) {
|
||||
const chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect');
|
||||
|
||||
if (chkItemSelect) {
|
||||
|
||||
if (chkItemSelect.classList.contains('checkedInitial')) {
|
||||
chkItemSelect.classList.remove('checkedInitial');
|
||||
} else {
|
||||
|
@ -56,11 +51,9 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function updateItemSelection(chkItemSelect, selected) {
|
||||
|
||||
const id = dom.parentWithAttribute(chkItemSelect, 'data-id').getAttribute('data-id');
|
||||
|
||||
if (selected) {
|
||||
|
||||
const current = selectedItems.filter(i => {
|
||||
return i === id;
|
||||
});
|
||||
|
@ -69,7 +62,6 @@ import 'css!./multiSelect';
|
|||
selectedItems.push(id);
|
||||
selectedElements.push(chkItemSelect);
|
||||
}
|
||||
|
||||
} else {
|
||||
selectedItems = selectedItems.filter(i => {
|
||||
return i !== id;
|
||||
|
@ -94,11 +86,9 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function showSelection(item, isChecked) {
|
||||
|
||||
let itemSelectionPanel = item.querySelector('.itemSelectionPanel');
|
||||
|
||||
if (!itemSelectionPanel) {
|
||||
|
||||
itemSelectionPanel = document.createElement('div');
|
||||
itemSelectionPanel.classList.add('itemSelectionPanel');
|
||||
|
||||
|
@ -120,11 +110,9 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function showSelectionCommands() {
|
||||
|
||||
let selectionCommandsPanel = currentSelectionCommandsPanel;
|
||||
|
||||
if (!selectionCommandsPanel) {
|
||||
|
||||
selectionCommandsPanel = document.createElement('div');
|
||||
selectionCommandsPanel.classList.add('selectionCommandsPanel');
|
||||
|
||||
|
@ -150,9 +138,7 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function alertText(options) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert(options).then(resolve, resolve);
|
||||
});
|
||||
|
@ -160,9 +146,7 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function deleteItems(apiClient, itemIds) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
let msg = globalize.translate('ConfirmDeleteItem');
|
||||
let title = globalize.translate('HeaderDeleteItem');
|
||||
|
||||
|
@ -172,28 +156,23 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
|
||||
confirm(msg, title).then(() => {
|
||||
const promises = itemIds.map(itemId => {
|
||||
apiClient.deleteItem(itemId);
|
||||
});
|
||||
|
||||
Promise.all(promises).then(resolve, () => {
|
||||
|
||||
alertText(globalize.translate('ErrorDeletingItem')).then(reject, reject);
|
||||
});
|
||||
}, reject);
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function showMenuForSelectedItems(e) {
|
||||
|
||||
const apiClient = connectionManager.currentApiClient();
|
||||
|
||||
apiClient.getCurrentUser().then(user => {
|
||||
|
||||
const menuItems = [];
|
||||
|
||||
menuItems.push({
|
||||
|
@ -317,17 +296,14 @@ import 'css!./multiSelect';
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function dispatchNeedsRefresh() {
|
||||
|
||||
const elems = [];
|
||||
|
||||
[].forEach.call(selectedElements, i => {
|
||||
|
||||
const container = dom.parentWithAttribute(i, 'is', 'emby-itemscontainer');
|
||||
|
||||
if (container && !elems.includes(container)) {
|
||||
|
@ -341,9 +317,7 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function combineVersions(apiClient, selection) {
|
||||
|
||||
if (selection.length < 2) {
|
||||
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert({
|
||||
|
||||
|
@ -361,7 +335,6 @@ import 'css!./multiSelect';
|
|||
url: apiClient.getUrl('Videos/MergeVersions', { Ids: selection.join(',') })
|
||||
|
||||
}).then(() => {
|
||||
|
||||
loading.hide();
|
||||
hideSelections();
|
||||
dispatchNeedsRefresh();
|
||||
|
@ -369,7 +342,6 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function showSelections(initialCard) {
|
||||
|
||||
import('emby-checkbox').then(() => {
|
||||
const cards = document.querySelectorAll('.card');
|
||||
for (let i = 0, length = cards.length; i < length; i++) {
|
||||
|
@ -382,11 +354,9 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function onContainerClick(e) {
|
||||
|
||||
const target = e.target;
|
||||
|
||||
if (selectedItems.length) {
|
||||
|
||||
const card = dom.parentWithClass(target, 'card');
|
||||
if (card) {
|
||||
const itemSelectionPanel = card.querySelector('.itemSelectionPanel');
|
||||
|
@ -404,17 +374,14 @@ import 'css!./multiSelect';
|
|||
document.addEventListener('viewbeforehide', hideSelections);
|
||||
|
||||
export default function (options) {
|
||||
|
||||
const self = this;
|
||||
|
||||
const container = options.container;
|
||||
|
||||
function onTapHold(e) {
|
||||
|
||||
const card = dom.parentWithClass(e.target, 'card');
|
||||
|
||||
if (card) {
|
||||
|
||||
showSelections(card);
|
||||
}
|
||||
|
||||
|
@ -427,7 +394,6 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function getTouches(e) {
|
||||
|
||||
return e.changedTouches || e.targetTouches || e.touches;
|
||||
}
|
||||
|
||||
|
@ -436,7 +402,6 @@ import 'css!./multiSelect';
|
|||
let touchStartX;
|
||||
let touchStartY;
|
||||
function onTouchStart(e) {
|
||||
|
||||
const touch = getTouches(e)[0];
|
||||
touchTarget = null;
|
||||
touchStartX = 0;
|
||||
|
@ -451,7 +416,6 @@ import 'css!./multiSelect';
|
|||
const card = dom.parentWithClass(element, 'card');
|
||||
|
||||
if (card) {
|
||||
|
||||
if (touchStartTimeout) {
|
||||
clearTimeout(touchStartTimeout);
|
||||
touchStartTimeout = null;
|
||||
|
@ -465,7 +429,6 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function onTouchMove(e) {
|
||||
|
||||
if (touchTarget) {
|
||||
const touch = getTouches(e)[0];
|
||||
let deltaX;
|
||||
|
@ -487,12 +450,10 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function onTouchEnd(e) {
|
||||
|
||||
onMouseOut(e);
|
||||
}
|
||||
|
||||
function onMouseDown(e) {
|
||||
|
||||
if (touchStartTimeout) {
|
||||
clearTimeout(touchStartTimeout);
|
||||
touchStartTimeout = null;
|
||||
|
@ -503,7 +464,6 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function onMouseOut(e) {
|
||||
|
||||
if (touchStartTimeout) {
|
||||
clearTimeout(touchStartTimeout);
|
||||
touchStartTimeout = null;
|
||||
|
@ -512,7 +472,6 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function onTouchStartTimerFired() {
|
||||
|
||||
if (!touchTarget) {
|
||||
return;
|
||||
}
|
||||
|
@ -521,13 +480,11 @@ import 'css!./multiSelect';
|
|||
touchTarget = null;
|
||||
|
||||
if (card) {
|
||||
|
||||
showSelections(card);
|
||||
}
|
||||
}
|
||||
|
||||
function initTapHold(element) {
|
||||
|
||||
// mobile safari doesn't allow contextmenu override
|
||||
if (browser.touch && !browser.safari) {
|
||||
element.addEventListener('contextmenu', onTapHold);
|
||||
|
@ -565,7 +522,6 @@ import 'css!./multiSelect';
|
|||
self.onContainerClick = onContainerClick;
|
||||
|
||||
self.destroy = () => {
|
||||
|
||||
container.removeEventListener('click', onContainerClick);
|
||||
container.removeEventListener('contextmenu', onTapHold);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue