mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update script loading
This commit is contained in:
parent
463ad6cfb1
commit
bbdbdf346e
92 changed files with 1062 additions and 518 deletions
|
@ -1,6 +1,6 @@
|
|||
(function ($, document) {
|
||||
|
||||
$(document).on('pageshown', "#aboutPage", function () {
|
||||
$(document).on('pageshowready', "#aboutPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#addPluginPage", function () {
|
||||
$(document).on('pageshowready', "#addPluginPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#advancedConfigurationPage", function () {
|
||||
$(document).on('pageshowready', "#advancedConfigurationPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
return html;
|
||||
}
|
||||
|
||||
$(document).on('pageinit', ".libraryPage", function () {
|
||||
$(document).on('pageinitdepends', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', ".page", function () {
|
||||
$(document).on('pagebeforeshowready', ".page", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@
|
|||
$('#selectPageSize', page).val(query.Limit).selectmenu('refresh');
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#channelItemsPage", function () {
|
||||
$(document).on('pageinitdepends', "#channelItemsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -256,10 +256,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#channelItemsPage", function () {
|
||||
|
||||
|
||||
}).on('pageshow', "#channelItemsPage", function () {
|
||||
}).on('pageshowready', "#channelItemsPage", function () {
|
||||
|
||||
var page = this;
|
||||
var limit = LibraryBrowser.getDefaultPageSize();
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#channelsPage", function () {
|
||||
$(document).on('pageshowready', "#channelsPage", function () {
|
||||
|
||||
LibraryBrowser.loadSavedQueryValues('channels', query);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
Sections.loadLatestChannelItems($(".items", page), Dashboard.getCurrentUserId());
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#channelsLatestPage", function () {
|
||||
$(document).on('pageshowready', "#channelsLatestPage", function () {
|
||||
|
||||
reloadItems(this);
|
||||
|
||||
|
|
|
@ -123,7 +123,23 @@
|
|||
Dashboard.navigate('selectserver.html');
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#connectLoginPage", function () {
|
||||
function onSubmit() {
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
submit(page);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function onManualServerSubmit() {
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
submitManualServer(page);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageinitdepends', "#connectLoginPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -131,7 +147,10 @@
|
|||
skip();
|
||||
});
|
||||
|
||||
}).on('pageshow', "#connectLoginPage", function () {
|
||||
$('.connectLoginForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
$('.manualServerForm').off('submit', onManualServerSubmit).on('submit', onManualServerSubmit);
|
||||
|
||||
}).on('pageshowready', "#connectLoginPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -179,25 +198,4 @@
|
|||
login(page, user, password);
|
||||
}
|
||||
|
||||
window.ConnectLoginPage = {
|
||||
|
||||
onSubmit: function () {
|
||||
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
submit(page);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
onManualServerSubmit: function () {
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
submitManualServer(page);
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
|
@ -40,7 +40,7 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#dashboardHostingPage", function () {
|
||||
$(document).on('pageshowready', "#dashboardHostingPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
|
|
|
@ -6,6 +6,12 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
var apiClient = ApiClient;
|
||||
|
||||
if (!apiClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Dashboard.lastSystemInfo) {
|
||||
Dashboard.setPageTitle(Dashboard.lastSystemInfo.ServerName);
|
||||
}
|
||||
|
@ -14,9 +20,9 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
DashboardPage.pollForInfo(page);
|
||||
DashboardPage.startInterval();
|
||||
DashboardPage.startInterval(apiClient);
|
||||
|
||||
$(ApiClient).on("websocketmessage", DashboardPage.onWebSocketMessage)
|
||||
$(apiClient).on("websocketmessage", DashboardPage.onWebSocketMessage)
|
||||
.on("websocketopen", DashboardPage.onWebSocketOpen);
|
||||
|
||||
DashboardPage.lastAppUpdateCheck = null;
|
||||
|
@ -33,7 +39,7 @@
|
|||
|
||||
$('.activityItems', page).activityLogList();
|
||||
|
||||
$('.swaggerLink', page).attr('href', ApiClient.getUrl('swagger-ui/index.html'));
|
||||
$('.swaggerLink', page).attr('href', apiClient.getUrl('swagger-ui/index.html'));
|
||||
},
|
||||
|
||||
onPageHide: function () {
|
||||
|
@ -42,8 +48,10 @@
|
|||
|
||||
$('.activityItems', page).activityLogList('destroy');
|
||||
|
||||
$(ApiClient).off("websocketmessage", DashboardPage.onWebSocketMessage).off("websocketopen", DashboardPage.onWebSocketConnectionChange).off("websocketerror", DashboardPage.onWebSocketConnectionChange).off("websocketclose", DashboardPage.onWebSocketConnectionChange);
|
||||
DashboardPage.stopInterval();
|
||||
var apiClient = ApiClient;
|
||||
|
||||
$(apiClient).off("websocketmessage", DashboardPage.onWebSocketMessage).off("websocketopen", DashboardPage.onWebSocketConnectionChange).off("websocketerror", DashboardPage.onWebSocketConnectionChange).off("websocketclose", DashboardPage.onWebSocketConnectionChange);
|
||||
DashboardPage.stopInterval(apiClient);
|
||||
|
||||
if (DashboardPage.sessionUpdateTimer) {
|
||||
clearInterval(DashboardPage.sessionUpdateTimer);
|
||||
|
@ -152,19 +160,19 @@
|
|||
|
||||
},
|
||||
|
||||
startInterval: function () {
|
||||
startInterval: function (apiClient) {
|
||||
|
||||
if (ApiClient.isWebSocketOpen()) {
|
||||
ApiClient.sendWebSocketMessage("SessionsStart", "0,1500");
|
||||
ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "0,1000");
|
||||
if (apiClient.isWebSocketOpen()) {
|
||||
apiClient.sendWebSocketMessage("SessionsStart", "0,1500");
|
||||
apiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "0,1000");
|
||||
}
|
||||
},
|
||||
|
||||
stopInterval: function () {
|
||||
stopInterval: function (apiClient) {
|
||||
|
||||
if (ApiClient.isWebSocketOpen()) {
|
||||
ApiClient.sendWebSocketMessage("SessionsStop");
|
||||
ApiClient.sendWebSocketMessage("ScheduledTasksInfoStop");
|
||||
if (apiClient.isWebSocketOpen()) {
|
||||
apiClient.sendWebSocketMessage("SessionsStop");
|
||||
apiClient.sendWebSocketMessage("ScheduledTasksInfoStop");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -199,16 +207,24 @@
|
|||
|
||||
onWebSocketOpen: function () {
|
||||
|
||||
DashboardPage.startInterval();
|
||||
var apiClient = this;
|
||||
|
||||
DashboardPage.startInterval(apiClient);
|
||||
},
|
||||
|
||||
pollForInfo: function (page, forceUpdate) {
|
||||
|
||||
ApiClient.getSessions().done(function (sessions) {
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (!apiClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiClient.getSessions().done(function (sessions) {
|
||||
|
||||
DashboardPage.renderInfo(page, sessions, forceUpdate);
|
||||
});
|
||||
ApiClient.getScheduledTasks().done(function (tasks) {
|
||||
apiClient.getScheduledTasks().done(function (tasks) {
|
||||
|
||||
DashboardPage.renderRunningTasks(page, tasks);
|
||||
});
|
||||
|
@ -991,7 +1007,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
$(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
||||
$(document).on('pagebeforeshowready', "#dashboardPage", DashboardPage.onPageShow)
|
||||
.on('pagehide', "#dashboardPage", DashboardPage.onPageHide);
|
||||
|
||||
(function ($, document, window) {
|
||||
|
@ -1204,7 +1220,13 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
|||
reloadData(this);
|
||||
});
|
||||
|
||||
$(ApiClient).on('websocketmessage.activityloglistener', function (e, data) {
|
||||
var apiClient = ApiClient;
|
||||
|
||||
if (!apiClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(apiClient).on('websocketmessage.activityloglistener', function (e, data) {
|
||||
|
||||
var msg = data;
|
||||
|
||||
|
@ -1217,31 +1239,35 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
|||
|
||||
}).on('websocketopen.activityloglistener', function (e, data) {
|
||||
|
||||
startListening();
|
||||
startListening(apiClient);
|
||||
});
|
||||
}
|
||||
|
||||
function startListening() {
|
||||
function startListening(apiClient) {
|
||||
|
||||
if (ApiClient.isWebSocketOpen()) {
|
||||
ApiClient.sendWebSocketMessage("ActivityLogEntryStart", "0,1500");
|
||||
if (apiClient.isWebSocketOpen()) {
|
||||
apiClient.sendWebSocketMessage("ActivityLogEntryStart", "0,1500");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function stopListening() {
|
||||
function stopListening(apiClient) {
|
||||
|
||||
if (ApiClient.isWebSocketOpen()) {
|
||||
ApiClient.sendWebSocketMessage("ActivityLogEntryStop", "0,1500");
|
||||
if (apiClient.isWebSocketOpen()) {
|
||||
apiClient.sendWebSocketMessage("ActivityLogEntryStop", "0,1500");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function destroyList(elem) {
|
||||
|
||||
$(ApiClient).off('websocketopen.activityloglistener').off('websocketmessage.activityloglistener');
|
||||
var apiClient = ApiClient;
|
||||
|
||||
stopListening();
|
||||
if (apiClient) {
|
||||
$(apiClient).off('websocketopen.activityloglistener').off('websocketmessage.activityloglistener');
|
||||
|
||||
stopListening(apiClient);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -1254,7 +1280,7 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
|||
createList(this);
|
||||
}
|
||||
|
||||
startListening();
|
||||
startListening(ApiClient);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
@ -1277,11 +1303,11 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
|||
});
|
||||
}
|
||||
|
||||
function showWelcomeIfNeeded(page) {
|
||||
function showWelcomeIfNeeded(page, apiClient) {
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getDisplayPreferences('dashboard', userId, 'dashboard').done(function (result) {
|
||||
apiClient.getDisplayPreferences('dashboard', userId, 'dashboard').done(function (result) {
|
||||
|
||||
if (result.CustomPrefs[welcomeTourKey] == welcomeDismissValue) {
|
||||
$('.welcomeMessage', page).hide();
|
||||
|
@ -1330,21 +1356,23 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#dashboardPage", function () {
|
||||
$(document).on('pageinitdepends', "#dashboardPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
$('.btnTakeTour', page).on('click', function () {
|
||||
takeTour(page, userId);
|
||||
takeTour(page, Dashboard.getCurrentUserId());
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow.checktour', "#dashboardPage", function () {
|
||||
}).on('pagebeforeshowready.checktour', "#dashboardPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
showWelcomeIfNeeded(page);
|
||||
var apiClient = ApiClient;
|
||||
|
||||
if (apiClient) {
|
||||
showWelcomeIfNeeded(page, apiClient);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
@ -1352,7 +1380,7 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
|||
|
||||
(function () {
|
||||
|
||||
$(document).on('pagebeforeshow', ".type-interior", function () {
|
||||
$(document).on('pagebeforeshowready', ".type-interior", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
|
||||
$('.deviceForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#devicePage", function () {
|
||||
}).on('pageshowready', "#devicePage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#devicesPage", function () {
|
||||
$(document).on('pageshowready', "#devicesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -569,7 +569,7 @@
|
|||
$('.uploadItemImageForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
|
||||
}).on('pageshown', "#editItemImagesPage", function () {
|
||||
}).on('pageshowready', "#editItemImagesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#episodesPage", function () {
|
||||
}).on('pageshowready', "#episodesPage", function () {
|
||||
|
||||
var page = this;
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#favoritesPage", function () {
|
||||
$(document).on('pageshowready', "#favoritesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#gameGenresPage", function () {
|
||||
}).on('pageshowready', "#gameGenresPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#gamesPage", function () {
|
||||
}).on('pageshowready', "#gamesPage", function () {
|
||||
|
||||
var page = this;
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(function ($, document) {
|
||||
|
||||
$(document).on('pageshown', "#gamesRecommendedPage", function () {
|
||||
$(document).on('pageshowready', "#gamesRecommendedPage", function () {
|
||||
|
||||
var parentId = LibraryMenu.getTopParentId();
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#gameStudiosPage", function () {
|
||||
}).on('pageshowready', "#gameStudiosPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
// Reset form values using the last used query
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#gamesystemsPage", function () {
|
||||
$(document).on('pageshowready', "#gamesystemsPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
Sections.loadLatestChannelItems($(".section2", page), userId);
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#homeLatestPage", function () {
|
||||
$(document).on('pageshowready', "#homeLatestPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -607,57 +607,38 @@
|
|||
afterClose: function () {
|
||||
dismissWelcome(page, userId);
|
||||
$('.welcomeMessage', page).hide();
|
||||
|
||||
loadConfigureViewsWelcomeMessage(page, userId);
|
||||
},
|
||||
hideBarsDelay: 30000
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadConfigureViewsWelcomeMessage(page, userId) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
if (user.Policy.EnableUserPreferenceAccess) {
|
||||
$('.btnMyPreferences', page).attr('href', 'mypreferencesdisplay.html?userId=' + userId);
|
||||
|
||||
// Need the timeout because previous methods in the chain have popups that will be in the act of closing
|
||||
setTimeout(function () {
|
||||
|
||||
$('.popupConfigureViews', page).popup('open');
|
||||
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#indexPage", function () {
|
||||
$(document).on('pageinitdepends', "#indexPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
$('.btnTakeTour', page).on('click', function () {
|
||||
takeTour(page, userId);
|
||||
takeTour(page, Dashboard.getCurrentUserId());
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#indexPage", function () {
|
||||
}).on('pagebeforeshowready', "#indexPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
if (window.ApiClient) {
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
getDisplayPreferences('home', userId).done(function (result) {
|
||||
getDisplayPreferences('home', userId).done(function (result) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
loadSections(page, user, result).done(function () {
|
||||
showWelcomeIfNeeded(page, result);
|
||||
});
|
||||
|
||||
loadSections(page, user, result).done(function () {
|
||||
showWelcomeIfNeeded(page, result);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@
|
|||
|
||||
$(page).on('click', '.mediaItem', onListItemClick);
|
||||
|
||||
}).on('pageshown', "#itemListPage", function () {
|
||||
}).on('pageshowready', "#itemListPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -1082,7 +1082,7 @@
|
|||
$('cardImage', page).remove();
|
||||
}
|
||||
|
||||
$(document).on('pageinit', ".libraryPage", function () {
|
||||
$(document).on('pageinitdepends', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -1127,7 +1127,7 @@
|
|||
|
||||
$('.itemsContainer', page).createCardMenus();
|
||||
|
||||
}).on('pagebeforeshow', ".libraryPage", function () {
|
||||
}).on('pagebeforeshowready', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -1212,9 +1212,15 @@
|
|||
$(apiClient).off('websocketmessage.librarylist', onWebSocketMessage).on('websocketmessage.librarylist', onWebSocketMessage);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
Dashboard.ready(function () {
|
||||
|
||||
initializeApiClient(apiClient);
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery, document, window);
|
|
@ -502,7 +502,7 @@
|
|||
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', ".page:not(.standalonePage)", function () {
|
||||
}).on('pagebeforeshowready', ".page:not(.standalonePage)", function () {
|
||||
|
||||
var page = this;
|
||||
var viewMenuBar = $('.viewMenuBar');
|
||||
|
@ -535,7 +535,7 @@
|
|||
$(document.body).removeClass('dashboardDocument').removeClass('libraryDocument');
|
||||
}
|
||||
|
||||
}).on('pagebeforeshow', ".libraryPage", function () {
|
||||
}).on('pagebeforeshowready', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -587,22 +587,23 @@
|
|||
|
||||
function initializeApiClient(apiClient) {
|
||||
|
||||
requiresLibraryMenuRefresh = true;
|
||||
$(apiClient).off('websocketmessage.librarymenu', onWebSocketMessage).on('websocketmessage.librarymenu', onWebSocketMessage);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
Dashboard.ready(function () {
|
||||
|
||||
requiresLibraryMenuRefresh = true;
|
||||
initializeApiClient(apiClient);
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
}).on('localusersignedin', function () {
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
|
||||
requiresLibraryMenuRefresh = true;
|
||||
|
||||
}).on('localusersignedout', function () {
|
||||
|
||||
$('.viewMenuBar').remove();
|
||||
requiresLibraryMenuRefresh = true;
|
||||
}).on('localusersignedin localusersignedout', function () {
|
||||
$('.viewMenuBar').remove();
|
||||
requiresLibraryMenuRefresh = true;
|
||||
});
|
||||
});
|
||||
|
||||
$(function () {
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#liveTvChannelsPage", function () {
|
||||
}).on('pageshowready', "#liveTvChannelsPage", function () {
|
||||
|
||||
// Can't use pagebeforeshow here or the loading popup won't center correctly
|
||||
var page = this;
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#liveTvItemsPage", function () {
|
||||
}).on('pageshowready', "#liveTvItemsPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#liveTvRecordingsPage", function () {
|
||||
$(document).on('pageshowready', "#liveTvRecordingsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
}).checkboxradio('refresh');
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#liveTvSeriesTimersPage", function () {
|
||||
$(document).on('pageshowready', "#liveTvSeriesTimersPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#liveTvSuggestedPage", function () {
|
||||
$(document).on('pageshowready', "#liveTvSuggestedPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#liveTvTimersPage", function () {
|
||||
$(document).on('pageshowready', "#liveTvTimersPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
showManualForm: function (page, showCancel, focusPassword) {
|
||||
$('.visualLoginForm', page).hide();
|
||||
$('#manualLoginForm', page).show();
|
||||
$('.manualLoginForm', page).show();
|
||||
|
||||
if (focusPassword) {
|
||||
$('#txtManualPassword', page).focus();
|
||||
|
@ -80,7 +80,7 @@
|
|||
|
||||
showVisualForm: function (page) {
|
||||
$('.visualLoginForm', page).show();
|
||||
$('#manualLoginForm', page).hide();
|
||||
$('.manualLoginForm', page).hide();
|
||||
},
|
||||
|
||||
getLastSeenText: function (lastActivityDate) {
|
||||
|
@ -215,4 +215,10 @@
|
|||
}
|
||||
};
|
||||
|
||||
$(document).on('pageshow', "#loginPage", LoginPage.onPageShow);
|
||||
$(document).on('pageinitdepends', "#loginPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.manualLoginForm', page).off('submit', LoginPage.onManualSubmit).on('submit', LoginPage.onManualSubmit);
|
||||
|
||||
}).on('pageshowready', "#loginPage", LoginPage.onPageShow);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(function () {
|
||||
|
||||
$(document).on('pageshown', "#logPage", function () {
|
||||
$(document).on('pageshowready', "#logPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -169,6 +169,13 @@
|
|||
|
||||
};
|
||||
|
||||
self.removeActiveTarget = function (id) {
|
||||
|
||||
if (self.getPlayerInfo().id == id) {
|
||||
self.setDefaultPlayerActive();
|
||||
}
|
||||
};
|
||||
|
||||
self.getPlayers = function() {
|
||||
return players;
|
||||
};
|
||||
|
@ -450,6 +457,20 @@
|
|||
|
||||
return bottomText ? topText + '<br/>' + bottomText : topText;
|
||||
};
|
||||
|
||||
self.showPlaybackInfoErrorMessage = function(errorCode) {
|
||||
|
||||
// This timeout is messy, but if jqm is in the act of hiding a popup, it will not show a new one
|
||||
// If we're coming from the popup play menu, this will be a problem
|
||||
|
||||
setTimeout(function() {
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('MessagePlaybackError' + errorCode),
|
||||
title: Globalize.translate('HeaderPlaybackError')
|
||||
});
|
||||
}, 300);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
window.MediaController = new mediaController();
|
||||
|
@ -512,15 +533,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function initializeApiClient(apiClient) {
|
||||
$(apiClient).on("websocketmessage", onWebSocketMessageReceived);
|
||||
$(apiClient).off("websocketmessage", onWebSocketMessageReceived).on("websocketmessage", onWebSocketMessageReceived);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
Dashboard.ready(function () {
|
||||
|
||||
initializeApiClient(apiClient);
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
});
|
||||
|
||||
function getTargetsHtml(targets) {
|
||||
|
@ -705,9 +730,8 @@
|
|||
|
||||
showPlayerSelection($.mobile.activePage);
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('pagebeforeshow', ".page", function () {
|
||||
}).on('pagebeforeshow', ".page", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -215,20 +215,16 @@
|
|||
profile.ContainerProfiles = [];
|
||||
|
||||
var audioConditions = [];
|
||||
var videoAudioMp3Conditions = [];
|
||||
|
||||
var maxAudioChannels = $.browser.msie || $.browser.safari ?
|
||||
'2' :
|
||||
'6';
|
||||
|
||||
var channelCondition = {
|
||||
audioConditions.push({
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'AudioChannels',
|
||||
Value: maxAudioChannels
|
||||
};
|
||||
|
||||
audioConditions.push(channelCondition);
|
||||
videoAudioMp3Conditions.push(channelCondition);
|
||||
});
|
||||
|
||||
profile.CodecProfiles = [];
|
||||
profile.CodecProfiles.push({
|
||||
|
@ -236,20 +232,21 @@
|
|||
Conditions: audioConditions
|
||||
});
|
||||
|
||||
if (videoAudioMp3Conditions.length) {
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'VideoAudio',
|
||||
Codec: 'mp3',
|
||||
Conditions: videoAudioMp3Conditions
|
||||
});
|
||||
}
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'VideoAudio',
|
||||
Codec: 'mp3',
|
||||
Conditions: [{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'AudioChannels',
|
||||
Value: maxAudioChannels
|
||||
}]
|
||||
});
|
||||
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'VideoAudio',
|
||||
Codec: 'aac',
|
||||
Container: 'mkv,mov',
|
||||
Conditions: [
|
||||
channelCondition,
|
||||
{
|
||||
Condition: 'NotEquals',
|
||||
Property: 'AudioProfile',
|
||||
|
@ -266,9 +263,12 @@
|
|||
profile.CodecProfiles.push({
|
||||
Type: 'VideoAudio',
|
||||
Codec: 'aac',
|
||||
Container: 'mp4,m4v',
|
||||
Conditions: [
|
||||
channelCondition
|
||||
{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'AudioChannels',
|
||||
Value: maxAudioChannels
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
@ -868,7 +868,7 @@
|
|||
}
|
||||
|
||||
if (item.IsPlaceHolder) {
|
||||
showPlaybackInfoErrorMessage('PlaceHolder');
|
||||
MediaController.showPlaybackInfoErrorMessage('PlaceHolder');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -901,7 +901,7 @@
|
|||
}
|
||||
} else {
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
showPlaybackInfoErrorMessage('NoCompatibleStream');
|
||||
MediaController.showPlaybackInfoErrorMessage('NoCompatibleStream');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -934,27 +934,13 @@
|
|||
|
||||
if (result.ErrorCode) {
|
||||
|
||||
showPlaybackInfoErrorMessage(result.ErrorCode);
|
||||
MediaController.showPlaybackInfoErrorMessage(result.ErrorCode);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function showPlaybackInfoErrorMessage(errorCode) {
|
||||
|
||||
// This timeout is messy, but if jqm is in the act of hiding a popup, it will not show a new one
|
||||
// If we're coming from the popup play menu, this will be a problem
|
||||
|
||||
setTimeout(function () {
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('MessagePlaybackError' + errorCode),
|
||||
title: Globalize.translate('HeaderPlaybackError')
|
||||
});
|
||||
}, 300);
|
||||
|
||||
}
|
||||
|
||||
self.getPosterUrl = function (item) {
|
||||
|
||||
var screenWidth = Math.max(screen.height, screen.width);
|
||||
|
@ -1748,8 +1734,10 @@
|
|||
|
||||
window.MediaPlayer = new mediaPlayer();
|
||||
|
||||
window.MediaController.registerPlayer(window.MediaPlayer);
|
||||
window.MediaController.setActivePlayer(window.MediaPlayer, window.MediaPlayer.getTargets()[0]);
|
||||
Dashboard.ready(function() {
|
||||
window.MediaController.registerPlayer(window.MediaPlayer);
|
||||
window.MediaController.setActivePlayer(window.MediaPlayer, window.MediaPlayer.getTargets()[0]);
|
||||
});
|
||||
|
||||
|
||||
})(document, setTimeout, clearTimeout, screen, window.store, $, setInterval, window);
|
|
@ -150,7 +150,23 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#advancedMetadataConfigurationPage", function () {
|
||||
function onSubmit() {
|
||||
var form = this;
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
saveAdvancedConfig(form);
|
||||
saveChapters(form);
|
||||
saveMetadata(form);
|
||||
saveTmdb(form);
|
||||
saveTvdb(form);
|
||||
saveFanart(form);
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageinitdepends', "#advancedMetadataConfigurationPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -174,7 +190,10 @@
|
|||
});
|
||||
});
|
||||
|
||||
}).on('pageshow', "#advancedMetadataConfigurationPage", function () {
|
||||
$('.advancedMetadataConfigurationForm').on('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
|
||||
}).on('pageshowready', "#advancedMetadataConfigurationPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -270,7 +289,7 @@
|
|||
}
|
||||
|
||||
function saveMetadata(form) {
|
||||
|
||||
|
||||
ApiClient.getNamedConfiguration("metadata").done(function (config) {
|
||||
|
||||
config.UseFileCreationTimeForDateAdded = $('#selectDateAdded', form).val() == '1';
|
||||
|
@ -307,24 +326,5 @@
|
|||
});
|
||||
}
|
||||
|
||||
window.AdvancedMetadataConfigurationPage = {
|
||||
|
||||
onSubmit: function () {
|
||||
var form = this;
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
saveAdvancedConfig(form);
|
||||
saveChapters(form);
|
||||
saveMetadata(form);
|
||||
saveTmdb(form);
|
||||
saveTvdb(form);
|
||||
saveFanart(form);
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
})(window, jQuery);
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@
|
|||
$('#selectPageSize', page).val(query.Limit).selectmenu('refresh');
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#boxsetsPage", function () {
|
||||
$(document).on('pageinitdepends', "#boxsetsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -257,7 +257,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#boxsetsPage", function () {
|
||||
}).on('pagebeforeshowready', "#boxsetsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -296,7 +296,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
}).on('pageshow', "#boxsetsPage", function () {
|
||||
}).on('pageshowready', "#boxsetsPage", function () {
|
||||
|
||||
updateFilterControls(this);
|
||||
|
||||
|
@ -417,7 +417,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', ".collectionEditorPage", function () {
|
||||
$(document).on('pageinitdepends', ".collectionEditorPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@
|
|||
LibraryBrowser.saveViewSetting(getSavedQueryKey(), view);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#movieGenresPage", function () {
|
||||
}).on('pageshowready', "#movieGenresPage", function () {
|
||||
|
||||
var page = this;
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#moviePeoplePage", function () {
|
||||
}).on('pageshowready', "#moviePeoplePage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#moviesPage", function () {
|
||||
}).on('pageshowready', "#moviesPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@
|
|||
|
||||
$('.recommendations', page).createCardMenus();
|
||||
|
||||
}).on('pageshown', "#moviesRecommendedPage", function () {
|
||||
}).on('pageshowready', "#moviesRecommendedPage", function () {
|
||||
|
||||
var parentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#movieStudiosPage", function () {
|
||||
}).on('pageshowready', "#movieStudiosPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
|
||||
$('.popupTrailerReelForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#movieTrailersPage", function () {
|
||||
}).on('pageshowready', "#movieTrailersPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#musicAlbumArtistsPage", function () {
|
||||
}).on('pageshowready', "#musicAlbumArtistsPage", function () {
|
||||
|
||||
var page = this;
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
|
|
@ -242,7 +242,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#musicAlbumsPage", function () {
|
||||
}).on('pageshowready', "#musicAlbumsPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#musicArtistsPage", function () {
|
||||
}).on('pageshowready', "#musicArtistsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#musicGenresPage", function () {
|
||||
}).on('pageshowready', "#musicGenresPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#musicRecommendedPage", function () {
|
||||
$(document).on('pageshowready', "#musicRecommendedPage", function () {
|
||||
|
||||
var parentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#musicVideosPage", function () {
|
||||
}).on('pageshowready', "#musicVideosPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -226,23 +226,28 @@
|
|||
}
|
||||
});
|
||||
|
||||
function initializeApiClient(apiClient) {
|
||||
$(apiClient).on("websocketmessage", function (e, msg) {
|
||||
function onWebSocketMessage(e, msg) {
|
||||
if (msg.MessageType === "NotificationUpdated" || msg.MessageType === "NotificationAdded" || msg.MessageType === "NotificationsMarkedRead") {
|
||||
|
||||
Notifications.getNotificationsSummaryPromise = null;
|
||||
|
||||
if (msg.MessageType === "NotificationUpdated" || msg.MessageType === "NotificationAdded" || msg.MessageType === "NotificationsMarkedRead") {
|
||||
|
||||
Notifications.getNotificationsSummaryPromise = null;
|
||||
|
||||
Notifications.updateNotificationCount();
|
||||
}
|
||||
|
||||
});
|
||||
Notifications.updateNotificationCount();
|
||||
}
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
function initializeApiClient(apiClient) {
|
||||
$(apiClient).off("websocketmessage", onWebSocketMessage).on("websocketmessage", onWebSocketMessage);
|
||||
}
|
||||
|
||||
initializeApiClient(apiClient);
|
||||
Dashboard.ready(function () {
|
||||
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery, document, Dashboard, LibraryBrowser);
|
|
@ -442,7 +442,7 @@
|
|||
.on('positionchange.nowplayingbar', onStateChanged);
|
||||
}
|
||||
|
||||
$(function () {
|
||||
Dashboard.ready(function () {
|
||||
|
||||
$(MediaController).on('playerchange', function () {
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#photosPage", function () {
|
||||
}).on('pageshowready', "#photosPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -355,9 +355,15 @@
|
|||
$(apiClient).on("websocketmessage", onWebSocketMessageReceived).on("websocketopen", onWebSocketConnectionChange);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
Dashboard.ready(function () {
|
||||
|
||||
initializeApiClient(apiClient);
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
});
|
||||
|
||||
})(window, document, jQuery);
|
|
@ -478,7 +478,7 @@
|
|||
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#libraryReportManagerPage", function () {
|
||||
$(document).on('pageinitdepends', "#libraryReportManagerPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -781,7 +781,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
})
|
||||
.on('pagebeforeshow', "#libraryReportManagerPage", function () {
|
||||
.on('pageshowready', "#libraryReportManagerPage", function () {
|
||||
|
||||
query.UserId = Dashboard.getCurrentUserId();
|
||||
var page = this;
|
||||
|
@ -791,11 +791,6 @@
|
|||
QueryReportColumns.onPageShow(page, query);
|
||||
$('#selectView', page).val(query.IncludeItemTypes).selectmenu('refresh').trigger('change');
|
||||
|
||||
})
|
||||
.on('pageshow', "#libraryReportManagerPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
updateFilterControls(page);
|
||||
|
||||
filtersLoaded = false;
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
html += '<div class="cardPadder"></div>';
|
||||
|
||||
var href = "#";
|
||||
var href = server.href || "#";
|
||||
html += '<a class="cardContent lnkServer" data-serverid="' + server.Id + '" href="' + href + '">';
|
||||
|
||||
var imgUrl = server.Id == 'connect' ? 'css/images/logo536.png' : '';
|
||||
|
@ -84,20 +84,22 @@
|
|||
// cardScalable
|
||||
html += "</div>";
|
||||
|
||||
html += '<div class="cardFooter">';
|
||||
html += '<div class="cardFooter outerCardFooter">';
|
||||
|
||||
if (server.showOptions !== false) {
|
||||
html += '<div class="cardText" style="text-align:right; float:right;">';
|
||||
|
||||
html += '<button class="btnServerMenu" type="button" data-inline="true" data-iconpos="notext" data-icon="ellipsis-v" style="margin: 2px 0 0;"></button>';
|
||||
|
||||
html += '<button class="listviewMenuButton imageButton btnCardOptions btnServerMenu" type="button" data-role="none" style="margin: 4px 0 0;"><i class="fa fa-ellipsis-v"></i></button>';
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
html += '<div class="cardText" style="margin-right: 30px; padding: 11px 0 10px;">';
|
||||
html += '<div class="cardText">';
|
||||
html += server.Name;
|
||||
html += "</div>";
|
||||
|
||||
html += '<div class="cardText">';
|
||||
html += ' ';
|
||||
html += "</div>";
|
||||
|
||||
// cardFooter
|
||||
html += "</div>";
|
||||
|
||||
|
@ -128,21 +130,15 @@
|
|||
|
||||
var id = this.getAttribute('data-serverid');
|
||||
|
||||
if (id == 'new') {
|
||||
Dashboard.navigate('connectlogin.html?mode=manualserver');
|
||||
return;
|
||||
if (id != 'new' && id != 'connect') {
|
||||
|
||||
var server = servers.filter(function (s) {
|
||||
return s.Id == id;
|
||||
})[0];
|
||||
|
||||
connectToServer(page, server);
|
||||
}
|
||||
|
||||
if (id == 'connect') {
|
||||
Dashboard.navigate('connectlogin.html?mode=connect');
|
||||
return;
|
||||
}
|
||||
|
||||
var server = servers.filter(function (s) {
|
||||
return s.Id == id;
|
||||
})[0];
|
||||
|
||||
connectToServer(page, server);
|
||||
});
|
||||
|
||||
$('.btnServerMenu', elem).on('click', function () {
|
||||
|
@ -312,17 +308,20 @@
|
|||
// cardScalable
|
||||
html += "</div>";
|
||||
|
||||
html += '<div class="cardFooter">';
|
||||
html += '<div class="cardFooter outerCardFooter">';
|
||||
|
||||
html += '<div class="cardText" style="text-align:right; float:right;">';
|
||||
|
||||
html += '<button class="btnInviteMenu" type="button" data-inline="true" data-iconpos="notext" data-icon="ellipsis-v" style="margin: 2px 0 0;"></button>';
|
||||
html += '<button class="listviewMenuButton imageButton btnCardOptions btnInviteMenu" type="button" data-role="none" style="margin: 4px 0 0;"><i class="fa fa-ellipsis-v"></i></button>';
|
||||
html += "</div>";
|
||||
|
||||
html += '<div class="cardText" style="margin-right: 30px; padding: 11px 0 10px;">';
|
||||
html += '<div class="cardText">';
|
||||
html += invite.Name;
|
||||
html += "</div>";
|
||||
|
||||
html += '<div class="cardText">';
|
||||
html += ' ';
|
||||
html += "</div>";
|
||||
|
||||
// cardFooter
|
||||
html += "</div>";
|
||||
|
||||
|
@ -383,15 +382,8 @@
|
|||
servers.push({
|
||||
Name: Globalize.translate('ButtonNewServer'),
|
||||
Id: 'new',
|
||||
showOptions: false
|
||||
});
|
||||
}
|
||||
|
||||
if (!ConnectionManager.isLoggedIntoConnect()) {
|
||||
servers.push({
|
||||
Name: Globalize.translate('ButtonSignInWithConnect'),
|
||||
Id: 'connect',
|
||||
showOptions: false
|
||||
showOptions: false,
|
||||
href: 'connectlogin.html?mode=manualserver'
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -401,10 +393,16 @@
|
|||
});
|
||||
|
||||
loadInvitations(page);
|
||||
|
||||
if (ConnectionManager.isLoggedIntoConnect()) {
|
||||
$('.connectLogin', page).hide();
|
||||
} else {
|
||||
$('.connectLogin', page).show();
|
||||
}
|
||||
}
|
||||
|
||||
function updatePageStyle(page) {
|
||||
|
||||
|
||||
if (ConnectionManager.isLoggedIntoConnect()) {
|
||||
$(page).addClass('libraryPage').addClass('noSecondaryNavPage').removeClass('standalonePage');
|
||||
} else {
|
||||
|
@ -412,12 +410,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(document).on('pagebeforecreate pageinit pagebeforeshow', "#selectServerPage", function () {
|
||||
$(document).on('pageinitdepends pagebeforeshowready', "#selectServerPage", function () {
|
||||
|
||||
var page = this;
|
||||
updatePageStyle(page);
|
||||
|
||||
}).on('pagebeforeshow', "#selectServerPage", function () {
|
||||
}).on('pageshowready', "#selectServerPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -425,21 +423,4 @@
|
|||
|
||||
});
|
||||
|
||||
window.SelectServerPage = {
|
||||
|
||||
onServerAddressEntrySubmit: function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var form = this;
|
||||
var page = $(form).parents('.page');
|
||||
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
})();
|
|
@ -133,7 +133,7 @@
|
|||
|
||||
$('.newKeyForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#serverSecurityPage", function () {
|
||||
}).on('pageshowready', "#serverSecurityPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -106,7 +106,9 @@ var Dashboard = {
|
|||
|
||||
onApiClientServerAddressChanged: function () {
|
||||
|
||||
Dashboard.serverAddress(ApiClient.serverAddress());
|
||||
var apiClient = this;
|
||||
|
||||
Dashboard.serverAddress(apiClient.serverAddress());
|
||||
},
|
||||
|
||||
getCurrentUser: function () {
|
||||
|
@ -200,7 +202,7 @@ var Dashboard = {
|
|||
Dashboard.getUserPromise = null;
|
||||
},
|
||||
|
||||
logout: function (logoutWithServer) {
|
||||
logout: function (logoutWithServer, forceReload) {
|
||||
|
||||
store.removeItem("userId");
|
||||
store.removeItem("token");
|
||||
|
@ -208,16 +210,20 @@ var Dashboard = {
|
|||
|
||||
function onLogoutDone() {
|
||||
|
||||
var loginPage = 'login.html';
|
||||
var loginPage;
|
||||
|
||||
if (Dashboard.isConnectMode()) {
|
||||
loginPage = 'connectlogin.html';
|
||||
window.ApiClient = null;
|
||||
} else {
|
||||
|
||||
loginPage = 'login.html';
|
||||
}
|
||||
|
||||
Dashboard.navigate(loginPage);
|
||||
if (forceReload) {
|
||||
window.location.href = loginPage;
|
||||
} else {
|
||||
Dashboard.navigate(loginPage);
|
||||
}
|
||||
}
|
||||
|
||||
if (logoutWithServer === false) {
|
||||
|
@ -697,14 +703,23 @@ var Dashboard = {
|
|||
|
||||
getPluginSecurityInfo: function () {
|
||||
|
||||
var apiClient = ApiClient;
|
||||
|
||||
if (!apiClient) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
deferred.reject();
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
if (!Dashboard.getPluginSecurityInfoPromise) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
// Don't let this blow up the dashboard when it fails
|
||||
ApiClient.ajax({
|
||||
apiClient.ajax({
|
||||
type: "GET",
|
||||
url: ApiClient.getUrl("Plugins/SecurityInfo"),
|
||||
url: apiClient.getUrl("Plugins/SecurityInfo"),
|
||||
dataType: 'json',
|
||||
|
||||
error: function () {
|
||||
|
@ -1393,7 +1408,7 @@ var Dashboard = {
|
|||
|
||||
} else {
|
||||
|
||||
quality -= 50;
|
||||
quality -= 40;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1413,7 +1428,7 @@ var Dashboard = {
|
|||
}
|
||||
},
|
||||
|
||||
getAppInfo: function () {
|
||||
getAppInfo: function (appName, deviceId, deviceName) {
|
||||
|
||||
function generateDeviceName() {
|
||||
|
||||
|
@ -1446,29 +1461,13 @@ var Dashboard = {
|
|||
}
|
||||
|
||||
var appVersion = window.dashboardVersion;
|
||||
var appName = "Emby Web Client";
|
||||
|
||||
var deviceName;
|
||||
var deviceId;
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
|
||||
appName = "Emby Mobile";
|
||||
|
||||
deviceName = store.getItem('cordovaDeviceName');
|
||||
deviceId = store.getItem('cordovaDeviceId');
|
||||
}
|
||||
appName = appName || "Emby Web Client";
|
||||
|
||||
deviceName = deviceName || generateDeviceName();
|
||||
|
||||
var seed = [];
|
||||
var keyName = 'randomId';
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
seed.push('cordova');
|
||||
keyName = 'cordovaDeviceId';
|
||||
}
|
||||
|
||||
deviceId = deviceId || MediaBrowser.generateDeviceId(keyName, seed.join(','));
|
||||
|
||||
return {
|
||||
|
@ -1501,6 +1500,23 @@ var Dashboard = {
|
|||
}
|
||||
|
||||
Dashboard.setCurrentUser(userId, accessToken);
|
||||
},
|
||||
|
||||
ready: function(fn) {
|
||||
|
||||
if (Dashboard.initPromiseDone) {
|
||||
fn();
|
||||
return;
|
||||
}
|
||||
|
||||
Dashboard.initPromise.done(fn);
|
||||
},
|
||||
|
||||
firePageEvent: function (page, name) {
|
||||
|
||||
Dashboard.ready(function () {
|
||||
$(page).trigger(name);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1516,7 +1532,7 @@ var AppInfo = {};
|
|||
|
||||
function setAppInfo() {
|
||||
|
||||
if (isTouchDevice() && $.browser.mobile) {
|
||||
if (isTouchDevice()) {
|
||||
AppInfo.isTouchPreferred = true;
|
||||
}
|
||||
|
||||
|
@ -1561,7 +1577,6 @@ var AppInfo = {};
|
|||
AppInfo.enablePeopleTabs = true;
|
||||
AppInfo.enableTvEpisodesTab = true;
|
||||
AppInfo.enableMusicArtistsTab = true;
|
||||
AppInfo.enableHomeLatestTab = true;
|
||||
AppInfo.enableMovieTrailersTab = true;
|
||||
}
|
||||
|
||||
|
@ -1582,9 +1597,7 @@ var AppInfo = {};
|
|||
.on('serveraddresschanged.dashboard', Dashboard.onApiClientServerAddressChanged);
|
||||
}
|
||||
|
||||
function createConnectionManager() {
|
||||
|
||||
var appInfo = Dashboard.getAppInfo();
|
||||
function createConnectionManager(appInfo) {
|
||||
|
||||
var credentialProvider = new MediaBrowser.CredentialProvider();
|
||||
|
||||
|
@ -1653,7 +1666,7 @@ var AppInfo = {};
|
|||
|
||||
}
|
||||
|
||||
function onReady() {
|
||||
function onDocumentReady() {
|
||||
|
||||
if (AppInfo.isTouchPreferred) {
|
||||
$(document.body).addClass('touch');
|
||||
|
@ -1691,10 +1704,6 @@ var AppInfo = {};
|
|||
$(document.body).addClass('musicArtistsTabDisabled');
|
||||
}
|
||||
|
||||
if (!AppInfo.enableHomeLatestTab) {
|
||||
$(document.body).addClass('homeLatestTabDisabled');
|
||||
}
|
||||
|
||||
if (!AppInfo.enableMovieTrailersTab) {
|
||||
$(document.body).addClass('movieTrailersTabDisabled');
|
||||
}
|
||||
|
@ -1818,7 +1827,7 @@ var AppInfo = {};
|
|||
});
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
requirejs(['thirdparty/cordova/connectsdk']);
|
||||
requirejs(['thirdparty/cordova/connectsdk', 'thirdparty/cordova/remotecontrols']);
|
||||
} else {
|
||||
if ($.browser.chrome) {
|
||||
requirejs(['scripts/chromecast']);
|
||||
|
@ -1826,38 +1835,64 @@ var AppInfo = {};
|
|||
}
|
||||
}
|
||||
|
||||
requirejs.config({
|
||||
map: {
|
||||
'*': {
|
||||
'css': 'thirdparty/requirecss' // or whatever the path to require-css is
|
||||
}
|
||||
},
|
||||
urlArgs: "v=" + window.dashboardVersion
|
||||
});
|
||||
function init(deferred, appName, deviceId, deviceName) {
|
||||
|
||||
// Required since jQuery is loaded before requireJs
|
||||
define('jquery', [], function () {
|
||||
return jQuery;
|
||||
});
|
||||
requirejs.config({
|
||||
map: {
|
||||
'*': {
|
||||
'css': 'thirdparty/requirecss' // or whatever the path to require-css is
|
||||
}
|
||||
},
|
||||
urlArgs: "v=" + window.dashboardVersion
|
||||
});
|
||||
|
||||
setAppInfo();
|
||||
createConnectionManager();
|
||||
// Required since jQuery is loaded before requireJs
|
||||
define('jquery', [], function () {
|
||||
return jQuery;
|
||||
});
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
setAppInfo();
|
||||
|
||||
var appInfo = Dashboard.getAppInfo(appName, deviceId, deviceName);
|
||||
|
||||
createConnectionManager(appInfo);
|
||||
|
||||
Dashboard.initPromiseDone = true;
|
||||
deferred.resolve();
|
||||
$(onDocumentReady);
|
||||
}
|
||||
|
||||
function initCordovaWithDeviceId(deferred, deviceId) {
|
||||
if ($.browser.safari) {
|
||||
requirejs(['thirdparty/cordova/imagestore.js']);
|
||||
}
|
||||
|
||||
init(deferred, "Emby Mobile", deviceId, device.model);
|
||||
}
|
||||
|
||||
function initCordova(deferred) {
|
||||
|
||||
document.addEventListener("deviceready", function () {
|
||||
|
||||
if ($.browser.safari) {
|
||||
requirejs(['thirdparty/cordova/imagestore.js']);
|
||||
}
|
||||
window.plugins.uniqueDeviceID.get(function (uuid) {
|
||||
|
||||
$(onReady);
|
||||
initCordovaWithDeviceId(deferred, uuid);
|
||||
|
||||
}, function () {
|
||||
|
||||
// Failure. Use cordova uuid
|
||||
initCordovaWithDeviceId(deferred, device.uuid);
|
||||
});
|
||||
}, false);
|
||||
}
|
||||
|
||||
var initDeferred = $.Deferred();
|
||||
Dashboard.initPromise = initDeferred.promise();
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
initCordova(initDeferred);
|
||||
} else {
|
||||
|
||||
$(onReady);
|
||||
init(initDeferred);
|
||||
}
|
||||
|
||||
})();
|
||||
|
@ -1903,10 +1938,10 @@ $(document).on('pagecreate', ".page", function () {
|
|||
if (require) {
|
||||
requirejs(require.split(','), function () {
|
||||
|
||||
$(page).trigger('pageinitdepends');
|
||||
Dashboard.firePageEvent(page, 'pageinitdepends');
|
||||
});
|
||||
} else {
|
||||
$(page).trigger('pageinitdepends');
|
||||
Dashboard.firePageEvent(page, 'pageinitdepends');
|
||||
}
|
||||
|
||||
$('.localnav a, .libraryViewNav a').attr('data-transition', 'none');
|
||||
|
@ -1914,16 +1949,29 @@ $(document).on('pagecreate', ".page", function () {
|
|||
}).on('pageshow', ".page", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var require = this.getAttribute('data-require');
|
||||
|
||||
if (require) {
|
||||
requirejs(require.split(','), function () {
|
||||
|
||||
$(page).trigger('pageshown');
|
||||
Dashboard.firePageEvent(page, 'pageshowready');
|
||||
});
|
||||
} else {
|
||||
$(page).trigger('pageshown');
|
||||
Dashboard.firePageEvent(page, 'pageshowready');
|
||||
}
|
||||
|
||||
}).on('pagebeforeshow', ".page", function () {
|
||||
|
||||
var page = this;
|
||||
var require = this.getAttribute('data-require');
|
||||
|
||||
if (require) {
|
||||
requirejs(require.split(','), function () {
|
||||
|
||||
Dashboard.firePageEvent(page, 'pagebeforeshowready');
|
||||
});
|
||||
} else {
|
||||
Dashboard.firePageEvent(page, 'pagebeforeshowready');
|
||||
}
|
||||
|
||||
}).on('pagebeforeshow', ".page", function () {
|
||||
|
@ -1961,7 +2009,7 @@ $(document).on('pagecreate', ".page", function () {
|
|||
if (isConnectMode) {
|
||||
|
||||
if (!Dashboard.isServerlessPage()) {
|
||||
Dashboard.logout();
|
||||
Dashboard.logout(true, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1969,7 +2017,7 @@ $(document).on('pagecreate', ".page", function () {
|
|||
if (this.id !== "loginPage" && !page.hasClass('forgotPasswordPage') && !page.hasClass('wizardPage') && !isConnectMode) {
|
||||
|
||||
console.log('Not logged into server. Redirecting to login.');
|
||||
Dashboard.logout();
|
||||
Dashboard.logout(true, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#songsPage", function () {
|
||||
}).on('pageshowready', "#songsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
$('.streamingSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#streamingSettingsPage", function () {
|
||||
}).on('pageshowready', "#streamingSettingsPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@
|
|||
|
||||
$('.supporterForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#supporterPage", function () {
|
||||
}).on('pageshowready', "#supporterPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
LibraryBrowser.saveViewSetting(getSavedQueryKey(), view);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#tvGenresPage", function () {
|
||||
}).on('pageshowready', "#tvGenresPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
var page = this;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
return 'Thumb';
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#tvNextUpPage", function () {
|
||||
$(document).on('pageshowready', "#tvNextUpPage", function () {
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#tvPeoplePage", function () {
|
||||
}).on('pageshowready', "#tvPeoplePage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#tvRecommendedPage", function () {
|
||||
$(document).on('pageshowready', "#tvRecommendedPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -360,7 +360,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#tvShowsPage", function () {
|
||||
}).on('pageshowready', "#tvShowsPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#tvStudiosPage", function () {
|
||||
}).on('pageshowready', "#tvStudiosPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(function ($, document) {
|
||||
|
||||
$(document).on('pageshown', "#tvUpcomingPage", function () {
|
||||
$(document).on('pageshowready', "#tvUpcomingPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@
|
|||
|
||||
$('.newUserProfileForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#newUserPage", function () {
|
||||
}).on('pageshowready', "#newUserPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
|
||||
$('.wizardSettingsForm', page).off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#wizardSettingsPage", function () {
|
||||
}).on('pageshowready', "#wizardSettingsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
$('.wizardUserForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#wizardUserPage", function () {
|
||||
}).on('pageshowready', "#wizardUserPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue