+/* global dijit, __ */
+
var loading_progress = 0;
var sanity_check_done = false;
var init_params = {};
}
function remove_splash() {
-
- if (Element.visible("overlay")) {
- console.log("about to remove splash, OMG!");
- Element.hide("overlay");
- console.log("removed splash!");
- }
+ Element.hide("overlay");
}
function strip_tags(s) {
const result = JSON.parse(transport.responseText);
if (result && dijit.byId("filterTestDlg") && dijit.byId("filterTestDlg").open) {
- test_dlg.results += result.size();
+ test_dlg.results += result.length;
- console.log("got results:" + result.size());
+ console.log("got results:" + result.length);
$("prefFilterProgressMsg").innerHTML = __("Looking for articles (%d processed, %f found)...")
.replace("%f", test_dlg.results)
console.log(offset + " " + test_dlg.max_offset);
- for (let i = 0; i < result.size(); i++) {
+ for (let i = 0; i < result.length; i++) {
const tmp = new Element("table");
tmp.innerHTML = result[i];
dojo.parser.parse(tmp);
style: "width: 600px",
getSelectedFeedIds: function () {
const list = $$("#browseFeedList li[id*=FBROW]");
- const selected = new Array();
+ const selected = [];
list.each(function (child) {
const id = child.id.replace("FBROW-", "");
},
getSelectedFeeds: function () {
const list = $$("#browseFeedList li.Selected");
- const selected = new Array();
+ const selected = [];
list.each(function (child) {
const title = child.getElementsBySelector("span.fb_feedTitle")[0].innerHTML;
+/* global dijit, __ */
+
let global_unread = -1;
let hotkey_prefix = false;
let hotkey_prefix_pressed = false;
id: "feedTree",
}, "feedTree");
- /* var menu = new dijit.Menu({id: 'feedMenu'});
-
- menu.addChild(new dijit.MenuItem({
- label: "Simple menu item"
- }));
-
- // menu.bindDomNode(tree.domNode); */
-
var tmph = dojo.connect(dijit.byId('feedMenu'), '_openMyself', function (event) {
console.log(dijit.getEnclosingWidget(event.target));
dojo.disconnect(tmph);
dijit.getEnclosingWidget(toolbar.order_by).attr('value',
getInitParam("default_view_order_by"));
- const feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
-
const hash_feed_id = hash_get('f');
const hash_feed_is_cat = hash_get('c') == "1";
new Ajax.Request("backend.php", {
parameters: query,
- onComplete: function(transport) {
+ onComplete: function() {
viewCurrentFeed();
} });
}
if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
- let keycode = false;
-
- const cmdline = $('cmdline');
+ let keycode = e.which;
- if (window.event) {
- keycode = window.event.keyCode;
- } else if (e) {
- keycode = e.which;
- }
-
- if (keycode == 27) { // escape
+ if (keycode == 27) { // escape and drop prefix
hotkey_prefix = false;
}
- if (keycode == 16) return; // ignore lone shift
- if (keycode == 17) return; // ignore lone ctrl
+ if (keycode == 16 || keycode == 17) return; // ignore lone shift / ctrl
- var hotkeys = getInitParam("hotkeys");
+ const hotkeys = getInitParam("hotkeys");
const keychar = String.fromCharCode(keycode).toLowerCase();
if (!hotkey_prefix && hotkeys[0].indexOf(keychar) != -1) {
hotkey_prefix = keychar;
hotkey_prefix_pressed = ts;
- cmdline.innerHTML = keychar;
- Element.show(cmdline);
+ $("cmdline").innerHTML = keychar;
+ Element.show("cmdline");
e.stopPropagation();
return true;
}
- Element.hide(cmdline);
+ Element.hide("cmdline");
let hotkey = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
hotkey_prefix = false;
let hotkey_action = false;
- var hotkeys = getInitParam("hotkeys");
for (const sequence in hotkeys[1]) {
if (sequence == hotkey) {
const seq = reply['seq'];
- if (seq) {
- if (get_seq() != seq) {
- console.log("[handle_rpc_json] sequence mismatch: " + seq +
- " (want: " + get_seq() + ")");
- return true;
- }
+ if (get_seq() != seq) {
+ console.log("[handle_rpc_json] sequence mismatch: " + seq +
+ " (want: " + get_seq() + ")");
+ return true;
}
const message = reply['message'];
- if (message) {
- if (message == "UPDATE_COUNTERS") {
- console.log("need to refresh counters...");
- setInitParam("last_article_id", -1);
- request_counters(true);
- }
+ if (message == "UPDATE_COUNTERS") {
+ console.log("need to refresh counters...");
+ setInitParam("last_article_id", -1);
+ request_counters(true);
}
const counters = reply['counters'];
if (netalert) netalert.hide();
- } else if (netalert)
+ } else
+ if (netalert)
netalert.show();
else
notify_error("Communication problem with server.");
+/* global dijit, __ */
+
let _active_article_id = 0;
let vgroup_last_feed = false;
}
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();
-}