summaryrefslogtreecommitdiff
path: root/js/Feeds.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-24 17:01:40 +0300
committerAndrew Dolgov <[email protected]>2021-02-24 17:01:40 +0300
commitdb583287b29b23dd07125db3b40c3324ba26e000 (patch)
tree47f47e4880e5db882e612502ce79cef8335de477 /js/Feeds.js
parent2f14fa1bc367551c1b29b00f366c29a513274729 (diff)
add hide/show events for feeds sidebar
Diffstat (limited to 'js/Feeds.js')
-rw-r--r--js/Feeds.js37
1 files changed, 28 insertions, 9 deletions
diff --git a/js/Feeds.js b/js/Feeds.js
index 3767f8b65..5a2dee5cf 100644
--- a/js/Feeds.js
+++ b/js/Feeds.js
@@ -1,6 +1,6 @@
'use strict'
-/* global __, App, Headlines, xhrPost, xhr, dojo, dijit, fox, PluginHost, Notify, fox */
+/* global __, App, Headlines, xhr, dojo, dijit, fox, PluginHost, Notify, fox */
const Feeds = {
_default_feed_id: -3,
@@ -13,6 +13,19 @@ const Feeds = {
_search_query: false,
last_search_query: [],
_viewfeed_wait_timeout: false,
+ _feeds_holder_observer: new IntersectionObserver(
+ (entries/*, observer*/) => {
+ entries.forEach((entry) => {
+ //console.log('feeds',entry.target, entry.intersectionRatio);
+
+ if (entry.intersectionRatio == 0)
+ Feeds.onHide(entry);
+ else
+ Feeds.onShow(entry);
+ });
+ },
+ {threshold: [0, 1], root: document.querySelector("body")}
+ ),
_counters_prev: [],
// NOTE: this implementation is incomplete
// for general objects but good enough for counters
@@ -120,14 +133,6 @@ const Feeds = {
},
toggle: function() {
Element.toggle("feeds-holder");
-
- const splitter = App.byId("feeds-holder_splitter");
-
- Element.visible("feeds-holder") ? splitter.show() : splitter.hide();
-
- dijit.byId("main").resize();
-
- Headlines.updateCurrentUnread();
},
cancelSearch: function() {
this._search_query = "";
@@ -208,9 +213,23 @@ const Feeds = {
App.Error.report(e);
}
},
+ onHide: function() {
+ App.byId("feeds-holder_splitter").hide();
+
+ dijit.byId("main").resize();
+ Headlines.updateCurrentUnread();
+ },
+ onShow: function() {
+ App.byId("feeds-holder_splitter").show();
+
+ dijit.byId("main").resize();
+ Headlines.updateCurrentUnread();
+ },
init: function() {
console.log("in feedlist init");
+ this._feeds_holder_observer.observe(App.byId("feeds-holder"));
+
App.setLoadingProgress(50);
//document.onkeydown = (event) => { return App.hotkeyHandler(event) };