summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/App.js8
-rw-r--r--js/Article.js35
-rw-r--r--js/Feeds.js6
-rwxr-xr-xjs/Headlines.js26
-rw-r--r--js/PrefHelpers.js2
5 files changed, 68 insertions, 9 deletions
diff --git a/js/App.js b/js/App.js
index 03103845e..87c4bd3e7 100644
--- a/js/App.js
+++ b/js/App.js
@@ -1037,7 +1037,8 @@ const App = {
//window.open("backend.php?op=feeds&method=update_debugger&feed_id=" + Feeds.getActive());
/* global __csrf_token */
- App.postOpenWindow("backend.php", {op: "feeds", method: "update_debugger", feed_id: Feeds.getActive(), csrf_token: __csrf_token});
+ App.postOpenWindow("backend.php", {op: "feeds", method: "update_debugger",
+ feed_id: Feeds.getActive(), csrf_token: __csrf_token});
} else {
alert("You can't debug this kind of feed.");
@@ -1045,7 +1046,10 @@ const App = {
};
this.hotkey_actions["feed_debug_viewfeed"] = () => {
- Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), viewfeed_debug: true});
+ //Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat(), viewfeed_debug: true});
+
+ App.postOpenWindow("backend.php", {op: "feeds", method: "view",
+ feed: Feeds.getActive(), timestamps: 1, debug: 1, cat: Feeds.activeIsCat(), csrf_token: __csrf_token});
};
this.hotkey_actions["feed_edit"] = () => {
diff --git a/js/Article.js b/js/Article.js
index e97a6c8e6..587243a01 100644
--- a/js/Article.js
+++ b/js/Article.js
@@ -180,6 +180,36 @@ const Article = {
${__('Originally from:')} <a target="_blank" rel="noopener noreferrer" href="${App.escapeHtml(hl.orig_feed[1])}">${hl.orig_feed[0]}</a>
</span>` : "";
},
+ unpack: function(row) {
+ if (row.hasAttribute("data-content")) {
+ console.log("unpacking: " + row.id);
+
+ 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 += "&nbsp;";
+
+ // in expandable mode, save content for later, so that we can pack unfocused rows back
+ if (App.isCombinedMode() && $("main").hasClassName("expandable"))
+ row.setAttribute("data-content-original", row.getAttribute("data-content"));
+
+ row.removeAttribute("data-content");
+
+ PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row);
+ }
+ },
+ pack: function(row) {
+ if (row.hasAttribute("data-content-original")) {
+ console.log("packing", row.id);
+ row.setAttribute("data-content", row.getAttribute("data-content-original"));
+ row.removeAttribute("data-content-original");
+
+ row.querySelector(".content-inner").innerHTML = "&nbsp;";
+ }
+ },
view: function (id, no_expand) {
this.setActive(id);
Headlines.scrollToArticleId(id);
@@ -265,7 +295,7 @@ const Article = {
},
});
- const tmph = dojo.connect(dialog, 'onLoad', function () {
+ const tmph = dojo.connect(dialog, 'onShow', function () {
dojo.disconnect(tmph);
new Ajax.Autocompleter('tags_str', 'tags_choices',
@@ -298,11 +328,14 @@ const Article = {
$$("div[id*=RROW][class*=active]").each((row) => {
row.removeClassName("active");
+ Article.pack(row);
});
const row = $("RROW-" + id);
if (row) {
+ Article.unpack(row);
+
row.removeClassName("Unread");
row.addClassName("active");
diff --git a/js/Feeds.js b/js/Feeds.js
index 9259cd547..ccb982cb3 100644
--- a/js/Feeds.js
+++ b/js/Feeds.js
@@ -441,7 +441,8 @@ const Feeds = {
const show_next_feed = App.getInitParam("on_catchup_show_next_feed");
- if (show_next_feed) {
+ // only select next unread feed if catching up entirely (as opposed to last week etc)
+ if (show_next_feed && !mode) {
const nuf = this.getNextUnread(feed, is_cat);
if (nuf) {
@@ -561,6 +562,7 @@ const Feeds = {
{op: "feeds", method: "search",
param: Feeds.getActive() + ":" + Feeds.activeIsCat()},
(transport) => {
+
const dialog = new dijit.Dialog({
id: "searchDlg",
content: transport.responseText,
@@ -580,7 +582,7 @@ const Feeds = {
},
});
- const tmph = dojo.connect(dialog, 'onLoad', function () {
+ const tmph = dojo.connect(dialog, 'onShow', function () {
dojo.disconnect(tmph);
if (Feeds._search_query) {
diff --git a/js/Headlines.js b/js/Headlines.js
index 23dc0b2c2..b98098c33 100755
--- a/js/Headlines.js
+++ b/js/Headlines.js
@@ -32,6 +32,15 @@ const Headlines = {
},
{threshold: [0, 1], root: document.querySelector("#headlines-frame")}
),
+ unpack_observer: new IntersectionObserver(
+ (entries, observer) => {
+ entries.forEach((entry) => {
+ if (entry.intersectionRatio > 0)
+ Article.unpack(entry.target);
+ });
+ },
+ {threshold: [0], root: document.querySelector("#headlines-frame")}
+ ),
row_observer: new MutationObserver((mutations) => {
const modified = [];
@@ -360,6 +369,7 @@ const Headlines = {
if (hl.active) {
new_row.addClassName("active");
+ Article.unpack(new_row);
if (App.isCombinedMode())
Article.cdmMoveToId(id, {noscroll: true});
@@ -375,6 +385,11 @@ const Headlines = {
this.sticky_header_observer.observe(e)
});
+ if (App.getInitParam("cdm_expanded"))
+ $$("#headlines-frame > div[id*=RROW].cdm").each((e) => {
+ this.unpack_observer.observe(e)
+ });
+
},
render: function (headlines, hl) {
let row = null;
@@ -411,6 +426,7 @@ const Headlines = {
id="RROW-${hl.id}"
data-article-id="${hl.id}"
data-orig-feed-id="${hl.feed_id}"
+ data-content="${App.escapeHtml(hl.content)}"
data-score="${hl.score}"
data-article-title="${App.escapeHtml(hl.title)}"
onmouseover="Article.mouseIn(${hl.id})"
@@ -450,7 +466,7 @@ const Headlines = {
<div class="content" onclick="return Headlines.click(event, ${hl.id}, true);">
<div id="POSTNOTE-${hl.id}">${hl.note}</div>
<div class="content-inner" lang="${hl.lang ? hl.lang : 'en'}">
- ${hl.content}
+ <img src="${App.getInitParam('icon_indicator_white')}">
</div>
<div class="intermediate">
${hl.enclosures}
@@ -517,7 +533,6 @@ const Headlines = {
this.row_observer.observe(tmp.firstChild, {attributes: true});
PluginHost.run(PluginHost.HOOK_HEADLINE_RENDERED, tmp.firstChild);
- PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, tmp.firstChild);
return tmp.firstChild;
},
@@ -687,6 +702,11 @@ const Headlines = {
this.sticky_header_observer.observe(e)
});
+ if (App.getInitParam("cdm_expanded"))
+ $$("#headlines-frame > div[id*=RROW].cdm").each((e) => {
+ this.unpack_observer.observe(e)
+ });
+
} else {
console.error("Invalid object received: " + transport.responseText);
dijit.byId("headlines-frame").attr('content', "<div class='whiteBox'>" +
@@ -697,7 +717,7 @@ const Headlines = {
Feeds.infscroll_in_progress = 0;
// this is used to auto-catchup articles if needed after infscroll request has finished,
- // fill buffer more, etc
+ // unpack visible articles, fill buffer more, etc
this.scrollHandler();
Notify.close();
diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js
index 12710bc6a..0780fb708 100644
--- a/js/PrefHelpers.js
+++ b/js/PrefHelpers.js
@@ -51,7 +51,7 @@ const Helpers = {
return false;
},
updateEventLog: function() {
- xhrPost("backend.php", { op: "pref-system" }, (transport) => {
+ xhrPost("backend.php", { op: "pref-system", severity: dijit.byId("severity").attr('value') }, (transport) => {
dijit.byId('systemConfigTab').attr('content', transport.responseText);
Notify.close();
});