mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add guide settings
This commit is contained in:
parent
fab755eccd
commit
35c68c997d
14 changed files with 314 additions and 154 deletions
|
@ -9,12 +9,24 @@
|
|||
});
|
||||
}
|
||||
|
||||
function showCategoryOptions(instance) {
|
||||
|
||||
require(['guide-categories-dialog'], function (guideCategoriesDialog) {
|
||||
guideCategoriesDialog.show(instance.categoryOptions).then(function (categoryOptions) {
|
||||
|
||||
instance.categoryOptions = categoryOptions;
|
||||
instance.refresh();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function Guide(options) {
|
||||
|
||||
var self = this;
|
||||
var items = {};
|
||||
|
||||
self.options = options;
|
||||
self.categoryOptions = { categories: [] };
|
||||
|
||||
// 30 mins
|
||||
var cellCurationMinutes = 30;
|
||||
|
@ -316,6 +328,14 @@
|
|||
|
||||
var clickAction = layoutManager.tv ? 'link' : 'programdialog';
|
||||
|
||||
var categories = self.categoryOptions.categories || [];
|
||||
var displayMovieContent = !categories.length || categories.indexOf('movies') != -1;
|
||||
var displaySportsContent = !categories.length || categories.indexOf('sports') != -1;
|
||||
var displayOtherContent = !categories.length || categories.indexOf('others') != -1;
|
||||
var displayNewsContent = !categories.length || categories.indexOf('news') != -1;
|
||||
var displayKidsContent = !categories.length || categories.indexOf('kids') != -1;
|
||||
var enableColorCodedBackgrounds = userSettings.get('guide-colorcodedbackgrounds') == 'true';
|
||||
|
||||
for (var i = 0, length = programs.length; i < length; i++) {
|
||||
|
||||
var program = programs[i];
|
||||
|
@ -346,20 +366,35 @@
|
|||
endPercent *= 100;
|
||||
|
||||
var cssClass = "programCell clearButton itemAction";
|
||||
var addAccent = true;
|
||||
var accentCssClass;
|
||||
var displayInnerContent = true;
|
||||
|
||||
if (program.IsKids) {
|
||||
cssClass += " childProgramInfo";
|
||||
displayInnerContent = displayKidsContent;
|
||||
accentCssClass = 'childAccent';
|
||||
} else if (program.IsSports) {
|
||||
cssClass += " sportsProgramInfo";
|
||||
displayInnerContent = displaySportsContent;
|
||||
accentCssClass = 'sportsAccent';
|
||||
} else if (program.IsNews) {
|
||||
cssClass += " newsProgramInfo";
|
||||
displayInnerContent = displayNewsContent;
|
||||
accentCssClass = 'newsAccent';
|
||||
} else if (program.IsMovie) {
|
||||
cssClass += " movieProgramInfo";
|
||||
displayInnerContent = displayMovieContent;
|
||||
accentCssClass = 'movieAccent';
|
||||
}
|
||||
else {
|
||||
cssClass += " plainProgramInfo";
|
||||
addAccent = false;
|
||||
displayInnerContent = displayOtherContent;
|
||||
}
|
||||
|
||||
if (enableColorCodedBackgrounds && accentCssClass) {
|
||||
cssClass += ' ' + accentCssClass;
|
||||
|
||||
accentCssClass = null;
|
||||
}
|
||||
|
||||
var timerAttributes = '';
|
||||
|
@ -369,53 +404,47 @@
|
|||
if (program.SeriesTimerId) {
|
||||
timerAttributes += ' data-seriestimerid="' + program.SeriesTimerId + '"';
|
||||
}
|
||||
|
||||
html += '<button data-action="' + clickAction + '"' + timerAttributes + ' data-isfolder="' + program.IsFolder + '" data-id="' + program.Id + '" data-serverid="' + program.ServerId + '" data-type="' + program.Type + '" class="' + cssClass + '" style="left:' + startPercent + '%;width:' + endPercent + '%;">';
|
||||
|
||||
var guideProgramNameClass = "guideProgramName";
|
||||
if (displayInnerContent) {
|
||||
var guideProgramNameClass = "guideProgramName";
|
||||
|
||||
html += '<div class="' + guideProgramNameClass + '">';
|
||||
html += '<div class="' + guideProgramNameClass + '">';
|
||||
|
||||
if (program.IsLive && options.showLiveIndicator) {
|
||||
html += '<span class="liveTvProgram guideProgramIndicator">' + globalize.translate('sharedcomponents#Live') + '</span>';
|
||||
}
|
||||
else if (program.IsPremiere && options.showPremiereIndicator) {
|
||||
html += '<span class="premiereTvProgram guideProgramIndicator">' + globalize.translate('sharedcomponents#Premiere') + '</span>';
|
||||
}
|
||||
else if (program.IsSeries && !program.IsRepeat && options.showNewIndicator) {
|
||||
html += '<span class="newTvProgram guideProgramIndicator">' + globalize.translate('sharedcomponents#AttributeNew') + '</span>';
|
||||
}
|
||||
else if (program.IsSeries && program.IsRepeat && options.showRepeatIndicator) {
|
||||
html += '<span class="repeatTvProgram guideProgramIndicator">' + globalize.translate('sharedcomponents#Repeat') + '</span>';
|
||||
}
|
||||
|
||||
html += program.Name;
|
||||
html += '</div>';
|
||||
|
||||
if (program.IsHD && options.showHdIcon) {
|
||||
html += '<i class="guideHdIcon md-icon programIcon">hd</i>';
|
||||
}
|
||||
|
||||
if (program.SeriesTimerId) {
|
||||
if (program.TimerId) {
|
||||
html += '<i class="seriesTimerIcon md-icon programIcon"></i>';
|
||||
} else {
|
||||
html += '<i class="seriesTimerIcon seriesTimerIcon-inactive md-icon programIcon"></i>';
|
||||
if (program.IsLive && options.showLiveIndicator) {
|
||||
html += '<span class="liveTvProgram guideProgramIndicator">' + globalize.translate('sharedcomponents#Live') + '</span>';
|
||||
}
|
||||
else if (program.IsPremiere && options.showPremiereIndicator) {
|
||||
html += '<span class="premiereTvProgram guideProgramIndicator">' + globalize.translate('sharedcomponents#Premiere') + '</span>';
|
||||
}
|
||||
else if (program.IsSeries && !program.IsRepeat && options.showNewIndicator) {
|
||||
html += '<span class="newTvProgram guideProgramIndicator">' + globalize.translate('sharedcomponents#AttributeNew') + '</span>';
|
||||
}
|
||||
else if (program.IsSeries && program.IsRepeat && options.showRepeatIndicator) {
|
||||
html += '<span class="repeatTvProgram guideProgramIndicator">' + globalize.translate('sharedcomponents#Repeat') + '</span>';
|
||||
}
|
||||
}
|
||||
else if (program.TimerId) {
|
||||
html += '<i class="timerIcon md-icon programIcon"></i>';
|
||||
}
|
||||
|
||||
if (addAccent) {
|
||||
html += program.Name;
|
||||
html += '</div>';
|
||||
|
||||
if (program.IsKids) {
|
||||
html += '<div class="programAccent childAccent"></div>';
|
||||
} else if (program.IsSports) {
|
||||
html += '<div class="programAccent sportsAccent"></div>';
|
||||
} else if (program.IsNews) {
|
||||
html += '<div class="programAccent newsAccent"></div>';
|
||||
} else if (program.IsMovie) {
|
||||
html += '<div class="programAccent movieAccent"></div>';
|
||||
if (program.IsHD && options.showHdIcon) {
|
||||
html += '<i class="guideHdIcon md-icon programIcon">hd</i>';
|
||||
}
|
||||
|
||||
if (program.SeriesTimerId) {
|
||||
if (program.TimerId) {
|
||||
html += '<i class="seriesTimerIcon md-icon programIcon"></i>';
|
||||
} else {
|
||||
html += '<i class="seriesTimerIcon seriesTimerIcon-inactive md-icon programIcon"></i>';
|
||||
}
|
||||
}
|
||||
else if (program.TimerId) {
|
||||
html += '<i class="timerIcon md-icon programIcon"></i>';
|
||||
}
|
||||
|
||||
if (accentCssClass) {
|
||||
html += '<div class="programAccent ' + accentCssClass + '"></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -503,19 +532,6 @@
|
|||
imageLoader.lazyChildren(channelList);
|
||||
}
|
||||
|
||||
function parentWithClass(elem, className) {
|
||||
|
||||
while (!elem.classList || !elem.classList.contains(className)) {
|
||||
elem = elem.parentNode;
|
||||
|
||||
if (!elem) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
function renderGuide(context, date, channels, programs, apiClient) {
|
||||
|
||||
//var list = [];
|
||||
|
@ -561,7 +577,7 @@
|
|||
var channelRowId = null;
|
||||
|
||||
if (activeElement) {
|
||||
channelRowId = parentWithClass(activeElement, 'channelPrograms');
|
||||
channelRowId = dom.parentWithClass(activeElement, 'channelPrograms');
|
||||
channelRowId = channelRowId && channelRowId.getAttribute ? channelRowId.getAttribute('data-channelid') : null;
|
||||
}
|
||||
|
||||
|
@ -736,22 +752,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
function parentWithClass(elem, className) {
|
||||
|
||||
while (!elem.classList || !elem.classList.contains(className)) {
|
||||
elem = elem.parentNode;
|
||||
|
||||
if (!elem) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
function onProgramGridFocus(e) {
|
||||
|
||||
var programCell = parentWithClass(e.target, 'programCell');
|
||||
var programCell = dom.parentWithClass(e.target, 'programCell');
|
||||
|
||||
if (!programCell) {
|
||||
return;
|
||||
|
@ -876,6 +879,10 @@
|
|||
showViewSettings(self);
|
||||
});
|
||||
|
||||
context.querySelector('.btnCategories').addEventListener('click', function () {
|
||||
showCategoryOptions(self);
|
||||
});
|
||||
|
||||
context.classList.add('tvguide');
|
||||
|
||||
setScrollEvents(context, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue