Form.enable("main_toolbar_form");
let query = Object.assign({op: "feeds", method: "view", feed: feed},
- dojo.formToObject("main_toolbar_form"));
+ dojo.formToObject("main_toolbar_form"));
if (method) query.m = method;
_viewfeed_timeout = setTimeout(() => {
xhrPost("backend.php", query, (transport) => {
- try {
- setFeedExpandoIcon(feed, is_cat, 'images/blank_icon.gif');
- headlines_callback2(transport, offset, background, infscroll_req);
- PluginHost.run(PluginHost.HOOK_FEED_LOADED, [feed, is_cat]);
- } catch (e) {
- exception_error(e);
- }
+ try {
+ setFeedExpandoIcon(feed, is_cat, 'images/blank_icon.gif');
+ headlines_callback2(transport, offset, background, infscroll_req);
+ PluginHost.run(PluginHost.HOOK_FEED_LOADED, [feed, is_cat]);
+ } catch (e) {
+ exception_error(e);
+ }
});
}, timeout_ms); // Wait 250ms
}
// bw_limit disables timeout() so we request initial counters separately
- if (getInitParam("bw_limit") == "1") {
+ if (getInitParam("bw_limit") == "1") {
request_counters(true);
- } else {
- setTimeout(timeout, 250);
- }
+ } else {
+ setTimeout(timeout, 250);
+ }
}
query.last_article_id = getInitParam("last_article_id");
xhrPost("backend.php", query, (transport) => {
- handle_rpc_json(transport);
+ handle_rpc_json(transport);
});
} else {
notify_progress("Loading, please wait...", true);
xhrPost("backend.php", { op: "rpc", method: "catchupFeed", feed_id: id, is_cat: false}, (transport) => {
- handle_rpc_json(transport);
+ handle_rpc_json(transport);
});
}
}
notify_progress("Loading, please wait...", true);
xhrPost("backend.php", catchup_query, (transport) => {
- handle_rpc_json(transport);
+ handle_rpc_json(transport);
- const show_next_feed = getInitParam("on_catchup_show_next_feed") == "1";
+ const show_next_feed = getInitParam("on_catchup_show_next_feed") == "1";
- if (show_next_feed) {
- const nuf = getNextUnreadFeed(feed, is_cat);
+ if (show_next_feed) {
+ const nuf = getNextUnreadFeed(feed, is_cat);
- if (nuf) {
- viewfeed({feed: nuf, is_cat: is_cat});
- }
- } else if (feed == getActiveFeedId() && is_cat == activeFeedIsCat()) {
- viewCurrentFeed();
- }
+ if (nuf) {
+ viewfeed({feed: nuf, is_cat: is_cat});
+ }
+ } else if (feed == getActiveFeedId() && is_cat == activeFeedIsCat()) {
+ viewCurrentFeed();
+ }
- notify("");
+ notify("");
});
}
function xhrPost(url, params, complete) {
console.log("xhrPost:", params);
- return new Ajax.Request(url, {
- parameters: params,
- onComplete: complete
- });
+ return new Ajax.Request(url, {
+ parameters: params,
+ onComplete: complete
+ });
}
function xhrJson(url, params, complete) {
- return xhrPost(url, params, (reply) => {
- try {
- const obj = JSON.parse(reply.responseText);
- complete(obj);
- } catch (e) {
- console.error("xhrJson", e, reply);
- complete(null);
- }
-
- })
+ return xhrPost(url, params, (reply) => {
+ try {
+ const obj = JSON.parse(reply.responseText);
+ complete(obj);
+ } catch (e) {
+ console.error("xhrJson", e, reply);
+ complete(null);
+ }
+
+ })
}
/* add method to remove element from array */
const prefix = name + "=";
let begin = dc.indexOf("; " + prefix);
if (begin == -1) {
- begin = dc.indexOf(prefix);
- if (begin != 0) return null;
+ begin = dc.indexOf(prefix);
+ if (begin != 0) return null;
}
else {
- begin += 2;
+ begin += 2;
}
let end = document.cookie.indexOf(";", begin);
if (end == -1) {
- end = dc.length;
+ end = dc.length;
}
return unescape(dc.substring(begin + prefix.length, end));
}
const query = { op: "dlg", method: id, param: param };
xhrPost("backend.php", query, (transport) => {
- infobox_callback2(transport, title);
- if (callback) callback(transport);
+ infobox_callback2(transport, title);
+ if (callback) callback(transport);
});
return false;
notify_progress("Removing feed icon...", true);
- const query = { op: "pref-feeds", method: "removeicon", feed_id: id };
+ const query = { op: "pref-feeds", method: "removeicon", feed_id: id };
xhrPost("backend.php", query, (transport) => {
- notify_info("Feed icon removed.");
- if (inPreferences()) {
- updateFeedList();
- } else {
- setTimeout('updateFeedList(false, false)', 50);
- }
- });
+ notify_info("Feed icon removed.");
+ if (inPreferences()) {
+ updateFeedList();
+ } else {
+ setTimeout('updateFeedList(false, false)', 50);
+ }
+ });
}
return false;
notify_progress("Loading, please wait...", true);
xhrPost("backend.php", query, (transport) => {
- if (callback) {
- callback(transport);
- } else if (inPreferences()) {
- updateLabelList();
- } else {
- updateFeedList();
- }
- });
+ if (callback) {
+ callback(transport);
+ } else if (inPreferences()) {
+ updateLabelList();
+ } else {
+ updateFeedList();
+ }
+ });
}
}
Element.hide("fadd_error_message");
xhrPost("backend.php", this.attr('value'), (transport) => {
- try {
-
- try {
- var reply = JSON.parse(transport.responseText);
- } catch (e) {
- Element.hide("feed_add_spinner");
- alert(__("Failed to parse output. This can indicate server timeout and/or network issues. Backend output was logged to browser console."));
- console.log('quickAddFeed, backend returned:' + transport.responseText);
- return;
- }
-
- const rc = reply['result'];
-
- notify('');
- Element.hide("feed_add_spinner");
-
- console.log(rc);
-
- switch (parseInt(rc['code'])) {
- case 1:
- dialog.hide();
- notify_info(__("Subscribed to %s").replace("%s", feed_url));
-
- updateFeedList();
- break;
- case 2:
- dialog.show_error(__("Specified URL seems to be invalid."));
- break;
- case 3:
- dialog.show_error(__("Specified URL doesn't seem to contain any feeds."));
- break;
- case 4:
- const feeds = rc['feeds'];
-
- Element.show("fadd_multiple_notify");
-
- const select = dijit.byId("feedDlg_feedContainerSelect");
-
- while (select.getOptions().length > 0)
- select.removeOption(0);
-
- select.addOption({value: '', label: __("Expand to select feed")});
-
- let count = 0;
- for (const feedUrl in feeds) {
- select.addOption({value: feedUrl, label: feeds[feedUrl]});
- count++;
- }
-
- Effect.Appear('feedDlg_feedsContainer', {duration : 0.5});
-
- break;
- case 5:
- dialog.show_error(__("Couldn't download the specified URL: %s").
- replace("%s", rc['message']));
- break;
- case 6:
- dialog.show_error(__("XML validation failed: %s").
- replace("%s", rc['message']));
- break;
- case 0:
- dialog.show_error(__("You are already subscribed to this feed."));
- break;
- }
-
- } catch (e) {
- console.error(transport.responseText);
- exception_error(e);
- }
+ try {
+
+ try {
+ var reply = JSON.parse(transport.responseText);
+ } catch (e) {
+ Element.hide("feed_add_spinner");
+ alert(__("Failed to parse output. This can indicate server timeout and/or network issues. Backend output was logged to browser console."));
+ console.log('quickAddFeed, backend returned:' + transport.responseText);
+ return;
+ }
+
+ const rc = reply['result'];
+
+ notify('');
+ Element.hide("feed_add_spinner");
+
+ console.log(rc);
+
+ switch (parseInt(rc['code'])) {
+ case 1:
+ dialog.hide();
+ notify_info(__("Subscribed to %s").replace("%s", feed_url));
+
+ updateFeedList();
+ break;
+ case 2:
+ dialog.show_error(__("Specified URL seems to be invalid."));
+ break;
+ case 3:
+ dialog.show_error(__("Specified URL doesn't seem to contain any feeds."));
+ break;
+ case 4:
+ const feeds = rc['feeds'];
+
+ Element.show("fadd_multiple_notify");
+
+ const select = dijit.byId("feedDlg_feedContainerSelect");
+
+ while (select.getOptions().length > 0)
+ select.removeOption(0);
+
+ select.addOption({value: '', label: __("Expand to select feed")});
+
+ let count = 0;
+ for (const feedUrl in feeds) {
+ select.addOption({value: feedUrl, label: feeds[feedUrl]});
+ count++;
+ }
+
+ Effect.Appear('feedDlg_feedsContainer', {duration : 0.5});
+
+ break;
+ case 5:
+ dialog.show_error(__("Couldn't download the specified URL: %s").
+ replace("%s", rc['message']));
+ break;
+ case 6:
+ dialog.show_error(__("XML validation failed: %s").
+ replace("%s", rc['message']));
+ break;
+ case 0:
+ dialog.show_error(__("You are already subscribed to this feed."));
+ break;
+ }
+
+ } catch (e) {
+ console.error(transport.responseText);
+ exception_error(e);
+ }
});
}
},
for (const k in params) {
switch (k) {
case "label_base_index":
- _label_base_index = parseInt(params[k])
+ _label_base_index = parseInt(params[k])
break;
case "hotkeys":
// filter mnemonic definitions (used for help panel) from hotkeys map
// i.e. *(191)|Ctrl-/ -> *(191)
- const tmp = [];
- for (const sequence in params[k][1]) {
- const filtered = sequence.replace(/\|.*$/, "");
- tmp[filtered] = params[k][1][sequence];
- }
+ const tmp = [];
+ for (const sequence in params[k][1]) {
+ const filtered = sequence.replace(/\|.*$/, "");
+ tmp[filtered] = params[k][1][sequence];
+ }
- params[k][1] = tmp;
- break;
+ params[k][1] = tmp;
+ break;
}
- console.log("IP:", k, "=>", params[k]);
+ console.log("IP:", k, "=>", params[k]);
}
init_params = params;
ids: sel_rows.toString() };
xhrPost("backend.php", query, () => {
- notify('');
- dialog.hide();
- updateFeedList();
- });
+ notify('');
+ dialog.hide();
+ updateFeedList();
+ });
}
} else {
}
function helpDialog(topic) {
- const query = "backend.php?op=backend&method=help&topic=" + param_escape(topic);
+ const query = "backend.php?op=backend&method=help&topic=" + param_escape(topic);
- if (dijit.byId("helpDlg"))
- dijit.byId("helpDlg").destroyRecursive();
+ if (dijit.byId("helpDlg"))
+ dijit.byId("helpDlg").destroyRecursive();
- const dialog = new dijit.Dialog({
- id: "helpDlg",
- title: __("Help"),
- style: "width: 600px",
- href: query,
- });
+ const dialog = new dijit.Dialog({
+ id: "helpDlg",
+ title: __("Help"),
+ style: "width: 600px",
+ href: query,
+ });
- dialog.show();
+ dialog.show();
}
function label_to_feed_id(label) {
function keyevent_to_action(e) {
- const hotkeys_map = getInitParam("hotkeys");
- const keycode = e.which;
- const keychar = String.fromCharCode(keycode).toLowerCase();
+ const hotkeys_map = getInitParam("hotkeys");
+ const keycode = e.which;
+ const keychar = String.fromCharCode(keycode).toLowerCase();
- if (keycode == 27) { // escape and drop prefix
- hotkey_prefix = false;
- }
+ if (keycode == 27) { // escape and drop prefix
+ hotkey_prefix = false;
+ }
- if (keycode == 16 || keycode == 17) return; // ignore lone shift / ctrl
+ if (keycode == 16 || keycode == 17) return; // ignore lone shift / ctrl
- if (!hotkey_prefix && hotkeys_map[0].indexOf(keychar) != -1) {
+ if (!hotkey_prefix && hotkeys_map[0].indexOf(keychar) != -1) {
- const date = new Date();
- const ts = Math.round(date.getTime() / 1000);
+ const date = new Date();
+ const ts = Math.round(date.getTime() / 1000);
- hotkey_prefix = keychar;
- hotkey_prefix_pressed = ts;
+ hotkey_prefix = keychar;
+ hotkey_prefix_pressed = ts;
- $("cmdline").innerHTML = keychar;
- Element.show("cmdline");
+ $("cmdline").innerHTML = keychar;
+ Element.show("cmdline");
- e.stopPropagation();
+ e.stopPropagation();
- return false;
- }
+ return false;
+ }
- Element.hide("cmdline");
+ Element.hide("cmdline");
- let hotkey_name = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
+ let hotkey_name = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
- // ensure ^*char notation
- if (e.shiftKey) hotkey_name = "*" + hotkey_name;
- if (e.ctrlKey) hotkey_name = "^" + hotkey_name;
- if (e.altKey) hotkey_name = "+" + hotkey_name;
- if (e.metaKey) hotkey_name = "%" + hotkey_name;
+ // ensure ^*char notation
+ if (e.shiftKey) hotkey_name = "*" + hotkey_name;
+ if (e.ctrlKey) hotkey_name = "^" + hotkey_name;
+ if (e.altKey) hotkey_name = "+" + hotkey_name;
+ if (e.metaKey) hotkey_name = "%" + hotkey_name;
- const hotkey_full = hotkey_prefix ? hotkey_prefix + " " + hotkey_name : hotkey_name;
- hotkey_prefix = false;
+ const hotkey_full = hotkey_prefix ? hotkey_prefix + " " + hotkey_name : hotkey_name;
+ hotkey_prefix = false;
- let action_name = false;
+ let action_name = false;
- for (const sequence in hotkeys_map[1]) {
- if (sequence == hotkey_full) {
- action_name = hotkeys_map[1][sequence];
- break;
- }
- }
+ for (const sequence in hotkeys_map[1]) {
+ if (sequence == hotkey_full) {
+ action_name = hotkeys_map[1][sequence];
+ break;
+ }
+ }
- console.log('keyevent_to_action', hotkey_full, '=>', action_name);
+ console.log('keyevent_to_action', hotkey_full, '=>', action_name);
- return action_name;
+ return action_name;
}
\ No newline at end of file
notify_progress("Adding user...");
xhrPost("backend.php", { op: "pref-users", method: "add", login: login }, (transport) => {
- notify_callback2(transport);
- updateUsersList();
- });
+ notify_callback2(transport);
+ updateUsersList();
+ });
}
notify_progress("Saving data...", true);
xhrPost("backend.php", dojo.formToObject("user_edit_form"), (transport) => {
- dialog.hide();
- updateUsersList();
- });
+ dialog.hide();
+ updateUsersList();
+ });
}
},
href: query
title: __("OPML Import"),
style: "width: 600px",
onCancel: function () {
- window.location.reload();
+ window.location.reload();
},
execute: function () {
window.location.reload();
if (user_search) { search = user_search.value; }
xhrPost("backend.php", { op: "pref-filters", search: search }, (transport) => {
- dijit.byId('filterConfigTab').attr('content', transport.responseText);
- notify("");
- });
+ dijit.byId('filterConfigTab').attr('content', transport.responseText);
+ notify("");
+ });
}
function updateLabelList() {
xhrPost("backend.php", { op: "pref-labels" }, (transport) => {
- dijit.byId('labelConfigTab').attr('content', transport.responseText);
- notify("");
- });
+ dijit.byId('labelConfigTab').attr('content', transport.responseText);
+ notify("");
+ });
}
function updatePrefsList() {
- xhrPost("backend.php", { op: "pref-prefs" }, (transport) => {
- dijit.byId('genConfigTab').attr('content', transport.responseText);
- notify("");
- });
+ xhrPost("backend.php", { op: "pref-prefs" }, (transport) => {
+ dijit.byId('genConfigTab').attr('content', transport.responseText);
+ notify("");
+ });
}
function updateSystemList() {
- xhrPost("backend.php", { op: "pref-system" }, (transport) => {
- dijit.byId('systemConfigTab').attr('content', transport.responseText);
- notify("");
- });
+ xhrPost("backend.php", { op: "pref-system" }, (transport) => {
+ dijit.byId('systemConfigTab').attr('content', transport.responseText);
+ notify("");
+ });
}
function selectTab(id, noupdate) {
switch (id) {
case "feedConfig":
- updateFeedList();
+ updateFeedList();
break;
case "filterConfig":
- updateFilterList();
+ updateFilterList();
break;
case "labelConfig":
- updateLabelList();
+ updateLabelList();
break;
case "genConfig":
- updatePrefsList();
+ updatePrefsList();
break;
case "userConfig":
- updateUsersList();
+ updateUsersList();
break;
case "systemConfig":
- updateSystemList();
+ updateSystemList();
break;
default:
console.warn("unknown tab", id);
"dijit/form/CheckBox",
"dijit/form/DropDownButton",
"dijit/form/FilteringSelect",
- "dijit/form/MultiSelect",
+ "dijit/form/MultiSelect",
"dijit/form/Form",
"dijit/form/RadioButton",
"dijit/form/ComboButton",
const query = "?op=pref-prefs&method=resetconfig";
xhrPost("backend.php", { op: "pref-prefs", method: "resetconfig" }, (transport) => {
- updatePrefsList();
- notify_info(transport.responseText);
- });
+ updatePrefsList();
+ notify_info(transport.responseText);
+ });
}
return false;
}
function pref_hotkey_handler(e) {
- if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
-
- const action_name = keyevent_to_action(e);
-
- if (action_name) {
- switch (action_name) {
- case "feed_subscribe":
- quickAddFeed();
- return false;
- case "create_label":
- addLabel();
- return false;
- case "create_filter":
- quickAddFilter();
- return false;
- case "help_dialog":
- helpDialog("main");
- return false;
- default:
- console.log("unhandled action: " + action_name + "; keycode: " + e.which);
- }
+ if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
+
+ const action_name = keyevent_to_action(e);
+
+ if (action_name) {
+ switch (action_name) {
+ case "feed_subscribe":
+ quickAddFeed();
+ return false;
+ case "create_label":
+ addLabel();
+ return false;
+ case "create_filter":
+ quickAddFilter();
+ return false;
+ case "help_dialog":
+ helpDialog("main");
+ return false;
+ default:
+ console.log("unhandled action: " + action_name + "; keycode: " + e.which);
+ }
}
}
if (confirm(__("Remove category %s? Any nested feeds would be placed into Uncategorized.").replace("%s", item.name))) {
notify_progress("Removing category...");
- const query = { op: "pref-feeds", method: "removeCat",
- ids: id };
+ const query = { op: "pref-feeds", method: "removeCat",
+ ids: id };
xhrPost("backend.php", query, () => {
- notify('');
- updateFeedList();
- });
+ notify('');
+ updateFeedList();
+ });
}
}
ids: sel_rows.toString() };
xhrPost("backend.php", query, () => {
- updateFeedList();
- });
+ updateFeedList();
+ });
}
} else {
alert(__("No categories are selected."));
notify_progress("Creating category...");
xhrPost("backend.php", { op: "pref-feeds", method: "addCat", cat: title }, () => {
- notify('');
- updateFeedList();
- });
+ notify('');
+ updateFeedList();
+ });
}
}
ids: sel_rows.toString() };
xhrPost("backend.php", query, () => {
- notify('');
- dialog.hide();
- updateFeedList();
- });
+ notify('');
+ dialog.hide();
+ updateFeedList();
+ });
}
} else {
notify_progress("Trying to change address...", true);
xhrJson("backend.php", { op: "pref-feeds", method: "regenOPMLKey" }, (reply) => {
- if (reply) {
- const new_link = reply.link;
- const e = $('pub_opml_url');
+ if (reply) {
+ const new_link = reply.link;
+ const e = $('pub_opml_url');
- if (new_link) {
- e.href = new_link;
- e.innerHTML = new_link;
+ if (new_link) {
+ e.href = new_link;
+ e.innerHTML = new_link;
- new Effect.Highlight(e);
+ new Effect.Highlight(e);
- notify('');
+ notify('');
- } else {
- notify_error("Could not change feed URL.");
- }
- }
- });
+ } else {
+ notify_error("Could not change feed URL.");
+ }
+ }
+ });
}
return false;
}
ids: labels.toString() };
xhrPost("backend.php", query, () => {
- updateLabelList();
- });
+ updateLabelList();
+ });
}
} else {
if (confirm(__("Activate selected profile?"))) {
notify_progress("Loading, please wait...");
- xhrPost("backend.php", { op: "rpc", method: "setprofile", id: sel_rows.toString() }, () => {
- window.location.reload();
- });
+ xhrPost("backend.php", { op: "rpc", method: "setprofile", id: sel_rows.toString() }, () => {
+ window.location.reload();
+ });
}
} else {
notify_progress("Clearing URLs...");
xhrPost("backend.php", { op: "pref-feeds", method: "clearKeys" }, () => {
- notify_info("Generated URLs cleared.");
- });
+ notify_info("Generated URLs cleared.");
+ });
}
return false;
function resetFilterOrder() {
notify_progress("Loading, please wait...");
- xhrPost("backend.php", { op: "pref-filters", method: "filtersortreset" }, () => {
- updateFilterList();
- });
+ xhrPost("backend.php", { op: "pref-filters", method: "filtersortreset" }, () => {
+ updateFilterList();
+ });
}
function resetFeedOrder() {
notify_progress("Loading, please wait...");
- xhrPost("backend.php", { op: "pref-feeds", method: "feedsortreset" }, () => {
- updateFeedList();
- });
+ xhrPost("backend.php", { op: "pref-feeds", method: "feedsortreset" }, () => {
+ updateFeedList();
+ });
}
function resetCatOrder() {
if (bg) e.style.backgroundColor = bg;
}
- const query = { op: "pref-labels", method: "colorset", kind: kind,
- ids: id, fg: fg, bg: bg, color: color };
+ const query = { op: "pref-labels", method: "colorset", kind: kind,
+ ids: id, fg: fg, bg: bg, color: color };
- xhrPost("backend.php", query, () => {
- updateFilterList(); // maybe there's labels in there
+ xhrPost("backend.php", query, () => {
+ updateFilterList(); // maybe there's labels in there
});
},
this.hide();
xhrPost("backend.php", this.attr('value'), () => {
- updateFilterList(); // maybe there's labels in there
+ updateFilterList(); // maybe there's labels in there
});
}
},
// overlapping widgets
if (dijit.byId("batchSubDlg")) dijit.byId("batchSubDlg").destroyRecursive();
- if (dijit.byId("feedAddDlg")) dijit.byId("feedAddDlg").destroyRecursive();
+ if (dijit.byId("feedAddDlg")) dijit.byId("feedAddDlg").destroyRecursive();
const dialog = new dijit.Dialog({
id: "batchSubDlg",
"dijit/form/Form",
"dijit/form/RadioButton",
"dijit/form/Select",
- "dijit/form/MultiSelect",
+ "dijit/form/MultiSelect",
"dijit/form/SimpleTextarea",
"dijit/form/TextBox",
"dijit/form/ComboBox",
loading_set_progress(30);
init_hotkey_actions();
- const a = document.createElement('audio');
- const hasAudio = !!a.canPlayType;
- const hasSandbox = "sandbox" in document.createElement("iframe");
- const hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, ''));
- const clientTzOffset = new Date().getTimezoneOffset() * 60;
+ const a = document.createElement('audio');
+ const hasAudio = !!a.canPlayType;
+ const hasSandbox = "sandbox" in document.createElement("iframe");
+ const hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, ''));
+ const clientTzOffset = new Date().getTimezoneOffset() * 60;
- const params = {
- op: "rpc", method: "sanityCheck", hasAudio: hasAudio,
- hasMp3: hasMp3,
- clientTzOffset: clientTzOffset,
- hasSandbox: hasSandbox
- };
+ const params = {
+ op: "rpc", method: "sanityCheck", hasAudio: hasAudio,
+ hasMp3: hasMp3,
+ clientTzOffset: clientTzOffset,
+ hasSandbox: hasSandbox
+ };
xhrPost("backend.php", params, (transport) => {
- try {
- backend_sanity_check_callback(transport);
- } catch (e) {
- console.error(e);
- }
+ try {
+ backend_sanity_check_callback(transport);
+ } catch (e) {
+ console.error(e);
+ }
});
} catch (e) {
const value = isCdmMode() ? "false" : "true";
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "COMBINED_DISPLAY_MODE", value: value}, () => {
- setInitParam("combined_display_mode",
- !getInitParam("combined_display_mode"));
+ setInitParam("combined_display_mode",
+ !getInitParam("combined_display_mode"));
- closeArticlePanel();
- viewCurrentFeed();
+ closeArticlePanel();
+ viewCurrentFeed();
})
};
}
const hide = !(getInitParam("hide_read_feeds") == "1");
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "HIDE_READ_FEEDS", value: hide}, () => {
- hideOrShowFeeds(hide);
- setInitParam("hide_read_feeds", hide);
+ hideOrShowFeeds(hide);
+ setInitParam("hide_read_feeds", hide);
});
}
function hotkey_handler(e) {
if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
- const action_name = keyevent_to_action(e);
+ const action_name = keyevent_to_action(e);
- if (action_name) {
- const action_func = hotkey_actions[action_name];
+ if (action_name) {
+ const action_func = hotkey_actions[action_name];
- if (action_func != null) {
- action_func();
- e.stopPropagation();
- return false;
- }
+ if (action_func != null) {
+ action_func();
+ e.stopPropagation();
+ return false;
+ }
}
}
return reply;
} else {
- if (netalert)
- netalert.show();
- else
- notify_error("Communication problem with server.");
- }
+ if (netalert)
+ netalert.show();
+ else
+ notify_error("Communication problem with server.");
+ }
} catch (e) {
if (netalert)
query.mode = "prefetch";
render_article(cached_article);
} else if (cached_article) {
- query.mode = "prefetch_old";
+ query.mode = "prefetch_old";
render_article(cached_article);
// if we don't need to request any relative ids, we might as well skip
}
xhrPost("backend.php", query, (transport) => {
- article_callback2(transport, id);
+ article_callback2(transport, id);
})
return false;
}
function togglePub(id, client_only, no_effects, note) {
- const query = { op: "rpc", id: id, method: "publ" };
+ const query = { op: "rpc", id: id, method: "publ" };
if (note != undefined) {
query.note = note;
}
if (tmpClassName != row.className) {
- if (cmode == undefined) cmode = 2;
+ if (cmode == undefined) cmode = 2;
- const query = {op: "rpc", method: "catchupSelected",
- cmode: cmode, ids: id};
+ const query = {op: "rpc", method: "catchupSelected",
+ cmode: cmode, ids: id};
- xhrPost("backend.php", query, (transport) => {
+ xhrPost("backend.php", query, (transport) => {
handle_rpc_json(transport);
});
ids: ids.toString(), lid: id };
xhrPost("backend.php", query, (transport) => {
- handle_rpc_json(transport);
- show_labels_in_headlines(transport);
+ handle_rpc_json(transport);
+ show_labels_in_headlines(transport);
});
}
const query = { op: "article", method: "assignToLabel",
ids: ids.toString(), lid: id };
- xhrPost("backend.php", query, (transport) => {
- handle_rpc_json(transport);
- show_labels_in_headlines(transport);
- });
+ xhrPost("backend.php", query, (transport) => {
+ handle_rpc_json(transport);
+ show_labels_in_headlines(transport);
+ });
}
function selectionToggleUnread(set_state, callback, no_error, ids) {
notify_progress("Loading, please wait...");
- xhrPost("backend.php", query, (transport) => {
- handle_rpc_json(transport);
- if (callback) callback(transport);
- });
+ xhrPost("backend.php", query, (transport) => {
+ handle_rpc_json(transport);
+ if (callback) callback(transport);
+ });
}
}
const query = { op: "rpc", method: "markSelected",
ids: rows.toString(), cmode: 2 };
- xhrPost("backend.php", query, (transport) => {
- handle_rpc_json(transport);
- if (callback) callback(transport);
- });
+ xhrPost("backend.php", query, (transport) => {
+ handle_rpc_json(transport);
+ if (callback) callback(transport);
+ });
}
}
}
if (rows.length > 0) {
- const query = { op: "rpc", method: "publishSelected",
- ids: rows.toString(), cmode: 2 };
+ const query = { op: "rpc", method: "publishSelected",
+ ids: rows.toString(), cmode: 2 };
- xhrPost("backend.php", query, (transport) => {
- handle_rpc_json(transport);
- if (callback) callback(transport);
- });
+ xhrPost("backend.php", query, (transport) => {
+ handle_rpc_json(transport);
+ if (callback) callback(transport);
+ });
}
}
const query = { op: "rpc", method: "delete", ids: rows.toString() };
xhrPost("backend.php", query, (transport) => {
- handle_rpc_json(transport);
- viewCurrentFeed();
+ handle_rpc_json(transport);
+ viewCurrentFeed();
});
}
function archiveSelection() {
- const rows = getSelectedArticleIds2();
+ const rows = getSelectedArticleIds2();
- if (rows.length == 0) {
- alert(__("No articles are selected."));
- return;
- }
+ if (rows.length == 0) {
+ alert(__("No articles are selected."));
+ return;
+ }
- const fn = getFeedName(getActiveFeedId(), activeFeedIsCat());
- let str;
- let op;
+ const fn = getFeedName(getActiveFeedId(), activeFeedIsCat());
+ let str;
+ let op;
- if (getActiveFeedId() != 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);
+ if (getActiveFeedId() != 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.");
+ str += " " + __("Please note that unstarred articles might get purged on next feed update.");
- op = "unarchive";
- }
+ op = "unarchive";
+ }
- str = str.replace("%d", rows.length);
- str = str.replace("%s", fn);
+ str = str.replace("%d", rows.length);
+ str = str.replace("%s", fn);
- if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str)) {
- return;
- }
+ if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str)) {
+ return;
+ }
- for (let i = 0; i < rows.length; i++) {
- cache_delete("article:" + rows[i]);
- }
+ for (let i = 0; i < rows.length; i++) {
+ cache_delete("article:" + rows[i]);
+ }
- const query = {op: "rpc", method: op, ids: rows.toString()};
+ const query = {op: "rpc", method: op, ids: rows.toString()};
- xhrPost("backend.php", query, (transport) => {
- handle_rpc_json(transport);
- viewCurrentFeed();
- });
+ xhrPost("backend.php", query, (transport) => {
+ handle_rpc_json(transport);
+ viewCurrentFeed();
+ });
}
function catchupSelection() {
notify_progress("Saving article tags...", true);
xhrPost("backend.php", this.attr('value'), (transport) => {
- try {
- notify('');
- dialog.hide();
+ try {
+ notify('');
+ dialog.hide();
- const data = JSON.parse(transport.responseText);
+ const data = JSON.parse(transport.responseText);
- if (data) {
- const id = data.id;
+ if (data) {
+ const id = data.id;
- const tags = $("ATSTR-" + id);
- const tooltip = dijit.byId("ATSTRTIP-" + id);
+ const tags = $("ATSTR-" + id);
+ const tooltip = dijit.byId("ATSTRTIP-" + id);
- if (tags) tags.innerHTML = data.content;
- if (tooltip) tooltip.attr('label', data.content_full);
- }
- } catch (e) {
- exception_error(e);
- }
+ if (tags) tags.innerHTML = data.content;
+ if (tooltip) tooltip.attr('label', data.content_full);
+ }
+ } catch (e) {
+ exception_error(e);
+ }
});
}
},
function unpackVisibleHeadlines() {
if (!isCdmMode()) return;
- const rows = $$("#headlines-frame div[id*=RROW][data-content]");
+ const rows = $$("#headlines-frame div[id*=RROW][data-content]");
const threshold = $("headlines-frame").scrollTop + $("headlines-frame").offsetHeight + 300;
- for (let i = 0; i < rows.length; i++) {
- const row = rows[i];
+ for (let i = 0; i < rows.length; i++) {
+ const row = rows[i];
- if (row.offsetTop <= threshold) {
- console.log("unpacking: " + row.id);
+ if (row.offsetTop <= threshold) {
+ console.log("unpacking: " + row.id);
- const content = row.getAttribute("data-content");
+ const content = row.getAttribute("data-content");
- row.select(".cdmContentInner")[0].innerHTML = content;
- row.removeAttribute("data-content");
+ row.select(".cdmContentInner")[0].innerHTML = content;
+ row.removeAttribute("data-content");
- PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row);
- } else {
- break;
- }
- }
+ PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row);
+ } else {
+ break;
+ }
+ }
}
function headlines_scroll_handler(e) {
}
if (!_infscroll_disable) {
- const hsp = $("headlines-spacer");
+ const hsp = $("headlines-spacer");
if (hsp && hsp.offsetTop - 250 <= e.scrollTop + e.offsetHeight) {
let rows = $$("#headlines-frame > div[id*=RROW][class*=Unread]");
for (let i = 0; i < rows.length; i++) {
- const row = rows[i];
+ const row = rows[i];
if ($("headlines-frame").scrollTop > (row.offsetTop + row.offsetHeight/2)) {
- const id = row.getAttribute("data-article-id")
+ const id = row.getAttribute("data-article-id")
- if (catchup_id_batch.indexOf(id) == -1)
- catchup_id_batch.push(id);
+ if (catchup_id_batch.indexOf(id) == -1)
+ catchup_id_batch.push(id);
- //console.log("auto_catchup_batch: " + catchup_id_batch.toString());
- } else {
+ //console.log("auto_catchup_batch: " + catchup_id_batch.toString());
+ } else {
break;
}
- }
+ }
if (_infscroll_disable) {
const row = $$("#headlines-frame div[id*=RROW]").last();
_catchup_request_sent = true;
xhrPost("backend.php", query, (transport) => {
- const reply = handle_rpc_json(transport);
+ const reply = handle_rpc_json(transport);
- _catchup_request_sent = false;
+ _catchup_request_sent = false;
- if (reply) {
- const batch = reply.ids;
+ if (reply) {
+ const batch = reply.ids;
- batch.each(function (id) {
- const elem = $("RROW-" + id);
- if (elem) elem.removeClassName("Unread");
- catchup_id_batch.remove(id);
- });
- }
+ batch.each(function (id) {
+ const elem = $("RROW-" + id);
+ if (elem) elem.removeClassName("Unread");
+ catchup_id_batch.remove(id);
+ });
+ }
- updateFloatingTitle(true);
+ updateFloatingTitle(true);
});
}
}
cmode: 0, ids: ids_to_mark.toString() };
xhrPost("backend.php", query, (transport) => {
- handle_rpc_json(transport);
+ handle_rpc_json(transport);
});
}
}
xhrJson("backend.php", query, (reply) => {
if (reply) {
- reply.id.each((id) => {
- const row = $("RROW-" + id);
-
- if (row) {
- const pic = row.getElementsByClassName("hlScorePic")[0];
-
- if (pic) {
- pic.src = pic.src.replace(/score_.*?\.png/,
- reply["score_pic"]);
- pic.setAttribute("score", reply["score"]);
- }
- }
- });
- }
+ reply.id.each((id) => {
+ const row = $("RROW-" + id);
+
+ if (row) {
+ const pic = row.getElementsByClassName("hlScorePic")[0];
+
+ if (pic) {
+ pic.src = pic.src.replace(/score_.*?\.png/,
+ reply["score_pic"]);
+ pic.setAttribute("score", reply["score"]);
+ }
+ }
+ });
+ }
});
}
const query = { op: "article", method: "setScore", id: id, score: new_score };
xhrJson("backend.php", query, (reply) => {
- if (reply) {
- pic.src = pic.src.replace(/score_.*?\.png/, reply["score_pic"]);
- pic.setAttribute("score", new_score);
- pic.setAttribute("title", new_score);
- }
+ if (reply) {
+ pic.src = pic.src.replace(/score_.*?\.png/, reply["score_pic"]);
+ pic.setAttribute("score", new_score);
+ pic.setAttribute("title", new_score);
+ }
});
}
}
const query = { op: "rpc", method: "getlinktitlebyid", id: id };
xhrJson("backend.php", query, (reply) => {
- if (reply && reply.link) {
- prompt(__("Article URL:"), reply.link);
- }
+ if (reply && reply.link) {
+ prompt(__("Article URL:"), reply.link);
+ }
});
}