summaryrefslogtreecommitdiff
path: root/js/Feeds.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/Feeds.js')
-rw-r--r--js/Feeds.js42
1 files changed, 36 insertions, 6 deletions
diff --git a/js/Feeds.js b/js/Feeds.js
index 401d669a7..07ec89452 100644
--- a/js/Feeds.js
+++ b/js/Feeds.js
@@ -3,7 +3,7 @@
define(["dojo/_base/declare"], function (declare) {
Feeds = {
counters_last_request: 0,
- _active_feed_id: 0,
+ _active_feed_id: undefined,
_active_feed_is_cat: false,
infscroll_in_progress: 0,
infscroll_disabled: 0,
@@ -44,6 +44,8 @@ define(["dojo/_base/declare"], function (declare) {
this._counters_prev = [];
},
parseCounters: function (elems) {
+ PluginHost.run(PluginHost.HOOK_COUNTERS_RECEIVED, elems);
+
for (let l = 0; l < elems.length; l++) {
if (Feeds._counters_prev[l] && this.counterEquals(elems[l], this._counters_prev[l])) {
@@ -93,11 +95,13 @@ define(["dojo/_base/declare"], function (declare) {
this.hideOrShowFeeds(App.getInitParam("hide_read_feeds") == 1);
this._counters_prev = elems;
+
+ PluginHost.run(PluginHost.HOOK_COUNTERS_PROCESSED);
},
reloadCurrent: function(method) {
- console.log("reloadCurrent: " + method);
-
if (this.getActive() != undefined) {
+ console.log("reloadCurrent: " + method);
+
this.open({feed: this.getActive(), is_cat: this.activeIsCat(), method: method});
}
return false; // block unneeded form submits
@@ -196,12 +200,16 @@ define(["dojo/_base/declare"], function (declare) {
App.setLoadingProgress(50);
document.onkeydown = (event) => { return App.hotkeyHandler(event) };
+ document.onkeypress = (event) => { return App.hotkeyHandler(event) };
window.onresize = () => { Headlines.scrollHandler(); }
- if (!this.getActive()) {
- this.open({feed: -3});
+ const hash_feed_id = hash_get('f');
+ const hash_feed_is_cat = hash_get('c') == "1";
+
+ if (hash_feed_id != undefined) {
+ this.open({feed: hash_feed_id, is_cat: hash_feed_is_cat});
} else {
- this.open({feed: this.getActive(), is_cat: this.activeIsCat()});
+ this.open({feed: -3});
}
this.hideOrShowFeeds(App.getInitParam("hide_read_feeds") == 1);
@@ -245,6 +253,8 @@ define(["dojo/_base/declare"], function (declare) {
return this._active_feed_id;
},
setActive: function(id, is_cat) {
+ console.log('setActive', id, is_cat);
+
hash_set('f', id);
hash_set('c', is_cat ? 1 : 0);
@@ -542,6 +552,11 @@ define(["dojo/_base/declare"], function (declare) {
execute: function () {
if (this.validate()) {
Feeds._search_query = this.attr('value');
+
+ // disallow empty queries
+ if (!Feeds._search_query.query)
+ Feeds._search_query = false;
+
this.hide();
Feeds.reloadCurrent();
}
@@ -549,6 +564,21 @@ define(["dojo/_base/declare"], function (declare) {
href: query
});
+ const tmph = dojo.connect(dialog, 'onLoad', function () {
+ dojo.disconnect(tmph);
+
+ if (Feeds._search_query) {
+ if (Feeds._search_query.query)
+ dijit.byId('search_query')
+ .attr('value', Feeds._search_query.query);
+
+ if (Feeds._search_query.search_language)
+ dijit.byId('search_language')
+ .attr('value', Feeds._search_query.search_language);
+ }
+
+ });
+
dialog.show();
},
updateRandom: function() {