-var _active_article_id = 0;
+/* global dijit, __ */
-var vgroup_last_feed = false;
-var post_under_pointer = false;
+let _active_article_id = 0;
-var last_requested_article = false;
+let vgroup_last_feed = false;
+let post_under_pointer = false;
-var catchup_id_batch = [];
-var catchup_timeout_id = false;
+let last_requested_article = false;
-var cids_requested = [];
-var loaded_article_ids = [];
-var _last_headlines_update = 0;
-var _headlines_scroll_offset = 0;
-var current_first_id = 0;
-var last_search_query;
+let catchup_id_batch = [];
+let catchup_timeout_id = false;
-var _catchup_request_sent = false;
+let cids_requested = [];
+let loaded_article_ids = [];
+let _last_headlines_update = 0;
+let _headlines_scroll_offset = 0;
+let current_first_id = 0;
+let last_search_query;
-var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null;
+let _catchup_request_sent = false;
+
+let has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null;
function headlines_callback2(transport, offset, background, infscroll_req) {
handle_rpc_json(transport);
}
function updateSelectedPrompt() {
- const count = getSelectedArticleIds2().size();
+ const count = getSelectedArticleIds2().length;
const elem = $("selected_prompt");
if (elem) {
const rows = $$("#headlines-frame > div[id*=RROW]");
for (let i = 0; i < rows.length; i++) {
- var child = rows[i];
+ const child = rows[i];
if ($("headlines-frame").scrollTop <= child.offsetTop &&
child.offsetTop - $("headlines-frame").scrollTop < 100 &&
$$("#headlines-frame > div[id*=RROW][class*=Unread]").each(
function(child) {
- if (child.hasClassName("Unread") && $("headlines-frame").scrollTop >
- (child.offsetTop + child.offsetHeight/2)) {
+ if ($("headlines-frame").scrollTop > (child.offsetTop + child.offsetHeight/2)) {
const id = child.getAttribute("data-article-id")
});
if (_infscroll_disable) {
- var child = $$("#headlines-frame div[id*=RROW]").last();
+ const child = $$("#headlines-frame div[id*=RROW]").last();
if (child && $("headlines-frame").scrollTop >
(child.offsetTop + child.offsetHeight - 50)) {
const visible_ids = getLoadedArticleIds();
- const ids_to_mark = new Array();
+ const ids_to_mark = [];
if (!below) {
for (var i = 0; i < visible_ids.length; i++) {
const old_offset = row.offsetTop;
if (getActiveArticleId() && elem && !getInitParam("cdm_expanded")) {
- var collapse = oldrow.select("span[class='collapseBtn']")[0];
+ let collapse = oldrow.select("span[class='collapseBtn']")[0];
Element.hide(elem);
Element.show("CEXC-" + getActiveArticleId());
elem = $("CICD-" + id);
- var collapse = row.select("span[class='collapseBtn']")[0];
+ let collapse = row.select("span[class='collapseBtn']")[0];
const cencw = $("CENCW-" + id);
return cdmExpandArticle(id);
} else {
- var elem = $("RROW-" + getActiveArticleId());
+ let elem = $("RROW-" + getActiveArticleId());
if (elem) elem.removeClassName("active");
selectArticles("none");
toggleSelected(id);
- var elem = $("RROW-" + id);
- var article_is_unread = elem.hasClassName("Unread");
+ elem = $("RROW-" + id);
+ const article_is_unread = elem.hasClassName("Unread");
elem.removeClassName("Unread");
elem.addClassName("active");
toggleSelected(id, true);
- var elem = $("RROW-" + id);
- var article_is_unread = elem.hasClassName("Unread");
+ let elem = $("RROW-" + id);
+ const article_is_unread = elem.hasClassName("Unread");
if (article_is_unread) {
decrementFeedCounter(getActiveFeedId(), activeFeedIsCat());
menu.addChild(new dijit.MenuItem({
label: __("Toggle unread"),
- onClick: function (event) {
+ onClick: function () {
let ids = getSelectedArticleIds2();
// cast to string
const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + "";
- ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
+ ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
selectionToggleUnread(undefined, false, true, ids);
}
menu.addChild(new dijit.MenuItem({
label: __("Toggle starred"),
- onClick: function (event) {
+ onClick: function () {
let ids = getSelectedArticleIds2();
// cast to string
const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + "";
- ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
+ ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
selectionToggleMarked(undefined, false, true, ids);
}
menu.addChild(new dijit.MenuItem({
label: __("Toggle published"),
- onClick: function (event) {
+ onClick: function () {
let ids = getSelectedArticleIds2();
// cast to string
const id = (this.getParent().currentTarget.getAttribute("data-article-id")) + "";
- ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
+ ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
selectionTogglePublished(undefined, false, true, ids);
}
menu.addChild(new dijit.MenuItem({
label: __("Mark above as read"),
- onClick: function (event) {
+ onClick: function () {
catchupRelativeToArticle(0, this.getParent().currentTarget.getAttribute("data-article-id"));
}
}));
menu.addChild(new dijit.MenuItem({
label: __("Mark below as read"),
- onClick: function (event) {
+ onClick: function () {
catchupRelativeToArticle(1, this.getParent().currentTarget.getAttribute("data-article-id"));
}
}));
labelAddMenu.addChild(new dijit.MenuItem({
label: name,
labelId: bare_id,
- onClick: function (event) {
+ onClick: function () {
let ids = getSelectedArticleIds2();
// cast to string
const id = (this.getParent().ownerMenu.currentTarget.getAttribute("data-article-id")) + "";
- ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
+ ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
selectionAssignLabel(this.labelId, ids);
}
labelDelMenu.addChild(new dijit.MenuItem({
label: name,
labelId: bare_id,
- onClick: function (event) {
+ onClick: function () {
let ids = getSelectedArticleIds2();
// cast to string
const id = (this.getParent().ownerMenu.currentTarget.getAttribute("data-article-id")) + "";
- ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
+ ids = ids.length != 0 && ids.indexOf(id) != -1 ? ids : [id];
selectionRemoveLabel(this.labelId, ids);
}
function initHeadlinesMenu() {
if (!dijit.byId("headlinesMenu")) {
- var menu = new dijit.Menu({
+ const menu = new dijit.Menu({
id: "headlinesMenu",
targetNodeIds: ["headlines-frame"],
selector: ".hlMenuAttach"
if (!dijit.byId("headlinesFeedTitleMenu")) {
- var menu = new dijit.Menu({
+ const menu = new dijit.Menu({
id: "headlinesFeedTitleMenu",
targetNodeIds: ["headlines-frame"],
selector: "div.cdmFeedTitle"
menu.addChild(new dijit.MenuItem({
label: __("Mark group as read"),
- onClick: function (event) {
+ onClick: function () {
selectArticles("none");
selectArticles("all",
"#headlines-frame > div[id*=RROW]" +
menu.addChild(new dijit.MenuItem({
label: __("Mark feed as read"),
- onClick: function (event) {
+ onClick: function () {
catchupFeedInGroup(this.getParent().currentTarget.getAttribute("data-feed-id"));
}
}));
menu.addChild(new dijit.MenuItem({
label: __("Edit feed"),
- onClick: function (event) {
+ onClick: function () {
editFeed(this.getParent().currentTarget.getAttribute("data-feed-id"));
}
}));
if (ids.length > 0) {
console.log(ids);
- var score = prompt(__("Please enter new score for selected articles:"), score);
+ const score = prompt(__("Please enter new score for selected articles:"));
if (score != undefined) {
const query = "op=article&method=setScore&id=" + param_escape(ids.toString()) +
}
}
}
-
-function cdmFooterClick(event) {
- event.stopPropagation();
-}