Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/gallery.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Paroz <github@oparoz.com>2015-04-10 14:28:36 +0300
committerOlivier Paroz <github@oparoz.com>2015-04-10 14:28:36 +0300
commit589d167777337335919f24e559fc721166940444 (patch)
tree578495be85f1c32e300fdf61f16de277d513773e /js/galleryview.js
parent4cc5770c4e0d322c494dfc8d5ba249af61665936 (diff)
Lowered complexity of Gallery.View
Diffstat (limited to 'js/galleryview.js')
-rw-r--r--js/galleryview.js53
1 files changed, 37 insertions, 16 deletions
diff --git a/js/galleryview.js b/js/galleryview.js
index e1950c1b..e768b427 100644
--- a/js/galleryview.js
+++ b/js/galleryview.js
@@ -90,21 +90,11 @@
}
this.clear();
+
if (albumPath !== Gallery.currentAlbum) {
this.loadVisibleRows.loading = false;
Gallery.currentAlbum = albumPath;
- this.shareButtonSetup(albumPath);
- this.infoButtonSetup();
-
- this.breadcrumb = new Gallery.Breadcrumb(albumPath);
- this.breadcrumb.setMaxWidth($(window).width() - 320);
-
- var currentSort = Gallery.albumConfig.getAlbumSorting();
- this.sortControlsSetup(currentSort.type, currentSort.order);
- Gallery.albumMap[Gallery.currentAlbum].images.sort(Gallery.sortBy(currentSort.type,
- currentSort.order));
- Gallery.albumMap[Gallery.currentAlbum].subAlbums.sort(Gallery.sortBy('name',
- currentSort.albumOrder));
+ this.setupButtons(albumPath);
}
Gallery.albumMap[albumPath].viewedItems = 0;
@@ -123,6 +113,26 @@
},
/**
+ * Sets up all the buttons of the interface
+ *
+ * @param {string} albumPath
+ */
+ setupButtons: function (albumPath) {
+ this.shareButtonSetup(albumPath);
+ this.infoButtonSetup();
+
+ this.breadcrumb = new Gallery.Breadcrumb(albumPath);
+ this.breadcrumb.setMaxWidth($(window).width() - 320);
+
+ var currentSort = Gallery.albumConfig.getAlbumSorting();
+ this.sortControlsSetup(currentSort.type, currentSort.order);
+ Gallery.albumMap[Gallery.currentAlbum].images.sort(Gallery.sortBy(currentSort.type,
+ currentSort.order));
+ Gallery.albumMap[Gallery.currentAlbum].subAlbums.sort(Gallery.sortBy('name',
+ currentSort.albumOrder));
+ },
+
+ /**
* Shows or hides the share button depending on if we're in a public gallery or not
*
* @param {string} albumPath
@@ -145,10 +155,7 @@
infoContentElement.slideUp();
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)) {
+ if (this.isAlbumInfoEmtpy(albumInfo)) {
infoButton.hide();
} else {
infoButton.show();
@@ -161,6 +168,20 @@
},
/**
+ * Determines if we have received a description and a copyright statement for the current
+ * album
+ *
+ * @param {object} albumInfo
+ * @returns {bool}
+ */
+ isAlbumInfoEmtpy: function (albumInfo) {
+ return $.isEmptyObject(albumInfo.description) &&
+ $.isEmptyObject(albumInfo.descriptionLink) &&
+ $.isEmptyObject(albumInfo.copyright) &&
+ $.isEmptyObject(albumInfo.copyrightLink);
+ },
+
+ /**
* Manages the sorting interface
*
* @param {string} sortType