summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/AppBase.js6
-rw-r--r--js/Article.js9
-rw-r--r--js/Feeds.js25
-rwxr-xr-xjs/Headlines.js13
-rw-r--r--js/PrefHelpers.js44
-rw-r--r--js/tt-rss.js2
6 files changed, 40 insertions, 59 deletions
diff --git a/js/AppBase.js b/js/AppBase.js
index 6fc4f8bff..c7e221094 100644
--- a/js/AppBase.js
+++ b/js/AppBase.js
@@ -218,7 +218,6 @@ define(["dojo/_base/declare"], function (declare) {
if (message == "UPDATE_COUNTERS") {
console.log("need to refresh counters...");
- App.setInitParam("last_article_id", -1);
Feeds.requestCounters(true);
}
@@ -380,10 +379,11 @@ define(["dojo/_base/declare"], function (declare) {
user_css = "css/default.css?" + Date.now();
}
- fetch(user_css).then(() => {
+ $("main").fade({duration: 0.5, afterFinish: () => {
link.setAttribute("href", user_css);
+ $("main").appear({duration: 0.5});
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "USER_CSS_THEME", value: user_theme});
- });
+ }});
}
},
diff --git a/js/Article.js b/js/Article.js
index e281ea5ae..b933ed716 100644
--- a/js/Article.js
+++ b/js/Article.js
@@ -169,7 +169,14 @@ define(["dojo/_base/declare"], function (declare) {
if (row.hasAttribute("data-content")) {
console.log("unpacking: " + row.id);
- row.select(".content-inner")[0].innerHTML = row.getAttribute("data-content");
+ const container = row.querySelector(".content-inner");
+
+ container.innerHTML = row.getAttribute("data-content").trim();
+
+ // blank content element might screw up onclick selection and keyboard moving
+ if (container.textContent.length == 0)
+ container.innerHTML += " ";
+
row.removeAttribute("data-content");
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row);
diff --git a/js/Feeds.js b/js/Feeds.js
index 94b72c731..44d48d6c7 100644
--- a/js/Feeds.js
+++ b/js/Feeds.js
@@ -120,27 +120,10 @@ define(["dojo/_base/declare"], function (declare) {
this._search_query = "";
this.reloadCurrent();
},
- requestCounters: function(force) {
- const date = new Date();
- const timestamp = Math.round(date.getTime() / 1000);
-
- if (force || timestamp - this.counters_last_request > 5) {
- console.log("scheduling request of counters...");
-
- this.counters_last_request = timestamp;
-
- let query = {op: "rpc", method: "getAllCounters", seq: App.next_seq()};
-
- if (!force)
- query.last_article_id = App.getInitParam("last_article_id");
-
- xhrPost("backend.php", query, (transport) => {
- App.handleRpcJson(transport);
- });
-
- } else {
- console.log("request_counters: rate limit reached: " + (timestamp - this.counters_last_request));
- }
+ requestCounters: function() {
+ xhrPost("backend.php", {op: "rpc", method: "getAllCounters", seq: App.next_seq()}, (transport) => {
+ App.handleRpcJson(transport);
+ });
},
reload: function() {
try {
diff --git a/js/Headlines.js b/js/Headlines.js
index 2f056aef6..bbf48738b 100755
--- a/js/Headlines.js
+++ b/js/Headlines.js
@@ -40,9 +40,12 @@ define(["dojo/_base/declare"], function (declare) {
Headlines.updateSelectedPrompt();
Headlines.updateFloatingTitle(true);
- window.requestIdleCallback(() => {
+ if ('requestIdleCallback' in window)
+ window.requestIdleCallback(() => {
+ Headlines.syncModified(modified);
+ });
+ else
Headlines.syncModified(modified);
- });
}),
syncModified: function(modified) {
const ops = {
@@ -439,7 +442,7 @@ define(["dojo/_base/declare"], function (declare) {
</span>
<div class="feed">
- <a href="#" style="background-color: rgba(${hl.favicon_avg_color_rgba})"
+ <a href="#" style="background-color: ${hl.feed_bg_color}"
onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title}</a>
</div>
@@ -498,14 +501,14 @@ define(["dojo/_base/declare"], function (declare) {
</span>
</div>
<span class="feed">
- <a style="background : rgba(${hl.favicon_avg_color_rgba})" href="#" onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title}</a>
+ <a style="background : ${hl.feed_bg_color}" href="#" onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title}</a>
</span>
<div title="${hl.imported}">
<span class="updated">${hl.updated}</span>
</div>
<div class="right">
<i class="material-icons icon-score" title="${hl.score}" onclick="Article.setScore(${hl.id}, this)">${Article.getScorePic(hl.score)}</i>
- <span onclick="Feeds.open({feed:${hl.feed_id})" style="cursor : pointer" title="${hl.feed_title}">${hl.feed_icon}</span>
+ <span onclick="Feeds.open({feed:${hl.feed_id}})" style="cursor : pointer" title="${hl.feed_title}">${hl.feed_icon}</span>
</div>
</div>
`;
diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js
index f7ca2525f..a3d122029 100644
--- a/js/PrefHelpers.js
+++ b/js/PrefHelpers.js
@@ -103,39 +103,27 @@ define(["dojo/_base/declare"], function (declare) {
dialog.show();
},
customizeCSS: function() {
- require(["codeflask"], function(CodeFlask) {
+ const query = "backend.php?op=pref-prefs&method=customizeCSS";
- const query = "backend.php?op=pref-prefs&method=customizeCSS";
+ if (dijit.byId("cssEditDlg"))
+ dijit.byId("cssEditDlg").destroyRecursive();
- if (dijit.byId("cssEditDlg"))
- dijit.byId("cssEditDlg").destroyRecursive();
-
- const dialog = new dijit.Dialog({
- id: "cssEditDlg",
- title: __("Customize stylesheet"),
- style: "width: 600px",
- execute: function () {
- Notify.progress('Saving data...', true);
-
- const params = this.attr('value');
- params.value = this._flask.getCode();
-
- xhrPost("backend.php", params, () => {
- window.location.reload();
- });
-
- },
- href: query
- });
+ const dialog = new dijit.Dialog({
+ id: "cssEditDlg",
+ title: __("Customize stylesheet"),
+ style: "width: 600px",
+ execute: function () {
+ Notify.progress('Saving data...', true);
- dojo.connect(dialog, "onShow", function () {
- setTimeout(() => {
- dialog._flask = new CodeFlask('#user-css-editor', {language: 'css'});
- }, 250);
- });
+ xhrPost("backend.php", this.attr('value'), () => {
+ window.location.reload();
+ });
- dialog.show();
+ },
+ href: query
});
+
+ dialog.show();
},
confirmReset: function() {
if (confirm(__("Reset to defaults?"))) {
diff --git a/js/tt-rss.js b/js/tt-rss.js
index eaf6ae1cd..7635e3a83 100644
--- a/js/tt-rss.js
+++ b/js/tt-rss.js
@@ -95,7 +95,7 @@ require(["dojo/_base/kernel",
checkBrowserFeatures: function() {
let errorMsg = "";
- ['requestIdleCallback', 'MutationObserver'].each(function(wf) {
+ ['MutationObserver'].each(function(wf) {
if (! (wf in window)) {
errorMsg = `Browser feature check failed: <code>window.${wf}</code> not found.`;
throw $break;