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

update image editor

This commit is contained in:
Luke Pulverenti 2015-09-17 17:26:06 -04:00
parent c5bfd529a2
commit c64aedc131
6 changed files with 64 additions and 24 deletions

View file

@ -234,7 +234,10 @@
require(['localassetmanager'], function () { require(['localassetmanager'], function () {
var url = apiClient.getUrl("Sync/JobItems/" + jobItem.SyncJobItemId + "/File"); var url = apiClient.getUrl("Sync/JobItems/" + jobItem.SyncJobItemId + "/File", {
api_key: apiClient.accessToken()
});
var localPath = localItem.LocalPath; var localPath = localItem.LocalPath;
Logger.log('Downloading media. Url: ' + url + '. Local path: ' + localPath); Logger.log('Downloading media. Url: ' + url + '. Local path: ' + localPath);
@ -337,7 +340,8 @@
var imageUrl = apiClient.getImageUrl(itemId, { var imageUrl = apiClient.getImageUrl(itemId, {
Tag: imageTag, Tag: imageTag,
ImageType: imageType ImageType: imageType,
api_key: apiClient.accessToken()
}); });
LocalAssetManager.downloadImage(imageUrl, serverId, itemId, imageTag).done(function () { LocalAssetManager.downloadImage(imageUrl, serverId, itemId, imageTag).done(function () {
@ -414,7 +418,8 @@
} }
var url = apiClient.getUrl("Sync/JobItems/" + jobItem.SyncJobItemId + "/AdditionalFiles", { var url = apiClient.getUrl("Sync/JobItems/" + jobItem.SyncJobItemId + "/AdditionalFiles", {
Name: file.Name Name: file.Name,
api_key: apiClient.accessToken()
}); });
require(['localassetmanager'], function () { require(['localassetmanager'], function () {

View file

@ -5,7 +5,9 @@
var currentDeferred; var currentDeferred;
var hasChanges = false; var hasChanges = false;
var browsableImagePageSize = 20; // These images can be large and we're seeing memory problems in safari
var browsableImagePageSize = $.browser.safari ? 6 : 12;
var browsableImageStartIndex = 0; var browsableImageStartIndex = 0;
var browsableImageType = 'Primary'; var browsableImageType = 'Primary';
var selectedProvider; var selectedProvider;

View file

@ -3,15 +3,15 @@
<label for="selectImageProvider">${LabelSource}</label> <label for="selectImageProvider">${LabelSource}</label>
</div> </div>
<div style="margin: 0; display: inline-block;"> <div style="margin: 0; display: inline-block;">
<select id="selectImageProvider" name="selectImageProvider" data-mini="true" data-inline="true"> <select id="selectImageProvider" style="padding-left:.5em;padding-right:0;">
<option value="">${OptionAll}</option> <option value="">${OptionAll}</option>
</select> </select>
</div> </div>
<div style="margin-left:1em; display: inline-block;"> <div style="margin-left:.5em; display: inline-block;">
<label for="selectBrowsableImageType">${LabelImage}</label> <label for="selectBrowsableImageType">${LabelImage}</label>
</div> </div>
<div style="display: inline-block;"> <div style="display: inline-block;">
<select id="selectBrowsableImageType" name="selectBrowsableImageType" data-mini="true" data-inline="true"> <select id="selectBrowsableImageType" style="padding-left:.5em;padding-right:0;">
<option value="Primary">${OptionPrimary}</option> <option value="Primary">${OptionPrimary}</option>
<option value="Art">${OptionArt}</option> <option value="Art">${OptionArt}</option>
<option value="Backdrop">${OptionBackdrop}</option> <option value="Backdrop">${OptionBackdrop}</option>
@ -26,10 +26,9 @@
<option value="Thumb">${OptionThumb}</option> <option value="Thumb">${OptionThumb}</option>
</select> </select>
</div> </div>
<div class="availableImagesPaging" style="display: inline-block;vertical-align: middle;margin-left:1em;"></div> <div class="availableImagesPaging" style="display: inline-block;vertical-align: middle;margin-left:.5em;"></div>
<div style="display: inline-block; vertical-align: middle; margin-left: 1em;"> <div style="display: inline-block; vertical-align: middle; margin-left: .5em;">
<input type="checkbox" id="chkAllLanguages" data-role="none" style="display: inline-block;vertical-align: middle;" /> <paper-checkbox id="chkAllLanguages">${LabelAllLanguages}</paper-checkbox>
<label for="chkAllLanguages" style="display: inline-block;vertical-align: middle;">${LabelAllLanguages}</label>
</div> </div>
</div> </div>

View file

@ -17,17 +17,12 @@
} }
} }
} }
if (isActive) {
document.body.classList.add('bodyWithPopupOpen');
}
else {
document.body.classList.remove('bodyWithPopupOpen');
}
} }
function onDialogClosed() { function onDialogClosed() {
Dashboard.onPopupClose();
dlg = null; dlg = null;
$(window).off('navigate', onHashChange); $(window).off('navigate', onHashChange);
@ -40,6 +35,7 @@
$(dlg).on('iron-overlay-closed', onDialogClosed); $(dlg).on('iron-overlay-closed', onDialogClosed);
dlg.open(); dlg.open();
Dashboard.onPopupOpen();
window.location.hash = hash; window.location.hash = hash;

View file

@ -467,13 +467,37 @@
var deferred = DeferredBuilder.Deferred(); var deferred = DeferredBuilder.Deferred();
Logger.log('downloading: ' + url + ' to ' + localPath); Logger.log('downloading: ' + url + ' to ' + localPath);
var ft = new FileTransfer();
ft.download(url, localPath, function (entry) {
var localUrl = normalizeReturnUrl(entry.toURL()); getFileSystem().done(function (fileSystem) {
fileSystem.root.getFile(localPath.replace('file://', ''), {}, function (targetFile) {
var downloader = new BackgroundTransfer.BackgroundDownloader();
// Create a new download operation.
var download = downloader.createDownload(url, targetFile);
// Start the download and persist the promise to be able to cancel the download.
app.downloadPromise = download.startAsync().then(function () {
// on success
var localUrl = normalizeReturnUrl(targetFile.toURL());
Logger.log('Downloaded local url: ' + localUrl);
deferred.resolveWith(null, [localUrl]);
}, function () {
// on error
Logger.log('download failed: ' + url + ' to ' + localPath);
deferred.reject();
}, function (value) {
// on progress
Logger.log('download progress: ' + value);
});
});
Logger.log('Downloaded local url: ' + localUrl);
deferred.resolveWith(null, [localUrl]);
}); });
return deferred.promise(); return deferred.promise();
@ -537,7 +561,7 @@
} }
function getLocalId(serverId, itemId) { function getLocalId(serverId, itemId) {
return serverId + '_' + itemId;
} }
function hasImage(serverId, itemId, imageTag) { function hasImage(serverId, itemId, imageTag) {

View file

@ -117,6 +117,20 @@ var Dashboard = {
} }
}, },
onPopupOpen: function(){
Dashboard.popupCount = (Dashboard.popupCount || 0) + 1;
document.body.classList.add('bodyWithPopupOpen');
},
onPopupClose: function(){
Dashboard.popupCount = (Dashboard.popupCount || 1) - 1;
if (!Dashboard.popupCount) {
document.body.classList.remove('bodyWithPopupOpen');
}
},
getCurrentUser: function () { getCurrentUser: function () {
if (!Dashboard.getUserPromise) { if (!Dashboard.getUserPromise) {