From 8e75b73db1e0cf6d64d63a813447515cce21e163 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 6 Sep 2018 20:27:38 -0700 Subject: [PATCH] Put randomize back in Signed-off-by: James Ketrenos --- frontend/src/ketr-photos/ketr-photos.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/src/ketr-photos/ketr-photos.html b/frontend/src/ketr-photos/ketr-photos.html index 52af49c..f6f32d5 100755 --- a/frontend/src/ketr-photos/ketr-photos.html +++ b/frontend/src/ketr-photos/ketr-photos.html @@ -392,6 +392,16 @@ this.thumbnails[index].visible = false; }.bind(this)); + /* Randomly index the visible array, keeping the center + * in the middle. This makes the loading look more organic. */ + for (var i = 0, j = visible.length - 1; i < j; i++, j--) { + if (Math.random() > 0.5) { + var tmp = visible[i]; + visible[i] = visible[j]; + visible[j] = tmp; + } + } + /* Turn on visibility for any item that is now visible */ visible.forEach(function(index) { if (this.thumbnails[index].visible != true) {