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

switch methods to fetch

This commit is contained in:
Luke Pulverenti 2015-11-27 20:18:15 -05:00
parent 6acc4bf69d
commit dd09b038d5
91 changed files with 349 additions and 314 deletions

View file

@ -195,6 +195,50 @@
return deferred.promise(); return deferred.promise();
}; };
/**
* Wraps around jQuery ajax methods to add additional info to the request.
*/
self.fetch = function (request, includeAuthorization) {
if (!request) {
throw new Error("Request cannot be null");
}
if (includeAuthorization !== false) {
request.headers = request.headers || {};
self.setRequestHeaders(request.headers);
}
if (self.enableAutomaticNetworking === false || request.type != "GET") {
logger.log('Requesting url without automatic networking: ' + request.url);
return fetch(request.url, {
headers: request.headers,
method: request.type
});
}
var deferred = DeferredBuilder.Deferred();
self.ajaxWithFailover(request, deferred, true);
return deferred.promise();
};
self.fetchJSON = function (url, includeAuthorization) {
return self.fetch({
url: url,
type: 'GET',
headers: {
accept: 'application/json'
}
}, includeAuthorization).then(function(response) {
return response.json();
});
};
function switchConnectionMode(connectionMode) { function switchConnectionMode(connectionMode) {
var currentServerInfo = self.serverInfo(); var currentServerInfo = self.serverInfo();
@ -569,7 +613,7 @@
self.getUrl("Users/" + userId + "/Items/" + itemId) : self.getUrl("Users/" + userId + "/Items/" + itemId) :
self.getUrl("Items/" + itemId); self.getUrl("Items/" + itemId);
return self.getJSON(url); return self.fetchJSON(url);
}; };
/** /**
@ -583,7 +627,7 @@
var url = self.getUrl("Users/" + userId + "/Items/Root"); var url = self.getUrl("Users/" + userId + "/Items/Root");
return self.getJSON(url); return self.fetchJSON(url);
}; };
self.getNotificationSummary = function (userId) { self.getNotificationSummary = function (userId) {
@ -1092,7 +1136,7 @@
var url = self.getUrl("System/Info"); var url = self.getUrl("System/Info");
return self.getJSON(url); return self.fetchJSON(url);
}; };
/** /**
@ -1102,12 +1146,7 @@
var url = self.getUrl("System/Info/Public"); var url = self.getUrl("System/Info/Public");
return self.ajax({ return self.fetchJSON(url, false);
type: "GET",
url: url,
dataType: "json"
}, false);
}; };
self.getInstantMixFromItem = function (itemId, options) { self.getInstantMixFromItem = function (itemId, options) {
@ -1425,7 +1464,7 @@
var url = self.getUrl("System/Configuration"); var url = self.getUrl("System/Configuration");
return self.getJSON(url); return self.fetchJSON(url);
}; };
/** /**
@ -2067,7 +2106,7 @@
var url = self.getUrl("Genres/" + self.encodeName(name), options); var url = self.getUrl("Genres/" + self.encodeName(name), options);
return self.getJSON(url); return self.fetchJSON(url);
}; };
self.getMusicGenre = function (name, userId) { self.getMusicGenre = function (name, userId) {
@ -2084,7 +2123,7 @@
var url = self.getUrl("MusicGenres/" + self.encodeName(name), options); var url = self.getUrl("MusicGenres/" + self.encodeName(name), options);
return self.getJSON(url); return self.fetchJSON(url);
}; };
self.getGameGenre = function (name, userId) { self.getGameGenre = function (name, userId) {
@ -2101,7 +2140,7 @@
var url = self.getUrl("GameGenres/" + self.encodeName(name), options); var url = self.getUrl("GameGenres/" + self.encodeName(name), options);
return self.getJSON(url); return self.fetchJSON(url);
}; };
/** /**
@ -2121,7 +2160,7 @@
var url = self.getUrl("Artists/" + self.encodeName(name), options); var url = self.getUrl("Artists/" + self.encodeName(name), options);
return self.getJSON(url); return self.fetchJSON(url);
}; };
/** /**
@ -2744,7 +2783,7 @@
url = self.getUrl("Items", options); url = self.getUrl("Items", options);
} }
return self.getJSON(url); return self.fetchJSON(url);
}; };
self.getChannels = function (query) { self.getChannels = function (query) {

View file

@ -210,7 +210,7 @@
return; return;
} }
apiClient.getPublicSystemInfo().done(function (systemInfo) { apiClient.getPublicSystemInfo().then(function (systemInfo) {
var credentials = credentialProvider.credentials(); var credentials = credentialProvider.credentials();
existingServer.Id = systemInfo.Id; existingServer.Id = systemInfo.Id;
@ -1385,7 +1385,7 @@
if (!match.DateLastLocalConnection) { if (!match.DateLastLocalConnection) {
ApiClient.getJSON(ApiClient.getUrl('System/Endpoint')).done(function (info) { ApiClient.fetchJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
if (info.IsInNetwork) { if (info.IsInNetwork) {
@ -1395,7 +1395,7 @@
deferred.resolveWith(null, [{}]); deferred.resolveWith(null, [{}]);
} }
}).fail(function () { }, function () {
deferred.resolveWith(null, [{}]); deferred.resolveWith(null, [{}]);
}); });

View file

@ -49,7 +49,7 @@
var context = getParameterByName('context'); var context = getParameterByName('context');
ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), id).then(function (item) {
Dashboard.navigate(LibraryBrowser.getHref(item, context)); Dashboard.navigate(LibraryBrowser.getHref(item, context));
@ -98,7 +98,7 @@
SortBy: "SortName" SortBy: "SortName"
}; };
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
var html = ''; var html = '';

View file

@ -8,7 +8,7 @@
if (systemInfo) { if (systemInfo) {
deferred.resolveWith(null, [systemInfo]); deferred.resolveWith(null, [systemInfo]);
} else { } else {
ApiClient.getPublicSystemInfo().done(function (info) { ApiClient.getPublicSystemInfo().then(function (info) {
systemInfo = info; systemInfo = info;
deferred.resolveWith(null, [systemInfo]); deferred.resolveWith(null, [systemInfo]);
}); });

View file

@ -21,7 +21,7 @@
reloadItem(page, item); reloadItem(page, item);
} }
else { else {
ApiClient.getItem(Dashboard.getCurrentUserId(), currentItem.Id).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), currentItem.Id).then(function (item) {
reloadItem(page, item); reloadItem(page, item);
}); });
} }
@ -240,7 +240,7 @@
}).done(function (template) { }).done(function (template) {
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
var dlg = PaperDialogHelper.createDialog({ var dlg = PaperDialogHelper.createDialog({
theme: options.theme theme: options.theme

View file

@ -236,7 +236,7 @@
function showIdentificationForm(page, item) { function showIdentificationForm(page, item) {
ApiClient.getJSON(ApiClient.getUrl("Items/" + item.Id + "/ExternalIdInfos")).done(function (idList) { ApiClient.fetchJSON(ApiClient.getUrl("Items/" + item.Id + "/ExternalIdInfos")).then(function (idList) {
var html = ''; var html = '';
@ -288,7 +288,7 @@
}).done(function (template) { }).done(function (template) {
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
currentItem = item; currentItem = item;

View file

@ -19,7 +19,7 @@
reloadItem(page, item); reloadItem(page, item);
} }
else { else {
ApiClient.getItem(Dashboard.getCurrentUserId(), currentItem.Id).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), currentItem.Id).then(function (item) {
reloadItem(page, item); reloadItem(page, item);
}); });
} }
@ -46,7 +46,7 @@
}).done(function (template) { }).done(function (template) {
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
var dlg = document.createElement('paper-dialog'); var dlg = document.createElement('paper-dialog');

View file

@ -6,7 +6,7 @@
var context = getParameterByName('context'); var context = getParameterByName('context');
ApiClient.getItem(Dashboard.getCurrentUserId(), id).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), id).then(function (item) {
Dashboard.navigate(LibraryBrowser.getHref(item, context)); Dashboard.navigate(LibraryBrowser.getHref(item, context));
@ -106,7 +106,7 @@
SortBy: 'SortName' SortBy: 'SortName'
}; };
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
var html = ''; var html = '';

View file

@ -189,7 +189,7 @@
} }
else { else {
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
var lang = user.Configuration.SubtitleLanguagePreference; var lang = user.Configuration.SubtitleLanguagePreference;
@ -291,7 +291,7 @@
var url = ApiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language); var url = ApiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language);
ApiClient.getJSON(url).done(function (results) { ApiClient.fetchJSON(url).then(function (results) {
renderSearchResults(page, results); renderSearchResults(page, results);
}); });
@ -310,7 +310,7 @@
} }
if (typeof itemId == 'string') { if (typeof itemId == 'string') {
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).done(onGetItem); ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(onGetItem);
} }
else { else {
onGetItem(itemId); onGetItem(itemId);
@ -338,7 +338,7 @@
}).done(function (template) { }).done(function (template) {
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
var dlg = PaperDialogHelper.createDialog(); var dlg = PaperDialogHelper.createDialog();

View file

@ -35,7 +35,7 @@
function setCountry(info) { function setCountry(info) {
ApiClient.getJSON(ApiClient.getUrl('LiveTv/ListingProviders/SchedulesDirect/Countries')).done(function (result) { ApiClient.fetchJSON(ApiClient.getUrl('LiveTv/ListingProviders/SchedulesDirect/Countries')).then(function (result) {
var countryList = []; var countryList = [];
var i, length; var i, length;
@ -72,7 +72,7 @@
$(page.querySelector('.txtZipCode')).trigger('change'); $(page.querySelector('.txtZipCode')).trigger('change');
}).fail(function () { }, function () {
Dashboard.alert({ Dashboard.alert({
message: Globalize.translate('ErrorGettingTvLineups') message: Globalize.translate('ErrorGettingTvLineups')

View file

@ -18,17 +18,15 @@
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
if (query.Ids && query.Ids.split(',').length == 1) { if (query.Ids && query.Ids.split(',').length == 1) {
var deferred = DeferredBuilder.Deferred(); return new Promise(function (resolve, reject) {
ApiClient.getItem(userId, query.Ids.split(',')).done(function (item) { ApiClient.getItem(userId, query.Ids.split(',')).then(function (item) {
deferred.resolveWith(null, [ resolve({
{
Items: [item], Items: [item],
TotalRecordCount: 1 TotalRecordCount: 1
}]);
}); });
});
return deferred.promise(); });
} }
else { else {
@ -78,7 +76,7 @@
return deferred.promise(); return deferred.promise();
} }
return ApiClient.getJSON(ApiClient.getUrl('System/Endpoint')).done(function (info) { return ApiClient.fetchJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
endpointInfo = info; endpointInfo = info;
}); });
@ -98,10 +96,10 @@
supportsAc3: AppSettings.enableChromecastAc3() supportsAc3: AppSettings.enableChromecastAc3()
}); });
getEndpointInfo().done(function (endpoint) { getEndpointInfo().then(function (endpoint) {
if (endpoint.IsInNetwork) { if (endpoint.IsInNetwork) {
ApiClient.getPublicSystemInfo().done(function (info) { ApiClient.getPublicSystemInfo().then(function (info) {
message.serverAddress = info.LocalAddress; message.serverAddress = info.LocalAddress;
sendMessageInternal(message); sendMessageInternal(message);
@ -119,7 +117,7 @@
self.play = function (options) { self.play = function (options) {
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
if (options.items) { if (options.items) {
@ -131,7 +129,7 @@
Ids: options.ids.join(',') Ids: options.ids.join(',')
}).done(function (result) { }).then(function (result) {
options.items = result.Items; options.items = result.Items;
self.playWithCommand(options, 'PlayNow'); self.playWithCommand(options, 'PlayNow');
@ -146,7 +144,7 @@
self.playWithCommand = function (options, command) { self.playWithCommand = function (options, command) {
if (!options.items) { if (!options.items) {
ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).then(function (item) {
options.items = [item]; options.items = [item];
self.playWithCommand(options, command); self.playWithCommand(options, command);
@ -189,7 +187,7 @@
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
ApiClient.getItem(userId, id).done(function (item) { ApiClient.getItem(userId, id).then(function (item) {
self.playWithCommand({ self.playWithCommand({
@ -205,7 +203,7 @@
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
ApiClient.getItem(userId, id).done(function (item) { ApiClient.getItem(userId, id).then(function (item) {
self.playWithCommand({ self.playWithCommand({

View file

@ -53,7 +53,7 @@
self.play = function (options) { self.play = function (options) {
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
if (options.items) { if (options.items) {
@ -65,7 +65,7 @@
Ids: options.ids.join(',') Ids: options.ids.join(',')
}).done(function (result) { }).then(function (result) {
options.items = result.Items; options.items = result.Items;
self.playWithCommand(options, 'PlayNow'); self.playWithCommand(options, 'PlayNow');
@ -80,7 +80,7 @@
self.playWithCommand = function (options, command) { self.playWithCommand = function (options, command) {
if (!options.items) { if (!options.items) {
ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).then(function (item) {
options.items = [item]; options.items = [item];
self.playWithCommand(options, command); self.playWithCommand(options, command);
@ -220,7 +220,7 @@
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
ApiClient.getItem(userId, id).done(function (item) { ApiClient.getItem(userId, id).then(function (item) {
self.playWithCommand({ self.playWithCommand({
@ -236,7 +236,7 @@
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
ApiClient.getItem(userId, id).done(function (item) { ApiClient.getItem(userId, id).then(function (item) {
self.playWithCommand({ self.playWithCommand({

View file

@ -154,7 +154,7 @@
return; return;
} }
Dashboard.getCurrentUser().done(showUserTabs); Dashboard.getCurrentUser().then(showUserTabs);
} }
var isFirstHide = true; var isFirstHide = true;

View file

@ -50,7 +50,7 @@
var form = this; var form = this;
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
config.EnableDebugLevelLogging = $('#chkDebugLog', form).checked(); config.EnableDebugLevelLogging = $('#chkDebugLog', form).checked();
@ -80,9 +80,9 @@
var promise2 = ApiClient.getSystemInfo(); var promise2 = ApiClient.getSystemInfo();
$.when(promise1, promise2).done(function (response1, response2) { Promise.all([promise1, promise2]).then(function (responses) {
loadPage(page, response1[0], response2[0]); loadPage(page, responses[0], responses[1]);
}); });

View file

@ -59,10 +59,10 @@
includeItemTypes: 'Series', includeItemTypes: 'Series',
sortBy: 'SortName' sortBy: 'SortName'
}).done(function (result) { }).then(function (result) {
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
showEpisodeCorrectionPopup(page, item, result.Items); showEpisodeCorrectionPopup(page, item, result.Items);
}).fail(onApiFailure); }, onApiFailure);
} }

View file

@ -64,7 +64,7 @@
ParentId: parentId ParentId: parentId
}; };
apiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { apiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
var images = result.Items.map(function (i) { var images = result.Items.map(function (i) {
return { return {

View file

@ -36,7 +36,7 @@
var channelId = getParameterByName('id'); var channelId = getParameterByName('id');
ApiClient.getJSON(ApiClient.getUrl("Channels/" + channelId + "/Features")).done(function (features) { ApiClient.fetchJSON(ApiClient.getUrl("Channels/" + channelId + "/Features")).then(function (features) {
if (features.CanFilter) { if (features.CanFilter) {
@ -78,14 +78,14 @@
if (folderId) { if (folderId) {
ApiClient.getItem(query.UserId, folderId).done(function (item) { ApiClient.getItem(query.UserId, folderId).then(function (item) {
LibraryMenu.setTitle(item.Name); LibraryMenu.setTitle(item.Name);
}); });
} else { } else {
ApiClient.getItem(query.UserId, channelId).done(function (item) { ApiClient.getItem(query.UserId, channelId).then(function (item) {
LibraryMenu.setTitle(item.Name); LibraryMenu.setTitle(item.Name);
}); });
@ -93,7 +93,7 @@
query.folderId = folderId; query.folderId = folderId;
ApiClient.getJSON(ApiClient.getUrl("Channels/" + channelId + "/Items", query)).done(function (result) { ApiClient.fetchJSON(ApiClient.getUrl("Channels/" + channelId + "/Items", query)).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -12,7 +12,7 @@
query.UserId = Dashboard.getCurrentUserId(); query.UserId = Dashboard.getCurrentUserId();
ApiClient.getJSON(ApiClient.getUrl("Channels", query)).done(function (result) { ApiClient.fetchJSON(ApiClient.getUrl("Channels", query)).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -323,7 +323,7 @@
return deferred.promise(); return deferred.promise();
} }
return ApiClient.getJSON(ApiClient.getUrl('System/Endpoint')).done(function (info) { return ApiClient.fetchJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
endpointInfo = info; endpointInfo = info;
}); });
@ -351,10 +351,10 @@
supportsAc3: AppSettings.enableChromecastAc3() supportsAc3: AppSettings.enableChromecastAc3()
}); });
getEndpointInfo().done(function (endpoint) { getEndpointInfo().then(function (endpoint) {
if (endpoint.IsInNetwork) { if (endpoint.IsInNetwork) {
ApiClient.getPublicSystemInfo().done(function (info) { ApiClient.getPublicSystemInfo().then(function (info) {
message.serverAddress = info.LocalAddress; message.serverAddress = info.LocalAddress;
player.sendMessageInternal(message); player.sendMessageInternal(message);
@ -462,17 +462,15 @@
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
if (query.Ids && query.Ids.split(',').length == 1) { if (query.Ids && query.Ids.split(',').length == 1) {
var deferred = DeferredBuilder.Deferred(); return new Promise(function (resolve, reject) {
ApiClient.getItem(userId, query.Ids.split(',')).done(function (item) { ApiClient.getItem(userId, query.Ids.split(',')).then(function (item) {
deferred.resolveWith(null, [ resolve({
{
Items: [item], Items: [item],
TotalRecordCount: 1 TotalRecordCount: 1
}]);
}); });
});
return deferred.promise(); });
} }
else { else {
@ -523,7 +521,7 @@
self.play = function (options) { self.play = function (options) {
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
if (options.items) { if (options.items) {
@ -535,7 +533,7 @@
Ids: options.ids.join(',') Ids: options.ids.join(',')
}).done(function (result) { }).then(function (result) {
options.items = result.Items; options.items = result.Items;
self.playWithCommand(options, 'PlayNow'); self.playWithCommand(options, 'PlayNow');
@ -550,7 +548,7 @@
self.playWithCommand = function (options, command) { self.playWithCommand = function (options, command) {
if (!options.items) { if (!options.items) {
ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).then(function (item) {
options.items = [item]; options.items = [item];
self.playWithCommand(options, command); self.playWithCommand(options, command);
@ -580,7 +578,7 @@
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
ApiClient.getItem(userId, id).done(function (item) { ApiClient.getItem(userId, id).then(function (item) {
self.playWithCommand({ self.playWithCommand({
@ -596,7 +594,7 @@
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
ApiClient.getItem(userId, id).done(function (item) { ApiClient.getItem(userId, id).then(function (item) {
self.playWithCommand({ self.playWithCommand({

View file

@ -29,7 +29,7 @@
function refreshPageTitle(page) { function refreshPageTitle(page) {
ApiClient.getSystemInfo().done(function (systemInfo) { ApiClient.getSystemInfo().then(function (systemInfo) {
Dashboard.setPageTitle(systemInfo.ServerName); Dashboard.setPageTitle(systemInfo.ServerName);
}); });
@ -41,7 +41,7 @@
var form = this; var form = this;
var page = $(form).parents('.page'); var page = $(form).parents('.page');
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
config.ServerName = form.querySelector('#txtServerName').value; config.ServerName = form.querySelector('#txtServerName').value;
config.UICulture = $('#selectLocalizationLanguage', form).val(); config.UICulture = $('#selectLocalizationLanguage', form).val();
@ -114,11 +114,11 @@
var promise1 = ApiClient.getServerConfiguration(); var promise1 = ApiClient.getServerConfiguration();
var promise2 = ApiClient.getJSON(ApiClient.getUrl("Localization/Options")); var promise2 = ApiClient.fetchJSON(ApiClient.getUrl("Localization/Options"));
$.when(promise1, promise2).done(function (response1, response2) { Promise.all([promise1, promise2]).then(function (responses) {
loadPage(page, response1[0], response2[0]); loadPage(page, responses[0], responses[1]);
}); });

View file

@ -22,7 +22,7 @@
var form = this; var form = this;
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
config.HttpServerPortNumber = $('#txtPortNumber', form).val(); config.HttpServerPortNumber = $('#txtPortNumber', form).val();
config.PublicPort = $('#txtPublicPort', form).val(); config.PublicPort = $('#txtPublicPort', form).val();
@ -46,7 +46,7 @@
var page = this; var page = this;
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
loadPage(page, config); loadPage(page, config);

View file

@ -82,7 +82,7 @@
reloadSystemInfo: function (page) { reloadSystemInfo: function (page) {
ApiClient.getSystemInfo().done(function (systemInfo) { ApiClient.getSystemInfo().then(function (systemInfo) {
Dashboard.setPageTitle(systemInfo.ServerName); Dashboard.setPageTitle(systemInfo.ServerName);
Dashboard.updateSystemInfo(systemInfo); Dashboard.updateSystemInfo(systemInfo);
@ -1170,13 +1170,13 @@ $(document).on('pageshow', "#dashboardPage", DashboardPage.onPageShow).on('pageb
var minDate = new Date(); var minDate = new Date();
minDate.setTime(minDate.getTime() - 86400000); minDate.setTime(minDate.getTime() - 86400000);
ApiClient.getJSON(ApiClient.getUrl('System/ActivityLog/Entries', { ApiClient.fetchJSON(ApiClient.getUrl('System/ActivityLog/Entries', {
startIndex: startIndex, startIndex: startIndex,
limit: limit, limit: limit,
minDate: minDate.toISOString() minDate: minDate.toISOString()
})).done(function (result) { })).then(function (result) {
elem.setAttribute('data-activitystartindex', startIndex); elem.setAttribute('data-activitystartindex', startIndex);
elem.setAttribute('data-activitylimit', limit); elem.setAttribute('data-activitylimit', limit);

View file

@ -82,11 +82,11 @@
function loadData(page) { function loadData(page) {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getJSON(ApiClient.getUrl('Devices', { ApiClient.fetchJSON(ApiClient.getUrl('Devices', {
SupportsPersistentIdentifier: true SupportsPersistentIdentifier: true
})).done(function (result) { })).then(function (result) {
load(page, result.Items); load(page, result.Items);

View file

@ -4,7 +4,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getJSON(ApiClient.getUrl("Dlna/ProfileInfos")).done(function (result) { ApiClient.fetchJSON(ApiClient.getUrl("Dlna/ProfileInfos")).then(function (result) {
renderProfiles(page, result); renderProfiles(page, result);

View file

@ -13,13 +13,13 @@
var promise1 = MetadataEditor.getItemPromise(); var promise1 = MetadataEditor.getItemPromise();
var promise2 = MetadataEditor.getCurrentItemId() ? var promise2 = MetadataEditor.getCurrentItemId() ?
ApiClient.getJSON(ApiClient.getUrl('Items/' + MetadataEditor.getCurrentItemId() + '/MetadataEditor')) : ApiClient.fetchJSON(ApiClient.getUrl('Items/' + MetadataEditor.getCurrentItemId() + '/MetadataEditor')) :
{}; {};
$.when(promise1, promise2).done(function (response1, response2) { Promise.all([promise1, promise2]).then(function (responses) {
var item = response1[0]; var item = responses[0];
metadataEditorInfo = response2[0]; metadataEditorInfo = responses[1];
currentItem = item; currentItem = item;
@ -280,7 +280,7 @@
$('#fldYear', page).show(); $('#fldYear', page).show();
} }
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
if (LibraryBrowser.getMoreCommands(item, user).indexOf('identify') != -1) { if (LibraryBrowser.getMoreCommands(item, user).indexOf('identify') != -1) {
@ -895,7 +895,7 @@
Dashboard.alert(Globalize.translate('MessageItemSaved')); Dashboard.alert(Globalize.translate('MessageItemSaved'));
MetadataEditor.getItemPromise().done(function (i) { MetadataEditor.getItemPromise().then(function (i) {
page.trigger('itemsaved', [i]); page.trigger('itemsaved', [i]);
bindItemChanged(page); bindItemChanged(page);
}); });
@ -1088,7 +1088,7 @@
function showMoreMenu(page, elem) { function showMoreMenu(page, elem) {
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
var moreCommands = LibraryBrowser.getMoreCommands(currentItem, user); var moreCommands = LibraryBrowser.getMoreCommands(currentItem, user);

View file

@ -173,7 +173,7 @@
function loadMediaFolders(page, scope, openItems, callback) { function loadMediaFolders(page, scope, openItems, callback) {
ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders")).done(function (result) { ApiClient.fetchJSON(ApiClient.getUrl("Library/MediaFolders")).then(function (result) {
var nodes = result.Items.map(function (n) { var nodes = result.Items.map(function (n) {
@ -229,7 +229,7 @@
query.SortBy = "SortName"; query.SortBy = "SortName";
} }
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
var nodes = result.Items.map(function (n) { var nodes = result.Items.map(function (n) {
@ -422,7 +422,7 @@
var page = this; var page = this;
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
var id = getCurrentItemId(); var id = getCurrentItemId();

View file

@ -45,7 +45,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
var query = getQuery(); var query = getQuery();
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -435,7 +435,7 @@
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
ApiClient.getItem(userId, itemId).done(function (item) { ApiClient.getItem(userId, itemId).then(function (item) {
getVideoStreamInfo(item).done(function (streamInfo) { getVideoStreamInfo(item).done(function (streamInfo) {

View file

@ -65,7 +65,7 @@
promise = ApiClient.getItems(userId, options); promise = ApiClient.getItems(userId, options);
} }
return promise.done(function (result) { return promise.then(function (result) {
var html = ''; var html = '';

View file

@ -25,7 +25,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -17,7 +17,7 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb" EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
}; };
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) { ApiClient.fetchJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
$('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({ $('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
items: items, items: items,
@ -44,7 +44,7 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb" EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
}; };
ApiClient.getItems(userId, options).done(function (result) { ApiClient.getItems(userId, options).then(function (result) {
if (result.Items.length) { if (result.Items.length) {
$('#recentlyPlayedSection', page).show(); $('#recentlyPlayedSection', page).show();

View file

@ -22,7 +22,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -16,7 +16,7 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb" EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
}; };
ApiClient.getJSON(ApiClient.getUrl("Shows/Upcoming", query)).done(function (result) { ApiClient.fetchJSON(ApiClient.getUrl("Shows/Upcoming", query)).then(function (result) {
var items = result.Items; var items = result.Items;

View file

@ -203,7 +203,7 @@
getDisplayPreferences('home', userId).done(function (result) { getDisplayPreferences('home', userId).done(function (result) {
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
loadSections(tabContent, user, result).done(function () { loadSections(tabContent, user, result).done(function () {

View file

@ -233,7 +233,7 @@
query = getQuery(query, item); query = getQuery(query, item);
getItemsFunction(query, item)(query.StartIndex, query.Limit, query.Fields).done(function (result) { getItemsFunction(query, item)(query.StartIndex, query.Limit, query.Fields).then(function (result) {
var html = ''; var html = '';

View file

@ -42,7 +42,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
getPromise().done(function (item) { getPromise().then(function (item) {
reloadFromItem(page, item); reloadFromItem(page, item);
window.scrollTo(0, 0); window.scrollTo(0, 0);
@ -61,7 +61,7 @@
LibraryBrowser.renderParentName(item, $('.parentName', page), context); LibraryBrowser.renderParentName(item, $('.parentName', page), context);
LibraryMenu.setTitle(item.SeriesName || item.Name); LibraryMenu.setTitle(item.SeriesName || item.Name);
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
renderImage(page, item, user); renderImage(page, item, user);
@ -273,7 +273,7 @@
currentItem.UserData = userData; currentItem.UserData = userData;
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
refreshImage(page, currentItem, user); refreshImage(page, currentItem, user);
}); });
@ -616,7 +616,7 @@
context = context || ''; context = context || '';
promise.done(function (result) { promise.then(function (result) {
var foundExisting = false; var foundExisting = false;
@ -683,7 +683,7 @@
options.limit = 12; options.limit = 12;
} }
ApiClient.getSimilarItems(item.Id, options).done(function (result) { ApiClient.getSimilarItems(item.Id, options).then(function (result) {
if (!result.Items.length) { if (!result.Items.length) {
@ -860,7 +860,7 @@
promise = promise || ApiClient.getItems(Dashboard.getCurrentUserId(), query); promise = promise || ApiClient.getItems(Dashboard.getCurrentUserId(), query);
promise.done(function (result) { promise.then(function (result) {
var html = ''; var html = '';
@ -1115,7 +1115,7 @@
options.limit = limit; options.limit = limit;
} }
ApiClient.getCriticReviews(item.Id, options).done(function (result) { ApiClient.getCriticReviews(item.Id, options).then(function (result) {
if (result.TotalRecordCount || item.CriticRatingSummary || item.AwardSummary) { if (result.TotalRecordCount || item.CriticRatingSummary || item.AwardSummary) {
$('#criticReviewsCollapsible', page).show(); $('#criticReviewsCollapsible', page).show();
@ -1206,7 +1206,7 @@
function renderThemeMedia(page, item) { function renderThemeMedia(page, item) {
ApiClient.getThemeMedia(Dashboard.getCurrentUserId(), item.Id, true).done(function (result) { ApiClient.getThemeMedia(Dashboard.getCurrentUserId(), item.Id, true).then(function (result) {
var themeSongs = result.ThemeSongsResult.OwnerId == item.Id ? var themeSongs = result.ThemeSongsResult.OwnerId == item.Id ?
result.ThemeSongsResult.Items : result.ThemeSongsResult.Items :
@ -1264,7 +1264,7 @@
Fields: "DateCreated,SyncInfo", Fields: "DateCreated,SyncInfo",
Albums: item.Name Albums: item.Name
}).done(function (result) { }).then(function (result) {
if (result.Items.length) { if (result.Items.length) {
$('#musicVideosCollapsible', page).show(); $('#musicVideosCollapsible', page).show();
@ -1279,7 +1279,7 @@
function renderAdditionalParts(page, item, user) { function renderAdditionalParts(page, item, user) {
ApiClient.getAdditionalVideoParts(user.Id, item.Id).done(function (result) { ApiClient.getAdditionalVideoParts(user.Id, item.Id).then(function (result) {
if (result.Items.length) { if (result.Items.length) {
@ -1612,7 +1612,7 @@
function renderSpecials(page, item, user, limit) { function renderSpecials(page, item, user, limit) {
ApiClient.getSpecialFeatures(user.Id, item.Id).done(function (specials) { ApiClient.getSpecialFeatures(user.Id, item.Id).then(function (specials) {
var specialsContent = page.querySelector('#specialsContent'); var specialsContent = page.querySelector('#specialsContent');
specialsContent.innerHTML = getVideosHtml(specials, user, limit, "moreSpecials"); specialsContent.innerHTML = getVideosHtml(specials, user, limit, "moreSpecials");
@ -1885,7 +1885,7 @@
function playTrailer(page) { function playTrailer(page) {
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), currentItem.Id).done(function (trailers) { ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), currentItem.Id).then(function (trailers) {
MediaController.play({ items: trailers }); MediaController.play({ items: trailers });
@ -1907,7 +1907,7 @@
if (currentItem.Type == 'Program') { if (currentItem.Type == 'Program') {
ApiClient.getLiveTvChannel(currentItem.ChannelId, Dashboard.getCurrentUserId()).done(function (channel) { ApiClient.getLiveTvChannel(currentItem.ChannelId, Dashboard.getCurrentUserId()).then(function (channel) {
LibraryBrowser.showPlayMenu(null, channel.Id, channel.Type, false, channel.MediaType, (channel.UserData || {}).PlaybackPositionTicks); LibraryBrowser.showPlayMenu(null, channel.Id, channel.Type, false, channel.MediaType, (channel.UserData || {}).PlaybackPositionTicks);
}); });
@ -1986,7 +1986,7 @@
var button = this; var button = this;
Dashboard.getCurrentUser().done(function(user) { Dashboard.getCurrentUser().then(function (user) {
LibraryBrowser.showMoreCommands(button, currentItem.Id, LibraryBrowser.getMoreCommands(currentItem, user)); LibraryBrowser.showMoreCommands(button, currentItem.Id, LibraryBrowser.getMoreCommands(currentItem, user));
}); });
@ -2004,7 +2004,7 @@
$(page).on("click", ".moreScenes", function() { $(page).on("click", ".moreScenes", function() {
Dashboard.getCurrentUser().done(function(user) { Dashboard.getCurrentUser().then(function (user) {
renderScenes(page, currentItem, user); renderScenes(page, currentItem, user);
}); });
@ -2014,7 +2014,7 @@
}).on("click", ".moreSpecials", function() { }).on("click", ".moreSpecials", function() {
Dashboard.getCurrentUser().done(function(user) { Dashboard.getCurrentUser().then(function (user) {
renderSpecials(page, currentItem, user); renderSpecials(page, currentItem, user);
}); });

View file

@ -53,11 +53,11 @@
var itemsPromise = ApiClient.getItems(userId, query); var itemsPromise = ApiClient.getItems(userId, query);
$.when(parentItemPromise, itemsPromise).done(function (r1, r2) { Promise.all([parentItemPromise, itemsPromise]).done(function (responses) {
var item = r1[0]; var item = responses[0];
currentItem = item; currentItem = item;
var result = r2[0]; var result = responses[1];
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -28,7 +28,7 @@
EnableImageTypes: "Primary,Backdrop,Thumb" EnableImageTypes: "Primary,Backdrop,Thumb"
}; };
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
$('.itemsContainer', page).html(LibraryBrowser.getPosterViewHtml({ $('.itemsContainer', page).html(LibraryBrowser.getPosterViewHtml({

View file

@ -645,7 +645,7 @@
return; return;
} }
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) { ApiClient.fetchJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
if (items.length == 1) { if (items.length == 1) {
@ -703,10 +703,10 @@
var promise1 = ApiClient.getItem(Dashboard.getCurrentUserId(), id); var promise1 = ApiClient.getItem(Dashboard.getCurrentUserId(), id);
var promise2 = Dashboard.getCurrentUser(); var promise2 = Dashboard.getCurrentUser();
$.when(promise1, promise2).done(function (response1, response2) { Promise.all([promise1, promise2]).then(function (responses) {
var item = response1[0]; var item = responses[0];
var user = response2[0]; var user = responses[1];
var card = elem; var card = elem;
@ -1040,7 +1040,7 @@
function showMenuForSelectedItems(e) { function showMenuForSelectedItems(e) {
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
var items = []; var items = [];
@ -1234,7 +1234,7 @@
Fields: 'MediaSources,Chapters', Fields: 'MediaSources,Chapters',
Limit: 100 Limit: 100
}).done(function (result) { }).then(function (result) {
MediaController[method]({ MediaController[method]({
items: result.Items items: result.Items

View file

@ -8,7 +8,7 @@
if (result) { if (result) {
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
config.PathSubstitutions.splice(index, 1); config.PathSubstitutions.splice(index, 1);
@ -87,7 +87,7 @@
$('#txtFrom', page).val(''); $('#txtFrom', page).val('');
$('#txtTo', page).val(''); $('#txtTo', page).val('');
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
loadPage(page, config); loadPage(page, config);
@ -100,7 +100,7 @@
var form = this; var form = this;
var page = $(form).parents('.page'); var page = $(form).parents('.page');
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
addSubstitution(page, config); addSubstitution(page, config);
ApiClient.updateServerConfiguration(config).done(function () { ApiClient.updateServerConfiguration(config).done(function () {
@ -123,7 +123,7 @@
var page = this; var page = this;
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
loadPage(page, config); loadPage(page, config);

View file

@ -23,7 +23,7 @@
var form = this; var form = this;
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
config.SeasonZeroDisplayName = $('#txtSeasonZeroName', form).val(); config.SeasonZeroDisplayName = $('#txtSeasonZeroName', form).val();
@ -45,7 +45,7 @@
var page = this; var page = this;
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
loadPage(page, config); loadPage(page, config);
@ -57,7 +57,7 @@
$('.librarySettingsForm').off('submit', onSubmit).on('submit', onSubmit); $('.librarySettingsForm').off('submit', onSubmit).on('submit', onSubmit);
ApiClient.getSystemInfo().done(function (systemInfo) { ApiClient.getSystemInfo().then(function (systemInfo) {
if (systemInfo.SupportsLibraryMonitor) { if (systemInfo.SupportsLibraryMonitor) {
page.querySelector('.fldLibraryMonitor').classList.remove('hide'); page.querySelector('.fldLibraryMonitor').classList.remove('hide');

View file

@ -16,18 +16,18 @@
registrationInfo = null; registrationInfo = null;
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getJSON(ApiClient.getUrl('LiveTv/Registration', { ApiClient.fetchJSON(ApiClient.getUrl('LiveTv/Registration', {
ProgramId: programId, ProgramId: programId,
Feature: 'seriesrecordings' Feature: 'seriesrecordings'
})).done(function (result) { })).then(function (result) {
lastRegId = programId; lastRegId = programId;
registrationInfo = result; registrationInfo = result;
deferred.resolveWith(null, [registrationInfo]); deferred.resolveWith(null, [registrationInfo]);
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
}).fail(function () { }, function () {
deferred.resolveWith(null, [ deferred.resolveWith(null, [
{ {

View file

@ -40,7 +40,7 @@
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
}); });
apiClient.getJSON(apiClient.getUrl('Branding/Configuration')).done(function (options) { apiClient.fetchJSON(apiClient.getUrl('Branding/Configuration')).then(function (options) {
$('.disclaimer', page).html(options.LoginDisclaimer || ''); $('.disclaimer', page).html(options.LoginDisclaimer || '');
}); });

View file

@ -6,7 +6,7 @@
var apiClient = ApiClient; var apiClient = ApiClient;
apiClient.getJSON(apiClient.getUrl('System/Logs')).done(function (logs) { apiClient.fetchJSON(apiClient.getUrl('System/Logs')).then(function (logs) {
var html = ''; var html = '';

View file

@ -38,6 +38,10 @@
return; return;
} }
if (self.isFullScreen()) {
self.exitFullScreen();
}
fadeOut(document.querySelector('#mediaPlayer')); fadeOut(document.querySelector('#mediaPlayer'));
$('#videoPlayer').removeClass('fullscreenVideo').removeClass('idlePlayer'); $('#videoPlayer').removeClass('fullscreenVideo').removeClass('idlePlayer');
$('.hiddenOnIdle').removeClass("inactive"); $('.hiddenOnIdle').removeClass("inactive");

View file

@ -628,12 +628,12 @@
subtitleStreamIndex = parseInt(subtitleStreamIndex); subtitleStreamIndex = parseInt(subtitleStreamIndex);
} }
MediaController.getPlaybackInfo(self.currentItem.Id, deviceProfile, ticks, self.currentMediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId).done(function (result) { MediaController.getPlaybackInfo(self.currentItem.Id, deviceProfile, ticks, self.currentMediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId).then(function (result) {
if (validatePlaybackInfoResult(result)) { if (validatePlaybackInfoResult(result)) {
self.currentMediaSource = result.MediaSources[0]; self.currentMediaSource = result.MediaSources[0];
self.createStreamInfo(self.currentItem.MediaType, self.currentItem, self.currentMediaSource, ticks).done(function (streamInfo) { self.createStreamInfo(self.currentItem.MediaType, self.currentItem, self.currentMediaSource, ticks).then(function (streamInfo) {
if (!streamInfo.url) { if (!streamInfo.url) {
MediaController.showPlaybackInfoErrorMessage('NoCompatibleStream'); MediaController.showPlaybackInfoErrorMessage('NoCompatibleStream');
@ -753,8 +753,6 @@
function translateItemsForPlayback(items) { function translateItemsForPlayback(items) {
var deferred = $.Deferred();
var firstItem = items[0]; var firstItem = items[0];
var promise; var promise;
@ -797,26 +795,31 @@
} }
if (promise) { if (promise) {
promise.done(function (result) { return new Promise(function (resolve, reject) {
deferred.resolveWith(null, [result.Items]); promise.then(function (result) {
resolve(result.Items);
});
}); });
} else { } else {
deferred.resolveWith(null, [items]);
}
return deferred.promise(); return new Promise(function (resolve, reject) {
resolve(items);
});
}
} }
self.play = function (options) { self.play = function (options) {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
if (options.items) { if (options.items) {
translateItemsForPlayback(options.items).done(function (items) { translateItemsForPlayback(options.items).then(function (items) {
self.playWithIntros(items, options, user); self.playWithIntros(items, options, user);
}); });
@ -827,9 +830,9 @@
Ids: options.ids.join(',') Ids: options.ids.join(',')
}).done(function (result) { }).then(function (result) {
translateItemsForPlayback(result.Items).done(function (items) { translateItemsForPlayback(result.Items).then(function (items) {
self.playWithIntros(items, options, user); self.playWithIntros(items, options, user);
}); });
@ -859,7 +862,7 @@
return; return;
} }
ApiClient.getJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/' + firstItem.Id + '/Intros')).done(function (intros) { ApiClient.fetchJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/' + firstItem.Id + '/Intros')).then(function (intros) {
items = intros.Items.concat(items); items = intros.Items.concat(items);
self.playInternal(items[0], options.startPositionTicks, function () { self.playInternal(items[0], options.startPositionTicks, function () {
@ -1077,7 +1080,7 @@
Dashboard.showModalLoadingMsg(); Dashboard.showModalLoadingMsg();
ApiClient.detectBitrate().done(function (bitrate) { ApiClient.detectBitrate().then(function (bitrate) {
Logger.log('Max bitrate auto detected to ' + bitrate); Logger.log('Max bitrate auto detected to ' + bitrate);
self.lastBitrateDetections[bitrateDetectionKey] = new Date().getTime(); self.lastBitrateDetections[bitrateDetectionKey] = new Date().getTime();
@ -1101,7 +1104,7 @@
Dashboard.showModalLoadingMsg(); Dashboard.showModalLoadingMsg();
} }
MediaController.getPlaybackInfo(item.Id, deviceProfile, startPosition).done(function (playbackInfoResult) { MediaController.getPlaybackInfo(item.Id, deviceProfile, startPosition).then(function (playbackInfoResult) {
if (validatePlaybackInfoResult(playbackInfoResult)) { if (validatePlaybackInfoResult(playbackInfoResult)) {
@ -1149,7 +1152,7 @@
if (item.MediaType === "Video") { if (item.MediaType === "Video") {
requirejs(['videorenderer'], function () { requirejs(['videorenderer', 'scripts/mediaplayer-video'], function () {
self.playVideo(item, self.currentMediaSource, startPosition, callback); self.playVideo(item, self.currentMediaSource, startPosition, callback);
}); });
@ -1209,17 +1212,16 @@
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
if (query.Ids && query.Ids.split(',').length == 1) { if (query.Ids && query.Ids.split(',').length == 1) {
var deferred = DeferredBuilder.Deferred();
ApiClient.getItem(userId, query.Ids.split(',')).done(function (item) { return new Promise(function (resolve, reject) {
deferred.resolveWith(null, [
{ ApiClient.getItem(userId, query.Ids.split(',')).then(function (item) {
resolve({
Items: [item], Items: [item],
TotalRecordCount: 1 TotalRecordCount: 1
}]);
}); });
});
return deferred.promise(); });
} }
else { else {
@ -1336,11 +1338,11 @@
return; return;
} }
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
if (options.items) { if (options.items) {
translateItemsForPlayback(options.items).done(function (items) { translateItemsForPlayback(options.items).then(function (items) {
self.queueItems(items); self.queueItems(items);
}); });
@ -1351,9 +1353,9 @@
Ids: options.ids.join(',') Ids: options.ids.join(',')
}).done(function (result) { }).then(function (result) {
translateItemsForPlayback(result.Items).done(function (items) { translateItemsForPlayback(result.Items).then(function (items) {
self.queueItems(items); self.queueItems(items);
}); });
@ -1370,7 +1372,7 @@
return; return;
} }
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
if (options.items) { if (options.items) {
@ -1382,7 +1384,7 @@
Ids: options.ids.join(',') Ids: options.ids.join(',')
}).done(function (result) { }).then(function (result) {
options.items = result.Items; options.items = result.Items;
@ -1480,7 +1482,7 @@
var userId = Dashboard.getCurrentUserId(); var userId = Dashboard.getCurrentUserId();
ApiClient.getItem(userId, id).done(function (item) { ApiClient.getItem(userId, id).then(function (item) {
var query = { var query = {
UserId: userId, UserId: userId,
@ -1511,7 +1513,7 @@
return; return;
} }
self.getItemsForPlayback(query).done(function (result) { self.getItemsForPlayback(query).then(function (result) {
self.play({ items: result.Items }); self.play({ items: result.Items });
@ -1530,7 +1532,7 @@
Fields: getItemFields, Fields: getItemFields,
Limit: itemLimit Limit: itemLimit
}).done(function (result) { }).then(function (result) {
self.play({ items: result.Items }); self.play({ items: result.Items });
@ -1571,10 +1573,9 @@
self.streamInfo = {}; self.streamInfo = {};
} }
if (self.isFullScreen()) { if (self.resetEnhancements) {
self.exitFullScreen();
}
self.resetEnhancements(); self.resetEnhancements();
}
}; };
self.isPlaying = function () { self.isPlaying = function () {
@ -1776,9 +1777,6 @@
if (item.MediaType == "Video") { if (item.MediaType == "Video") {
if (self.isFullScreen()) {
self.exitFullScreen();
}
self.resetEnhancements(); self.resetEnhancements();
} }
@ -1922,7 +1920,7 @@
function playAudioInternal(item, mediaSource, startPositionTicks) { function playAudioInternal(item, mediaSource, startPositionTicks) {
self.createStreamInfo('Audio', item, mediaSource, startPositionTicks).done(function (streamInfo) { self.createStreamInfo('Audio', item, mediaSource, startPositionTicks).then(function (streamInfo) {
self.startTimeTicksOffset = streamInfo.startTimeTicksOffset; self.startTimeTicksOffset = streamInfo.startTimeTicksOffset;
@ -1974,7 +1972,7 @@
self.currentMediaRenderer = mediaRenderer; self.currentMediaRenderer = mediaRenderer;
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks; self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
mediaRenderer.init().done(function () { mediaRenderer.init().then(function () {
// Set volume first to avoid an audible change // Set volume first to avoid an audible change
mediaRenderer.volume(initialVolume); mediaRenderer.volume(initialVolume);

View file

@ -101,7 +101,7 @@
var page = this; var page = this;
ApiClient.getServerConfiguration().done(function (configuration) { ApiClient.getServerConfiguration().then(function (configuration) {
loadAdvancedConfig(page, configuration); loadAdvancedConfig(page, configuration);
@ -170,7 +170,7 @@
function saveAdvancedConfig(form) { function saveAdvancedConfig(form) {
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
config.SaveMetadataHidden = $('#chkSaveMetadataHidden', form).checked(); config.SaveMetadataHidden = $('#chkSaveMetadataHidden', form).checked();

View file

@ -20,7 +20,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
config.ImageSavingConvention = $('#selectImageSavingConvention', form).val(); config.ImageSavingConvention = $('#selectImageSavingConvention', form).val();
@ -52,7 +52,7 @@
var allCultures; var allCultures;
var allCountries; var allCountries;
ApiClient.getServerConfiguration().done(function (result) { ApiClient.getServerConfiguration().then(function (result) {
config = result; config = result;
load(page, config, allCultures, allCountries); load(page, config, allCultures, allCountries);

View file

@ -27,12 +27,12 @@
currentType = type; currentType = type;
var promise1 = ApiClient.getServerConfiguration(); var promise1 = ApiClient.getServerConfiguration();
var promise2 = ApiClient.getJSON(ApiClient.getUrl("System/Configuration/MetadataPlugins")); var promise2 = ApiClient.fetchJSON(ApiClient.getUrl("System/Configuration/MetadataPlugins"));
$.when(promise1, promise2).done(function (response1, response2) { Promise.all([promise1, promise2]).then(function (responses) {
var config = response1[0]; var config = responses[0];
var metadataPlugins = response2[0]; var metadataPlugins = responses[1];
config = config.MetadataOptions.filter(function (c) { config = config.MetadataOptions.filter(function (c) {
return c.ItemType == type; return c.ItemType == type;
@ -46,7 +46,7 @@
} else { } else {
ApiClient.getJSON(ApiClient.getUrl("System/Configuration/MetadataOptions/Default")).done(function (defaultConfig) { ApiClient.fetchJSON(ApiClient.getUrl("System/Configuration/MetadataOptions/Default")).then(function (defaultConfig) {
config = defaultConfig; config = defaultConfig;
@ -490,7 +490,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
var type = currentType; var type = currentType;
@ -505,7 +505,7 @@
} else { } else {
ApiClient.getJSON(ApiClient.getUrl("System/Configuration/MetadataOptions/Default")).done(function (defaultOptions) { ApiClient.fetchJSON(ApiClient.getUrl("System/Configuration/MetadataOptions/Default")).then(function (defaultOptions) {
defaultOptions.ItemType = type; defaultOptions.ItemType = type;
config.MetadataOptions.push(defaultOptions); config.MetadataOptions.push(defaultOptions);

View file

@ -44,10 +44,10 @@
var promise1 = ApiClient.getItems(Dashboard.getCurrentUserId(), query); var promise1 = ApiClient.getItems(Dashboard.getCurrentUserId(), query);
var promise2 = Dashboard.getCurrentUser(); var promise2 = Dashboard.getCurrentUser();
$.when(promise1, promise2).done(function (response1, response2) { Promise.all([promise1, promise2]).then(function (responses) {
var result = response1[0]; var result = responses[0];
var user = response2[0]; var user = responses[1];
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -47,7 +47,7 @@
var query = getQuery(); var query = getQuery();
var view = getPageData().view; var view = getPageData().view;
ApiClient.getItems(userId, query).done(function (result) { ApiClient.getItems(userId, query).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -36,7 +36,7 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb" EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
}; };
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) { ApiClient.fetchJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
var view = getView(); var view = getView();
var html = ''; var html = '';
@ -93,7 +93,7 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb" EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
}; };
ApiClient.getItems(userId, options).done(function (result) { ApiClient.getItems(userId, options).then(function (result) {
if (result.Items.length) { if (result.Items.length) {
$('#resumableSection', page).show(); $('#resumableSection', page).show();
@ -216,7 +216,7 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb" EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
}); });
ApiClient.getJSON(url).done(function (recommendations) { ApiClient.fetchJSON(url).then(function (recommendations) {
if (!recommendations.length) { if (!recommendations.length) {
@ -355,7 +355,7 @@
if (parentId) { if (parentId) {
ApiClient.getItem(Dashboard.getCurrentUserId(), parentId).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), parentId).then(function (item) {
page.setAttribute('data-title', item.Name); page.setAttribute('data-title', item.Name);
LibraryMenu.setTitle(item.Name); LibraryMenu.setTitle(item.Name);

View file

@ -39,7 +39,7 @@
var query = getQuery(); var query = getQuery();
query.UserId = Dashboard.getCurrentUserId(); query.UserId = Dashboard.getCurrentUserId();
ApiClient.getJSON(ApiClient.getUrl('Trailers', query)).done(function (result) { ApiClient.fetchJSON(ApiClient.getUrl('Trailers', query)).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -43,7 +43,7 @@
var query = getQuery(); var query = getQuery();
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -40,7 +40,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
var query = getQuery(); var query = getQuery();
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -30,7 +30,7 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb" EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
}; };
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) { ApiClient.fetchJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
var elem = page.querySelector('#recentlyAddedSongs'); var elem = page.querySelector('#recentlyAddedSongs');
elem.innerHTML = LibraryBrowser.getPosterViewHtml({ elem.innerHTML = LibraryBrowser.getPosterViewHtml({
@ -70,7 +70,7 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb" EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
}; };
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
var elem; var elem;
@ -115,7 +115,7 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb" EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
}; };
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
var elem; var elem;
@ -158,7 +158,7 @@
Limit: itemsPerRow() Limit: itemsPerRow()
}; };
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
var elem; var elem;
@ -316,7 +316,7 @@
if (parentId) { if (parentId) {
ApiClient.getItem(Dashboard.getCurrentUserId(), parentId).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), parentId).then(function (item) {
page.setAttribute('data-title', item.Name); page.setAttribute('data-title', item.Name);
LibraryMenu.setTitle(item.Name); LibraryMenu.setTitle(item.Name);

View file

@ -27,7 +27,7 @@ pageIdOn('pageshow', 'myPreferencesMenuPage', function () {
page.querySelector('.lnkSync').classList.add('hide'); page.querySelector('.lnkSync').classList.add('hide');
} }
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
page.querySelector('.headerUser').innerHTML = user.Name; page.querySelector('.headerUser').innerHTML = user.Name;

View file

@ -140,15 +140,15 @@
sortBy: "SortName" sortBy: "SortName"
}); });
var promise2 = ApiClient.getUserViews({}, user.Id); var promise2 = ApiClient.getUserViews({}, user.Id);
var promise3 = ApiClient.getJSON(ApiClient.getUrl("Users/" + user.Id + "/SpecialViewOptions")); var promise3 = ApiClient.fetchJSON(ApiClient.getUrl("Users/" + user.Id + "/SpecialViewOptions"));
var promise4 = ApiClient.getJSON(ApiClient.getUrl("Users/" + user.Id + "/GroupingOptions")); var promise4 = ApiClient.fetchJSON(ApiClient.getUrl("Users/" + user.Id + "/GroupingOptions"));
$.when(promise1, promise2, promise3, promise4).done(function (r1, r2, r3, r4) { Promise.all([promise1, promise2, promise3, promise4]).then(function (responses) {
renderViews(page, user, r4[0]); renderViews(page, user, responses[3]);
renderLatestItems(page, user, r1[0]); renderLatestItems(page, user, responses[0]);
renderViewOrder(page, user, r2[0]); renderViewOrder(page, user, responses[1]);
renderViewStyles(page, user, r3[0]); renderViewStyles(page, user, responses[2]);
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
}); });

View file

@ -4,7 +4,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getJSON(ApiClient.getUrl("Notifications/Types")).done(function (list) { ApiClient.fetchJSON(ApiClient.getUrl("Notifications/Types")).then(function (list) {
var html = ''; var html = '';

View file

@ -452,7 +452,7 @@
nowPlayingImageElement.html(imgHtml); nowPlayingImageElement.html(imgHtml);
if (nowPlayingItem.Id) { if (nowPlayingItem.Id) {
ApiClient.getItem(Dashboard.getCurrentUserId(), nowPlayingItem.Id).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), nowPlayingItem.Id).then(function (item) {
nowPlayingUserData.html(LibraryBrowser.getUserDataIconsHtml(item, false)); nowPlayingUserData.html(LibraryBrowser.getUserDataIconsHtml(item, false));
}); });
} else { } else {

View file

@ -604,7 +604,7 @@
Backdrops.setBackdropUrl(page, backdropUrl); Backdrops.setBackdropUrl(page, backdropUrl);
} }
ApiClient.getItem(Dashboard.getCurrentUserId(), item.Id).done(function (fullItem) { ApiClient.getItem(Dashboard.getCurrentUserId(), item.Id).then(function (fullItem) {
page.querySelector('.nowPlayingPageUserDataButtons').innerHTML = LibraryBrowser.getUserDataIconsHtml(fullItem, false); page.querySelector('.nowPlayingPageUserDataButtons').innerHTML = LibraryBrowser.getUserDataIconsHtml(fullItem, false);
}); });
} else { } else {
@ -686,7 +686,7 @@
// EnableImageTypes: "Primary,Backdrop,Banner,Thumb", // EnableImageTypes: "Primary,Backdrop,Banner,Thumb",
// Limit: 100 // Limit: 100
//}).done(function (result) { //}).then(function (result) {
// html += LibraryBrowser.getListViewHtml({ // html += LibraryBrowser.getListViewHtml({
// items: result.Items, // items: result.Items,

View file

@ -38,7 +38,7 @@
var query = getQuery(tabIndex); var query = getQuery(tabIndex);
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);
@ -117,7 +117,7 @@
localQuery.Recursive = true; localQuery.Recursive = true;
localQuery.Filters = "IsNotFolder"; localQuery.Filters = "IsNotFolder";
ApiClient.getItems(userId, localQuery).done(function (result) { ApiClient.getItems(userId, localQuery).then(function (result) {
showSlideshow(page, result.Items, startItemId); showSlideshow(page, result.Items, startItemId);
}); });

View file

@ -14,7 +14,7 @@
var form = this; var form = this;
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
config.MinResumePct = $('#txtMinResumePct', form).val(); config.MinResumePct = $('#txtMinResumePct', form).val();
config.MaxResumePct = $('#txtMaxResumePct', form).val(); config.MaxResumePct = $('#txtMaxResumePct', form).val();
@ -37,7 +37,7 @@
var page = this; var page = this;
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
loadPage(page, config); loadPage(page, config);

View file

@ -41,7 +41,7 @@
query.UserId = Dashboard.getCurrentUserId(); query.UserId = Dashboard.getCurrentUserId();
ApiClient.getJSON(ApiClient.getUrl('Playlists/' + item.Id + '/Items', query)).done(function (result) { ApiClient.fetchJSON(ApiClient.getUrl('Playlists/' + item.Id + '/Items', query)).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -52,10 +52,10 @@
var promise1 = ApiClient.getItems(Dashboard.getCurrentUserId(), query); var promise1 = ApiClient.getItems(Dashboard.getCurrentUserId(), query);
var promise2 = Dashboard.getCurrentUser(); var promise2 = Dashboard.getCurrentUser();
$.when(promise1, promise2).done(function (response1, response2) { Promise.all([promise1, promise2]).then(function (responses) {
var result = response1[0]; var result = responses[0];
var user = response2[0]; var user = responses[1];
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -110,7 +110,7 @@
function renderPlugins(page, plugins, showNoPluginsMessage) { function renderPlugins(page, plugins, showNoPluginsMessage) {
ApiClient.getJSON(ApiClient.getUrl("dashboard/configurationpages") + "?pageType=PluginConfiguration").done(function (configPages) { ApiClient.fetchJSON(ApiClient.getUrl("dashboard/configurationpages") + "?pageType=PluginConfiguration").then(function (configPages) {
populateList(page, plugins, configPages, showNoPluginsMessage); populateList(page, plugins, configPages, showNoPluginsMessage);

View file

@ -131,14 +131,14 @@
function loadFilters(page, userId, itemQuery, reloadItemsFn) { function loadFilters(page, userId, itemQuery, reloadItemsFn) {
return ApiClient.getJSON(ApiClient.getUrl('Items/Filters', { return ApiClient.fetchJSON(ApiClient.getUrl('Items/Filters', {
UserId: userId, UserId: userId,
ParentId: itemQuery.ParentId, ParentId: itemQuery.ParentId,
IncludeItemTypes: itemQuery.IncludeItemTypes IncludeItemTypes: itemQuery.IncludeItemTypes
})).done(function (result) { })).then(function (result) {
renderFilters(page, result); renderFilters(page, result);

View file

@ -274,7 +274,7 @@
var url = ""; var url = "";
url = ApiClient.getUrl("Reports/Headers", query); url = ApiClient.getUrl("Reports/Headers", query);
ApiClient.getJSON(url).done(function (result) { ApiClient.fetchJSON(url).then(function (result) {
var selected = "None"; var selected = "None";
$('#selectReportGroup', page).find('option').remove().end(); $('#selectReportGroup', page).find('option').remove().end();
@ -438,7 +438,7 @@
break; break;
} }
ApiClient.getJSON(url).done(function (result) { ApiClient.fetchJSON(url).then(function (result) {
updateFilterControls(page); updateFilterControls(page);
renderItems(page, result); renderItems(page, result);
}); });
@ -1029,7 +1029,7 @@
function loadFilters(page, userId, itemQuery, reloadItemsFn) { function loadFilters(page, userId, itemQuery, reloadItemsFn) {
return ApiClient.getJSON(ApiClient.getUrl('Items/Filters', { return ApiClient.fetchJSON(ApiClient.getUrl('Items/Filters', {
UserId: userId, UserId: userId,
ParentId: itemQuery.ParentId, ParentId: itemQuery.ParentId,
@ -1037,7 +1037,7 @@
ReportView: itemQuery.ReportView ReportView: itemQuery.ReportView
})).done(function (result) { })).then(function (result) {
renderFilters(page, result); renderFilters(page, result);
@ -1047,13 +1047,13 @@
function loadColumns(page, userId, itemQuery, reloadItemsFn) { function loadColumns(page, userId, itemQuery, reloadItemsFn) {
return ApiClient.getJSON(ApiClient.getUrl('Reports/Headers', { return ApiClient.fetchJSON(ApiClient.getUrl('Reports/Headers', {
UserId: userId, UserId: userId,
IncludeItemTypes: itemQuery.IncludeItemTypes, IncludeItemTypes: itemQuery.IncludeItemTypes,
ReportView: itemQuery.ReportView ReportView: itemQuery.ReportView
})).done(function (result) { })).then(function (result) {
renderColumnss(page, result); renderColumnss(page, result);
var filters = ""; var filters = "";

View file

@ -12,7 +12,7 @@
EnableImages: false EnableImages: false
}; };
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
var html = result.Items.map(function (i) { var html = result.Items.map(function (i) {

View file

@ -90,7 +90,7 @@
var query = getQuery(parentItem); var query = getQuery(parentItem);
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);
@ -174,7 +174,7 @@
var page = this; var page = this;
if (getParameterByName('parentid')) { if (getParameterByName('parentid')) {
ApiClient.getItem(Dashboard.getCurrentUserId(), getParameterByName('parentid')).done(function (parent) { ApiClient.getItem(Dashboard.getCurrentUserId(), getParameterByName('parentid')).then(function (parent) {
LibraryMenu.setTitle(parent.Name); LibraryMenu.setTitle(parent.Name);
if (LibraryBrowser.needsRefresh(page)) { if (LibraryBrowser.needsRefresh(page)) {

View file

@ -191,7 +191,7 @@
EnableImageTypes: "Primary,Backdrop,Thumb" EnableImageTypes: "Primary,Backdrop,Thumb"
}; };
return ApiClient.getJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/Latest', options)).done(function (items) { return ApiClient.fetchJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/Latest', options)).then(function (items) {
var html = ''; var html = '';
@ -239,7 +239,7 @@
IncludeItemTypes: "Movie" IncludeItemTypes: "Movie"
}; };
return ApiClient.getJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/Latest', options)).done(function (items) { return ApiClient.fetchJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/Latest', options)).then(function (items) {
var html = ''; var html = '';
@ -282,7 +282,7 @@
IncludeItemTypes: "Episode" IncludeItemTypes: "Episode"
}; };
return ApiClient.getJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/Latest', options)).done(function (items) { return ApiClient.fetchJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/Latest', options)).then(function (items) {
var html = ''; var html = '';
@ -327,7 +327,7 @@
UserId: userId UserId: userId
}; };
return ApiClient.getJSON(ApiClient.getUrl("Channels/Items/Latest", options)).done(function (result) { return ApiClient.fetchJSON(ApiClient.getUrl("Channels/Items/Latest", options)).then(function (result) {
var html = ''; var html = '';
@ -429,7 +429,7 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb" EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
}; };
return ApiClient.getItems(userId, options).done(function (result) { return ApiClient.getItems(userId, options).then(function (result) {
var html = ''; var html = '';
@ -532,7 +532,7 @@
SupportsLatestItems: true SupportsLatestItems: true
}); });
return ApiClient.getJSON(ApiClient.getUrl("Channels", options)).done(function (result) { return ApiClient.fetchJSON(ApiClient.getUrl("Channels", options)).then(function (result) {
var channels = result.Items; var channels = result.Items;
@ -567,7 +567,7 @@
ChannelIds: channel.Id ChannelIds: channel.Id
}; };
ApiClient.getJSON(ApiClient.getUrl("Channels/Items/Latest", options)).done(function (result) { ApiClient.fetchJSON(ApiClient.getUrl("Channels/Items/Latest", options)).then(function (result) {
var html = ''; var html = '';

View file

@ -8,7 +8,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getJSON(ApiClient.getUrl('Social/Shares/Public/' + id + '/Item')).done(function (item) { ApiClient.fetchJSON(ApiClient.getUrl('Social/Shares/Public/' + id + '/Item')).then(function (item) {
reloadFromItem(page, item); reloadFromItem(page, item);
}); });

View file

@ -301,7 +301,7 @@ var Dashboard = {
Dashboard.hideDashboardVersionWarning(); Dashboard.hideDashboardVersionWarning();
Dashboard.getCurrentUser().done(function (currentUser) { Dashboard.getCurrentUser().then(function (currentUser) {
if (currentUser.Policy.IsAdministrator) { if (currentUser.Policy.IsAdministrator) {
Dashboard.showServerRestartWarning(info); Dashboard.showServerRestartWarning(info);
@ -766,7 +766,7 @@ var Dashboard = {
if (apiClient && apiClient.accessToken()) { if (apiClient && apiClient.accessToken()) {
if (AppInfo.enableFooterNotifications) { if (AppInfo.enableFooterNotifications) {
apiClient.getSystemInfo().done(function (info) { apiClient.getSystemInfo().then(function (info) {
Dashboard.updateSystemInfo(info); Dashboard.updateSystemInfo(info);
}); });
@ -795,7 +795,7 @@ var Dashboard = {
reloadPageWhenServerAvailable: function (retryCount) { reloadPageWhenServerAvailable: function (retryCount) {
// Don't use apiclient method because we don't want it reporting authentication under the old version // Don't use apiclient method because we don't want it reporting authentication under the old version
ApiClient.getJSON(ApiClient.getUrl("System/Info")).done(function (info) { ApiClient.fetchJSON(ApiClient.getUrl("System/Info")).then(function (info) {
// If this is back to false, the restart completed // If this is back to false, the restart completed
if (!info.HasPendingRestart) { if (!info.HasPendingRestart) {
@ -1220,7 +1220,7 @@ var Dashboard = {
} }
else if (msg.MessageType === "PackageInstallationCompleted") { else if (msg.MessageType === "PackageInstallationCompleted") {
Dashboard.getCurrentUser().done(function (currentUser) { Dashboard.getCurrentUser().then(function (currentUser) {
if (currentUser.Policy.IsAdministrator) { if (currentUser.Policy.IsAdministrator) {
Dashboard.showPackageInstallNotification(msg.Data, "completed"); Dashboard.showPackageInstallNotification(msg.Data, "completed");
@ -1229,7 +1229,7 @@ var Dashboard = {
}); });
} }
else if (msg.MessageType === "PackageInstallationFailed") { else if (msg.MessageType === "PackageInstallationFailed") {
Dashboard.getCurrentUser().done(function (currentUser) { Dashboard.getCurrentUser().then(function (currentUser) {
if (currentUser.Policy.IsAdministrator) { if (currentUser.Policy.IsAdministrator) {
Dashboard.showPackageInstallNotification(msg.Data, "failed"); Dashboard.showPackageInstallNotification(msg.Data, "failed");
@ -1238,7 +1238,7 @@ var Dashboard = {
}); });
} }
else if (msg.MessageType === "PackageInstallationCancelled") { else if (msg.MessageType === "PackageInstallationCancelled") {
Dashboard.getCurrentUser().done(function (currentUser) { Dashboard.getCurrentUser().then(function (currentUser) {
if (currentUser.Policy.IsAdministrator) { if (currentUser.Policy.IsAdministrator) {
Dashboard.showPackageInstallNotification(msg.Data, "cancelled"); Dashboard.showPackageInstallNotification(msg.Data, "cancelled");
@ -1247,7 +1247,7 @@ var Dashboard = {
}); });
} }
else if (msg.MessaapiclientcgeType === "PackageInstalling") { else if (msg.MessaapiclientcgeType === "PackageInstalling") {
Dashboard.getCurrentUser().done(function (currentUser) { Dashboard.getCurrentUser().then(function (currentUser) {
if (currentUser.Policy.IsAdministrator) { if (currentUser.Policy.IsAdministrator) {
Dashboard.showPackageInstallNotification(msg.Data, "progress"); Dashboard.showPackageInstallNotification(msg.Data, "progress");
@ -1293,7 +1293,7 @@ var Dashboard = {
return; return;
} }
ApiClient.getItem(Dashboard.getCurrentUserId(), cmd.ItemId).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), cmd.ItemId).then(function (item) {
Dashboard.navigate(LibraryBrowser.getHref(item, null, '')); Dashboard.navigate(LibraryBrowser.getHref(item, null, ''));
@ -1378,7 +1378,7 @@ var Dashboard = {
ImageTypes: "Primary", ImageTypes: "Primary",
Ids: newItems.join(',') Ids: newItems.join(',')
}).done(function (result) { }).then(function (result) {
var items = result.Items; var items = result.Items;
@ -2381,20 +2381,18 @@ var AppInfo = {};
deps.push('scripts/search'); deps.push('scripts/search');
deps.push('scripts/librarylist'); deps.push('scripts/librarylist');
deps.push('scripts/notifications'); deps.push('scripts/notifications');
deps.push('scripts/alphapicker');
require(deps, function () { require(deps, function () {
$.mobile.initializePage(); $.mobile.initializePage();
promiseResolve(); promiseResolve();
require(['scripts/mediaplayer-video']); require(['scripts/thememediaplayer']);
}); });
if (AppInfo.enableNowPlayingBar) { if (AppInfo.enableNowPlayingBar) {
require(['scripts/nowplayingbar']); require(['scripts/nowplayingbar']);
} }
require(['scripts/alphapicker']);
require(['scripts/thememediaplayer']);
} }
function loadImageCache() { function loadImageCache() {
@ -2551,7 +2549,7 @@ pageClassOn('pageshow', "page", function () {
Dashboard.ensureToolsMenu(page); Dashboard.ensureToolsMenu(page);
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
if (!user.Policy.IsAdministrator) { if (!user.Policy.IsAdministrator) {
Dashboard.logout(); Dashboard.logout();

View file

@ -91,7 +91,7 @@
}, query); }, query);
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
if (result.Items.length) { if (result.Items.length) {
createElements(); createElements();

View file

@ -43,7 +43,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
var query = getQuery(); var query = getQuery();
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -12,7 +12,7 @@
var form = this; var form = this;
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
config.RemoteClientBitrateLimit = parseInt(parseFloat(($('#txtRemoteClientBitrateLimit', form).val() || '0')) * 1000000); config.RemoteClientBitrateLimit = parseInt(parseFloat(($('#txtRemoteClientBitrateLimit', form).val() || '0')) * 1000000);
@ -58,7 +58,7 @@
var page = this; var page = this;
ApiClient.getServerConfiguration().done(function (config) { ApiClient.getServerConfiguration().then(function (config) {
loadPage(page, config); loadPage(page, config);

View file

@ -257,7 +257,7 @@ $(document).on('pageshow', "#supporterKeyPage", SupporterKeyPage.onPageShow);
function loadUserInfo(page) { function loadUserInfo(page) {
ApiClient.getJSON(ApiClient.getUrl('System/SupporterInfo')).done(function (info) { ApiClient.fetchJSON(ApiClient.getUrl('System/SupporterInfo')).then(function (info) {
if (info.IsActiveSupporter) { if (info.IsActiveSupporter) {
$('.supporterContainer', page).addClass('hide'); $('.supporterContainer', page).addClass('hide');

View file

@ -217,7 +217,7 @@
Category: options.Category Category: options.Category
}; };
ApiClient.getJSON(ApiClient.getUrl('Sync/Options', dialogOptionsQuery)).done(function (dialogOptions) { ApiClient.fetchJSON(ApiClient.getUrl('Sync/Options', dialogOptionsQuery)).then(function (dialogOptions) {
currentDialogOptions = dialogOptions; currentDialogOptions = dialogOptions;
@ -385,7 +385,7 @@
return; return;
} }
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
var item = { var item = {
SupportsSync: true SupportsSync: true

View file

@ -315,7 +315,7 @@
var options = {}; var options = {};
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
if ($(page).hasClass('mySyncPage')) { if ($(page).hasClass('mySyncPage')) {
options.UserId = Dashboard.getCurrentUserId(); options.UserId = Dashboard.getCurrentUserId();
@ -325,7 +325,7 @@
} }
} }
ApiClient.getJSON(ApiClient.getUrl('Sync/Jobs', options)).done(function (response) { ApiClient.fetchJSON(ApiClient.getUrl('Sync/Jobs', options)).then(function (response) {
loadData(page, response.Items); loadData(page, response.Items);
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();

View file

@ -288,9 +288,9 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
var id = getParameterByName('id'); var id = getParameterByName('id');
ApiClient.getJSON(ApiClient.getUrl('Sync/Jobs/' + id)).done(function (job) { ApiClient.fetchJSON(ApiClient.getUrl('Sync/Jobs/' + id)).then(function (job) {
ApiClient.getJSON(ApiClient.getUrl('Sync/Options', { ApiClient.fetchJSON(ApiClient.getUrl('Sync/Options', {
UserId: job.UserId, UserId: job.UserId,
ItemIds: (job.RequestedItemIds && job.RequestedItemIds.length ? job.RequestedItemIds.join('') : null), ItemIds: (job.RequestedItemIds && job.RequestedItemIds.length ? job.RequestedItemIds.join('') : null),
@ -299,7 +299,7 @@
Category: job.Category, Category: job.Category,
TargetId: job.TargetId TargetId: job.TargetId
})).done(function (options) { })).then(function (options) {
_jobOptions = options; _jobOptions = options;
renderJob(page, job, options); renderJob(page, job, options);
@ -307,12 +307,12 @@
}); });
}); });
ApiClient.getJSON(ApiClient.getUrl('Sync/JobItems', { ApiClient.fetchJSON(ApiClient.getUrl('Sync/JobItems', {
JobId: id, JobId: id,
AddMetadata: true AddMetadata: true
})).done(function (result) { })).then(function (result) {
renderJobItems(page, result.Items); renderJobItems(page, result.Items);
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
@ -331,7 +331,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
var id = getParameterByName('id'); var id = getParameterByName('id');
ApiClient.getJSON(ApiClient.getUrl('Sync/Jobs/' + id)).done(function (job) { ApiClient.fetchJSON(ApiClient.getUrl('Sync/Jobs/' + id)).then(function (job) {
SyncManager.setJobValues(job, page); SyncManager.setJobValues(job, page);

View file

@ -29,7 +29,7 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb" EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
}; };
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) { ApiClient.fetchJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
var view = getView(); var view = getView();
var html = ''; var html = '';

View file

@ -122,7 +122,7 @@
EnableImageTypes: "Primary,Backdrop,Banner,Thumb" EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
}; };
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
if (result.Items.length) { if (result.Items.length) {
$('#resumableSection', page).show(); $('#resumableSection', page).show();
@ -285,7 +285,7 @@
if (parentId) { if (parentId) {
ApiClient.getItem(Dashboard.getCurrentUserId(), parentId).done(function (item) { ApiClient.getItem(Dashboard.getCurrentUserId(), parentId).then(function (item) {
page.setAttribute('data-title', item.Name); page.setAttribute('data-title', item.Name);
LibraryMenu.setTitle(item.Name); LibraryMenu.setTitle(item.Name);

View file

@ -44,7 +44,7 @@
var query = getQuery(); var query = getQuery();
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
// Scroll back up so they can see the results from the beginning // Scroll back up so they can see the results from the beginning
window.scrollTo(0, 0); window.scrollTo(0, 0);

View file

@ -19,7 +19,7 @@
query.ParentId = LibraryMenu.getTopParentId(); query.ParentId = LibraryMenu.getTopParentId();
ApiClient.getJSON(ApiClient.getUrl("Shows/Upcoming", query)).done(function (result) { ApiClient.fetchJSON(ApiClient.getUrl("Shows/Upcoming", query)).then(function (result) {
var items = result.Items; var items = result.Items;

View file

@ -348,12 +348,12 @@
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
}); });
ApiClient.getJSON(ApiClient.getUrl('Connect/Pending')).done(function (pending) { ApiClient.fetchJSON(ApiClient.getUrl('Connect/Pending')).then(function (pending) {
renderPendingGuests(page, pending); renderPendingGuests(page, pending);
}); });
ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", { IsHidden: false })).done(function (result) { ApiClient.fetchJSON(ApiClient.getUrl("Library/MediaFolders", { IsHidden: false })).then(function (result) {
renderLibrarySharingList(page, result); renderLibrarySharingList(page, result);
}); });
@ -363,7 +363,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getJSON(ApiClient.getUrl("Channels", {})).done(function (channelsResult) { ApiClient.fetchJSON(ApiClient.getUrl("Channels", {})).then(function (channelsResult) {
var shareExcludes = $(".chkShareFolder:checked", page).get().map(function (i) { var shareExcludes = $(".chkShareFolder:checked", page).get().map(function (i) {
@ -425,7 +425,7 @@
function showInvitePopup(page) { function showInvitePopup(page) {
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().then(function (user) {
if (user.ConnectUserId) { if (user.ConnectUserId) {

View file

@ -8,7 +8,7 @@
var apiClient = ApiClient; var apiClient = ApiClient;
apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).done(function (config) { apiClient.fetchJSON(apiClient.getUrl('Startup/Configuration')).then(function (config) {
var providerId = null; var providerId = null;
@ -58,7 +58,7 @@
function skip() { function skip() {
var apiClient = ApiClient; var apiClient = ApiClient;
apiClient.getJSON(apiClient.getUrl('Startup/Info')).done(function (info) { apiClient.fetchJSON(apiClient.getUrl('Startup/Info')).then(function (info) {
if (info.SupportsRunningAsService) { if (info.SupportsRunningAsService) {
Dashboard.navigate('wizardservice.html'); Dashboard.navigate('wizardservice.html');

View file

@ -7,7 +7,7 @@
var apiClient = ApiClient; var apiClient = ApiClient;
// After saving chapter task, now save server config // After saving chapter task, now save server config
apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).done(function (config) { apiClient.fetchJSON(apiClient.getUrl('Startup/Configuration')).then(function (config) {
config.LiveTvTunerType = $('#selectTunerType', page).val(); config.LiveTvTunerType = $('#selectTunerType', page).val();
config.LiveTvTunerPath = $('.txtDevicePath', page).val(); config.LiveTvTunerPath = $('.txtDevicePath', page).val();
@ -41,7 +41,7 @@
var apiClient = ApiClient; var apiClient = ApiClient;
apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).done(function (config) { apiClient.fetchJSON(apiClient.getUrl('Startup/Configuration')).then(function (config) {
$('#selectTunerType', page).val(config.LiveTvTunerType || 'hdhomerun'); $('#selectTunerType', page).val(config.LiveTvTunerType || 'hdhomerun');
page.querySelector('.txtDevicePath').value = config.LiveTvTunerPath || ''; page.querySelector('.txtDevicePath').value = config.LiveTvTunerPath || '';
@ -62,7 +62,7 @@
function skip() { function skip() {
var apiClient = ApiClient; var apiClient = ApiClient;
apiClient.getJSON(apiClient.getUrl('Startup/Info')).done(function (info) { apiClient.fetchJSON(apiClient.getUrl('Startup/Info')).then(function (info) {
if (info.SupportsRunningAsService) { if (info.SupportsRunningAsService) {
Dashboard.navigate('wizardservice.html'); Dashboard.navigate('wizardservice.html');

View file

@ -7,7 +7,7 @@
var apiClient = ApiClient; var apiClient = ApiClient;
// After saving chapter task, now save server config // After saving chapter task, now save server config
apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).done(function (config) { apiClient.fetchJSON(apiClient.getUrl('Startup/Configuration')).then(function (config) {
config.PreferredMetadataLanguage = $('#selectLanguage', page).val(); config.PreferredMetadataLanguage = $('#selectLanguage', page).val();
config.MetadataCountryCode = $('#selectCountry', page).val(); config.MetadataCountryCode = $('#selectCountry', page).val();

View file

@ -17,7 +17,7 @@
var apiClient = ApiClient; var apiClient = ApiClient;
apiClient.getJSON(apiClient.getUrl('Startup/Configuration')).done(function (config) { apiClient.fetchJSON(apiClient.getUrl('Startup/Configuration')).then(function (config) {
config.UICulture = $('#selectLocalizationLanguage', page).val(); config.UICulture = $('#selectLocalizationLanguage', page).val();

View file

@ -77,7 +77,7 @@
var apiClient = getApiClient(); var apiClient = getApiClient();
apiClient.getJSON(apiClient.getUrl('Startup/User')).done(function (user) { apiClient.fetchJSON(apiClient.getUrl('Startup/User')).then(function (user) {
page.querySelector('#txtUsername').value = user.Name; page.querySelector('#txtUsername').value = user.Name;
page.querySelector('#txtConnectUserName').value = user.ConnectUserName; page.querySelector('#txtConnectUserName').value = user.ConnectUserName;

View file

@ -178,7 +178,7 @@
query.IncludeItemTypes = result.itemType; query.IncludeItemTypes = result.itemType;
} }
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (queryResult) { ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (queryResult) {
playItems(queryResult.Items, shuffle); playItems(queryResult.Items, shuffle);
}); });