summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/AppBase.js11
-rw-r--r--js/CommonFilters.js3
-rw-r--r--js/Feeds.js3
-rwxr-xr-xjs/Headlines.js54
-rw-r--r--js/PrefFilterTree.js2
-rw-r--r--js/tt-rss.js20
6 files changed, 55 insertions, 38 deletions
diff --git a/js/AppBase.js b/js/AppBase.js
index c7e221094..121b7aa85 100644
--- a/js/AppBase.js
+++ b/js/AppBase.js
@@ -209,8 +209,7 @@ define(["dojo/_base/declare"], function (declare) {
const seq = reply['seq'];
if (seq && this.get_seq() != seq) {
- console.log("[handleRpcJson] sequence mismatch: " + seq +
- " (want: " + this.get_seq() + ")");
+ console.log("[handleRpcJson] sequence mismatch: ", seq, '!=', this.get_seq());
return true;
}
@@ -263,14 +262,6 @@ define(["dojo/_base/declare"], function (declare) {
return;
}
- if (k == "update_result") {
- if (v) {
- Element.show("updates-available");
- } else {
- Element.hide("updates-available");
- }
- }
-
if (k == "recent_log_events") {
const alert = $$(".log-alert")[0];
diff --git a/js/CommonFilters.js b/js/CommonFilters.js
index fb2061ea3..a8171f64f 100644
--- a/js/CommonFilters.js
+++ b/js/CommonFilters.js
@@ -218,7 +218,8 @@ define(["dojo/_base/declare"], function (declare) {
Element.hide("prefFilterLoadingIndicator");
if (test_dlg.results == 0) {
- $("prefFilterTestResultList").innerHTML = "<tr><td align='center'>No recent articles matching this filter have been found.</td></tr>";
+ $("prefFilterTestResultList").innerHTML = `<tr><td align='center'>
+ ${__('No recent articles matching this filter have been found.')}</td></tr>`;
$("prefFilterProgressMsg").innerHTML = "Articles matching this filter:";
} else {
$("prefFilterProgressMsg").innerHTML = __("Found %d articles matching this filter:")
diff --git a/js/Feeds.js b/js/Feeds.js
index 44d48d6c7..487f5bafe 100644
--- a/js/Feeds.js
+++ b/js/Feeds.js
@@ -282,6 +282,7 @@ define(["dojo/_base/declare"], function (declare) {
const is_cat = !!params.is_cat || false;
const offset = params.offset || 0;
const viewfeed_debug = params.viewfeed_debug;
+ const append = params.append || false;
const method = params.method;
// this is used to quickly switch between feeds, sets active but xhr is on a timeout
const delayed = params.delayed || false;
@@ -349,7 +350,7 @@ define(["dojo/_base/declare"], function (declare) {
try {
window.clearTimeout(this._infscroll_timeout);
this.setExpando(feed, is_cat, 'images/blank_icon.gif');
- Headlines.onLoaded(transport, offset);
+ Headlines.onLoaded(transport, offset, append);
PluginHost.run(PluginHost.HOOK_FEED_LOADED, [feed, is_cat]);
} catch (e) {
App.Error.report(e);
diff --git a/js/Headlines.js b/js/Headlines.js
index bbf48738b..43837f65b 100755
--- a/js/Headlines.js
+++ b/js/Headlines.js
@@ -4,6 +4,7 @@ define(["dojo/_base/declare"], function (declare) {
Headlines = {
vgroup_last_feed: undefined,
_headlines_scroll_timeout: 0,
+ _observer_counters_timeout: 0,
headlines: [],
current_first_id: 0,
row_observer: new MutationObserver((mutations) => {
@@ -141,7 +142,11 @@ define(["dojo/_base/declare"], function (declare) {
if (promises.length > 0)
Promise.all([promises]).then(() => {
- Feeds.requestCounters(true);
+ window.clearTimeout(this._observer_counters_timeout);
+
+ this._observer_counters_timeout = setTimeout(() => {
+ Feeds.requestCounters(true);
+ }, 1000);
});
},
@@ -213,7 +218,7 @@ define(["dojo/_base/declare"], function (declare) {
console.log("loadMore, offset=", offset);
- Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), offset: offset});
+ Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), offset: offset, append: true});
},
scrollHandler: function () {
try {
@@ -524,19 +529,16 @@ define(["dojo/_base/declare"], function (declare) {
return tmp.firstChild;
},
- onLoaded: function (transport, offset) {
+ onLoaded: function (transport, offset, append) {
const reply = App.handleRpcJson(transport);
- console.log("Headlines.onLoaded: offset=", offset);
+ console.log("Headlines.onLoaded: offset=", offset, "append=", append);
let is_cat = false;
let feed_id = false;
if (reply) {
- if (offset == 0)
- Article.setActive(0);
-
is_cat = reply['headlines']['is_cat'];
feed_id = reply['headlines']['id'];
Feeds.last_search_query = reply['headlines']['search_query'];
@@ -544,22 +546,6 @@ define(["dojo/_base/declare"], function (declare) {
if (feed_id != -7 && (feed_id != Feeds.getActive() || is_cat != Feeds.activeIsCat()))
return;
- try {
- if (offset == 0) {
- $("headlines-frame").scrollTop = 0;
-
- Element.hide("floatingTitle");
- $("floatingTitle").setAttribute("data-article-id", 0);
- $("floatingTitle").innerHTML = "";
- }
- } catch (e) {
- }
-
- $("headlines-frame").removeClassName("cdm");
- $("headlines-frame").removeClassName("normal");
-
- $("headlines-frame").addClassName(App.isCombinedMode() ? "cdm" : "normal");
-
const headlines_count = reply['headlines-info']['count'];
Feeds.infscroll_disabled = parseInt(headlines_count) != 30;
@@ -568,7 +554,25 @@ define(["dojo/_base/declare"], function (declare) {
//this.vgroup_last_feed = reply['headlines-info']['vgroup_last_feed'];
this.current_first_id = reply['headlines']['first_id'];
- if (offset == 0) {
+ if (!append) {
+
+ $("headlines-frame").removeClassName("cdm");
+ $("headlines-frame").removeClassName("normal");
+
+ $("headlines-frame").addClassName(App.isCombinedMode() ? "cdm" : "normal");
+
+ Article.setActive(0);
+
+ try {
+ $("headlines-frame").scrollTop = 0;
+
+ Element.hide("floatingTitle");
+ $("floatingTitle").setAttribute("data-article-id", 0);
+ $("floatingTitle").innerHTML = "";
+ } catch (e) {
+ console.warn(e);
+ }
+
//this.headlines = [];
this.vgroup_last_feed = undefined;
@@ -746,7 +750,7 @@ define(["dojo/_base/declare"], function (declare) {
}
ids.each((id) => {
- this.toggleMark(id);
+ this.togglePub(id);
});
},
toggleMark: function (id) {
diff --git a/js/PrefFilterTree.js b/js/PrefFilterTree.js
index 0a8a2aa43..a7c7464fb 100644
--- a/js/PrefFilterTree.js
+++ b/js/PrefFilterTree.js
@@ -17,7 +17,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
}
if (rules) {
- param = dojo.doc.createElement('span');
+ param = dojo.doc.createElement('ul');
param.className = 'filterRules';
param.innerHTML = rules;
domConstruct.place(param, tnode.rowNode, 'next');
diff --git a/js/tt-rss.js b/js/tt-rss.js
index 7635e3a83..99b44549b 100644
--- a/js/tt-rss.js
+++ b/js/tt-rss.js
@@ -163,11 +163,31 @@ require(["dojo/_base/kernel",
window.setInterval(() => { Feeds.updateRandom() }, 30 * 1000);
}
+ if (App.getInitParam('check_for_updates')) {
+ window.setInterval(() => {
+ App.checkForUpdates();
+ }, 3600 * 1000);
+ }
+
console.log("second stage ok");
PluginHost.run(PluginHost.HOOK_INIT_COMPLETE, null);
},
+ checkForUpdates: function() {
+ console.log('checking for updates...');
+
+ xhrJson("backend.php", {op: 'rpc', method: 'checkforupdates'})
+ .then((reply) => {
+ console.log('update reply', reply);
+
+ if (reply.id) {
+ $("updates-available").show();
+ } else {
+ $("updates-available").hide();
+ }
+ });
+ },
updateTitle: function() {
let tmp = "Tiny Tiny RSS";