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

move completely to fetch

This commit is contained in:
Luke Pulverenti 2015-11-28 03:07:44 -05:00
parent ee899a7332
commit 9932bc3eb5
168 changed files with 948 additions and 945 deletions

View file

@ -33,7 +33,7 @@
url: url,
dataType: "json"
}).done(function (result) {
}).then(function (result) {
Dashboard.hideLoadingMsg();
@ -67,7 +67,7 @@
type: "POST",
url: url
}).done(function () {
}).then(function () {
Dashboard.hideLoadingMsg();

View file

@ -53,7 +53,7 @@
parentPathPromise = parentPathPromise.promise();
}
$.when(promise, parentPathPromise).done(function (response1, response2) {
$.when(promise, parentPathPromise).then(function (response1, response2) {
var folders = response1[0];
var parentPath = response2 && response2.length ? response2[0] || '' : '';
@ -84,7 +84,7 @@
Dashboard.hideLoadingMsg();
}).fail(function () {
}, function () {
$('#txtDirectoryPickerPath', page).val("");
$('.results', page).html('');
@ -211,7 +211,7 @@
fileOptions.includeFiles = options.includeFiles;
}
getSystemInfo().done(function (systemInfo) {
getSystemInfo().then(function (systemInfo) {
require(['components/paperdialoghelper'], function () {

View file

@ -38,7 +38,7 @@
options.ProviderName = provider;
}
ApiClient.getAvailableRemoteImages(options).done(function (result) {
ApiClient.getAvailableRemoteImages(options).then(function (result) {
renderRemoteImages(page, result, browsableImageType, options.startIndex, options.limit);
@ -125,7 +125,7 @@
Dashboard.showLoadingMsg();
ApiClient.downloadRemoteImage(options).done(function () {
ApiClient.downloadRemoteImage(options).then(function () {
hasChanges = true;
var dlg = $(page).parents('paper-dialog')[0];
@ -260,13 +260,12 @@
Dashboard.showLoadingMsg();
HttpClient.send({
var xhr = new XMLHttpRequest();
xhr.open('GET', 'components/imagedownloader/imagedownloader.template.html', true);
type: 'GET',
url: 'components/imagedownloader/imagedownloader.template.html'
}).done(function (template) {
xhr.onload = function (e) {
var template = this.response;
currentItemId = itemId;
currentItemType = itemType;
@ -299,7 +298,9 @@
});
reloadBrowsableImages(editorContent);
});
}
xhr.send();
}
function onDialogClosed() {

View file

@ -31,7 +31,7 @@
currentItem = item;
ApiClient.getRemoteImageProviders(getBaseRemoteOptions()).done(function (providers) {
ApiClient.getRemoteImageProviders(getBaseRemoteOptions()).then(function (providers) {
if (providers.length) {
$('.btnBrowseAllImages', page).removeClass('hide');
@ -39,7 +39,7 @@
$('.btnBrowseAllImages', page).addClass('hide');
}
ApiClient.getItemImageInfos(currentItem.Id).done(function (imageInfos) {
ApiClient.getItemImageInfos(currentItem.Id).then(function (imageInfos) {
renderStandardImages(page, item, imageInfos, providers);
renderBackdrops(page, item, imageInfos, providers);
@ -122,7 +122,7 @@
Dashboard.confirm(Globalize.translate('DeleteImageConfirmation'), Globalize.translate('HeaderDeleteImage'), function (result) {
if (result) {
ApiClient.deleteItemImage(currentItem.Id, type, index).done(function () {
ApiClient.deleteItemImage(currentItem.Id, type, index).then(function () {
hasChanges = true;
reload(page);
@ -137,7 +137,7 @@
var type = this.getAttribute('data-imagetype');
var index = parseInt(this.getAttribute('data-index'));
var newIndex = parseInt(this.getAttribute('data-newindex'));
ApiClient.updateItemImageIndex(currentItem.Id, type, index, newIndex).done(function () {
ApiClient.updateItemImageIndex(currentItem.Id, type, index, newIndex).then(function () {
hasChanges = true;
reload(page);
@ -192,7 +192,7 @@
function showImageDownloader(page, imageType) {
require(['components/imagedownloader/imagedownloader'], function () {
ImageDownloader.show(currentItem.Id, currentItem.Type, imageType).done(function (hasChanged) {
ImageDownloader.show(currentItem.Id, currentItem.Type, imageType).then(function (hasChanged) {
if (hasChanged) {
hasChanges = true;
@ -212,7 +212,7 @@
theme: options.theme
}).done(function (hasChanged) {
}).then(function (hasChanged) {
if (hasChanged) {
hasChanges = true;
@ -233,13 +233,12 @@
Dashboard.showLoadingMsg();
HttpClient.send({
var xhr = new XMLHttpRequest();
xhr.open('GET', 'components/imageeditor/imageeditor.template.html', true);
type: 'GET',
url: 'components/imageeditor/imageeditor.template.html'
}).done(function (template) {
xhr.onload = function (e) {
var template = this.response;
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
var dlg = PaperDialogHelper.createDialog({
@ -269,12 +268,14 @@
var editorContent = dlg.querySelector('.editorContent');
reload(editorContent, item);
$('.btnCloseDialog', dlg).on('click', function() {
$('.btnCloseDialog', dlg).on('click', function () {
PaperDialogHelper.close(dlg);
});
});
});
}
xhr.send();
}
function onDialogClosed() {

View file

@ -85,7 +85,7 @@
var imageType = $('#selectImageType', page).val();
ApiClient.uploadItemImage(currentItemId, imageType, file).done(function () {
ApiClient.uploadItemImage(currentItemId, imageType, file).then(function () {
$('#uploadImage', page).val('').trigger('change');
Dashboard.hideLoadingMsg();
@ -125,13 +125,12 @@
options = options || {};
HttpClient.send({
var xhr = new XMLHttpRequest();
xhr.open('GET', 'components/imageuploader/imageuploader.template.html', true);
type: 'GET',
url: 'components/imageuploader/imageuploader.template.html'
}).done(function (template) {
xhr.onload = function (e) {
var template = this.response;
currentItemId = itemId;
var dlg = PaperDialogHelper.createDialog({
@ -163,7 +162,9 @@
PaperDialogHelper.close(dlg);
});
});
}
xhr.send();
}
function onDialogClosed() {

View file

@ -69,7 +69,7 @@
data: JSON.stringify(lookupInfo),
contentType: "application/json"
}).done(function (results) {
}).then(function (results) {
Dashboard.hideLoadingMsg();
showIdentificationSearchResults(page, results);
@ -213,14 +213,14 @@
data: JSON.stringify(currentSearchResult),
contentType: "application/json"
}).done(function () {
}).then(function () {
hasChanges = true;
Dashboard.hideLoadingMsg();
PaperDialogHelper.close(document.querySelector('.identifyDialog'));
}).fail(function () {
}, function () {
Dashboard.hideLoadingMsg();
@ -236,7 +236,7 @@
function showIdentificationForm(page, item) {
ApiClient.fetchJSON(ApiClient.getUrl("Items/" + item.Id + "/ExternalIdInfos")).then(function (idList) {
ApiClient.getJSON(ApiClient.getUrl("Items/" + item.Id + "/ExternalIdInfos")).then(function (idList) {
var html = '';
@ -281,13 +281,12 @@
Dashboard.showLoadingMsg();
HttpClient.send({
var xhr = new XMLHttpRequest();
xhr.open('GET', 'components/itemidentifier/itemidentifier.template.html', true);
type: 'GET',
url: 'components/itemidentifier/itemidentifier.template.html'
}).done(function (template) {
xhr.onload = function (e) {
var template = this.response;
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
currentItem = item;
@ -325,7 +324,9 @@
showIdentificationForm(dlg, item);
Dashboard.hideLoadingMsg();
});
});
}
xhr.send();
}
function onDialogClosed() {

View file

@ -24,12 +24,12 @@
type = null;
}
ApiClient.addVirtualFolder(name, type, currentOptions.refresh, paths).done(function () {
ApiClient.addVirtualFolder(name, type, currentOptions.refresh, paths).then(function () {
hasChanges = true;
PaperDialogHelper.close(dlg);
}).fail(function () {
}, function () {
Dashboard.alert(Globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
});
@ -188,13 +188,12 @@
require(['components/paperdialoghelper'], function () {
HttpClient.send({
var xhr = new XMLHttpRequest();
xhr.open('GET', 'components/medialibrarycreator/medialibrarycreator.template.html', true);
type: 'GET',
url: 'components/medialibrarycreator/medialibrarycreator.template.html'
}).done(function (template) {
xhr.onload = function (e) {
var template = this.response;
var dlg = PaperDialogHelper.createDialog({
size: 'small',
theme: 'a',
@ -233,7 +232,9 @@
paths = [];
renderPaths(editorContent);
});
}
xhr.send();
});

View file

@ -10,12 +10,12 @@
var refreshAfterChange = currentOptions.refresh;
ApiClient.addMediaPath(virtualFolder.Name, path, refreshAfterChange).done(function () {
ApiClient.addMediaPath(virtualFolder.Name, path, refreshAfterChange).then(function () {
hasChanges = true;
refreshLibraryFromServer(page);
}).fail(function () {
}, function () {
Dashboard.alert(Globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
});
@ -36,12 +36,12 @@
var refreshAfterChange = currentOptions.refresh;
ApiClient.removeMediaPath(virtualFolder.Name, location, refreshAfterChange).done(function () {
ApiClient.removeMediaPath(virtualFolder.Name, location, refreshAfterChange).then(function () {
hasChanges = true;
refreshLibraryFromServer($(button).parents('.editorContent')[0]);
}).fail(function () {
}, function () {
Dashboard.alert(Globalize.translate('DefaultErrorMessage'));
});
@ -70,7 +70,7 @@
function refreshLibraryFromServer(page) {
ApiClient.getVirtualFolders().done(function (result) {
ApiClient.getVirtualFolders().then(function (result) {
var library = result.filter(function (f) {
@ -142,13 +142,12 @@
require(['components/paperdialoghelper'], function () {
HttpClient.send({
var xhr = new XMLHttpRequest();
xhr.open('GET', 'components/medialibraryeditor/medialibraryeditor.template.html', true);
type: 'GET',
url: 'components/medialibraryeditor/medialibraryeditor.template.html'
}).done(function (template) {
xhr.onload = function (e) {
var template = this.response;
var dlg = PaperDialogHelper.createDialog({
size: 'small',
theme: 'a',
@ -184,7 +183,9 @@
});
refreshLibraryFromServer(editorContent);
});
}
xhr.send();
});

View file

@ -39,13 +39,12 @@
Dashboard.showLoadingMsg();
HttpClient.send({
var xhr = new XMLHttpRequest();
xhr.open('GET', 'components/metadataeditor/metadataeditor.template.html', true);
type: 'GET',
url: 'components/metadataeditor/metadataeditor.template.html'
}).done(function (template) {
xhr.onload = function (e) {
var template = this.response;
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
var dlg = document.createElement('paper-dialog');
@ -88,7 +87,9 @@
PaperDialogHelper.close(dlg);
});
});
});
}
xhr.send();
}
function onDialogClosed() {

View file

@ -46,7 +46,7 @@
url: url,
dataType: "json"
}).done(function (result) {
}).then(function (result) {
Dashboard.hideLoadingMsg();
@ -69,7 +69,7 @@
type: "POST",
url: url
}).done(function () {
}).then(function () {
Dashboard.hideLoadingMsg();

View file

@ -35,7 +35,7 @@
var url = 'Providers/Subtitles/Subtitles/' + id;
ApiClient.get(ApiClient.getUrl(url)).done(function (result) {
ApiClient.get(ApiClient.getUrl(url)).then(function (result) {
$('.subtitleContent', page).html(result);
@ -54,7 +54,7 @@
type: "POST",
url: ApiClient.getUrl(url)
}).done(function () {
}).then(function () {
Dashboard.alert(Globalize.translate('MessageDownloadQueued'));
});
@ -78,7 +78,7 @@
type: "DELETE",
url: ApiClient.getUrl(url)
}).done(function () {
}).then(function () {
reload(page, itemId);
});
@ -291,7 +291,7 @@
var url = ApiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language);
ApiClient.fetchJSON(url).then(function (results) {
ApiClient.getJSON(url).then(function (results) {
renderSearchResults(page, results);
});
@ -331,13 +331,12 @@
Dashboard.showLoadingMsg();
HttpClient.send({
var xhr = new XMLHttpRequest();
xhr.open('GET', 'components/subtitleeditor/subtitleeditor.template.html', true);
type: 'GET',
url: 'components/subtitleeditor/subtitleeditor.template.html'
}).done(function (template) {
xhr.onload = function (e) {
var template = this.response;
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
var dlg = PaperDialogHelper.createDialog();
@ -365,7 +364,7 @@
var editorContent = dlg.querySelector('.editorContent');
reload(editorContent, item);
ApiClient.getCultures().done(function (languages) {
ApiClient.getCultures().then(function (languages) {
fillLanguages(editorContent, languages);
});
@ -375,7 +374,9 @@
PaperDialogHelper.close(dlg);
});
});
});
}
xhr.send();
}
function onDialogClosed() {

View file

@ -67,7 +67,7 @@
var nextDay = new Date(date.getTime() + msPerDay - 2000);
Logger.log(nextDay);
channelsPromise.done(function (channelsResult) {
channelsPromise.then(function (channelsResult) {
ApiClient.getLiveTvPrograms({
UserId: Dashboard.getCurrentUserId(),
@ -80,7 +80,7 @@
EnableImages: false,
SortBy: "StartDate"
}).done(function (programsResult) {
}).then(function (programsResult) {
renderGuide(page, date, channelsResult.Items, programsResult.Items);
@ -424,7 +424,7 @@
channelLimit = limit;
ApiClient.getLiveTvGuideInfo().done(function (guideInfo) {
ApiClient.getLiveTvGuideInfo().then(function (guideInfo) {
setDateRange(page, guideInfo);
});
@ -434,11 +434,11 @@
$('.guideRequiresUnlock', page).hide();
RegistrationServices.validateFeature('livetv').done(function () {
RegistrationServices.validateFeature('livetv').then(function () {
Dashboard.showModalLoadingMsg();
reloadPageAfterValidation(page, 1000);
}).fail(function () {
}, function () {
Dashboard.showModalLoadingMsg();
@ -469,13 +469,12 @@
});
}
HttpClient.send({
var xhr = new XMLHttpRequest();
xhr.open('GET', 'components/tvguide/tvguide.template.html', true);
type: 'GET',
url: 'components/tvguide/tvguide.template.html'
}).done(function (template) {
xhr.onload = function (e) {
var template = this.response;
var tabContent = options.element;
tabContent.innerHTML = Globalize.translateDocument(template);
@ -517,6 +516,8 @@
});
self.refresh();
});
}
xhr.send();
};
});

View file

@ -10,7 +10,7 @@
Dashboard.showLoadingMsg();
ApiClient.getNamedConfiguration("livetv").done(function (config) {
ApiClient.getNamedConfiguration("livetv").then(function (config) {
var info = config.ListingProviders.filter(function (i) {
return i.Id == providerId;
@ -35,7 +35,7 @@
function setCountry(info) {
ApiClient.fetchJSON(ApiClient.getUrl('LiveTv/ListingProviders/SchedulesDirect/Countries')).then(function (result) {
ApiClient.getJSON(ApiClient.getUrl('LiveTv/ListingProviders/SchedulesDirect/Countries')).then(function (result) {
var countryList = [];
var i, length;
@ -108,13 +108,13 @@
data: JSON.stringify(info),
contentType: "application/json"
}).done(function (result) {
}).then(function (result) {
Dashboard.processServerConfigurationUpdateResult();
providerId = result.Id;
reload();
}).fail(function () {
}, function () {
Dashboard.alert({
message: Globalize.translate('ErrorSavingTvProvider')
});
@ -137,7 +137,7 @@
var id = providerId;
ApiClient.getNamedConfiguration("livetv").done(function (config) {
ApiClient.getNamedConfiguration("livetv").then(function (config) {
var info = config.ListingProviders.filter(function (i) {
return i.Id == id;
@ -155,7 +155,7 @@
data: JSON.stringify(info),
contentType: "application/json"
}).done(function (result) {
}).then(function (result) {
Dashboard.hideLoadingMsg();
if (options.showConfirmation !== false) {
@ -163,7 +163,7 @@
}
$(self).trigger('submitted');
}).fail(function () {
}, function () {
Dashboard.hideLoadingMsg();
Dashboard.alert({
message: Globalize.translate('ErrorAddingListingsToSchedulesDirect')
@ -191,7 +191,7 @@
}),
dataType: 'json'
}).done(function (result) {
}).then(function (result) {
$('#selectListing', page).html(result.map(function (o) {
@ -205,7 +205,7 @@
Dashboard.hideModalLoadingMsg();
}).fail(function (result) {
}, function (result) {
Dashboard.alert({
message: Globalize.translate('ErrorGettingTvLineups')