';
-
- if (image.Width || image.Height || image.Language) {
-
- html += '
';
-
- if (image.Width && image.Height) {
- html += image.Width + ' x ' + image.Height;
-
- if (image.Language) {
-
- html += ' • ' + image.Language;
- }
- } else {
- if (image.Language) {
-
- html += image.Language;
- }
- }
-
- html += '
';
- }
-
- if (image.CommunityRating != null) {
-
- html += '
';
-
- if (image.RatingType == "Likes") {
- html += image.CommunityRating + (image.CommunityRating == 1 ? " like" : " likes");
- } else {
-
- if (image.CommunityRating) {
- html += image.CommunityRating.toFixed(1);
-
- if (image.VoteCount) {
- html += ' • ' + image.VoteCount + (image.VoteCount == 1 ? " vote" : " votes");
- }
- } else {
- html += "Unrated";
- }
- }
-
- html += '
';
- }
-
- html += '';
-
- html += '
';
-
- return html;
- }
-
- function getPagingHtml(startIndex, limit, totalRecordCount) {
-
- var html = '';
-
- var recordsEnd = Math.min(startIndex + limit, totalRecordCount);
-
- // 20 is the minimum page size
- var showControls = totalRecordCount > limit;
-
- html += '
';
-
- html += '';
-
- var startAtDisplay = totalRecordCount ? startIndex + 1 : 0;
- html += startAtDisplay + '-' + recordsEnd + ' of ' + totalRecordCount;
-
- html += '';
-
- if (showControls) {
- html += '
';
-
- html += '';
- html += ' totalRecordCount ? 'disabled' : '') + '>';
- html += '
';
- }
-
- html += '
';
-
- return html;
- }
-
function reload(page, item) {
Dashboard.showLoadingMsg();
- browsableImageStartIndex = 0;
- browsableImageType = 'Primary';
- selectedProvider = null;
-
if (item) {
reloadItem(page, item);
}
@@ -291,23 +78,23 @@
if (image.ImageType == "Backdrop" || image.ImageType == "Screenshot") {
if (i > 0) {
- html += '';
+ html += '';
} else {
html += '';
}
if (i < length - 1) {
- html += '';
+ html += '';
} else {
html += '';
}
}
if (imageProviders.length) {
- html += '';
+ html += '';
}
- html += '';
+ html += '';
html += '';
@@ -316,7 +103,40 @@
html += '';
}
- elem.html(html).trigger('create');
+ elem.innerHTML = html;
+
+ $('.btnSearchImages', elem).on('click', function () {
+ showImageDownloader(page, this.getAttribute('data-imagetype'));
+ });
+
+ $('.btnDeleteImage', elem).on('click', function () {
+
+ var type = this.getAttribute('data-imagetype');
+ var index = this.getAttribute('data-index');
+ index = index == "null" ? null : parseInt(index);
+ Dashboard.confirm(Globalize.translate('DeleteImageConfirmation'), Globalize.translate('HeaderDeleteImage'), function (result) {
+
+ if (result) {
+ ApiClient.deleteItemImage(currentItem.Id, type, index).done(function () {
+
+ reload(page);
+
+ });
+ }
+
+ });
+ });
+
+ $('.btnMoveImage', elem).on('click', function () {
+ 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 () {
+
+ reload(page);
+
+ });
+ });
}
function renderStandardImages(page, item, imageInfos, imageProviders) {
@@ -325,7 +145,7 @@
return i.ImageType != "Screenshot" && i.ImageType != "Backdrop" && i.ImageType != "Chapter";
});
- renderImages(page, item, images, imageProviders, $('#images', page));
+ renderImages(page, item, images, imageProviders, page.querySelector('#images'));
}
function renderBackdrops(page, item, imageInfos, imageProviders) {
@@ -339,7 +159,7 @@
if (images.length) {
$('#backdropsContainer', page).show();
- renderImages(page, item, images, imageProviders, $('#backdrops', page));
+ renderImages(page, item, images, imageProviders, page.querySelector('#backdrops'));
} else {
$('#backdropsContainer', page).hide();
}
@@ -362,80 +182,20 @@
}
}
- function editItemImages() {
+ function showImageDownloader(page, imageType) {
+ require(['components/imagedownloader/imagedownloader'], function () {
- var self = this;
+ ImageDownloader.show(currentItem.Id, imageType).done(function (hasChanges) {
- self.deleteImage = function (type, index) {
-
- var page = $.mobile.activePage;
-
- Dashboard.confirm(Globalize.translate('DeleteImageConfirmation'), Globalize.translate('HeaderDeleteImage'), function (result) {
-
- if (result) {
- ApiClient.deleteItemImage(currentItem.Id, type, index).done(function () {
-
- reload(page);
-
- });
+ if (hasChanges) {
+ reload(page);
}
-
});
- };
-
- self.moveImage = function (type, index, newIndex) {
-
- var page = $.mobile.activePage;
-
- ApiClient.updateItemImageIndex(currentItem.Id, type, index, newIndex).done(function () {
-
- reload(page);
-
- });
-
-
- };
-
- self.showDownloadMenu = function (type) {
- browsableImageStartIndex = 0;
- browsableImageType = type;
-
- var page = $.mobile.activePage;
-
- selectedProvider = null;
- $('.popupDownload', page).popup('open');
- reloadBrowsableImages(page);
- };
+ });
}
- window.EditItemImagesPage = new editItemImages();
-
function initEditor(page) {
- $('#selectBrowsableImageType', page).on('change', function () {
-
- browsableImageType = this.value;
- browsableImageStartIndex = 0;
- selectedProvider = null;
-
- reloadBrowsableImages(page);
- });
-
- $('#selectImageProvider', page).on('change', function () {
-
- browsableImageStartIndex = 0;
- selectedProvider = this.value;
-
- reloadBrowsableImages(page);
- });
-
- $('#chkAllLanguages', page).on('change', function () {
-
- browsableImageStartIndex = 0;
-
- reloadBrowsableImages(page);
- });
-
$('.btnOpenUploadMenu', page).on('click', function () {
require(['components/imageuploader/imageuploader'], function () {
@@ -450,11 +210,7 @@
});
$('.btnBrowseAllImages', page).on('click', function () {
-
- selectedProvider = null;
- browsableImageType = 'Primary';
- $('.popupDownload', page).popup('open');
- reloadBrowsableImages(page);
+ showImageDownloader(page, 'Primary');
});
}
@@ -475,6 +231,8 @@
dlg.setAttribute('with-backdrop', 'with-backdrop');
dlg.setAttribute('role', 'alertdialog');
+ // without this safari will scroll the background instead of the dialog contents
+ dlg.setAttribute('modal', 'modal');
dlg.entryAnimation = 'scale-up-animation';
dlg.exitAnimation = 'fade-out-animation';
dlg.classList.add('fullscreen-editor-paper-dialog');
@@ -498,7 +256,6 @@
// Has to be assigned a z-index after the call to .open()
$(dlg).on('iron-overlay-closed', onDialogClosed);
- document.body.classList.add('bodyWithPopupOpen');
PaperDialogHelper.openWithHash(dlg, 'imageeditor');
var editorContent = dlg.querySelector('.editorContent');
@@ -516,7 +273,6 @@
function onDialogClosed() {
- document.body.classList.remove('bodyWithPopupOpen');
$(this).remove();
Dashboard.hideLoadingMsg();
}
@@ -524,7 +280,7 @@
window.ImageEditor = {
show: function (itemId) {
- require(['components/paperdialoghelper', 'jqmpopup'], function () {
+ require(['components/paperdialoghelper'], function () {
Dashboard.importCss('css/metadataeditor.css');
showEditor(itemId);
diff --git a/dashboard-ui/components/imageeditor/imageeditor.template.html b/dashboard-ui/components/imageeditor/imageeditor.template.html
index 54186ddf33..f61fac363d 100644
--- a/dashboard-ui/components/imageeditor/imageeditor.template.html
+++ b/dashboard-ui/components/imageeditor/imageeditor.template.html
@@ -24,51 +24,4 @@
${Screenshots}
-
-
-
-
-
-
${HeaderBrowseOnlineImages}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dashboard-ui/components/imageuploader/imageuploader.js b/dashboard-ui/components/imageuploader/imageuploader.js
index a1bf190ee2..7a069a76b0 100644
--- a/dashboard-ui/components/imageuploader/imageuploader.js
+++ b/dashboard-ui/components/imageuploader/imageuploader.js
@@ -137,6 +137,8 @@
dlg.setAttribute('with-backdrop', 'with-backdrop');
dlg.setAttribute('role', 'alertdialog');
+ // without this safari will scroll the background instead of the dialog contents
+ dlg.setAttribute('modal', 'modal');
dlg.entryAnimation = 'scale-up-animation';
dlg.exitAnimation = 'fade-out-animation';
dlg.classList.add('fullscreen-editor-paper-dialog');
@@ -158,7 +160,6 @@
// Has to be assigned a z-index after the call to .open()
$(dlg).on('iron-overlay-closed', onDialogClosed);
- document.body.classList.add('bodyWithPopupOpen');
PaperDialogHelper.openWithHash(dlg, 'imageuploader');
var editorContent = dlg.querySelector('.editorContent');
@@ -175,7 +176,6 @@
function onDialogClosed() {
- document.body.classList.remove('bodyWithPopupOpen');
$(this).remove();
Dashboard.hideLoadingMsg();
currentDeferred.resolveWith(null, [hasChanges]);
diff --git a/dashboard-ui/components/imageuploader/imageuploader.template.html b/dashboard-ui/components/imageuploader/imageuploader.template.html
index 4070f8ca3b..ede3d699bd 100644
--- a/dashboard-ui/components/imageuploader/imageuploader.template.html
+++ b/dashboard-ui/components/imageuploader/imageuploader.template.html
@@ -3,7 +3,8 @@