2019-01-23 11:33:34 +00:00
|
|
|
define(['playbackManager', 'userSettings', 'alphaPicker', 'alphaNumericShortcuts', 'connectionManager', 'focusManager', 'loading', 'globalize'], function (playbackManager, userSettings, AlphaPicker, AlphaNumericShortcuts, connectionManager, focusManager, loading, globalize) {
|
2019-01-10 15:39:37 +03:00
|
|
|
'use strict';
|
2018-10-23 01:05:09 +03:00
|
|
|
|
|
|
|
function trySelectValue(instance, scroller, view, value) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var card;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
// If it's the symbol just pick the first card
|
|
|
|
if (value === '#') {
|
|
|
|
|
|
|
|
card = view.querySelector('.card');
|
|
|
|
|
|
|
|
if (card) {
|
|
|
|
scroller.toStart(card, false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
card = view.querySelector('.card[data-prefix^=\'' + value + '\']');
|
|
|
|
|
|
|
|
if (card) {
|
|
|
|
scroller.toStart(card, false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// go to the previous letter
|
|
|
|
var values = instance.alphaPicker.values();
|
|
|
|
var index = values.indexOf(value);
|
|
|
|
|
|
|
|
if (index < values.length - 2) {
|
|
|
|
trySelectValue(instance, scroller, view, values[index + 1]);
|
|
|
|
} else {
|
|
|
|
var all = view.querySelectorAll('.card');
|
|
|
|
card = all.length ? all[all.length - 1] : null;
|
|
|
|
|
|
|
|
if (card) {
|
|
|
|
scroller.toStart(card, false);
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function onAlphaValueChanged() {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var value = this.alphaPicker.value();
|
2019-01-10 15:39:37 +03:00
|
|
|
var scroller = this.scroller;
|
|
|
|
|
|
|
|
trySelectValue(this, scroller, this.itemsContainer, value);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function initAlphaPicker(instance, view) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
instance.itemsContainer = view.querySelector('.itemsContainer');
|
|
|
|
|
|
|
|
instance.alphaPicker = new AlphaPicker({
|
2018-10-23 01:05:09 +03:00
|
|
|
element: instance.alphaPickerElement,
|
|
|
|
itemsContainer: instance.itemsContainer,
|
2019-01-10 15:39:37 +03:00
|
|
|
itemClass: 'card'
|
|
|
|
});
|
|
|
|
|
|
|
|
instance.alphaPicker.on('alphavaluechanged', onAlphaValueChanged.bind(instance));
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function showFilterMenu() {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var instance = this;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
require(['filterMenu'], function (FilterMenu) {
|
|
|
|
|
|
|
|
new FilterMenu().show({
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
settingsKey: instance.getSettingsKey(),
|
|
|
|
settings: instance.getFilters(),
|
|
|
|
visibleSettings: instance.getVisibleFilters(),
|
|
|
|
onChange: instance.itemsContainer.refreshItems.bind(instance.itemsContainer),
|
|
|
|
parentId: instance.params.parentId,
|
|
|
|
itemTypes: instance.getItemTypes ? instance.getItemTypes() : [],
|
|
|
|
serverId: instance.apiClient.serverId(),
|
|
|
|
filterMenuOptions: instance.getFilterMenuOptions()
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
}).then(function () {
|
|
|
|
|
|
|
|
instance.itemsContainer.refreshItems();
|
|
|
|
});
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function updateAlphaPickerState(instance) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
if (!instance.alphaPicker) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var alphaPicker = instance.alphaPickerElement;
|
|
|
|
if (!alphaPicker) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var values = instance.getSortValues();
|
|
|
|
|
|
|
|
if (values.sortBy === 'SortName' && values.sortOrder === 'Ascending') {
|
|
|
|
alphaPicker.classList.remove('hide');
|
|
|
|
} else {
|
|
|
|
alphaPicker.classList.add('hide');
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function showSortMenu() {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var instance = this;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
require(['sortMenu'], function (SortMenu) {
|
|
|
|
|
|
|
|
new SortMenu().show({
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
settingsKey: instance.getSettingsKey(),
|
|
|
|
settings: instance.getSortValues(),
|
|
|
|
onChange: instance.itemsContainer.refreshItems.bind(instance.itemsContainer),
|
|
|
|
serverId: instance.params.serverId,
|
|
|
|
sortOptions: instance.getSortMenuOptions()
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
}).then(function () {
|
|
|
|
|
|
|
|
updateSortText(instance);
|
|
|
|
updateAlphaPickerState(instance);
|
|
|
|
|
|
|
|
instance.itemsContainer.refreshItems();
|
|
|
|
});
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function showViewSettingsMenu() {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var instance = this;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
require(['viewSettings'], function (ViewSettings) {
|
|
|
|
|
|
|
|
new ViewSettings().show({
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
settingsKey: instance.getSettingsKey(),
|
|
|
|
settings: instance.getViewSettings(),
|
|
|
|
visibleSettings: instance.getVisibleViewSettings()
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
}).then(function () {
|
|
|
|
|
|
|
|
updateItemsContainerForViewType(instance);
|
|
|
|
instance.itemsContainer.refreshItems();
|
|
|
|
});
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function updateItemsContainerForViewType(instance) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
var settings = instance.getViewSettings();
|
|
|
|
|
|
|
|
if (settings.imageType === 'list') {
|
|
|
|
|
|
|
|
instance.itemsContainer.classList.remove('vertical-wrap');
|
|
|
|
instance.itemsContainer.classList.add('vertical-list');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
instance.itemsContainer.classList.add('vertical-wrap');
|
|
|
|
instance.itemsContainer.classList.remove('vertical-list');
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function updateSortText(instance) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var btnSortText = instance.btnSortText;
|
2019-01-10 15:39:37 +03:00
|
|
|
if (!btnSortText) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var options = instance.getSortMenuOptions();
|
|
|
|
var values = instance.getSortValues();
|
|
|
|
|
|
|
|
var sortBy = values.sortBy;
|
|
|
|
|
|
|
|
for (var i = 0, length = options.length; i < length; i++) {
|
|
|
|
|
|
|
|
if (sortBy === options[i].value) {
|
|
|
|
|
2019-02-03 02:41:16 +09:00
|
|
|
btnSortText.innerHTML = globalize.translate('SortByValue', options[i].name);
|
2019-01-10 15:39:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
var btnSortIcon = instance.btnSortIcon;
|
|
|
|
if (!btnSortIcon) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
btnSortIcon.innerHTML = values.sortOrder === 'Descending' ? '' : '';
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function bindAll(elems, eventName, fn) {
|
2019-01-10 15:39:37 +03:00
|
|
|
for (var i = 0, length = elems.length; i < length; i++) {
|
|
|
|
|
|
|
|
elems[i].addEventListener(eventName, fn);
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function play() {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
this.fetchData().then(function (result) {
|
2018-10-23 01:05:09 +03:00
|
|
|
playbackManager.play({
|
|
|
|
items: result.Items || result
|
2019-01-10 15:39:37 +03:00
|
|
|
});
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function shuffle() {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
this.fetchData().then(function (result) {
|
2018-10-23 01:05:09 +03:00
|
|
|
playbackManager.play({
|
|
|
|
items: result.Items || result
|
2019-01-10 15:39:37 +03:00
|
|
|
});
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function hideOrShowAll(elems, hide) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
for (var i = 0, length = elems.length; i < length; i++) {
|
|
|
|
|
|
|
|
if (hide) {
|
|
|
|
elems[i].classList.add('hide');
|
|
|
|
} else {
|
|
|
|
elems[i].classList.remove('hide');
|
|
|
|
}
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function ItemsTab(view, params) {
|
2019-01-10 15:39:37 +03:00
|
|
|
this.view = view;
|
|
|
|
this.params = params;
|
|
|
|
|
|
|
|
if (params.serverId) {
|
|
|
|
this.apiClient = connectionManager.getApiClient(params.serverId);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.itemsContainer = view.querySelector('.itemsContainer');
|
|
|
|
this.scroller = view.querySelector('.scrollFrameY');
|
|
|
|
|
|
|
|
this.itemsContainer.fetchData = this.fetchData.bind(this);
|
|
|
|
this.itemsContainer.getItemsHtml = this.getItemsHtml.bind(this);
|
|
|
|
|
|
|
|
if (params.parentId) {
|
|
|
|
this.itemsContainer.setAttribute('data-parentid', params.parentId);
|
|
|
|
}
|
|
|
|
|
|
|
|
var i, length;
|
|
|
|
|
|
|
|
var btnViewSettings = view.querySelectorAll('.btnViewSettings');
|
|
|
|
for (i = 0, length = btnViewSettings.length; i < length; i++) {
|
|
|
|
|
|
|
|
btnViewSettings[i].addEventListener('click', showViewSettingsMenu.bind(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
var filterButtons = view.querySelectorAll('.btnFilter');
|
2018-10-23 01:05:09 +03:00
|
|
|
this.filterButtons = filterButtons;
|
|
|
|
var hasVisibleFilters = this.getVisibleFilters().length;
|
|
|
|
for (i = 0, length = filterButtons.length; i < length; i++) {
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var btnFilter = filterButtons[i];
|
2019-01-10 15:39:37 +03:00
|
|
|
btnFilter.addEventListener('click', showFilterMenu.bind(this));
|
|
|
|
|
|
|
|
if (hasVisibleFilters) {
|
|
|
|
btnFilter.classList.remove('hide');
|
|
|
|
} else {
|
|
|
|
btnFilter.classList.add('hide');
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
var sortButtons = view.querySelectorAll('.btnSort');
|
|
|
|
this.sortButtons = sortButtons;
|
|
|
|
for (i = 0, length = sortButtons.length; i < length; i++) {
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var sortButton = sortButtons[i];
|
2019-01-10 15:39:37 +03:00
|
|
|
sortButton.addEventListener('click', showSortMenu.bind(this));
|
|
|
|
|
|
|
|
if (params.type !== 'nextup') {
|
|
|
|
sortButton.classList.remove('hide');
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
this.btnSortText = view.querySelector('.btnSortText');
|
|
|
|
this.btnSortIcon = view.querySelector('.btnSortIcon');
|
|
|
|
|
|
|
|
this.alphaPickerElement = view.querySelector('.alphaPicker');
|
|
|
|
|
|
|
|
hideOrShowAll(view.querySelectorAll('.btnShuffle'), true);
|
|
|
|
|
|
|
|
bindAll(view.querySelectorAll('.btnPlay'), 'click', play.bind(this));
|
|
|
|
bindAll(view.querySelectorAll('.btnShuffle'), 'click', shuffle.bind(this));
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
function getSettingValue(key, defaultValue) {
|
|
|
|
}
|
|
|
|
|
|
|
|
ItemsTab.prototype.getViewSettings = function () {
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var basekey = this.getSettingsKey();
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
return {
|
2019-01-10 15:39:37 +03:00
|
|
|
showTitle: userSettings.get(basekey + '-showTitle') !== 'false',
|
|
|
|
showYear: userSettings.get(basekey + '-showYear') !== 'false',
|
|
|
|
imageType: userSettings.get(basekey + '-imageType') || this.getDefaultImageType()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getDefaultImageType = function () {
|
|
|
|
|
|
|
|
return 'primary';
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getSettingsKey = function () {
|
|
|
|
|
|
|
|
return this.params.parentId + '-1';
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.onResume = function (options) {
|
|
|
|
|
|
|
|
if (options && options.refresh) {
|
|
|
|
updateSortText(this);
|
|
|
|
updateItemsContainerForViewType(this);
|
|
|
|
loading.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
var view = this.view;
|
|
|
|
|
|
|
|
var scroller = this.scroller;
|
|
|
|
if (scroller && scroller.resume) {
|
|
|
|
scroller.resume();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.enableAlphaPicker && !this.alphaPicker) {
|
|
|
|
initAlphaPicker(this, view);
|
|
|
|
updateAlphaPickerState(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.enableAlphaNumericShortcuts !== false) {
|
|
|
|
this.alphaNumericShortcuts = new AlphaNumericShortcuts({
|
|
|
|
itemsContainer: this.itemsContainer
|
|
|
|
});
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
var instance = this;
|
|
|
|
var autoFocus = options.autoFocus;
|
|
|
|
|
|
|
|
this.itemsContainer.resume(options).then(function (result) {
|
|
|
|
|
|
|
|
loading.hide();
|
|
|
|
|
|
|
|
if (autoFocus) {
|
|
|
|
focusManager.autoFocus(instance.itemsContainer);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getVisibleViewSettings = function () {
|
|
|
|
|
|
|
|
return [
|
|
|
|
'showTitle',
|
|
|
|
'showYear',
|
|
|
|
'imageType'
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getFilters = function () {
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var basekey = this.getSettingsKey();
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
return {
|
2019-01-10 15:39:37 +03:00
|
|
|
IsPlayed: userSettings.getFilter(basekey + '-filter-IsPlayed') === 'true',
|
|
|
|
IsUnplayed: userSettings.getFilter(basekey + '-filter-IsUnplayed') === 'true',
|
|
|
|
IsFavorite: userSettings.getFilter(basekey + '-filter-IsFavorite') === 'true',
|
|
|
|
IsResumable: userSettings.getFilter(basekey + '-filter-IsResumable') === 'true',
|
|
|
|
Is4K: userSettings.getFilter(basekey + '-filter-Is4K') === 'true',
|
|
|
|
IsHD: userSettings.getFilter(basekey + '-filter-IsHD') === 'true',
|
|
|
|
IsSD: userSettings.getFilter(basekey + '-filter-IsSD') === 'true',
|
|
|
|
Is3D: userSettings.getFilter(basekey + '-filter-Is3D') === 'true',
|
|
|
|
VideoTypes: userSettings.getFilter(basekey + '-filter-VideoTypes'),
|
|
|
|
SeriesStatus: userSettings.getFilter(basekey + '-filter-SeriesStatus'),
|
|
|
|
HasSubtitles: userSettings.getFilter(basekey + '-filter-HasSubtitles'),
|
|
|
|
HasTrailer: userSettings.getFilter(basekey + '-filter-HasTrailer'),
|
|
|
|
HasSpecialFeature: userSettings.getFilter(basekey + '-filter-HasSpecialFeature'),
|
|
|
|
HasThemeSong: userSettings.getFilter(basekey + '-filter-HasThemeSong'),
|
|
|
|
HasThemeVideo: userSettings.getFilter(basekey + '-filter-HasThemeVideo'),
|
|
|
|
GenreIds: userSettings.getFilter(basekey + '-filter-GenreIds')
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getSortValues = function () {
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var basekey = this.getSettingsKey();
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
return {
|
2019-01-10 15:39:37 +03:00
|
|
|
sortBy: userSettings.getFilter(basekey + '-sortby') || this.getSortMenuOptions()[0].value,
|
|
|
|
sortOrder: userSettings.getFilter(basekey + '-sortorder') === 'Descending' ? 'Descending' : 'Ascending'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getVisibleFilters = function () {
|
|
|
|
|
|
|
|
return [
|
|
|
|
'IsUnplayed',
|
|
|
|
'IsPlayed',
|
|
|
|
'IsFavorite',
|
|
|
|
'IsResumable',
|
|
|
|
'VideoType',
|
|
|
|
'HasSubtitles',
|
|
|
|
'HasTrailer',
|
|
|
|
'HasSpecialFeature',
|
|
|
|
'HasThemeSong',
|
|
|
|
'HasThemeVideo'
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getDefaultSortBy = function () {
|
|
|
|
|
|
|
|
return 'SortName';
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getSortMenuOptions = function () {
|
|
|
|
|
|
|
|
var sortBy = [];
|
|
|
|
|
|
|
|
var option = this.getNameSortOption();
|
|
|
|
if (option) {
|
|
|
|
sortBy.push(option);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
option = this.getCommunityRatingSortOption();
|
|
|
|
if (option) {
|
|
|
|
sortBy.push(option);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
option = this.getCriticRatingSortOption();
|
|
|
|
|
|
|
|
if (option) {
|
|
|
|
sortBy.push(option);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
sortBy.push({
|
2019-02-03 02:41:16 +09:00
|
|
|
name: globalize.translate('DateAdded'),
|
2019-01-10 15:39:37 +03:00
|
|
|
value: 'DateCreated,SortName'
|
|
|
|
});
|
|
|
|
|
|
|
|
option = this.getDatePlayedSortOption();
|
|
|
|
if (option) {
|
|
|
|
sortBy.push(option);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
sortBy.push({
|
2019-02-03 02:41:16 +09:00
|
|
|
name: globalize.translate('ParentalRating'),
|
2019-01-10 15:39:37 +03:00
|
|
|
value: 'OfficialRating,SortName'
|
|
|
|
});
|
|
|
|
|
|
|
|
option = this.getPlayCountSortOption();
|
|
|
|
if (option) {
|
|
|
|
sortBy.push(option);
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
sortBy.push({
|
2019-02-03 02:41:16 +09:00
|
|
|
name: globalize.translate('ReleaseDate'),
|
2019-01-10 15:39:37 +03:00
|
|
|
value: 'PremiereDate,ProductionYear,SortName'
|
|
|
|
});
|
|
|
|
|
|
|
|
sortBy.push({
|
2019-02-03 02:41:16 +09:00
|
|
|
name: globalize.translate('Runtime'),
|
2019-01-10 15:39:37 +03:00
|
|
|
value: 'Runtime,SortName'
|
|
|
|
});
|
|
|
|
|
|
|
|
return sortBy;
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getNameSortOption = function () {
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
return {
|
2019-02-03 02:41:16 +09:00
|
|
|
name: globalize.translate('Name'),
|
2019-01-10 15:39:37 +03:00
|
|
|
value: 'SortName'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getPlayCountSortOption = function () {
|
|
|
|
|
|
|
|
return {
|
2019-02-03 02:41:16 +09:00
|
|
|
name: globalize.translate('PlayCount'),
|
2019-01-10 15:39:37 +03:00
|
|
|
value: 'PlayCount,SortName'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getDatePlayedSortOption = function () {
|
|
|
|
|
|
|
|
return {
|
2019-02-03 02:41:16 +09:00
|
|
|
name: globalize.translate('DatePlayed'),
|
2019-01-10 15:39:37 +03:00
|
|
|
value: 'DatePlayed,SortName'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getCriticRatingSortOption = function () {
|
|
|
|
|
|
|
|
return {
|
2019-02-03 02:41:16 +09:00
|
|
|
name: globalize.translate('CriticRating'),
|
2019-01-10 15:39:37 +03:00
|
|
|
value: 'CriticRating,SortName'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getCommunityRatingSortOption = function () {
|
|
|
|
|
|
|
|
return {
|
2019-02-03 02:41:16 +09:00
|
|
|
name: globalize.translate('CommunityRating'),
|
2019-01-10 15:39:37 +03:00
|
|
|
value: 'CommunityRating,SortName'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getFilterMenuOptions = function () {
|
|
|
|
|
|
|
|
var params = this.params;
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.getItemTypes = function () {
|
|
|
|
|
|
|
|
return [];
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.setFilterStatus = function (hasFilters) {
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
this.hasFilters = hasFilters;
|
2019-01-10 15:39:37 +03:00
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var filterButtons = this.filterButtons;
|
2019-01-10 15:39:37 +03:00
|
|
|
if (!filterButtons.length) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0, length = filterButtons.length; i < length; i++) {
|
|
|
|
|
|
|
|
var btnFilter = filterButtons[i];
|
|
|
|
|
|
|
|
var bubble = btnFilter.querySelector('.filterButtonBubble');
|
|
|
|
if (!bubble) {
|
|
|
|
|
|
|
|
if (!hasFilters) {
|
|
|
|
continue;
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
|
|
|
|
btnFilter.insertAdjacentHTML('afterbegin', '<div class="filterButtonBubble">!</div>');
|
|
|
|
btnFilter.classList.add('btnFilterWithBubble');
|
|
|
|
bubble = btnFilter.querySelector('.filterButtonBubble');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasFilters) {
|
|
|
|
bubble.classList.remove('hide');
|
|
|
|
} else {
|
|
|
|
bubble.classList.add('hide');
|
2018-10-23 01:05:09 +03:00
|
|
|
}
|
2019-01-10 15:39:37 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.onPause = function () {
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var scroller = this.scroller;
|
2019-01-10 15:39:37 +03:00
|
|
|
if (scroller && scroller.pause) {
|
|
|
|
scroller.pause();
|
|
|
|
}
|
|
|
|
|
2018-10-23 01:05:09 +03:00
|
|
|
var alphaNumericShortcuts = this.alphaNumericShortcuts;
|
2019-01-10 15:39:37 +03:00
|
|
|
if (alphaNumericShortcuts) {
|
|
|
|
alphaNumericShortcuts.destroy();
|
|
|
|
this.alphaNumericShortcuts = null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemsTab.prototype.destroy = function () {
|
|
|
|
|
|
|
|
this.view = null;
|
|
|
|
this.itemsContainer = null;
|
|
|
|
this.params = null;
|
|
|
|
this.apiClient = null;
|
|
|
|
this.scroller = null;
|
|
|
|
this.filterButtons = null;
|
|
|
|
|
|
|
|
if (this.alphaPicker) {
|
|
|
|
this.alphaPicker.destroy();
|
|
|
|
this.alphaPicker = null;
|
|
|
|
}
|
|
|
|
this.sortButtons = null;
|
|
|
|
this.btnSortText = null;
|
|
|
|
this.btnSortIcon = null;
|
|
|
|
this.alphaPickerElement = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
return ItemsTab;
|
2018-10-23 01:05:09 +03:00
|
|
|
});
|