summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/Article.js7
-rw-r--r--js/CommonDialogs.js125
-rwxr-xr-xjs/Headlines.js61
3 files changed, 18 insertions, 175 deletions
diff --git a/js/Article.js b/js/Article.js
index 587243a01..a075e321f 100644
--- a/js/Article.js
+++ b/js/Article.js
@@ -175,11 +175,6 @@ const Article = {
return comments;
},
- formatOriginallyFrom: function(hl) {
- return hl.orig_feed ? `<span>
- ${__('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);
@@ -220,7 +215,6 @@ const Article = {
if (hl) {
const comments = this.formatComments(hl);
- const originally_from = this.formatOriginallyFrom(hl);
const article = `<div class="post post-${hl.id}" data-article-id="${hl.id}">
<div class="header">
@@ -243,7 +237,6 @@ const Article = {
</div>
<div id="POSTNOTE-${hl.id}">${hl.note}</div>
<div class="content" lang="${hl.lang ? hl.lang : 'en'}">
- ${originally_from}
${hl.content}
${hl.enclosures}
</div>
diff --git a/js/CommonDialogs.js b/js/CommonDialogs.js
index c59ef9b25..b344967a7 100644
--- a/js/CommonDialogs.js
+++ b/js/CommonDialogs.js
@@ -241,131 +241,6 @@ const CommonDialogs = {
dialog.show();
},
- feedBrowser: function() {
- const query = {op: "feeds", method: "feedBrowser"};
-
- if (dijit.byId("feedAddDlg"))
- dijit.byId("feedAddDlg").hide();
-
- if (dijit.byId("feedBrowserDlg"))
- dijit.byId("feedBrowserDlg").destroyRecursive();
-
- // noinspection JSUnusedGlobalSymbols
- const dialog = new dijit.Dialog({
- id: "feedBrowserDlg",
- title: __("More Feeds"),
- style: "width: 600px",
- getSelectedFeedIds: function () {
- const list = $$("#browseFeedList li[id*=FBROW]");
- const selected = [];
-
- list.each(function (child) {
- const id = child.id.replace("FBROW-", "");
-
- if (child.hasClassName('Selected')) {
- selected.push(id);
- }
- });
-
- return selected;
- },
- getSelectedFeeds: function () {
- const list = $$("#browseFeedList li.Selected");
- const selected = [];
-
- list.each(function (child) {
- const title = child.getElementsBySelector("span.fb_feedTitle")[0].innerHTML;
- const url = child.getElementsBySelector("a.fb_feedUrl")[0].href;
-
- selected.push([title, url]);
-
- });
-
- return selected;
- },
-
- subscribe: function () {
- const mode = this.attr('value').mode;
- let selected = [];
-
- if (mode == "1")
- selected = this.getSelectedFeeds();
- else
- selected = this.getSelectedFeedIds();
-
- if (selected.length > 0) {
- dijit.byId("feedBrowserDlg").hide();
-
- Notify.progress("Loading, please wait...", true);
-
- const query = {
- op: "rpc", method: "massSubscribe",
- payload: JSON.stringify(selected), mode: mode
- };
-
- xhrPost("backend.php", query, () => {
- Notify.close();
-
- if (App.isPrefs())
- dijit.byId("feedTree").reload();
- else
- Feeds.reload();
- });
-
- } else {
- alert(__("No feeds selected."));
- }
-
- },
- update: function () {
- Element.show('feed_browser_spinner');
-
- xhrPost("backend.php", dialog.attr("value"), (transport) => {
- Notify.close();
-
- Element.hide('feed_browser_spinner');
-
- const reply = JSON.parse(transport.responseText);
- const mode = reply['mode'];
-
- if ($("browseFeedList") && reply['content']) {
- $("browseFeedList").innerHTML = reply['content'];
- }
-
- dojo.parser.parse("browseFeedList");
-
- if (mode == 2) {
- Element.show(dijit.byId('feed_archive_remove').domNode);
- } else {
- Element.hide(dijit.byId('feed_archive_remove').domNode);
- }
- });
- },
- removeFromArchive: function () {
- const selected = this.getSelectedFeedIds();
-
- if (selected.length > 0) {
- if (confirm(__("Remove selected feeds from the archive? Feeds with stored articles will not be removed."))) {
- Element.show('feed_browser_spinner');
-
- const query = {op: "rpc", method: "remarchive", ids: selected.toString()};
-
- xhrPost("backend.php", query, () => {
- dialog.update();
- });
- }
- }
- },
- execute: function () {
- if (this.validate()) {
- this.subscribe();
- }
- },
- href: "backend.php?" + dojo.objectToQuery(query)
- });
-
- dialog.show();
- },
addLabel: function(select, callback) {
const caption = prompt(__("Please enter label caption:"), "");
diff --git a/js/Headlines.js b/js/Headlines.js
index b98098c33..3b4498430 100755
--- a/js/Headlines.js
+++ b/js/Headlines.js
@@ -300,6 +300,16 @@ const Headlines = {
}
}
},
+ unpackVisible: function(container) {
+ const rows = $$("#headlines-frame > div[id*=RROW][data-content].cdm");
+
+ for (let i = 0; i < rows.length; i++) {
+ if (App.Scrollable.isChildVisible(rows[i], container)) {
+ console.log('force unpacking:', rows[i].getAttribute('id'));
+ Article.unpack(rows[i]);
+ }
+ }
+ },
scrollHandler: function (/*event*/) {
try {
if (!Feeds.infscroll_disabled && !Feeds.infscroll_in_progress) {
@@ -320,6 +330,14 @@ const Headlines = {
}
}
+ if (App.isCombinedMode() && App.getInitParam("cdm_expanded")) {
+ const container = $("headlines-frame")
+
+ /* don't do anything until there was some scrolling */
+ if (container.scrollTop > 0)
+ Headlines.unpackVisible(container);
+ }
+
if (App.getInitParam("cdm_auto_catchup")) {
const rows = $$("#headlines-frame > div[id*=RROW][class*=Unread]");
@@ -420,7 +438,6 @@ const Headlines = {
row_class += App.getInitParam("cdm_expanded") ? " expanded" : " expandable";
const comments = Article.formatComments(hl);
- const originally_from = Article.formatOriginallyFrom(hl);
row = `<div class="cdm ${row_class} ${Article.getScoreClass(hl.score)}"
id="RROW-${hl.id}"
@@ -483,7 +500,6 @@ const Headlines = {
</div>
<div class="right">
- ${originally_from}
${hl.buttons}
</div>
</div>
@@ -1085,42 +1101,6 @@ const Headlines = {
}
}
},
- archiveSelection: function () {
- const rows = Headlines.getSelected();
-
- if (rows.length == 0) {
- alert(__("No articles selected."));
- return;
- }
-
- const fn = Feeds.getName(Feeds.getActive(), Feeds.activeIsCat());
- let str;
- let op;
-
- if (Feeds.getActive() != 0) {
- str = ngettext("Archive %d selected article in %s?", "Archive %d selected articles in %s?", rows.length);
- op = "archive";
- } else {
- str = ngettext("Move %d archived article back?", "Move %d archived articles back?", rows.length);
- str += " " + __("Please note that unstarred articles might get purged on next feed update.");
-
- op = "unarchive";
- }
-
- str = str.replace("%d", rows.length);
- str = str.replace("%s", fn);
-
- if (App.getInitParam("confirm_feed_catchup") && !confirm(str)) {
- return;
- }
-
- const query = {op: "rpc", method: op, ids: rows.toString()};
-
- xhrPost("backend.php", query, (transport) => {
- App.handleRpcJson(transport);
- Feeds.reloadCurrent();
- });
- },
catchupSelection: function () {
const rows = Headlines.getSelected();
@@ -1206,11 +1186,6 @@ const Headlines = {
});
}
},
- onActionChanged: function (elem) {
- // eslint-disable-next-line no-eval
- eval(elem.value);
- elem.attr('value', 'false');
- },
scrollToArticleId: function (id) {
const container = $("headlines-frame");
const row = $("RROW-" + id);