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-09-26 23:00:37 +0300
committerOlivier Paroz <github@oparoz.com>2015-09-26 23:00:37 +0300
commitd9ac106057c71ff51e5ea9e648efe1735af46db3 (patch)
tree87a24dc9fe705fd0e443c0e921d93eea525a3419 /js/galleryview.js
parentb9520a1ff9ea7042d1816e616a1de83e313ae01f (diff)
Better fix for #366
It doesn't matter if we initialise hidden buttons, because the user is either going to navigate away to an album with images or leave the app. The important thing is to not add events every time we enter an album. [ci skip]
Diffstat (limited to 'js/galleryview.js')
-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