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-07-27 05:28:33 +0300
committerOlivier Paroz <github@oparoz.com>2015-07-27 05:28:33 +0300
commitd53b8cd8afeed3de3fcdfece196d92fc1a3e80aa (patch)
tree0353884ad39e4a34aca44531f6e26a1391bbf2cf /js/galleryview.js
parentaeecff52ca70f16def62329d017c843b556b2557 (diff)
JS cleanup
All methods should be documented Public methods first, then private ones Finish "use strict" implementation
Diffstat (limited to 'js/galleryview.js')
-rw-r--r--js/galleryview.js124
1 files changed, 64 insertions, 60 deletions
diff --git a/js/galleryview.js b/js/galleryview.js
index 75b35b6c..5d3ae12e 100644
--- a/js/galleryview.js
+++ b/js/galleryview.js
@@ -86,7 +86,7 @@
if (albumPath !== Gallery.currentAlbum) {
this.loadVisibleRows.loading = false;
Gallery.currentAlbum = albumPath;
- this.setupButtons(albumPath);
+ this._setupButtons(albumPath);
}
Gallery.albumMap[albumPath].viewedItems = 0;
@@ -105,65 +105,6 @@
},
/**
- * 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() - Gallery.buttonsWidth);
-
- var currentSort = Gallery.config.albumSorting;
- this.sortControlsSetup(currentSort.type, currentSort.order);
- Gallery.albumMap[Gallery.currentAlbum].images.sort(Gallery.utility.sortBy(currentSort.type,
- currentSort.order));
- Gallery.albumMap[Gallery.currentAlbum].subAlbums.sort(Gallery.utility.sortBy('name',
- currentSort.albumOrder));
- },
-
- /**
- * Shows or hides the share button depending on if we're in a public gallery or not
- *
- * @param {string} albumPath
- */
- shareButtonSetup: function (albumPath) {
- var shareButton = $('#share-button');
- if (albumPath === '' || Gallery.token) {
- shareButton.hide();
- } else {
- shareButton.show();
- }
- },
-
- /**
- * Shows or hides the info button based on the information we've received from the server
- */
- infoButtonSetup: function () {
- var infoButton = $('#album-info-button');
- infoButton.find('span').hide();
- var infoContentElement = $('.album-info-content');
- infoContentElement.slideUp();
- infoContentElement.css('max-height', $(window).height() - Gallery.browserToolbarHeight);
- var albumInfo = Gallery.config.albumInfo;
- if (Gallery.config.albumError) {
- infoButton.hide();
- var text = '<strong>' + t('gallery', 'Configuration error') + '</strong></br>' +
- Gallery.config.albumError.message + '</br></br>';
- Gallery.utility.showHtmlNotification(text, 7);
- } else if ($.isEmptyObject(albumInfo)) {
- infoButton.hide();
- } else {
- infoButton.show();
- if (albumInfo.inherit !== 'yes' || albumInfo.level === 0) {
- infoButton.find('span').delay(1000).slideDown();
- }
- }
- },
-
- /**
* Manages the sorting interface
*
* @param {string} sortType
@@ -276,6 +217,69 @@
this.loadVisibleRows.loading = showRows(album);
return this.loadVisibleRows.loading;
}
+ },
+
+ /**
+ * Sets up all the buttons of the interface
+ *
+ * @param {string} albumPath
+ * @private
+ */
+ _setupButtons: function (albumPath) {
+ this._shareButtonSetup(albumPath);
+ this._infoButtonSetup();
+
+ this.breadcrumb = new Gallery.Breadcrumb(albumPath);
+ this.breadcrumb.setMaxWidth($(window).width() - Gallery.buttonsWidth);
+
+ var currentSort = Gallery.config.albumSorting;
+ this.sortControlsSetup(currentSort.type, currentSort.order);
+ Gallery.albumMap[Gallery.currentAlbum].images.sort(Gallery.utility.sortBy(currentSort.type,
+ currentSort.order));
+ Gallery.albumMap[Gallery.currentAlbum].subAlbums.sort(Gallery.utility.sortBy('name',
+ currentSort.albumOrder));
+ },
+
+ /**
+ * Shows or hides the share button depending on if we're in a public gallery or not
+ *
+ * @param {string} albumPath
+ * @private
+ */
+ _shareButtonSetup: function (albumPath) {
+ var shareButton = $('#share-button');
+ if (albumPath === '' || Gallery.token) {
+ shareButton.hide();
+ } else {
+ shareButton.show();
+ }
+ },
+
+ /**
+ * Shows or hides the info button based on the information we've received from the server
+ *
+ * @private
+ */
+ _infoButtonSetup: function () {
+ var infoButton = $('#album-info-button');
+ infoButton.find('span').hide();
+ var infoContentElement = $('.album-info-content');
+ infoContentElement.slideUp();
+ infoContentElement.css('max-height', $(window).height() - Gallery.browserToolbarHeight);
+ var albumInfo = Gallery.config.albumInfo;
+ if (Gallery.config.albumError) {
+ infoButton.hide();
+ var text = '<strong>' + t('gallery', 'Configuration error') + '</strong></br>' +
+ Gallery.config.albumError.message + '</br></br>';
+ Gallery.utility.showHtmlNotification(text, 7);
+ } else if ($.isEmptyObject(albumInfo)) {
+ infoButton.hide();
+ } else {
+ infoButton.show();
+ if (albumInfo.inherit !== 'yes' || albumInfo.level === 0) {
+ infoButton.find('span').delay(1000).slideDown();
+ }
+ }
}
};