add hide/show events for feeds sidebar
This commit is contained in:
parent
2f14fa1bc3
commit
db583287b2
37
js/Feeds.js
37
js/Feeds.js
|
@ -1,6 +1,6 @@
|
||||||
'use strict'
|
'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 = {
|
const Feeds = {
|
||||||
_default_feed_id: -3,
|
_default_feed_id: -3,
|
||||||
|
@ -13,6 +13,19 @@ const Feeds = {
|
||||||
_search_query: false,
|
_search_query: false,
|
||||||
last_search_query: [],
|
last_search_query: [],
|
||||||
_viewfeed_wait_timeout: false,
|
_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: [],
|
_counters_prev: [],
|
||||||
// NOTE: this implementation is incomplete
|
// NOTE: this implementation is incomplete
|
||||||
// for general objects but good enough for counters
|
// for general objects but good enough for counters
|
||||||
|
@ -120,14 +133,6 @@ const Feeds = {
|
||||||
},
|
},
|
||||||
toggle: function() {
|
toggle: function() {
|
||||||
Element.toggle("feeds-holder");
|
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() {
|
cancelSearch: function() {
|
||||||
this._search_query = "";
|
this._search_query = "";
|
||||||
|
@ -208,9 +213,23 @@ const Feeds = {
|
||||||
App.Error.report(e);
|
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() {
|
init: function() {
|
||||||
console.log("in feedlist init");
|
console.log("in feedlist init");
|
||||||
|
|
||||||
|
this._feeds_holder_observer.observe(App.byId("feeds-holder"));
|
||||||
|
|
||||||
App.setLoadingProgress(50);
|
App.setLoadingProgress(50);
|
||||||
|
|
||||||
//document.onkeydown = (event) => { return App.hotkeyHandler(event) };
|
//document.onkeydown = (event) => { return App.hotkeyHandler(event) };
|
||||||
|
|
Loading…
Reference in New Issue