From b9bded862e54c427f97340c119e881fd013ab635 Mon Sep 17 00:00:00 2001 From: Niko Date: Mon, 14 Feb 2022 16:55:44 +0100 Subject: [PATCH] Improved pages.meet loading UX --- web/src/app/js/pages/meet.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/web/src/app/js/pages/meet.js b/web/src/app/js/pages/meet.js index e2d2717..cec8151 100644 --- a/web/src/app/js/pages/meet.js +++ b/web/src/app/js/pages/meet.js @@ -1,9 +1,9 @@ app.pages.meet = { load: function(args) { + document.querySelector('#page-meet').removeAttribute('style'); http.get('/api/v1/feed/meet', {}, function(json) { if (json === undefined) return; app.template.loadMany(['meet.item','meet.item_actions'], function(_) { - document.querySelector('#page-meet').removeAttribute('style'); var _; _ = function () { const dom = document.querySelector('#page-meet #content'); @@ -30,7 +30,10 @@ app.pages.meet = { var tpl = app.template.get('meet.item_actions'); dom.innerHTML += tpl; }; _(); - app.pages.meet.carousel.set(0); + var index = app.storage.get('status_meet_index'); + if (index === undefined) + index = 0; + app.pages.meet.carousel.set(parseInt(index)); }); }); }, @@ -43,7 +46,11 @@ app.pages.meet = { _parent: function() { return document.querySelector('#page-meet #content') }, _elements: function() { return app.pages.meet.carousel._parent().querySelectorAll('.meet.item') }, _size: function() { return app.pages.meet.carousel._elements().length }, - _onSetEvent: function() { app.pages.meet.carousel.setDragEvent() }, + _onSetEvent: function() { + app.storage.set('status_meet_index', + app.pages.meet.carousel._current); + app.pages.meet.carousel.setDragEvent(); + }, set: function(i) { return app.carousel.set(app.pages.meet.carousel, i) }, next: function() { return app.carousel.next(app.pages.meet.carousel) }, prev: function() { return app.carousel.prev(app.pages.meet.carousel) },