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-09 15:16:04 +0300
committerOlivier Paroz <github@oparoz.com>2015-04-09 15:16:04 +0300
commitbb4f0404b41635221f59fea137526caea42b0d44 (patch)
treee3032f587838394c491758dc91daa85a69fc5f76
parenta182fef1126edb0c3b338ed77dd8547667e79cc6 (diff)
Speed up sorting by only sorting the current album
-rw-r--r--js/gallery.js19
-rw-r--r--js/galleryview.js8
2 files changed, 11 insertions, 16 deletions
diff --git a/js/gallery.js b/js/gallery.js
index 07a9dba2..371e6eb0 100644
--- a/js/gallery.js
+++ b/js/gallery.js
@@ -112,18 +112,6 @@ Gallery.getFiles = function () {
album.images.push(image);
Gallery.imageMap[image.path] = image;
}
-
- var currentSort = Gallery.albumConfig.getAlbumSorting();
-
- // Update the controls
- Gallery.view.sortControlsSetup(currentSort.type, currentSort.order);
-
- for (var j = 0, keys = Object.keys(Gallery.albumMap); j < keys.length; j++) {
- Gallery.albumMap[keys[j]].images.sort(Gallery.sortBy(currentSort.type,
- currentSort.order));
- Gallery.albumMap[keys[j]].subAlbums.sort(Gallery.sortBy('name',
- currentSort.albumOrder));
- }
}, function () {
// Triggered if we couldn't find a working folder
Gallery.view.element.empty();
@@ -224,10 +212,9 @@ Gallery.sorter = function () {
Gallery.view.clear();
// Sort the images
- for (var i = 0, keys = Object.keys(Gallery.albumMap); i < keys.length; i++) {
- Gallery.albumMap[keys[i]].images.sort(Gallery.sortBy(sortType, sortOrder));
- Gallery.albumMap[keys[i]].subAlbums.sort(Gallery.sortBy(albumSortType, albumSortOrder));
- }
+ Gallery.albumMap[Gallery.currentAlbum].images.sort(Gallery.sortBy(sortType, sortOrder));
+ Gallery.albumMap[Gallery.currentAlbum].subAlbums.sort(Gallery.sortBy(albumSortType,
+ albumSortOrder));
// Save the new settings
Gallery.albumConfig.updateSorting(sortType, sortOrder, albumSortOrder);
diff --git a/js/galleryview.js b/js/galleryview.js
index 0182c3ce..ba9548d4 100644
--- a/js/galleryview.js
+++ b/js/galleryview.js
@@ -64,8 +64,16 @@ Gallery.view.viewAlbum = function (albumPath) {
Gallery.currentAlbum = albumPath;
Gallery.view.shareButtonSetup(albumPath);
Gallery.view.infoButtonSetup();
+
Gallery.view.breadcrumb = new Gallery.Breadcrumb(albumPath);
Gallery.view.breadcrumb.setMaxWidth($(window).width() - 320);
+
+ var currentSort = Gallery.albumConfig.getAlbumSorting();
+ Gallery.view.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));
}
Gallery.albumMap[albumPath].viewedItems = 0;