diff options
author | Olivier Paroz <github@oparoz.com> | 2015-04-06 00:28:42 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-04-06 00:28:42 +0300 |
commit | 4191190bf334492e8799d11dfda25142748b66bd (patch) | |
tree | d7dd9aae2daec4a340fb18a5cb20bfd4258ea2ee /js | |
parent | 675624b423dad6c0a23bde2f4477083b2daca754 (diff) |
Several fixes for the album configuration
Diffstat (limited to 'js')
-rw-r--r-- | js/gallery.js | 24 | ||||
-rw-r--r-- | js/galleryconfig.js | 1 | ||||
-rw-r--r-- | js/galleryview.js | 1 |
3 files changed, 13 insertions, 13 deletions
diff --git a/js/gallery.js b/js/gallery.js index 02841d33..077ccd68 100644 --- a/js/gallery.js +++ b/js/gallery.js @@ -270,6 +270,12 @@ Gallery.showInfo = function (event) { }, 500); infoContentElement.scrollTop(0); }; + var addContent = function (content) { + infoContentElement.append(marked(content)); + infoContentElement.find('a').attr("target", "_blank"); + Gallery.showCopyright(albumInfo, infoContentElement); + adjustHeight(); + }; if (infoContentElement.is(':visible')) { infoContentElement.slideUp(); @@ -280,29 +286,21 @@ Gallery.showInfo = function (event) { infoContentElement.empty(); infoContentElement.height(100); infoContentElement.slideDown(); - if (!$.isEmptyObject(albumInfo.description)) { + if (!$.isEmptyObject(albumInfo.descriptionLink)) { var params = { - file: albumInfo.filePath + '/' + albumInfo.description + file: albumInfo.filePath + '/' + albumInfo.descriptionLink }; var descriptionUrl = Gallery.buildUrl('download', '', params); $.get(descriptionUrl).done(function (data) { - infoContentElement.append(marked(data)); - infoContentElement.find('a').attr("target", "_blank"); - Gallery.showCopyright(albumInfo, infoContentElement); - adjustHeight(); + addContent(data); } ).fail(function () { - infoContentElement.append('<p>' + - t('gallery', 'Could not load the description') + '</p>'); - Gallery.showCopyright(albumInfo, infoContentElement); - adjustHeight(); + addContent(t('gallery', 'Could not load the description')); }); } else { - Gallery.showCopyright(albumInfo, infoContentElement); - adjustHeight(); + addContent(albumInfo.description); } Gallery.albumConfig.setInfoLoaded(); - } else { infoContentElement.slideDown(); } diff --git a/js/galleryconfig.js b/js/galleryconfig.js index f95739bd..d26223b4 100644 --- a/js/galleryconfig.js +++ b/js/galleryconfig.js @@ -50,6 +50,7 @@ GalleryConfig.prototype = { params = { description: albumInfo.description, + descriptionLink: albumInfo.description_link, copyright: albumInfo.copyright, copyrightLink: albumInfo.copyright_link, filePath: docPath diff --git a/js/galleryview.js b/js/galleryview.js index ad886e41..55a95336 100644 --- a/js/galleryview.js +++ b/js/galleryview.js @@ -103,6 +103,7 @@ Gallery.view.infoButtonSetup = function () { infoContentElement.css('max-height', $(window).height() - 150); var albumInfo = Gallery.albumConfig.getAlbumInfo(); if ($.isEmptyObject(albumInfo.description) && + $.isEmptyObject(albumInfo.descriptionLink) && $.isEmptyObject(albumInfo.copyright) && $.isEmptyObject(albumInfo.copyrightLink)) { infoButton.hide(); |