minify
This commit is contained in:
parent
82bcca376f
commit
8a6884abef
494 changed files with 256 additions and 120180 deletions
|
@ -1,36 +1 @@
|
|||
.recordingDialogSubmitIcon {
|
||||
color: #cc3333;
|
||||
}
|
||||
|
||||
.recordingDialog-imageContainer {
|
||||
flex-shrink: 0;
|
||||
padding: 1em 1em 1em 0;
|
||||
min-width: 17%;
|
||||
max-width: 25%;
|
||||
}
|
||||
|
||||
.recordingDialog-img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.recordingDialog-itemName {
|
||||
margin-top: .7em;
|
||||
}
|
||||
|
||||
.recordingDialog-btnRecord {
|
||||
background-color: #cc3333;
|
||||
}
|
||||
|
||||
.recordingDetailsContainer {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.recordingDetails {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.recordingDetailText {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.recordingDialogSubmitIcon{color:#c33}.recordingDialog-imageContainer{-webkit-flex-shrink:0;flex-shrink:0;padding:1em 1em 1em 0;min-width:17%;max-width:25%}.recordingDialog-img{max-width:100%}.recordingDialog-itemName{margin-top:.7em}.recordingDialog-btnRecord{background-color:#c33}.recordingDetailsContainer{display:-webkit-box;display:-webkit-flex;display:flex}.recordingDetails{-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1}.recordingDetailText{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-flex-wrap:wrap;flex-wrap:wrap}
|
|
@ -1,206 +1 @@
|
|||
define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'connectionManager', 'require', 'loading', 'scrollHelper', 'datetime', 'imageLoader', 'recordingFields', 'events', 'emby-checkbox', 'emby-button', 'emby-collapse', 'emby-input', 'paper-icon-button-light', 'css!./../formdialog', 'css!./recordingcreator', 'material-icons'], function (dialogHelper, globalize, layoutManager, mediaInfo, appHost, connectionManager, require, loading, scrollHelper, datetime, imageLoader, recordingFields, events) {
|
||||
'use strict';
|
||||
|
||||
var currentDialog;
|
||||
var closeAction;
|
||||
var currentRecordingFields;
|
||||
|
||||
function closeDialog() {
|
||||
|
||||
dialogHelper.close(currentDialog);
|
||||
}
|
||||
|
||||
function init(context) {
|
||||
|
||||
context.querySelector('.btnPlay').addEventListener('click', function () {
|
||||
|
||||
closeAction = 'play';
|
||||
closeDialog();
|
||||
});
|
||||
|
||||
context.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
closeAction = null;
|
||||
closeDialog();
|
||||
});
|
||||
}
|
||||
|
||||
function getImageUrl(item, apiClient, imageHeight) {
|
||||
|
||||
var imageTags = item.ImageTags || {};
|
||||
|
||||
if (item.PrimaryImageTag) {
|
||||
imageTags.Primary = item.PrimaryImageTag;
|
||||
}
|
||||
|
||||
if (imageTags.Primary) {
|
||||
|
||||
return apiClient.getScaledImageUrl(item.Id, {
|
||||
type: "Primary",
|
||||
maxHeight: imageHeight,
|
||||
tag: item.ImageTags.Primary
|
||||
});
|
||||
}
|
||||
else if (imageTags.Thumb) {
|
||||
|
||||
return apiClient.getScaledImageUrl(item.Id, {
|
||||
type: "Thumb",
|
||||
maxHeight: imageHeight,
|
||||
tag: item.ImageTags.Thumb
|
||||
});
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function renderRecording(context, defaultTimer, program, apiClient, refreshRecordingStateOnly) {
|
||||
|
||||
if (!refreshRecordingStateOnly) {
|
||||
var imgUrl = getImageUrl(program, apiClient, 200);
|
||||
var imageContainer = context.querySelector('.recordingDialog-imageContainer');
|
||||
|
||||
if (imgUrl) {
|
||||
imageContainer.innerHTML = '<img src="' + require.toUrl('.').split('?')[0] + '/empty.png" data-src="' + imgUrl + '" class="recordingDialog-img lazy" />';
|
||||
imageContainer.classList.remove('hide');
|
||||
|
||||
imageLoader.lazyChildren(imageContainer);
|
||||
} else {
|
||||
imageContainer.innerHTML = '';
|
||||
imageContainer.classList.add('hide');
|
||||
}
|
||||
|
||||
context.querySelector('.recordingDialog-itemName').innerHTML = program.Name;
|
||||
context.querySelector('.formDialogHeaderTitle').innerHTML = program.Name;
|
||||
context.querySelector('.itemGenres').innerHTML = (program.Genres || []).join(' / ');
|
||||
context.querySelector('.itemOverview').innerHTML = program.Overview || '';
|
||||
|
||||
var formDialogFooter = context.querySelector('.formDialogFooter');
|
||||
var now = new Date();
|
||||
if (now >= datetime.parseISO8601Date(program.StartDate, true) && now < datetime.parseISO8601Date(program.EndDate, true)) {
|
||||
formDialogFooter.classList.remove('hide');
|
||||
} else {
|
||||
formDialogFooter.classList.add('hide');
|
||||
}
|
||||
|
||||
context.querySelector('.itemMiscInfoPrimary').innerHTML = mediaInfo.getPrimaryMediaInfoHtml(program);
|
||||
}
|
||||
|
||||
context.querySelector('.itemMiscInfoSecondary').innerHTML = mediaInfo.getSecondaryMediaInfoHtml(program, {
|
||||
});
|
||||
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function reload(context, programId, serverId, refreshRecordingStateOnly) {
|
||||
|
||||
loading.show();
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
var promise1 = apiClient.getNewLiveTvTimerDefaults({ programId: programId });
|
||||
var promise2 = apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId());
|
||||
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
var defaults = responses[0];
|
||||
var program = responses[1];
|
||||
|
||||
renderRecording(context, defaults, program, apiClient, refreshRecordingStateOnly);
|
||||
});
|
||||
}
|
||||
|
||||
function executeCloseAction(action, programId, serverId) {
|
||||
|
||||
if (action === 'play') {
|
||||
|
||||
require(['playbackManager'], function (playbackManager) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId()).then(function (item) {
|
||||
|
||||
playbackManager.play({
|
||||
ids: [item.ChannelId],
|
||||
serverId: serverId
|
||||
});
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function showEditor(itemId, serverId) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
closeAction = null;
|
||||
|
||||
loading.show();
|
||||
|
||||
require(['text!./recordingcreator.template.html'], function (template) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
};
|
||||
|
||||
if (layoutManager.tv) {
|
||||
dialogOptions.size = 'fullscreen';
|
||||
} else {
|
||||
dialogOptions.size = 'small';
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.classList.add('recordingDialog');
|
||||
|
||||
var html = '';
|
||||
|
||||
html += globalize.translateDocument(template, 'sharedcomponents');
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
currentDialog = dlg;
|
||||
|
||||
function onRecordingChanged() {
|
||||
reload(dlg, itemId, serverId, true);
|
||||
}
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
events.off(currentRecordingFields, 'recordingchanged', onRecordingChanged);
|
||||
executeCloseAction(closeAction, itemId, serverId);
|
||||
|
||||
if (currentRecordingFields && currentRecordingFields.hasChanged()) {
|
||||
resolve();
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
|
||||
if (layoutManager.tv) {
|
||||
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false);
|
||||
}
|
||||
|
||||
init(dlg);
|
||||
|
||||
reload(dlg, itemId, serverId);
|
||||
|
||||
currentRecordingFields = new recordingFields({
|
||||
parent: dlg.querySelector('.recordingFields'),
|
||||
programId: itemId,
|
||||
serverId: serverId
|
||||
});
|
||||
|
||||
events.on(currentRecordingFields, 'recordingchanged', onRecordingChanged);
|
||||
|
||||
dialogHelper.open(dlg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
show: showEditor
|
||||
};
|
||||
});
|
||||
define(["dialogHelper","globalize","layoutManager","mediaInfo","apphost","connectionManager","require","loading","scrollHelper","datetime","imageLoader","recordingFields","events","emby-checkbox","emby-button","emby-collapse","emby-input","paper-icon-button-light","css!./../formdialog","css!./recordingcreator","material-icons"],function(dialogHelper,globalize,layoutManager,mediaInfo,appHost,connectionManager,require,loading,scrollHelper,datetime,imageLoader,recordingFields,events){"use strict";function closeDialog(){dialogHelper.close(currentDialog)}function init(context){context.querySelector(".btnPlay").addEventListener("click",function(){closeAction="play",closeDialog()}),context.querySelector(".btnCancel").addEventListener("click",function(){closeAction=null,closeDialog()})}function getImageUrl(item,apiClient,imageHeight){var imageTags=item.ImageTags||{};return item.PrimaryImageTag&&(imageTags.Primary=item.PrimaryImageTag),imageTags.Primary?apiClient.getScaledImageUrl(item.Id,{type:"Primary",maxHeight:imageHeight,tag:item.ImageTags.Primary}):imageTags.Thumb?apiClient.getScaledImageUrl(item.Id,{type:"Thumb",maxHeight:imageHeight,tag:item.ImageTags.Thumb}):null}function renderRecording(context,defaultTimer,program,apiClient,refreshRecordingStateOnly){if(!refreshRecordingStateOnly){var imgUrl=getImageUrl(program,apiClient,200),imageContainer=context.querySelector(".recordingDialog-imageContainer");imgUrl?(imageContainer.innerHTML='<img src="'+require.toUrl(".").split("?")[0]+'/empty.png" data-src="'+imgUrl+'" class="recordingDialog-img lazy" />',imageContainer.classList.remove("hide"),imageLoader.lazyChildren(imageContainer)):(imageContainer.innerHTML="",imageContainer.classList.add("hide")),context.querySelector(".recordingDialog-itemName").innerHTML=program.Name,context.querySelector(".formDialogHeaderTitle").innerHTML=program.Name,context.querySelector(".itemGenres").innerHTML=(program.Genres||[]).join(" / "),context.querySelector(".itemOverview").innerHTML=program.Overview||"";var formDialogFooter=context.querySelector(".formDialogFooter"),now=new Date;now>=datetime.parseISO8601Date(program.StartDate,!0)&&now<datetime.parseISO8601Date(program.EndDate,!0)?formDialogFooter.classList.remove("hide"):formDialogFooter.classList.add("hide"),context.querySelector(".itemMiscInfoPrimary").innerHTML=mediaInfo.getPrimaryMediaInfoHtml(program)}context.querySelector(".itemMiscInfoSecondary").innerHTML=mediaInfo.getSecondaryMediaInfoHtml(program,{}),loading.hide()}function reload(context,programId,serverId,refreshRecordingStateOnly){loading.show();var apiClient=connectionManager.getApiClient(serverId),promise1=apiClient.getNewLiveTvTimerDefaults({programId:programId}),promise2=apiClient.getLiveTvProgram(programId,apiClient.getCurrentUserId());Promise.all([promise1,promise2]).then(function(responses){var defaults=responses[0],program=responses[1];renderRecording(context,defaults,program,apiClient,refreshRecordingStateOnly)})}function executeCloseAction(action,programId,serverId){if("play"===action)return void require(["playbackManager"],function(playbackManager){var apiClient=connectionManager.getApiClient(serverId);apiClient.getLiveTvProgram(programId,apiClient.getCurrentUserId()).then(function(item){playbackManager.play({ids:[item.ChannelId],serverId:serverId})})})}function showEditor(itemId,serverId){return new Promise(function(resolve,reject){closeAction=null,loading.show(),require(["text!./recordingcreator.template.html"],function(template){function onRecordingChanged(){reload(dlg,itemId,serverId,!0)}var dialogOptions={removeOnClose:!0,scrollY:!1};layoutManager.tv?dialogOptions.size="fullscreen":dialogOptions.size="small";var dlg=dialogHelper.createDialog(dialogOptions);dlg.classList.add("formDialog"),dlg.classList.add("recordingDialog");var html="";html+=globalize.translateDocument(template,"sharedcomponents"),dlg.innerHTML=html,currentDialog=dlg,dlg.addEventListener("close",function(){events.off(currentRecordingFields,"recordingchanged",onRecordingChanged),executeCloseAction(closeAction,itemId,serverId),currentRecordingFields&¤tRecordingFields.hasChanged()?resolve():reject()}),layoutManager.tv&&scrollHelper.centerFocus.on(dlg.querySelector(".formDialogContent"),!1),init(dlg),reload(dlg,itemId,serverId),currentRecordingFields=new recordingFields({parent:dlg.querySelector(".recordingFields"),programId:itemId,serverId:serverId}),events.on(currentRecordingFields,"recordingchanged",onRecordingChanged),dialogHelper.open(dlg)})})}var currentDialog,closeAction,currentRecordingFields;return{show:showEditor}});
|
|
@ -1,164 +1 @@
|
|||
define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'connectionManager', 'require', 'loading', 'scrollHelper', 'imageLoader', 'scrollStyles', 'emby-button', 'emby-collapse', 'emby-input', 'paper-icon-button-light', 'css!./../formdialog', 'css!./recordingcreator', 'material-icons'], function (dialogHelper, globalize, layoutManager, mediaInfo, appHost, connectionManager, require, loading, scrollHelper, imageLoader) {
|
||||
'use strict';
|
||||
|
||||
var currentDialog;
|
||||
var recordingDeleted = false;
|
||||
var currentItemId;
|
||||
var currentServerId;
|
||||
var currentResolve;
|
||||
|
||||
function deleteTimer(apiClient, timerId) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['recordingHelper'], function (recordingHelper) {
|
||||
|
||||
recordingHelper.cancelTimerWithConfirmation(timerId, apiClient.serverId()).then(resolve, reject);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function renderTimer(context, item, apiClient) {
|
||||
|
||||
var program = item.ProgramInfo || {};
|
||||
|
||||
context.querySelector('#txtPrePaddingMinutes').value = item.PrePaddingSeconds / 60;
|
||||
context.querySelector('#txtPostPaddingMinutes').value = item.PostPaddingSeconds / 60;
|
||||
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function closeDialog(isDeleted) {
|
||||
|
||||
recordingDeleted = isDeleted;
|
||||
|
||||
dialogHelper.close(currentDialog);
|
||||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
var form = this;
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
|
||||
apiClient.getLiveTvTimer(currentItemId).then(function (item) {
|
||||
item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60;
|
||||
item.PostPaddingSeconds = form.querySelector('#txtPostPaddingMinutes').value * 60;
|
||||
apiClient.updateLiveTvTimer(item).then(currentResolve);
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
function init(context) {
|
||||
|
||||
context.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
closeDialog(false);
|
||||
});
|
||||
|
||||
context.querySelector('.btnCancelRecording').addEventListener('click', function () {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
deleteTimer(apiClient, currentItemId).then(function () {
|
||||
closeDialog(true);
|
||||
});
|
||||
});
|
||||
|
||||
context.querySelector('form').addEventListener('submit', onSubmit);
|
||||
}
|
||||
|
||||
function reload(context, id) {
|
||||
|
||||
loading.show();
|
||||
currentItemId = id;
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
apiClient.getLiveTvTimer(id).then(function (result) {
|
||||
|
||||
renderTimer(context, result, apiClient);
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function showEditor(itemId, serverId, options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
recordingDeleted = false;
|
||||
currentServerId = serverId;
|
||||
loading.show();
|
||||
options = options || {};
|
||||
currentResolve = resolve;
|
||||
|
||||
require(['text!./recordingeditor.template.html'], function (template) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
};
|
||||
|
||||
if (layoutManager.tv) {
|
||||
dialogOptions.size = 'fullscreen';
|
||||
} else {
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.classList.add('recordingDialog');
|
||||
|
||||
if (!layoutManager.tv) {
|
||||
dlg.style['min-width'] = '20%';
|
||||
dlg.classList.add('dialog-fullscreen-lowres');
|
||||
}
|
||||
|
||||
var html = '';
|
||||
|
||||
html += globalize.translateDocument(template, 'sharedcomponents');
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
if (options.enableCancel === false) {
|
||||
dlg.querySelector('.formDialogFooter').classList.add('hide');
|
||||
}
|
||||
|
||||
currentDialog = dlg;
|
||||
|
||||
dlg.addEventListener('closing', function () {
|
||||
|
||||
if (!recordingDeleted) {
|
||||
dlg.querySelector('.btnSubmit').click();
|
||||
}
|
||||
});
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
if (recordingDeleted) {
|
||||
resolve({
|
||||
updated: true,
|
||||
deleted: true
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (layoutManager.tv) {
|
||||
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false);
|
||||
}
|
||||
|
||||
init(dlg);
|
||||
|
||||
reload(dlg, itemId);
|
||||
|
||||
dialogHelper.open(dlg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
show: showEditor
|
||||
};
|
||||
});
|
||||
define(["dialogHelper","globalize","layoutManager","mediaInfo","apphost","connectionManager","require","loading","scrollHelper","imageLoader","scrollStyles","emby-button","emby-collapse","emby-input","paper-icon-button-light","css!./../formdialog","css!./recordingcreator","material-icons"],function(dialogHelper,globalize,layoutManager,mediaInfo,appHost,connectionManager,require,loading,scrollHelper,imageLoader){"use strict";function deleteTimer(apiClient,timerId){return new Promise(function(resolve,reject){require(["recordingHelper"],function(recordingHelper){recordingHelper.cancelTimerWithConfirmation(timerId,apiClient.serverId()).then(resolve,reject)})})}function renderTimer(context,item,apiClient){item.ProgramInfo||{};context.querySelector("#txtPrePaddingMinutes").value=item.PrePaddingSeconds/60,context.querySelector("#txtPostPaddingMinutes").value=item.PostPaddingSeconds/60,loading.hide()}function closeDialog(isDeleted){recordingDeleted=isDeleted,dialogHelper.close(currentDialog)}function onSubmit(e){var form=this,apiClient=connectionManager.getApiClient(currentServerId);return apiClient.getLiveTvTimer(currentItemId).then(function(item){item.PrePaddingSeconds=60*form.querySelector("#txtPrePaddingMinutes").value,item.PostPaddingSeconds=60*form.querySelector("#txtPostPaddingMinutes").value,apiClient.updateLiveTvTimer(item).then(currentResolve)}),e.preventDefault(),!1}function init(context){context.querySelector(".btnCancel").addEventListener("click",function(){closeDialog(!1)}),context.querySelector(".btnCancelRecording").addEventListener("click",function(){var apiClient=connectionManager.getApiClient(currentServerId);deleteTimer(apiClient,currentItemId).then(function(){closeDialog(!0)})}),context.querySelector("form").addEventListener("submit",onSubmit)}function reload(context,id){loading.show(),currentItemId=id;var apiClient=connectionManager.getApiClient(currentServerId);apiClient.getLiveTvTimer(id).then(function(result){renderTimer(context,result,apiClient),loading.hide()})}function showEditor(itemId,serverId,options){return new Promise(function(resolve,reject){recordingDeleted=!1,currentServerId=serverId,loading.show(),options=options||{},currentResolve=resolve,require(["text!./recordingeditor.template.html"],function(template){var dialogOptions={removeOnClose:!0,scrollY:!1};layoutManager.tv&&(dialogOptions.size="fullscreen");var dlg=dialogHelper.createDialog(dialogOptions);dlg.classList.add("formDialog"),dlg.classList.add("recordingDialog"),layoutManager.tv||(dlg.style["min-width"]="20%",dlg.classList.add("dialog-fullscreen-lowres"));var html="";html+=globalize.translateDocument(template,"sharedcomponents"),dlg.innerHTML=html,options.enableCancel===!1&&dlg.querySelector(".formDialogFooter").classList.add("hide"),currentDialog=dlg,dlg.addEventListener("closing",function(){recordingDeleted||dlg.querySelector(".btnSubmit").click()}),dlg.addEventListener("close",function(){recordingDeleted&&resolve({updated:!0,deleted:!0})}),layoutManager.tv&&scrollHelper.centerFocus.on(dlg.querySelector(".formDialogContent"),!1),init(dlg),reload(dlg,itemId),dialogHelper.open(dlg)})})}var currentDialog,currentItemId,currentServerId,currentResolve,recordingDeleted=!1;return{show:showEditor}});
|
|
@ -1,44 +1 @@
|
|||
.recordingButton {
|
||||
margin-left: 0;
|
||||
min-width: 10em;
|
||||
}
|
||||
|
||||
.recordingIcon {
|
||||
font-size: 1.3em !important;
|
||||
}
|
||||
|
||||
.recordingIcon-active {
|
||||
color: #cc3333;
|
||||
}
|
||||
|
||||
.manageButtonText {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.recordSeriesContainer {
|
||||
margin-bottom: .8em;
|
||||
}
|
||||
|
||||
.recordingFields-buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@media all and (max-width: 440px) {
|
||||
|
||||
.manageButtonText {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.recordingButton {
|
||||
width: auto;
|
||||
margin-right: 1.5em !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (min-width: 440px) {
|
||||
|
||||
.manageButtonIcon {
|
||||
font-size: 90% !important;
|
||||
}
|
||||
}
|
||||
.recordingButton{margin-left:0;min-width:10em}.recordingIcon{font-size:1.3em!important}.recordingIcon-active{color:#c33}.manageButtonText{text-transform:none}.recordSeriesContainer{margin-bottom:.8em}.recordingFields-buttons{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}@media all and (max-width:440px){.manageButtonText{display:none!important}.recordingButton{width:auto;margin-right:1.5em!important}}@media all and (min-width:440px){.manageButtonIcon{font-size:90%!important}}
|
File diff suppressed because one or more lines are too long
|
@ -1,162 +1 @@
|
|||
define(['globalize', 'loading', 'connectionManager'], function (globalize, loading, connectionManager) {
|
||||
'use strict';
|
||||
|
||||
function changeRecordingToSeries(apiClient, timerId, programId) {
|
||||
|
||||
loading.show();
|
||||
|
||||
apiClient.getItem(apiClient.getCurrentUserId(), programId).then(function (item) {
|
||||
|
||||
if (item.IsSeries) {
|
||||
// cancel, then create series
|
||||
cancelTimer(apiClient, timerId, false).then(function () {
|
||||
apiClient.getNewLiveTvTimerDefaults({ programId: programId }).then(function (timerDefaults) {
|
||||
|
||||
apiClient.createLiveTvSeriesTimer(timerDefaults).then(function () {
|
||||
|
||||
loading.hide();
|
||||
sendToast(globalize.translate('sharedcomponents#SeriesRecordingScheduled'));
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// cancel
|
||||
cancelTimer(apiClient, timerId, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cancelTimerWithConfirmation(timerId, serverId) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
|
||||
confirm({
|
||||
|
||||
text: globalize.translate('sharedcomponents#MessageConfirmRecordingCancellation'),
|
||||
primary: 'cancel',
|
||||
confirmText: globalize.translate('sharedcomponents#HeaderCancelRecording'),
|
||||
cancelText: globalize.translate('sharedcomponents#HeaderKeepRecording')
|
||||
|
||||
}).then(function () {
|
||||
|
||||
loading.show();
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
apiClient.cancelLiveTvTimer(timerId).then(function () {
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
toast(globalize.translate('sharedcomponents#RecordingCancelled'));
|
||||
});
|
||||
|
||||
loading.hide();
|
||||
resolve();
|
||||
}, reject);
|
||||
|
||||
}, reject);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function cancelSeriesTimerWithConfirmation(timerId, serverId) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
|
||||
confirm({
|
||||
|
||||
text: globalize.translate('sharedcomponents#MessageConfirmRecordingCancellation'),
|
||||
primary: 'cancel',
|
||||
confirmText: globalize.translate('sharedcomponents#HeaderCancelSeries'),
|
||||
cancelText: globalize.translate('sharedcomponents#HeaderKeepSeries')
|
||||
|
||||
}).then(function () {
|
||||
|
||||
loading.show();
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
apiClient.cancelLiveTvSeriesTimer(timerId).then(function () {
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
toast(globalize.translate('sharedcomponents#SeriesCancelled'));
|
||||
});
|
||||
|
||||
loading.hide();
|
||||
resolve();
|
||||
}, reject);
|
||||
|
||||
}, reject);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function cancelTimer(apiClient, timerId, hideLoading) {
|
||||
loading.show();
|
||||
return apiClient.cancelLiveTvTimer(timerId).then(function () {
|
||||
|
||||
if (hideLoading) {
|
||||
loading.hide();
|
||||
sendToast(globalize.translate('sharedcomponents#RecordingCancelled'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createRecording(apiClient, programId, isSeries) {
|
||||
|
||||
loading.show();
|
||||
return apiClient.getNewLiveTvTimerDefaults({ programId: programId }).then(function (item) {
|
||||
|
||||
var promise = isSeries ?
|
||||
apiClient.createLiveTvSeriesTimer(item) :
|
||||
apiClient.createLiveTvTimer(item);
|
||||
|
||||
return promise.then(function () {
|
||||
|
||||
loading.hide();
|
||||
sendToast(globalize.translate('sharedcomponents#RecordingScheduled'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function sendToast(msg) {
|
||||
require(['toast'], function (toast) {
|
||||
toast(msg);
|
||||
});
|
||||
}
|
||||
|
||||
function toggleRecording(serverId, programId, timerId, timerStatus, seriesTimerId) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
var hasTimer = timerId && timerStatus !== 'Cancelled';
|
||||
|
||||
if (seriesTimerId && hasTimer) {
|
||||
|
||||
// cancel
|
||||
return cancelTimer(apiClient, timerId, true);
|
||||
|
||||
} else if (hasTimer && programId) {
|
||||
|
||||
// change to series recording, if possible
|
||||
// otherwise cancel individual recording
|
||||
return changeRecordingToSeries(apiClient, timerId, programId);
|
||||
|
||||
} else if (programId) {
|
||||
// schedule recording
|
||||
return createRecording(apiClient, programId);
|
||||
} else {
|
||||
return Promise.reject();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
cancelTimer: cancelTimer,
|
||||
createRecording: createRecording,
|
||||
changeRecordingToSeries: changeRecordingToSeries,
|
||||
toggleRecording: toggleRecording,
|
||||
cancelTimerWithConfirmation: cancelTimerWithConfirmation,
|
||||
cancelSeriesTimerWithConfirmation: cancelSeriesTimerWithConfirmation
|
||||
};
|
||||
});
|
||||
define(["globalize","loading","connectionManager"],function(globalize,loading,connectionManager){"use strict";function changeRecordingToSeries(apiClient,timerId,programId){loading.show(),apiClient.getItem(apiClient.getCurrentUserId(),programId).then(function(item){item.IsSeries?cancelTimer(apiClient,timerId,!1).then(function(){apiClient.getNewLiveTvTimerDefaults({programId:programId}).then(function(timerDefaults){apiClient.createLiveTvSeriesTimer(timerDefaults).then(function(){loading.hide(),sendToast(globalize.translate("sharedcomponents#SeriesRecordingScheduled"))})})}):cancelTimer(apiClient,timerId,!0)})}function cancelTimerWithConfirmation(timerId,serverId){return new Promise(function(resolve,reject){require(["confirm"],function(confirm){confirm({text:globalize.translate("sharedcomponents#MessageConfirmRecordingCancellation"),primary:"cancel",confirmText:globalize.translate("sharedcomponents#HeaderCancelRecording"),cancelText:globalize.translate("sharedcomponents#HeaderKeepRecording")}).then(function(){loading.show();var apiClient=connectionManager.getApiClient(serverId);apiClient.cancelLiveTvTimer(timerId).then(function(){require(["toast"],function(toast){toast(globalize.translate("sharedcomponents#RecordingCancelled"))}),loading.hide(),resolve()},reject)},reject)})})}function cancelSeriesTimerWithConfirmation(timerId,serverId){return new Promise(function(resolve,reject){require(["confirm"],function(confirm){confirm({text:globalize.translate("sharedcomponents#MessageConfirmRecordingCancellation"),primary:"cancel",confirmText:globalize.translate("sharedcomponents#HeaderCancelSeries"),cancelText:globalize.translate("sharedcomponents#HeaderKeepSeries")}).then(function(){loading.show();var apiClient=connectionManager.getApiClient(serverId);apiClient.cancelLiveTvSeriesTimer(timerId).then(function(){require(["toast"],function(toast){toast(globalize.translate("sharedcomponents#SeriesCancelled"))}),loading.hide(),resolve()},reject)},reject)})})}function cancelTimer(apiClient,timerId,hideLoading){return loading.show(),apiClient.cancelLiveTvTimer(timerId).then(function(){hideLoading&&(loading.hide(),sendToast(globalize.translate("sharedcomponents#RecordingCancelled")))})}function createRecording(apiClient,programId,isSeries){return loading.show(),apiClient.getNewLiveTvTimerDefaults({programId:programId}).then(function(item){var promise=isSeries?apiClient.createLiveTvSeriesTimer(item):apiClient.createLiveTvTimer(item);return promise.then(function(){loading.hide(),sendToast(globalize.translate("sharedcomponents#RecordingScheduled"))})})}function sendToast(msg){require(["toast"],function(toast){toast(msg)})}function toggleRecording(serverId,programId,timerId,timerStatus,seriesTimerId){var apiClient=connectionManager.getApiClient(serverId),hasTimer=timerId&&"Cancelled"!==timerStatus;return seriesTimerId&&hasTimer?cancelTimer(apiClient,timerId,!0):hasTimer&&programId?changeRecordingToSeries(apiClient,timerId,programId):programId?createRecording(apiClient,programId):Promise.reject()}return{cancelTimer:cancelTimer,createRecording:createRecording,changeRecordingToSeries:changeRecordingToSeries,toggleRecording:toggleRecording,cancelTimerWithConfirmation:cancelTimerWithConfirmation,cancelSeriesTimerWithConfirmation:cancelSeriesTimerWithConfirmation}});
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue