2016-03-18 21:26:17 -07:00
|
|
|
|
define(['jQuery'], function ($) {
|
2014-09-22 14:56:54 -07:00
|
|
|
|
|
|
|
|
|
function loadPage(page, config) {
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
$('.chkMovies', page).checked(config.EnableIntrosForMovies);
|
|
|
|
|
$('.chkEpisodes', page).checked(config.EnableIntrosForEpisodes);
|
2014-09-22 14:56:54 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
$('.chkMyMovieTrailers', page).checked(config.EnableIntrosFromMoviesInLibrary);
|
2014-09-29 21:47:30 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
$('.chkUpcomingTheaterTrailers', page).checked(config.EnableIntrosFromUpcomingTrailers);
|
|
|
|
|
$('.chkUpcomingDvdTrailers', page).checked(config.EnableIntrosFromUpcomingDvdMovies);
|
|
|
|
|
$('.chkUpcomingStreamingTrailers', page).checked(config.EnableIntrosFromUpcomingStreamingMovies);
|
|
|
|
|
$('.chkOtherTrailers', page).checked(config.EnableIntrosFromSimilarMovies);
|
2014-09-22 14:56:54 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
$('.chkUnwatchedOnly', page).checked(!config.EnableIntrosForWatchedContent);
|
|
|
|
|
$('.chkEnableParentalControl', page).checked(config.EnableIntrosParentalControl);
|
2014-09-22 14:56:54 -07:00
|
|
|
|
|
2014-09-22 17:04:50 -07:00
|
|
|
|
$('#txtCustomIntrosPath', page).val(config.CustomIntroPath || '');
|
2016-02-04 22:59:09 -07:00
|
|
|
|
$('#txtCodecIntrosPath', page).val(config.MediaInfoIntroPath || '');
|
2014-10-09 15:22:04 -07:00
|
|
|
|
$('#txtNumTrailers', page).val(config.TrailerLimit);
|
2014-09-22 17:04:50 -07:00
|
|
|
|
|
2014-09-22 14:56:54 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-08 14:32:20 -07:00
|
|
|
|
function onSubmit() {
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var form = this;
|
|
|
|
|
|
|
|
|
|
var page = $(form).parents('.page');
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getNamedConfiguration("cinemamode").then(function (config) {
|
2015-06-08 14:32:20 -07:00
|
|
|
|
|
|
|
|
|
config.CustomIntroPath = $('#txtCustomIntrosPath', page).val();
|
2016-02-04 22:59:09 -07:00
|
|
|
|
config.MediaInfoIntroPath = $('#txtCodecIntrosPath', page).val();
|
2015-06-08 14:32:20 -07:00
|
|
|
|
config.TrailerLimit = $('#txtNumTrailers', page).val();
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
config.EnableIntrosForMovies = $('.chkMovies', page).checked();
|
|
|
|
|
config.EnableIntrosForEpisodes = $('.chkEpisodes', page).checked();
|
|
|
|
|
config.EnableIntrosFromMoviesInLibrary = $('.chkMyMovieTrailers', page).checked();
|
|
|
|
|
config.EnableIntrosForWatchedContent = !$('.chkUnwatchedOnly', page).checked();
|
|
|
|
|
config.EnableIntrosParentalControl = $('.chkEnableParentalControl', page).checked();
|
2015-06-08 14:32:20 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
config.EnableIntrosFromUpcomingTrailers = $('.chkUpcomingTheaterTrailers', page).checked();
|
|
|
|
|
config.EnableIntrosFromUpcomingDvdMovies = $('.chkUpcomingDvdTrailers', page).checked();
|
|
|
|
|
config.EnableIntrosFromUpcomingStreamingMovies = $('.chkUpcomingStreamingTrailers', page).checked();
|
|
|
|
|
config.EnableIntrosFromSimilarMovies = $('.chkOtherTrailers', page).checked();
|
2015-06-08 14:32:20 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.updateNamedConfiguration("cinemamode", config).then(Dashboard.processServerConfigurationUpdateResult);
|
2015-06-08 14:32:20 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Disable default form submission
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-01 07:01:59 -07:00
|
|
|
|
$(document).on('pageinit', "#cinemaModeConfigurationPage", function () {
|
2014-09-22 17:04:50 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
$('#btnSelectCustomIntrosPath', page).on("click.selectDirectory", function () {
|
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
require(['directorybrowser'], function (directoryBrowser) {
|
2014-09-22 17:04:50 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
var picker = new directoryBrowser();
|
2014-09-22 17:04:50 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
picker.show({
|
2014-09-22 17:04:50 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
callback: function (path) {
|
2014-09-22 17:04:50 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
if (path) {
|
|
|
|
|
$('#txtCustomIntrosPath', page).val(path);
|
|
|
|
|
}
|
|
|
|
|
picker.close();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
header: Globalize.translate('HeaderSelectCustomIntrosPath')
|
|
|
|
|
});
|
2014-09-22 17:04:50 -07:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2016-02-04 22:59:09 -07:00
|
|
|
|
$('#btnSelectCodecIntrosPath', page).on("click.selectDirectory", function () {
|
|
|
|
|
|
|
|
|
|
require(['directorybrowser'], function (directoryBrowser) {
|
|
|
|
|
|
|
|
|
|
var picker = new directoryBrowser();
|
|
|
|
|
|
|
|
|
|
picker.show({
|
|
|
|
|
|
|
|
|
|
callback: function (path) {
|
|
|
|
|
|
|
|
|
|
if (path) {
|
|
|
|
|
$('#txtCodecIntrosPath', page).val(path);
|
|
|
|
|
}
|
|
|
|
|
picker.close();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
header: Globalize.translate('HeaderSelectCodecIntrosPath')
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2015-06-08 14:32:20 -07:00
|
|
|
|
$('.cinemaModeConfigurationForm').off('submit', onSubmit).on('submit', onSubmit);
|
|
|
|
|
|
2016-03-28 21:26:25 -07:00
|
|
|
|
if (!AppInfo.enableSupporterMembership) {
|
|
|
|
|
page.querySelector('.lnkSupporterLearnMore').href = '#';
|
|
|
|
|
page.querySelector('.lnkSupporterLearnMore').addEventListener('click', function (e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-24 10:08:10 -07:00
|
|
|
|
}).on('pageshow', "#cinemaModeConfigurationPage", function () {
|
2014-09-22 14:56:54 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getNamedConfiguration("cinemamode").then(function (config) {
|
2014-09-22 14:56:54 -07:00
|
|
|
|
|
|
|
|
|
loadPage(page, config);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|