jellyfin-web/dashboard-ui/scripts/kids.js

124 lines
3.1 KiB
JavaScript
Raw Normal View History

define(['jQuery'], function ($) {
2015-03-01 22:16:29 -07:00
function showSignIn(page) {
$('.kidsOptionsLogin', page).fadeIn();
$('#txtPinCode', page).val('');
$('.btnOptions', page).hide();
$('.kidContent', page).hide();
}
function validatePin(page) {
}
function loadContent(page) {
var options = {
SortBy: "Random",
SortOrder: "Descending",
MediaTypes: "Video",
Limit: 100,
Recursive: true,
Fields: "PrimaryImageAspectRatio",
ExcludeLocationTypes: "Virtual",
ImageTypeLimit: 1,
EnableImageTypes: "Primary,Backdrop,Thumb"
};
2015-12-14 08:43:03 -07:00
ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
2015-03-01 22:16:29 -07:00
$('.itemsContainer', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "horizontalBackdrop",
preferThumb: true,
overlayText: true,
lazy: true,
defaultAction: 'play',
coverImage: true,
enableImageEnhancers: false
})).lazyChildren();
});
}
2015-06-01 22:46:06 -07:00
function onPinSubmit() {
var page = $(this).parents('.page');
if (validatePin(page)) {
$('.kidsOptionsLogin', page).hide();
$('.kidsOptions', page).fadeIn();
} else {
Dashboard.alert({
message: 'Invalid pin code entered. Please try again.',
title: 'Input Error'
});
}
return false;
}
function onOptionsSubmit() {
var page = $(this).parents('.page');
$('.kidsOptions', page).fadeOut();
$('.btnOptions', page).show();
$('.kidContent', page).show();
return false;
}
2015-09-24 10:08:10 -07:00
$(document).on('pageshow', "#kidsPage", function () {
2015-03-01 22:16:29 -07:00
var page = this;
var userId = Dashboard.getCurrentUserId();
$('.kidContent', page).hide();
$('.kidsWelcome', page).show();
$('.lnkPinCode', page).attr('href', 'myprofile.html?userId=' + userId);
$('.btnOptions', page).buttonEnabled(false);
$('.kidsOptionsLogin', page).hide();
$('.kidsOptions', page).hide();
$('.kidsBackdropContainer').css('background-image', 'url(css/images/kids/bg.jpg)');
2015-09-01 07:01:59 -07:00
}).on('pageinit', "#kidsPage", function () {
2015-03-01 22:16:29 -07:00
var page = this;
$('.btnDismissWelcome', page).on('click', function () {
$('.kidsWelcome', page).fadeOut();
$('.btnOptions', page).buttonEnabled(true);
$('.kidContent', page).show();
loadContent(page);
});
$('.btnOptions', page).on('click', function () {
showSignIn(page);
});
$('.btnCancelPin', page).on('click', function () {
$('.kidsOptionsLogin', page).fadeOut();
$('.btnOptions', page).show();
$('.kidContent', page).show();
});
2015-06-01 22:46:06 -07:00
$('.kidPinForm').off('submit', onPinSubmit).on('submit', onPinSubmit);
$('.kidsOptionsForm').off('submit', onOptionsSubmit).on('submit', onOptionsSubmit);
});
2015-03-01 22:16:29 -07:00
});