remove registration services
This commit is contained in:
parent
886dec1174
commit
65fafe9c58
11 changed files with 30 additions and 393 deletions
|
@ -4,25 +4,11 @@ define(['browser', 'dom', 'layoutManager', 'shell', 'appRouter', 'apphost', 'css
|
||||||
var EmbyButtonPrototype = Object.create(HTMLButtonElement.prototype);
|
var EmbyButtonPrototype = Object.create(HTMLButtonElement.prototype);
|
||||||
var EmbyLinkButtonPrototype = Object.create(HTMLAnchorElement.prototype);
|
var EmbyLinkButtonPrototype = Object.create(HTMLAnchorElement.prototype);
|
||||||
|
|
||||||
function openPremiumInfo() {
|
|
||||||
|
|
||||||
require(['registrationServices'], function (registrationServices) {
|
|
||||||
registrationServices.showPremiereInfo();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onAnchorClick(e) {
|
function onAnchorClick(e) {
|
||||||
|
|
||||||
var href = this.getAttribute('href') || '';
|
var href = this.getAttribute('href') || '';
|
||||||
|
|
||||||
if (href !== '#') {
|
if (href !== '#') {
|
||||||
|
|
||||||
if (this.getAttribute('target')) {
|
if (this.getAttribute('target')) {
|
||||||
if (href.indexOf('emby.media/premiere') !== -1 && !appHost.supports('externalpremium')) {
|
if (!appHost.supports('targetblank')) {
|
||||||
e.preventDefault();
|
|
||||||
openPremiumInfo();
|
|
||||||
}
|
|
||||||
else if (!appHost.supports('targetblank')) {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
shell.openUrl(href);
|
shell.openUrl(href);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['connectionManager', 'cardBuilder', 'registrationServices', 'appSettings', 'dom', 'apphost', 'layoutManager', 'imageLoader', 'globalize', 'itemShortcuts', 'itemHelper', 'appRouter', 'emby-button', 'paper-icon-button-light', 'emby-itemscontainer', 'emby-scroller', 'emby-linkbutton', 'css!./homesections'], function (connectionManager, cardBuilder, registrationServices, appSettings, dom, appHost, layoutManager, imageLoader, globalize, itemShortcuts, itemHelper, appRouter) {
|
define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'layoutManager', 'imageLoader', 'globalize', 'itemShortcuts', 'itemHelper', 'appRouter', 'emby-button', 'paper-icon-button-light', 'emby-itemscontainer', 'emby-scroller', 'emby-linkbutton', 'css!./homesections'], function (connectionManager, cardBuilder, appSettings, dom, appHost, layoutManager, imageLoader, globalize, itemShortcuts, itemHelper, appRouter) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function getDefaultSection(index) {
|
function getDefaultSection(index) {
|
||||||
|
@ -662,34 +662,10 @@ define(['connectionManager', 'cardBuilder', 'registrationServices', 'appSettings
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindUnlockClick(elem) {
|
|
||||||
|
|
||||||
var btnUnlock = elem.querySelector('.btnUnlock');
|
|
||||||
if (btnUnlock) {
|
|
||||||
btnUnlock.addEventListener('click', function (e) {
|
|
||||||
|
|
||||||
registrationServices.validateFeature('livetv', {
|
|
||||||
|
|
||||||
viewOnly: true
|
|
||||||
|
|
||||||
}).then(function () {
|
|
||||||
|
|
||||||
dom.parentWithClass(elem, 'homeSectionsContainer').dispatchEvent(new CustomEvent('settingschange', {
|
|
||||||
cancelable: false
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getOnNowFetchFn(serverId) {
|
function getOnNowFetchFn(serverId) {
|
||||||
|
|
||||||
return function () {
|
return function () {
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
var apiClient = connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
return apiClient.getLiveTvRecommendedPrograms({
|
return apiClient.getLiveTvRecommendedPrograms({
|
||||||
|
|
||||||
userId: apiClient.getCurrentUserId(),
|
userId: apiClient.getCurrentUserId(),
|
||||||
IsAiring: true,
|
IsAiring: true,
|
||||||
limit: 24,
|
limit: 24,
|
||||||
|
@ -697,15 +673,12 @@ define(['connectionManager', 'cardBuilder', 'registrationServices', 'appSettings
|
||||||
EnableImageTypes: "Primary,Thumb,Backdrop",
|
EnableImageTypes: "Primary,Thumb,Backdrop",
|
||||||
EnableTotalRecordCount: false,
|
EnableTotalRecordCount: false,
|
||||||
Fields: "ChannelInfo,PrimaryImageAspectRatio"
|
Fields: "ChannelInfo,PrimaryImageAspectRatio"
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOnNowItemsHtml(items) {
|
function getOnNowItemsHtml(items) {
|
||||||
|
|
||||||
var cardLayout = false;
|
var cardLayout = false;
|
||||||
|
|
||||||
return cardBuilder.getCardsHtml({
|
return cardBuilder.getCardsHtml({
|
||||||
items: items,
|
items: items,
|
||||||
preferThumb: 'auto',
|
preferThumb: 'auto',
|
||||||
|
@ -728,27 +701,12 @@ define(['connectionManager', 'cardBuilder', 'registrationServices', 'appSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadOnNow(elem, apiClient, user) {
|
function loadOnNow(elem, apiClient, user) {
|
||||||
|
|
||||||
if (!user.Policy.EnableLiveTvAccess) {
|
if (!user.Policy.EnableLiveTvAccess) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
var promises = [];
|
|
||||||
|
|
||||||
promises.push(registrationServices.validateFeature('livetv',
|
|
||||||
{
|
|
||||||
viewOnly: true,
|
|
||||||
showDialog: false
|
|
||||||
}).then(function () {
|
|
||||||
return true;
|
|
||||||
}, function () {
|
|
||||||
return false;
|
|
||||||
}));
|
|
||||||
|
|
||||||
var userId = user.Id;
|
var userId = user.Id;
|
||||||
|
apiClient.getLiveTvRecommendedPrograms({
|
||||||
promises.push(apiClient.getLiveTvRecommendedPrograms({
|
|
||||||
|
|
||||||
userId: apiClient.getCurrentUserId(),
|
userId: apiClient.getCurrentUserId(),
|
||||||
IsAiring: true,
|
IsAiring: true,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
|
@ -756,17 +714,9 @@ define(['connectionManager', 'cardBuilder', 'registrationServices', 'appSettings
|
||||||
EnableImageTypes: "Primary,Thumb,Backdrop",
|
EnableImageTypes: "Primary,Thumb,Backdrop",
|
||||||
EnableTotalRecordCount: false,
|
EnableTotalRecordCount: false,
|
||||||
Fields: "ChannelInfo,PrimaryImageAspectRatio"
|
Fields: "ChannelInfo,PrimaryImageAspectRatio"
|
||||||
|
}).then(function (result) {
|
||||||
}));
|
|
||||||
|
|
||||||
return Promise.all(promises).then(function (responses) {
|
|
||||||
|
|
||||||
var registered = responses[0];
|
|
||||||
var result = responses[1];
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
if (result.Items.length) {
|
||||||
if (result.Items.length && registered) {
|
|
||||||
|
|
||||||
elem.classList.remove('padded-left');
|
elem.classList.remove('padded-left');
|
||||||
elem.classList.remove('padded-right');
|
elem.classList.remove('padded-right');
|
||||||
elem.classList.remove('padded-bottom');
|
elem.classList.remove('padded-bottom');
|
||||||
|
@ -774,51 +724,38 @@ define(['connectionManager', 'cardBuilder', 'registrationServices', 'appSettings
|
||||||
|
|
||||||
html += '<div class="verticalSection">';
|
html += '<div class="verticalSection">';
|
||||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
||||||
|
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate('LiveTV') + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate('LiveTV') + '</h2>';
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-mousewheel="false" data-centerfocus="true" data-scrollbuttons="false">';
|
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-mousewheel="false" data-centerfocus="true" data-scrollbuttons="false">';
|
||||||
html += '<div class="scrollSlider padded-left padded-right padded-top padded-bottom focuscontainer-x">';
|
html += '<div class="scrollSlider padded-left padded-right padded-top padded-bottom focuscontainer-x">';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
html += '<div class="padded-left padded-right padded-top focuscontainer-x">';
|
html += '<div class="padded-left padded-right padded-top focuscontainer-x">';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<a style="margin-left:.8em;margin-right:0;" is="emby-linkbutton" href="' + appRouter.getRouteUrl('livetv', {
|
html += '<a style="margin-left:.8em;margin-right:0;" is="emby-linkbutton" href="' + appRouter.getRouteUrl('livetv', {
|
||||||
|
|
||||||
serverId: apiClient.serverId()
|
serverId: apiClient.serverId()
|
||||||
|
|
||||||
}) + '" class="raised"><span>' + globalize.translate('Programs') + '</span></a>';
|
}) + '" class="raised"><span>' + globalize.translate('Programs') + '</span></a>';
|
||||||
|
|
||||||
html += '<a style="margin-left:.5em;margin-right:0;" is="emby-linkbutton" href="' + appRouter.getRouteUrl('livetv', {
|
html += '<a style="margin-left:.5em;margin-right:0;" is="emby-linkbutton" href="' + appRouter.getRouteUrl('livetv', {
|
||||||
|
|
||||||
serverId: apiClient.serverId(),
|
serverId: apiClient.serverId(),
|
||||||
section: 'guide'
|
section: 'guide'
|
||||||
|
|
||||||
}) + '" class="raised"><span>' + globalize.translate('Guide') + '</span></a>';
|
}) + '" class="raised"><span>' + globalize.translate('Guide') + '</span></a>';
|
||||||
|
|
||||||
html += '<a style="margin-left:.5em;margin-right:0;" is="emby-linkbutton" href="' + appRouter.getRouteUrl('recordedtv', {
|
html += '<a style="margin-left:.5em;margin-right:0;" is="emby-linkbutton" href="' + appRouter.getRouteUrl('recordedtv', {
|
||||||
|
|
||||||
serverId: apiClient.serverId()
|
serverId: apiClient.serverId()
|
||||||
|
|
||||||
}) + '" class="raised"><span>' + globalize.translate('Recordings') + '</span></a>';
|
}) + '" class="raised"><span>' + globalize.translate('Recordings') + '</span></a>';
|
||||||
|
|
||||||
html += '<a style="margin-left:.5em;margin-right:0;" is="emby-linkbutton" href="' + appRouter.getRouteUrl('livetv', {
|
html += '<a style="margin-left:.5em;margin-right:0;" is="emby-linkbutton" href="' + appRouter.getRouteUrl('livetv', {
|
||||||
|
|
||||||
serverId: apiClient.serverId(),
|
serverId: apiClient.serverId(),
|
||||||
section: 'dvrschedule'
|
section: 'dvrschedule'
|
||||||
|
|
||||||
}) + '" class="raised"><span>' + globalize.translate('Schedule') + '</span></a>';
|
}) + '" class="raised"><span>' + globalize.translate('Schedule') + '</span></a>';
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
|
@ -826,12 +763,9 @@ define(['connectionManager', 'cardBuilder', 'registrationServices', 'appSettings
|
||||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
||||||
|
|
||||||
if (!layoutManager.tv) {
|
if (!layoutManager.tv) {
|
||||||
|
|
||||||
html += '<a is="emby-linkbutton" href="' + appRouter.getRouteUrl('livetv', {
|
html += '<a is="emby-linkbutton" href="' + appRouter.getRouteUrl('livetv', {
|
||||||
|
|
||||||
serverId: apiClient.serverId(),
|
serverId: apiClient.serverId(),
|
||||||
section: 'onnow'
|
section: 'onnow'
|
||||||
|
|
||||||
}) + '" class="more button-flat button-flat-mini sectionTitleTextButton">';
|
}) + '" class="more button-flat button-flat-mini sectionTitleTextButton">';
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
||||||
html += globalize.translate('HeaderOnNow');
|
html += globalize.translate('HeaderOnNow');
|
||||||
|
@ -863,22 +797,7 @@ define(['connectionManager', 'cardBuilder', 'registrationServices', 'appSettings
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
itemsContainer.fetchData = getOnNowFetchFn(apiClient.serverId());
|
itemsContainer.fetchData = getOnNowFetchFn(apiClient.serverId());
|
||||||
itemsContainer.getItemsHtml = getOnNowItemsHtml;
|
itemsContainer.getItemsHtml = getOnNowItemsHtml;
|
||||||
|
|
||||||
} else if (result.Items.length && !registered) {
|
|
||||||
|
|
||||||
elem.classList.add('padded-left');
|
|
||||||
elem.classList.add('padded-right');
|
|
||||||
elem.classList.add('padded-bottom');
|
|
||||||
|
|
||||||
html += '<h2 class="sectionTitle">' + globalize.translate('LiveTvRequiresUnlock') + '</h2>';
|
|
||||||
html += '<button is="emby-button" type="button" class="raised button-submit block btnUnlock">';
|
|
||||||
html += '<span>' + globalize.translate('HeaderBecomeProjectSupporter') + '</span>';
|
|
||||||
html += '</button>';
|
|
||||||
|
|
||||||
elem.innerHTML = html;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bindUnlockClick(elem);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,16 +2,13 @@ define(['connectionManager', 'globalize'], function (connectionManager, globaliz
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function getRequirePromise(deps) {
|
function getRequirePromise(deps) {
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
require(deps, resolve);
|
require(deps, resolve);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showErrorMessage() {
|
function showErrorMessage() {
|
||||||
return getRequirePromise(['alert']).then(function (alert) {
|
return getRequirePromise(['alert']).then(function (alert) {
|
||||||
|
|
||||||
return alert(globalize.translate('MessagePlayAccessRestricted')).then(function () {
|
return alert(globalize.translate('MessagePlayAccessRestricted')).then(function () {
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
});
|
});
|
||||||
|
@ -19,7 +16,6 @@ define(['connectionManager', 'globalize'], function (connectionManager, globaliz
|
||||||
}
|
}
|
||||||
|
|
||||||
function PlayAccessValidation() {
|
function PlayAccessValidation() {
|
||||||
|
|
||||||
this.name = 'Playback validation';
|
this.name = 'Playback validation';
|
||||||
this.type = 'preplayintercept';
|
this.type = 'preplayintercept';
|
||||||
this.id = 'playaccessvalidation';
|
this.id = 'playaccessvalidation';
|
||||||
|
@ -27,7 +23,6 @@ define(['connectionManager', 'globalize'], function (connectionManager, globaliz
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayAccessValidation.prototype.intercept = function (options) {
|
PlayAccessValidation.prototype.intercept = function (options) {
|
||||||
|
|
||||||
var item = options.item;
|
var item = options.item;
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
@ -38,7 +33,6 @@ define(['connectionManager', 'globalize'], function (connectionManager, globaliz
|
||||||
}
|
}
|
||||||
|
|
||||||
return connectionManager.getApiClient(serverId).getCurrentUser().then(function (user) {
|
return connectionManager.getApiClient(serverId).getCurrentUser().then(function (user) {
|
||||||
|
|
||||||
if (user.Policy.EnableMediaPlayback) {
|
if (user.Policy.EnableMediaPlayback) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
define(['playbackManager', 'itemHelper'], function (playbackManager, itemHelper) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
function getRequirePromise(deps) {
|
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
|
|
||||||
require(deps, resolve);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function validatePlayback(options) {
|
|
||||||
|
|
||||||
var feature = 'playback';
|
|
||||||
if (options.item && (options.item.Type === 'TvChannel' || options.item.Type === 'Recording')) {
|
|
||||||
feature = 'livetv';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (feature === 'playback') {
|
|
||||||
var player = playbackManager.getCurrentPlayer();
|
|
||||||
if (player && !player.isLocalPlayer) {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return getRequirePromise(["registrationServices"]).then(function (registrationServices) {
|
|
||||||
|
|
||||||
return registrationServices.validateFeature(feature, options).then(function (result) {
|
|
||||||
|
|
||||||
if (result && result.enableTimeLimit) {
|
|
||||||
startAutoStopTimer();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var autoStopTimeout;
|
|
||||||
function startAutoStopTimer() {
|
|
||||||
stopAutoStopTimer();
|
|
||||||
autoStopTimeout = setTimeout(onAutoStopTimeout, 63000);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onAutoStopTimeout() {
|
|
||||||
stopAutoStopTimer();
|
|
||||||
playbackManager.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopAutoStopTimer() {
|
|
||||||
|
|
||||||
var timeout = autoStopTimeout;
|
|
||||||
if (timeout) {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
autoStopTimeout = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function PlaybackValidation() {
|
|
||||||
|
|
||||||
this.name = 'Playback validation';
|
|
||||||
this.type = 'preplayintercept';
|
|
||||||
this.id = 'playbackvalidation';
|
|
||||||
this.order = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlaybackValidation.prototype.intercept = function (options) {
|
|
||||||
|
|
||||||
// Don't care about video backdrops, or theme music or any kind of non-fullscreen playback
|
|
||||||
if (!options.fullscreen) {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.item && itemHelper.isLocalItem(options.item)) {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
return validatePlayback(options);
|
|
||||||
};
|
|
||||||
|
|
||||||
return PlaybackValidation;
|
|
||||||
});
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'registrationServices', 'paper-icon-button-light', 'emby-button', 'css!./recordingfields'], function (globalize, connectionManager, require, loading, appHost, dom, recordingHelper, events, registrationServices) {
|
define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'paper-icon-button-light', 'emby-button', 'css!./recordingfields'], function (globalize, connectionManager, require, loading, appHost, dom, recordingHelper, events) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function onRecordingButtonClick(e) {
|
function onRecordingButtonClick(e) {
|
||||||
|
|
|
@ -1,75 +1,16 @@
|
||||||
define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'registrationServices', 'paper-icon-button-light', 'emby-button', 'css!./recordingfields', 'flexStyles'], function (globalize, connectionManager, serverNotifications, require, loading, appHost, dom, recordingHelper, events, registrationServices) {
|
define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'paper-icon-button-light', 'emby-button', 'css!./recordingfields', 'flexStyles'], function (globalize, connectionManager, serverNotifications, require, loading, appHost, dom, recordingHelper, events) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function getRegistration(apiClient, feature) {
|
|
||||||
|
|
||||||
return registrationServices.validateFeature(feature, {
|
|
||||||
showDialog: false,
|
|
||||||
viewOnly: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showConvertRecordingsUnlockMessage(context, apiClient) {
|
|
||||||
|
|
||||||
getRegistration(apiClient, getDvrFeatureCode()).then(function () {
|
|
||||||
|
|
||||||
context.querySelector('.convertRecordingsContainer').classList.add('hide');
|
|
||||||
}, function () {
|
|
||||||
context.querySelector('.convertRecordingsContainer').classList.remove('hide');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showSeriesRecordingFields(context, programId, apiClient) {
|
function showSeriesRecordingFields(context, programId, apiClient) {
|
||||||
|
context.querySelector('.convertRecordingsContainer').classList.add('hide');
|
||||||
getRegistration(apiClient, getDvrFeatureCode()).then(function () {
|
context.querySelector('.recordSeriesContainer').classList.remove('hide');
|
||||||
|
|
||||||
context.querySelector('.supporterContainer').classList.add('hide');
|
|
||||||
context.querySelector('.convertRecordingsContainer').classList.add('hide');
|
|
||||||
context.querySelector('.recordSeriesContainer').classList.remove('hide');
|
|
||||||
|
|
||||||
}, function () {
|
|
||||||
|
|
||||||
context.querySelector('.supporterContainerText').innerHTML = globalize.translate('MessageActiveSubscriptionRequiredSeriesRecordings');
|
|
||||||
context.querySelector('.supporterContainer').classList.remove('hide');
|
|
||||||
context.querySelector('.recordSeriesContainer').classList.add('hide');
|
|
||||||
context.querySelector('.convertRecordingsContainer').classList.add('hide');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDvrFeatureCode() {
|
|
||||||
|
|
||||||
return 'dvr';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSingleRecordingFields(context, programId, apiClient) {
|
function showSingleRecordingFields(context, programId, apiClient) {
|
||||||
|
context.querySelector('.convertRecordingsContainer').classList.add('hide');
|
||||||
getRegistration(apiClient, getDvrFeatureCode()).then(function () {
|
|
||||||
|
|
||||||
context.querySelector('.supporterContainer').classList.add('hide');
|
|
||||||
showConvertRecordingsUnlockMessage(context, apiClient);
|
|
||||||
|
|
||||||
}, function () {
|
|
||||||
|
|
||||||
context.querySelector('.supporterContainerText').innerHTML = globalize.translate('DvrSubscriptionRequired');
|
|
||||||
context.querySelector('.supporterContainer').classList.remove('hide');
|
|
||||||
context.querySelector('.convertRecordingsContainer').classList.add('hide');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showRecordingFieldsContainer(context, programId, apiClient) {
|
|
||||||
|
|
||||||
getRegistration(apiClient, getDvrFeatureCode()).then(function () {
|
|
||||||
|
|
||||||
context.querySelector('.recordingFields').classList.remove('hide');
|
|
||||||
|
|
||||||
}, function () {
|
|
||||||
|
|
||||||
context.querySelector('.recordingFields').classList.add('hide');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadData(parent, program, apiClient) {
|
function loadData(parent, program, apiClient) {
|
||||||
|
|
||||||
if (program.IsSeries) {
|
if (program.IsSeries) {
|
||||||
parent.querySelector('.recordSeriesContainer').classList.remove('hide');
|
parent.querySelector('.recordSeriesContainer').classList.remove('hide');
|
||||||
showSeriesRecordingFields(parent, program.Id, apiClient);
|
showSeriesRecordingFields(parent, program.Id, apiClient);
|
||||||
|
@ -91,13 +32,11 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
||||||
if (program.TimerId && program.Status !== 'Cancelled') {
|
if (program.TimerId && program.Status !== 'Cancelled') {
|
||||||
parent.querySelector('.btnManageRecording').classList.remove('hide');
|
parent.querySelector('.btnManageRecording').classList.remove('hide');
|
||||||
parent.querySelector('.singleRecordingButton .recordingIcon').classList.add('recordingIcon-active');
|
parent.querySelector('.singleRecordingButton .recordingIcon').classList.add('recordingIcon-active');
|
||||||
|
|
||||||
if (program.Status === 'InProgress') {
|
if (program.Status === 'InProgress') {
|
||||||
parent.querySelector('.singleRecordingButton .buttonText').innerHTML = globalize.translate('StopRecording');
|
parent.querySelector('.singleRecordingButton .buttonText').innerHTML = globalize.translate('StopRecording');
|
||||||
} else {
|
} else {
|
||||||
parent.querySelector('.singleRecordingButton .buttonText').innerHTML = globalize.translate('DoNotRecord');
|
parent.querySelector('.singleRecordingButton .buttonText').innerHTML = globalize.translate('DoNotRecord');
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
parent.querySelector('.btnManageRecording').classList.add('hide');
|
parent.querySelector('.btnManageRecording').classList.add('hide');
|
||||||
parent.querySelector('.singleRecordingButton .recordingIcon').classList.remove('recordingIcon-active');
|
parent.querySelector('.singleRecordingButton .recordingIcon').classList.remove('recordingIcon-active');
|
||||||
|
@ -110,20 +49,16 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
||||||
var options = instance.options;
|
var options = instance.options;
|
||||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||||
|
|
||||||
showRecordingFieldsContainer(options.parent, options.programId, apiClient);
|
instance.querySelector('.recordingFields').classList.remove('hide');
|
||||||
|
|
||||||
return apiClient.getLiveTvProgram(options.programId, apiClient.getCurrentUserId()).then(function (program) {
|
return apiClient.getLiveTvProgram(options.programId, apiClient.getCurrentUserId()).then(function (program) {
|
||||||
|
|
||||||
instance.TimerId = program.TimerId;
|
instance.TimerId = program.TimerId;
|
||||||
instance.Status = program.Status;
|
instance.Status = program.Status;
|
||||||
instance.SeriesTimerId = program.SeriesTimerId;
|
instance.SeriesTimerId = program.SeriesTimerId;
|
||||||
|
|
||||||
loadData(options.parent, program, apiClient);
|
loadData(options.parent, program, apiClient);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTimerChangedExternally(e, apiClient, data) {
|
function onTimerChangedExternally(e, apiClient, data) {
|
||||||
|
|
||||||
var options = this.options;
|
var options = this.options;
|
||||||
var refresh = false;
|
var refresh = false;
|
||||||
|
|
||||||
|
@ -144,7 +79,6 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSeriesTimerChangedExternally(e, apiClient, data) {
|
function onSeriesTimerChangedExternally(e, apiClient, data) {
|
||||||
|
|
||||||
var options = this.options;
|
var options = this.options;
|
||||||
var refresh = false;
|
var refresh = false;
|
||||||
|
|
||||||
|
@ -181,26 +115,16 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
||||||
events.on(serverNotifications, 'SeriesTimerCancelled', seriesTimerChangedHandler);
|
events.on(serverNotifications, 'SeriesTimerCancelled', seriesTimerChangedHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSupporterButtonClick() {
|
|
||||||
registrationServices.showPremiereInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onManageRecordingClick(e) {
|
function onManageRecordingClick(e) {
|
||||||
|
|
||||||
var options = this.options;
|
var options = this.options;
|
||||||
|
|
||||||
if (!this.TimerId || this.Status === 'Cancelled') {
|
if (!this.TimerId || this.Status === 'Cancelled') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
require(['recordingEditor'], function (recordingEditor) {
|
require(['recordingEditor'], function (recordingEditor) {
|
||||||
|
|
||||||
recordingEditor.show(self.TimerId, options.serverId, {
|
recordingEditor.show(self.TimerId, options.serverId, {
|
||||||
|
|
||||||
enableCancel: false
|
enableCancel: false
|
||||||
|
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
self.changed = true;
|
self.changed = true;
|
||||||
});
|
});
|
||||||
|
@ -282,21 +206,16 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
||||||
|
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
showSeriesRecordingFields(options.parent, options.programId, apiClient);
|
showSeriesRecordingFields(options.parent, options.programId, apiClient);
|
||||||
|
|
||||||
if (!this.SeriesTimerId) {
|
if (!this.SeriesTimerId) {
|
||||||
|
|
||||||
var promise = this.TimerId ?
|
var promise = this.TimerId ?
|
||||||
recordingHelper.changeRecordingToSeries(apiClient, this.TimerId, options.programId) :
|
recordingHelper.changeRecordingToSeries(apiClient, this.TimerId, options.programId) :
|
||||||
recordingHelper.createRecording(apiClient, options.programId, true);
|
recordingHelper.createRecording(apiClient, options.programId, true);
|
||||||
|
|
||||||
promise.then(function () {
|
promise.then(function () {
|
||||||
fetchData(self);
|
fetchData(self);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
showSingleRecordingFields(options.parent, options.programId, apiClient);
|
showSingleRecordingFields(options.parent, options.programId, apiClient);
|
||||||
|
|
||||||
if (this.SeriesTimerId) {
|
if (this.SeriesTimerId) {
|
||||||
apiClient.cancelLiveTvSeriesTimer(this.SeriesTimerId).then(function () {
|
apiClient.cancelLiveTvSeriesTimer(this.SeriesTimerId).then(function () {
|
||||||
sendToast(globalize.translate('RecordingCancelled'));
|
sendToast(globalize.translate('RecordingCancelled'));
|
||||||
|
@ -307,22 +226,13 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordingEditor.prototype.embed = function () {
|
RecordingEditor.prototype.embed = function () {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
require(['text!./recordingfields.template.html'], function (template) {
|
require(['text!./recordingfields.template.html'], function (template) {
|
||||||
|
|
||||||
var options = self.options;
|
var options = self.options;
|
||||||
var context = options.parent;
|
var context = options.parent;
|
||||||
context.innerHTML = globalize.translateDocument(template, 'core');
|
context.innerHTML = globalize.translateDocument(template, 'core');
|
||||||
|
|
||||||
var supporterButtons = context.querySelectorAll('.btnSupporter');
|
|
||||||
for (var i = 0, length = supporterButtons.length; i < length; i++) {
|
|
||||||
supporterButtons[i].addEventListener('click', onSupporterButtonClick);
|
|
||||||
}
|
|
||||||
|
|
||||||
context.querySelector('.singleRecordingButton').addEventListener('click', onRecordChange.bind(self));
|
context.querySelector('.singleRecordingButton').addEventListener('click', onRecordChange.bind(self));
|
||||||
context.querySelector('.seriesRecordingButton').addEventListener('click', onRecordSeriesChange.bind(self));
|
context.querySelector('.seriesRecordingButton').addEventListener('click', onRecordSeriesChange.bind(self));
|
||||||
context.querySelector('.btnManageRecording').addEventListener('click', onManageRecordingClick.bind(self));
|
context.querySelector('.btnManageRecording').addEventListener('click', onManageRecordingClick.bind(self));
|
||||||
|
@ -334,17 +244,14 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
||||||
};
|
};
|
||||||
|
|
||||||
RecordingEditor.prototype.hasChanged = function () {
|
RecordingEditor.prototype.hasChanged = function () {
|
||||||
|
|
||||||
return this.changed;
|
return this.changed;
|
||||||
};
|
};
|
||||||
|
|
||||||
RecordingEditor.prototype.refresh = function () {
|
RecordingEditor.prototype.refresh = function () {
|
||||||
|
|
||||||
fetchData(this);
|
fetchData(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
RecordingEditor.prototype.destroy = function () {
|
RecordingEditor.prototype.destroy = function () {
|
||||||
|
|
||||||
var timerChangedHandler = this.timerChangedHandler;
|
var timerChangedHandler = this.timerChangedHandler;
|
||||||
this.timerChangedHandler = null;
|
this.timerChangedHandler = null;
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,8 @@
|
||||||
<div class="convertRecordingsContainer hide infoBanner" style="margin: 1em 0 2em;">
|
<div class="convertRecordingsContainer hide infoBanner" style="margin: 1em 0 2em;">
|
||||||
<h1 style="margin: .25em 0 .5em;">${HeaderConvertYourRecordings}</h1>
|
<h1 style="margin: .25em 0 .5em;">${HeaderConvertYourRecordings}</h1>
|
||||||
<div class="fieldDescription">${PromoConvertRecordingsToStreamingFormat}</div>
|
<div class="fieldDescription">${PromoConvertRecordingsToStreamingFormat}</div>
|
||||||
<br />
|
|
||||||
<button is="emby-button" type="button" class="raised btnSupporter btnSupporterForConverting button-submit">
|
|
||||||
<span>${HeaderLearnMore}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="supporterContainer hide infoBanner" style="margin: 1em 0 2em;">
|
|
||||||
<div class="supporterContainerText"></div>
|
|
||||||
<br />
|
|
||||||
<button is="emby-button" type="button" class="btnSupporter raised button-submit block">
|
|
||||||
<span>${HeaderBecomeProjectSupporter}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="recordingFields hide">
|
<div class="recordingFields hide">
|
||||||
|
|
||||||
<div class="recordSeriesContainer recordingFields-buttons flex align-items-center hide">
|
<div class="recordSeriesContainer recordingFields-buttons flex align-items-center hide">
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="button" class="raised recordingButton seriesRecordingButton">
|
<button is="emby-button" type="button" class="raised recordingButton seriesRecordingButton">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['globalize', 'loading', 'connectionManager', 'registrationServices'], function (globalize, loading, connectionManager, registrationServices) {
|
define(['globalize', 'loading', 'connectionManager'], function (globalize, loading, connectionManager) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function changeRecordingToSeries(apiClient, timerId, programId, confirmTimerCancellation) {
|
function changeRecordingToSeries(apiClient, timerId, programId, confirmTimerCancellation) {
|
||||||
|
@ -18,7 +18,7 @@ define(['globalize', 'loading', 'connectionManager', 'registrationServices'], fu
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// cancel
|
// cancel
|
||||||
if (confirmTimerCancellation) {
|
if (confirmTimerCancellation) {
|
||||||
return cancelTimerWithConfirmation(timerId, apiClient.serverId());
|
return cancelTimerWithConfirmation(timerId, apiClient.serverId());
|
||||||
}
|
}
|
||||||
|
@ -190,30 +190,21 @@ define(['globalize', 'loading', 'connectionManager', 'registrationServices'], fu
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleRecording(serverId, programId, timerId, timerStatus, seriesTimerId) {
|
function toggleRecording(serverId, programId, timerId, timerStatus, seriesTimerId) {
|
||||||
|
var apiClient = connectionManager.getApiClient(serverId);
|
||||||
return registrationServices.validateFeature('dvr').then(function () {
|
var hasTimer = timerId && timerStatus !== 'Cancelled';
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
if (seriesTimerId && hasTimer) {
|
||||||
|
// cancel
|
||||||
var hasTimer = timerId && timerStatus !== 'Cancelled';
|
return showMultiCancellationPrompt(serverId, programId, timerId, timerStatus, seriesTimerId);
|
||||||
|
} else if (hasTimer && programId) {
|
||||||
if (seriesTimerId && hasTimer) {
|
// change to series recording, if possible
|
||||||
|
// otherwise cancel individual recording
|
||||||
// cancel
|
return changeRecordingToSeries(apiClient, timerId, programId, true);
|
||||||
return showMultiCancellationPrompt(serverId, programId, timerId, timerStatus, seriesTimerId);
|
} else if (programId) {
|
||||||
|
// schedule recording
|
||||||
} else if (hasTimer && programId) {
|
return createRecording(apiClient, programId);
|
||||||
|
} else {
|
||||||
// change to series recording, if possible
|
return Promise.reject();
|
||||||
// otherwise cancel individual recording
|
}
|
||||||
return changeRecordingToSeries(apiClient, timerId, programId, true);
|
|
||||||
|
|
||||||
} else if (programId) {
|
|
||||||
// schedule recording
|
|
||||||
return createRecording(apiClient, programId);
|
|
||||||
} else {
|
|
||||||
return Promise.reject();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
define(['appSettings', 'loading', 'apphost', 'events', 'shell', 'globalize', 'dialogHelper', 'connectionManager', 'layoutManager', 'emby-button', 'emby-linkbutton'], function (appSettings, loading, appHost, events, shell, globalize, dialogHelper, connectionManager, layoutManager) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
function validateFeature(feature, options) {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
function showPremiereInfo() {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
validateFeature: validateFeature,
|
|
||||||
showPremiereInfo: showPremiereInfo
|
|
||||||
};
|
|
||||||
});
|
|
|
@ -9,13 +9,11 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
|
||||||
|
|
||||||
function getRequirePromise(deps) {
|
function getRequirePromise(deps) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
require(deps, resolve);
|
require(deps, resolve);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSkin(id) {
|
function loadSkin(id) {
|
||||||
|
|
||||||
var newSkin = pluginManager.plugins().filter(function (p) {
|
var newSkin = pluginManager.plugins().filter(function (p) {
|
||||||
return p.id === id;
|
return p.id === id;
|
||||||
})[0];
|
})[0];
|
||||||
|
@ -29,7 +27,6 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
|
||||||
var unloadPromise;
|
var unloadPromise;
|
||||||
|
|
||||||
if (currentSkin) {
|
if (currentSkin) {
|
||||||
|
|
||||||
if (currentSkin.id === newSkin.id) {
|
if (currentSkin.id === newSkin.id) {
|
||||||
// Nothing to do, it's already the active skin
|
// Nothing to do, it's already the active skin
|
||||||
return Promise.resolve(currentSkin);
|
return Promise.resolve(currentSkin);
|
||||||
|
@ -72,7 +69,6 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
|
||||||
console.log('Unloading skin: ' + skin.name);
|
console.log('Unloading skin: ' + skin.name);
|
||||||
|
|
||||||
// TODO: unload css
|
// TODO: unload css
|
||||||
|
|
||||||
return skin.unload().then(function () {
|
return skin.unload().then(function () {
|
||||||
document.dispatchEvent(new CustomEvent("skinunload", {
|
document.dispatchEvent(new CustomEvent("skinunload", {
|
||||||
detail: {
|
detail: {
|
||||||
|
@ -83,9 +79,7 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSkinHeader(skin) {
|
function loadSkinHeader(skin) {
|
||||||
|
|
||||||
return getSkinHeader(skin).then(function (headerHtml) {
|
return getSkinHeader(skin).then(function (headerHtml) {
|
||||||
|
|
||||||
document.querySelector('.skinHeader').innerHTML = headerHtml;
|
document.querySelector('.skinHeader').innerHTML = headerHtml;
|
||||||
|
|
||||||
currentSkin = skin;
|
currentSkin = skin;
|
||||||
|
@ -175,29 +169,7 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
|
||||||
getThemes: getThemes
|
getThemes: getThemes
|
||||||
};
|
};
|
||||||
|
|
||||||
function onRegistrationSuccess() {
|
|
||||||
appSettings.set('appthemesregistered', 'true');
|
|
||||||
}
|
|
||||||
|
|
||||||
function onRegistrationFailure() {
|
|
||||||
appSettings.set('appthemesregistered', 'false');
|
|
||||||
}
|
|
||||||
|
|
||||||
function isRegistered() {
|
|
||||||
|
|
||||||
getRequirePromise(['registrationServices']).then(function (registrationServices) {
|
|
||||||
registrationServices.validateFeature('themes', {
|
|
||||||
|
|
||||||
showDialog: false
|
|
||||||
|
|
||||||
}).then(onRegistrationSuccess, onRegistrationFailure);
|
|
||||||
});
|
|
||||||
|
|
||||||
return appSettings.get('appthemesregistered') !== 'false';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getThemeStylesheetInfo(id, requiresRegistration, isDefaultProperty) {
|
function getThemeStylesheetInfo(id, requiresRegistration, isDefaultProperty) {
|
||||||
|
|
||||||
var themes = skinManager.getThemes();
|
var themes = skinManager.getThemes();
|
||||||
var defaultTheme;
|
var defaultTheme;
|
||||||
var selectedTheme;
|
var selectedTheme;
|
||||||
|
@ -214,11 +186,6 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedTheme = selectedTheme || defaultTheme;
|
selectedTheme = selectedTheme || defaultTheme;
|
||||||
|
|
||||||
if (selectedTheme.id !== defaultTheme.id && requiresRegistration && !isRegistered()) {
|
|
||||||
selectedTheme = defaultTheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
stylesheetPath: require.toUrl('components/themes/' + selectedTheme.id + '/theme.css'),
|
stylesheetPath: require.toUrl('components/themes/' + selectedTheme.id + '/theme.css'),
|
||||||
themeId: selectedTheme.id
|
themeId: selectedTheme.id
|
||||||
|
@ -230,9 +197,7 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
|
||||||
var currentSound;
|
var currentSound;
|
||||||
|
|
||||||
function loadThemeResources(id) {
|
function loadThemeResources(id) {
|
||||||
|
|
||||||
lastSound = 0;
|
lastSound = 0;
|
||||||
|
|
||||||
if (currentSound) {
|
if (currentSound) {
|
||||||
currentSound.stop();
|
currentSound.stop();
|
||||||
currentSound = null;
|
currentSound = null;
|
||||||
|
@ -243,26 +208,19 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
|
||||||
|
|
||||||
function onThemeLoaded() {
|
function onThemeLoaded() {
|
||||||
document.documentElement.classList.remove('preload');
|
document.documentElement.classList.remove('preload');
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var color = getComputedStyle(document.querySelector('.skinHeader')).getPropertyValue("background-color");
|
var color = getComputedStyle(document.querySelector('.skinHeader')).getPropertyValue("background-color");
|
||||||
|
|
||||||
if (color) {
|
if (color) {
|
||||||
appHost.setThemeColor(color);
|
appHost.setThemeColor(color);
|
||||||
}
|
}
|
||||||
}
|
} catch (err) {
|
||||||
catch (err) {
|
|
||||||
console.log('Error setting theme color: ' + err);
|
console.log('Error setting theme color: ' + err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
skinManager.setTheme = function (id, context) {
|
skinManager.setTheme = function (id, context) {
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
var requiresRegistration = true;
|
var requiresRegistration = true;
|
||||||
|
|
||||||
if (currentThemeId && currentThemeId === id) {
|
if (currentThemeId && currentThemeId === id) {
|
||||||
resolve();
|
resolve();
|
||||||
return;
|
return;
|
||||||
|
@ -270,22 +228,18 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
|
||||||
|
|
||||||
var isDefaultProperty = context === 'serverdashboard' ? 'isDefaultServerDashboard' : 'isDefault';
|
var isDefaultProperty = context === 'serverdashboard' ? 'isDefaultServerDashboard' : 'isDefault';
|
||||||
var info = getThemeStylesheetInfo(id, requiresRegistration, isDefaultProperty);
|
var info = getThemeStylesheetInfo(id, requiresRegistration, isDefaultProperty);
|
||||||
|
|
||||||
if (currentThemeId && currentThemeId === info.themeId) {
|
if (currentThemeId && currentThemeId === info.themeId) {
|
||||||
resolve();
|
resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var linkUrl = info.stylesheetPath;
|
var linkUrl = info.stylesheetPath;
|
||||||
|
|
||||||
unloadTheme();
|
unloadTheme();
|
||||||
|
|
||||||
var link = document.createElement('link');
|
var link = document.createElement('link');
|
||||||
|
|
||||||
link.setAttribute('rel', 'stylesheet');
|
link.setAttribute('rel', 'stylesheet');
|
||||||
link.setAttribute('type', 'text/css');
|
link.setAttribute('type', 'text/css');
|
||||||
link.onload = function () {
|
link.onload = function () {
|
||||||
|
|
||||||
onThemeLoaded();
|
onThemeLoaded();
|
||||||
resolve();
|
resolve();
|
||||||
};
|
};
|
||||||
|
@ -301,23 +255,19 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
|
||||||
};
|
};
|
||||||
|
|
||||||
function onViewBeforeShow(e) {
|
function onViewBeforeShow(e) {
|
||||||
|
|
||||||
if (e.detail && e.detail.type === 'video-osd') {
|
if (e.detail && e.detail.type === 'video-osd') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (themeResources.backdrop) {
|
if (themeResources.backdrop) {
|
||||||
|
|
||||||
backdrop.setBackdrop(themeResources.backdrop);
|
backdrop.setBackdrop(themeResources.backdrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!browser.mobile && userSettings.enableThemeSongs()) {
|
if (!browser.mobile && userSettings.enableThemeSongs()) {
|
||||||
if (lastSound === 0) {
|
if (lastSound === 0) {
|
||||||
|
|
||||||
if (themeResources.themeSong) {
|
if (themeResources.themeSong) {
|
||||||
playSound(themeResources.themeSong);
|
playSound(themeResources.themeSong);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((new Date().getTime() - lastSound) > 30000) {
|
} else if ((new Date().getTime() - lastSound) > 30000) {
|
||||||
if (themeResources.effect) {
|
if (themeResources.effect) {
|
||||||
playSound(themeResources.effect);
|
playSound(themeResources.effect);
|
||||||
|
|
|
@ -1131,7 +1131,6 @@ var AppInfo = {};
|
||||||
function loadPlugins(externalPlugins, appHost, browser, shell) {
|
function loadPlugins(externalPlugins, appHost, browser, shell) {
|
||||||
console.log("Loading installed plugins");
|
console.log("Loading installed plugins");
|
||||||
var list = [
|
var list = [
|
||||||
"components/playback/playbackvalidation",
|
|
||||||
"components/playback/playaccessvalidation",
|
"components/playback/playaccessvalidation",
|
||||||
"components/playback/experimentalwarnings",
|
"components/playback/experimentalwarnings",
|
||||||
"components/htmlaudioplayer/plugin",
|
"components/htmlaudioplayer/plugin",
|
||||||
|
@ -1476,7 +1475,6 @@ var AppInfo = {};
|
||||||
define("viewSettings", [componentsPath + "/viewsettings/viewsettings"], returnFirstDependency);
|
define("viewSettings", [componentsPath + "/viewsettings/viewsettings"], returnFirstDependency);
|
||||||
define("filterMenu", [componentsPath + "/filtermenu/filtermenu"], returnFirstDependency);
|
define("filterMenu", [componentsPath + "/filtermenu/filtermenu"], returnFirstDependency);
|
||||||
define("sortMenu", [componentsPath + "/sortmenu/sortmenu"], returnFirstDependency);
|
define("sortMenu", [componentsPath + "/sortmenu/sortmenu"], returnFirstDependency);
|
||||||
define("registrationServices", [componentsPath + "/registrationservices/registrationservices"], returnFirstDependency);
|
|
||||||
|
|
||||||
if ("cordova" === self.appMode || "android" === self.appMode) {
|
if ("cordova" === self.appMode || "android" === self.appMode) {
|
||||||
define("fileupload", ["cordova/fileupload"], returnFirstDependency);
|
define("fileupload", ["cordova/fileupload"], returnFirstDependency);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue