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:
-rw-r--r--js/galleryview.js39
1 files changed, 23 insertions, 16 deletions
diff --git a/js/galleryview.js b/js/galleryview.js
index 572125fc..b77d8240 100644
--- a/js/galleryview.js
+++ b/js/galleryview.js
@@ -31,11 +31,11 @@
* @param {string} albumPath
*/
init: function (albumPath) {
+ // Only do it when the app is initialised
+ if (this.requestId === -1) {
+ this._initButtons();
+ }
if ($.isEmptyObject(Gallery.imageMap)) {
- if (this.requestId === -1) {
- $('#filelist-button').click(Gallery.switchToFilesView);
- this.requestId = Math.random();
- }
this.clear();
if (albumPath === '') {
Gallery.showEmpty();
@@ -46,18 +46,6 @@
this.breadcrumb.setMaxWidth($(window).width() - Gallery.buttonsWidth);
}
} else {
- // Only do it when the app is initialised
- if (this.requestId === -1) {
- $('#filelist-button').click(Gallery.switchToFilesView);
- $('#download').click(Gallery.download);
- $('#share-button').click(Gallery.share);
- Gallery.infoBox = new Gallery.InfoBox();
- $('#album-info-button').click(Gallery.showInfo);
- $('#sort-name-button').click(Gallery.sorter);
- $('#sort-date-button').click(Gallery.sorter);
- $('#save #save-button').click(Gallery.showSaveForm);
- $('.save-form').submit(Gallery.saveForm);
- }
this._setBackgroundColour();
this.viewAlbum(albumPath);
}
@@ -211,6 +199,25 @@
},
/**
+ * Adds all the click handlers to buttons the first time they appear in the interface
+ *
+ * @private
+ */
+ _initButtons: function () {
+ $('#filelist-button').click(Gallery.switchToFilesView);
+ $('#download').click(Gallery.download);
+ $('#share-button').click(Gallery.share);
+ Gallery.infoBox = new Gallery.InfoBox();
+ $('#album-info-button').click(Gallery.showInfo);
+ $('#sort-name-button').click(Gallery.sorter);
+ $('#sort-date-button').click(Gallery.sorter);
+ $('#save #save-button').click(Gallery.showSaveForm);
+ $('.save-form').submit(Gallery.saveForm);
+
+ this.requestId = Math.random();
+ },
+
+ /**
* Sets up all the buttons of the interface
*
* @param {string} albumPath