1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update now playing screen

This commit is contained in:
Luke Pulverenti 2017-01-24 00:52:47 -05:00
parent 52e8f36d41
commit 3b258484af
7 changed files with 106 additions and 42 deletions

View file

@ -840,7 +840,12 @@
};
self.audioTracks = function () {
return [];
var state = self.lastPlayerData || {};
state = state.NowPlayingItem || {};
var streams = state.MediaStreams || [];
return streams.filter(function (s) {
return s.Type === 'Audio';
});
};
self.setAudioStreamIndex = function (index) {
@ -859,7 +864,12 @@
};
self.subtitleTracks = function () {
return [];
var state = self.lastPlayerData || {};
state = state.NowPlayingItem || {};
var streams = state.MediaStreams || [];
return streams.filter(function (s) {
return s.Type === 'Subtitle';
});
};
self.getSubtitleStreamIndex = function () {
@ -975,8 +985,7 @@
return Promise.resolve([]);
};
self.getCurrentPlaylistIndex = function () {
return 0;
self.getCurrentPlaylistItemId = function () {
};
self.setCurrentPlaylistItem = function (playlistItemId) {

View file

@ -64,6 +64,7 @@
.listItem-shaded:nth-child(even) {
background: #1c1c1c;
background: rgba(30, 30, 30, .9);
}
.three-line {
@ -112,9 +113,9 @@
color: #fff;
}
.listItemIcon:not(.listItemIcon-transparent) {
background-color: #52B54B;
}
.listItemIcon:not(.listItemIcon-transparent) {
background-color: #52B54B;
}
.listItemProgressBar {
position: absolute;

View file

@ -1118,9 +1118,8 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
var apiClient = connectionManager.getApiClient(item.ServerId);
if (item.LocalTrailerCount) {
apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(function (result) {
self.play({
return apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(function (result) {
return self.play({
items: result
});
});
@ -1128,10 +1127,10 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
var remoteTrailers = item.RemoteTrailers || [];
if (!remoteTrailers.length) {
return;
return Promise.reject();
}
self.play({
return self.play({
items: remoteTrailers.map(function (t) {
return {
Name: t.Name || (item.Name + ' Trailer'),

View file

@ -81,7 +81,6 @@
ids: itemIds.split(',')
});
dialogHelper.close(dlg);
showToast();
return;
}
@ -102,13 +101,6 @@
loading.hide();
dialogHelper.close(dlg);
showToast();
});
}
function showToast() {
require(['toast'], function (toast) {
toast(globalize.translate('sharedcomponents#MessageItemsAdded'));
});
}
@ -116,7 +108,7 @@
select.dispatchEvent(new CustomEvent('change', {}));
}
function populatePlaylists(panel) {
function populatePlaylists(editorOptions, panel) {
var select = panel.querySelector('#selectPlaylistToAddTo');
@ -136,7 +128,7 @@
var html = '';
if (playbackManager.isPlaying()) {
if (editorOptions.enableAddToPlayQueue !== false && playbackManager.isPlaying()) {
html += '<option value="queue">' + globalize.translate('sharedcomponents#AddToPlayQueue') + '</option>';
}
@ -148,7 +140,12 @@
});
select.innerHTML = html;
select.value = userSettings.get('playlisteditor-lastplaylistid') || '';
var defaultValue = editorOptions.defaultValue;
if (!defaultValue) {
defaultValue = userSettings.get('playlisteditor-lastplaylistid') || '';
}
select.value = defaultValue === 'new' ? '' : defaultValue;
// If the value is empty set it again, in case we tried to set a lastplaylistid that is no longer valid
if (!select.value) {
@ -195,7 +192,7 @@
return html;
}
function initEditor(content, items) {
function initEditor(content, options, items) {
content.querySelector('#selectPlaylistToAddTo').addEventListener('change', function () {
if (this.value) {
@ -213,7 +210,7 @@
if (items.length) {
content.querySelector('.fldSelectPlaylist').classList.remove('hide');
populatePlaylists(content);
populatePlaylists(options, content);
} else {
content.querySelector('.fldSelectPlaylist').classList.add('hide');
@ -270,7 +267,7 @@
dlg.innerHTML = html;
initEditor(dlg, items);
initEditor(dlg, options, items);
dlg.querySelector('.btnCancel').addEventListener('click', function () {

View file

@ -207,11 +207,18 @@
};
self.audioTracks = function () {
return [];
var state = self.lastPlayerData || {};
state = state.NowPlayingItem || {};
var streams = state.MediaStreams || [];
return streams.filter(function (s) {
return s.Type === 'Audio';
});
};
self.getAudioStreamIndex = function () {
var state = self.lastPlayerData || {};
state = state.PlayState || {};
return state.AudioStreamIndex;
};
self.setAudioStreamIndex = function (index) {
@ -221,11 +228,18 @@
};
self.subtitleTracks = function () {
return [];
var state = self.lastPlayerData || {};
state = state.NowPlayingItem || {};
var streams = state.MediaStreams || [];
return streams.filter(function (s) {
return s.Type === 'Subtitle';
});
};
self.getSubtitleStreamIndex = function () {
var state = self.lastPlayerData || {};
state = state.PlayState || {};
return state.SubtitleStreamIndex;
};
self.setSubtitleStreamIndex = function (index) {
@ -287,8 +301,7 @@
return Promise.resolve([]);
};
self.getCurrentPlaylistIndex = function () {
return 0;
self.getCurrentPlaylistItemId = function () {
};
self.setCurrentPlaylistItem = function (playlistItemId) {