eslint-related fixes

This commit is contained in:
Andrew Dolgov 2018-11-29 20:07:23 +03:00
parent 79c5035920
commit 424e28db6b
5 changed files with 568 additions and 592 deletions

View File

@ -15,12 +15,12 @@ function resetCounterCache() {
function loadMoreHeadlines() {
console.log("loadMoreHeadlines");
var offset = 0;
let offset = 0;
var view_mode = document.forms["main_toolbar_form"].view_mode.value;
var unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length;
var num_all = $$("#headlines-frame > div[id*=RROW]").length;
var num_unread = getFeedUnread(getActiveFeedId(), activeFeedIsCat());
const view_mode = document.forms["main_toolbar_form"].view_mode.value;
const unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length;
const num_all = $$("#headlines-frame > div[id*=RROW]").length;
const num_unread = getFeedUnread(getActiveFeedId(), activeFeedIsCat());
// TODO implement marked & published
@ -48,7 +48,7 @@ function loadMoreHeadlines() {
}
function cleanup_memory(root) {
var dijits = dojo.query("[widgetid]", dijit.byId(root).domNode).map(dijit.byNode);
const dijits = dojo.query("[widgetid]", dijit.byId(root).domNode).map(dijit.byNode);
dijits.each(function (d) {
dojo.destroy(d.domNode);
@ -60,14 +60,14 @@ function cleanup_memory(root) {
}
function viewfeed(params) {
var feed = params.feed;
var is_cat = params.is_cat;
var offset = params.offset;
var background = params.background;
var infscroll_req = params.infscroll_req;
var can_wait = params.can_wait;
var viewfeed_debug = params.viewfeed_debug;
var method = params.method;
const feed = params.feed;
let is_cat = params.is_cat;
let offset = params.offset;
let background = params.background;
let infscroll_req = params.infscroll_req;
const can_wait = params.can_wait;
const viewfeed_debug = params.viewfeed_debug;
const method = params.method;
if (is_cat == undefined)
is_cat = false;
@ -96,7 +96,7 @@ function viewfeed(params) {
}
if (infscroll_req) {
var timestamp = get_timestamp();
const timestamp = get_timestamp();
if (_infscroll_request_sent && _infscroll_request_sent + 30 > timestamp) {
//console.log("infscroll request in progress, aborting");
@ -109,9 +109,9 @@ function viewfeed(params) {
Form.enable("main_toolbar_form");
var toolbar_query = Form.serialize("main_toolbar_form");
const toolbar_query = Form.serialize("main_toolbar_form");
var query = "?op=feeds&method=view&feed=" + param_escape(feed) + "&" +
let query = "?op=feeds&method=view&feed=" + param_escape(feed) + "&" +
toolbar_query;
if (method) query += "&m=" + param_escape(method);
@ -135,11 +135,9 @@ function viewfeed(params) {
if (vgroup_last_feed) {
query = query + "&vgrlf=" + param_escape(vgroup_last_feed);
}
} else {
if (!is_cat && feed == getActiveFeedId() && !params.method) {
} else if (!is_cat && feed == getActiveFeedId() && !params.method) {
query = query + "&m=ForceUpdate";
}
}
Form.enable("main_toolbar_form");
@ -163,7 +161,7 @@ function viewfeed(params) {
window.open("backend.php" + query + "&debug=1&csrf_token=" + getInitParam("csrf_token"));
}
var timeout_ms = can_wait ? 250 : 0;
const timeout_ms = can_wait ? 250 : 0;
_viewfeed_timeout = setTimeout(function() {
new Ajax.Request("backend.php", {
@ -200,7 +198,7 @@ function feedlist_init() {
if (getInitParam("is_default_pw")) {
console.warn("user password is at default value");
var dialog = new dijit.Dialog({
const dialog = new dijit.Dialog({
title: __("Your password is at default value"),
href: "backend.php?op=dlg&method=defaultpasswordwarning",
id: 'infoBox',
@ -229,15 +227,15 @@ function feedlist_init() {
function request_counters(force) {
var date = new Date();
var timestamp = Math.round(date.getTime() / 1000);
const date = new Date();
const timestamp = Math.round(date.getTime() / 1000);
if (force || timestamp - counters_last_request > 5) {
console.log("scheduling request of counters...");
counters_last_request = timestamp;
var query = "?op=rpc&method=getAllCounters&seq=" + next_seq();
let query = "?op=rpc&method=getAllCounters&seq=" + next_seq();
if (!force)
query = query + "&last_article_id=" + getInitParam("last_article_id");
@ -260,8 +258,8 @@ function request_counters(force) {
// http://adripofjavascript.com/blog/drips/object-equality-in-javascript.html
function counter_is_equal(a, b) {
// Create arrays of property names
var aProps = Object.getOwnPropertyNames(a);
var bProps = Object.getOwnPropertyNames(b);
const aProps = Object.getOwnPropertyNames(a);
const bProps = Object.getOwnPropertyNames(b);
// If number of properties is different,
// objects are not equivalent
@ -269,8 +267,8 @@ function counter_is_equal(a, b) {
return false;
}
for (var i = 0; i < aProps.length; i++) {
var propName = aProps[i];
for (let i = 0; i < aProps.length; i++) {
const propName = aProps[i];
// If values of same property are not equal,
// objects are not equivalent
@ -286,19 +284,19 @@ function counter_is_equal(a, b) {
function parse_counters(elems) {
for (var l = 0; l < elems.length; l++) {
for (let l = 0; l < elems.length; l++) {
if (_counters_prev[l] && counter_is_equal(elems[l], _counters_prev[l])) {
continue;
}
var id = elems[l].id;
var kind = elems[l].kind;
var ctr = parseInt(elems[l].counter);
var error = elems[l].error;
var has_img = elems[l].has_img;
var updated = elems[l].updated;
var auxctr = parseInt(elems[l].auxcounter);
const id = elems[l].id;
const kind = elems[l].kind;
const ctr = parseInt(elems[l].counter);
const error = elems[l].error;
const has_img = elems[l].has_img;
const updated = elems[l].updated;
const auxctr = parseInt(elems[l].auxcounter);
if (id == "global-unread") {
global_unread = ctr;
@ -340,7 +338,7 @@ function parse_counters(elems) {
function getFeedUnread(feed, is_cat) {
try {
var tree = dijit.byId("feedTree");
const tree = dijit.byId("feedTree");
if (tree && tree.model)
return tree.model.getFeedUnread(feed, is_cat);
@ -354,7 +352,7 @@ function getFeedUnread(feed, is_cat) {
function getFeedCategory(feed) {
try {
var tree = dijit.byId("feedTree");
const tree = dijit.byId("feedTree");
if (tree && tree.model)
return tree.getFeedCategory(feed);
@ -367,7 +365,7 @@ function getFeedCategory(feed) {
}
function hideOrShowFeeds(hide) {
var tree = dijit.byId("feedTree");
const tree = dijit.byId("feedTree");
if (tree)
return tree.hideRead(hide, getInitParam("hide_read_shows_special"));
@ -377,7 +375,7 @@ function getFeedName(feed, is_cat) {
if (isNaN(feed)) return feed; // it's a tag
var tree = dijit.byId("feedTree");
const tree = dijit.byId("feedTree");
if (tree && tree.model)
return tree.model.getFeedValue(feed, is_cat, 'name');
@ -385,7 +383,7 @@ function getFeedName(feed, is_cat) {
function getFeedValue(feed, is_cat, key) {
try {
var tree = dijit.byId("feedTree");
const tree = dijit.byId("feedTree");
if (tree && tree.model)
return tree.model.getFeedValue(feed, is_cat, key);
@ -397,7 +395,7 @@ function getFeedValue(feed, is_cat, key) {
}
function setFeedUnread(feed, is_cat, unread) {
var tree = dijit.byId("feedTree");
const tree = dijit.byId("feedTree");
if (tree && tree.model)
return tree.model.setFeedUnread(feed, is_cat, unread);
@ -405,7 +403,7 @@ function setFeedUnread(feed, is_cat, unread) {
function setFeedValue(feed, is_cat, key, value) {
try {
var tree = dijit.byId("feedTree");
const tree = dijit.byId("feedTree");
if (tree && tree.model)
return tree.model.setFeedValue(feed, is_cat, key, value);
@ -416,19 +414,19 @@ function setFeedValue(feed, is_cat, key, value) {
}
function selectFeed(feed, is_cat) {
var tree = dijit.byId("feedTree");
const tree = dijit.byId("feedTree");
if (tree) return tree.selectFeed(feed, is_cat);
}
function setFeedIcon(feed, is_cat, src) {
var tree = dijit.byId("feedTree");
const tree = dijit.byId("feedTree");
if (tree) return tree.setFeedIcon(feed, is_cat, src);
}
function setFeedExpandoIcon(feed, is_cat, src) {
var tree = dijit.byId("feedTree");
const tree = dijit.byId("feedTree");
if (tree) return tree.setFeedExpandoIcon(feed, is_cat, src);
@ -436,8 +434,8 @@ function setFeedExpandoIcon(feed, is_cat, src) {
}
function getNextUnreadFeed(feed, is_cat) {
var tree = dijit.byId("feedTree");
var nuf = tree.model.getNextUnreadFeed(feed, is_cat);
const tree = dijit.byId("feedTree");
const nuf = tree.model.getNextUnreadFeed(feed, is_cat);
if (nuf)
return tree.model.store.getValue(nuf, 'bare_id');
@ -448,13 +446,13 @@ function catchupCurrentFeed(mode) {
}
function catchupFeedInGroup(id) {
var title = getFeedName(id);
const title = getFeedName(id);
var str = __("Mark all articles in %s as read?").replace("%s", title);
const str = __("Mark all articles in %s as read?").replace("%s", title);
if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
var rows = $$("#headlines-frame > div[id*=RROW][data-orig-feed-id='"+id+"']");
const rows = $$("#headlines-frame > div[id*=RROW][data-orig-feed-id='"+id+"']");
if (rows.length > 0) {
@ -467,9 +465,9 @@ function catchupFeedInGroup(id) {
});
var feedTitles = $$("#headlines-frame > div[class='cdmFeedTitle']");
const feedTitles = $$("#headlines-frame > div[class='cdmFeedTitle']");
for (var i = 0; i < feedTitles.length; i++) {
for (let i = 0; i < feedTitles.length; i++) {
if (feedTitles[i].getAttribute("data-feed-id") == id) {
if (i < feedTitles.length - 1) {
@ -483,7 +481,7 @@ function catchupFeedInGroup(id) {
updateFloatingTitle(true);
}
var catchup_query = "?op=rpc&method=catchupFeed&feed_id=" +
const catchup_query = "?op=rpc&method=catchupFeed&feed_id=" +
id + "&is_cat=false";
console.log(catchup_query);
@ -504,7 +502,7 @@ function catchupFeedInGroup(id) {
function catchupFeed(feed, is_cat, mode) {
if (is_cat == undefined) is_cat = false;
var str = false;
let str = false;
switch (mode) {
case "1day":
@ -520,8 +518,8 @@ function catchupFeed(feed, is_cat, mode) {
str = __("Mark %w in %s as read?");
}
var mark_what = last_search_query && last_search_query[0] ? __("search results") : __("all articles");
var fn = getFeedName(feed, is_cat);
const mark_what = last_search_query && last_search_query[0] ? __("search results") : __("all articles");
const fn = getFeedName(feed, is_cat);
str = str.replace("%s", fn)
.replace("%w", mark_what);
@ -530,7 +528,7 @@ function catchupFeed(feed, is_cat, mode) {
return;
}
var catchup_query = {op: 'rpc', method: 'catchupFeed', feed_id: feed,
const catchup_query = {op: 'rpc', method: 'catchupFeed', feed_id: feed,
is_cat: is_cat, mode: mode, search_query: last_search_query[0],
search_lang: last_search_query[1]};
@ -543,19 +541,17 @@ function catchupFeed(feed, is_cat, mode) {
onComplete: function(transport) {
handle_rpc_json(transport);
var 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) {
var nuf = getNextUnreadFeed(feed, is_cat);
const nuf = getNextUnreadFeed(feed, is_cat);
if (nuf) {
viewfeed({feed: nuf, is_cat: is_cat});
}
} else {
if (feed == getActiveFeedId() && is_cat == activeFeedIsCat()) {
} else if (feed == getActiveFeedId() && is_cat == activeFeedIsCat()) {
viewCurrentFeed();
}
}
notify("");
} });
@ -563,7 +559,7 @@ function catchupFeed(feed, is_cat, mode) {
}
function decrementFeedCounter(feed, is_cat) {
var ctr = getFeedUnread(feed, is_cat);
let ctr = getFeedUnread(feed, is_cat);
if (ctr > 0) {
setFeedUnread(feed, is_cat, ctr - 1);
@ -571,7 +567,7 @@ function decrementFeedCounter(feed, is_cat) {
updateTitle();
if (!is_cat) {
var cat = parseInt(getFeedCategory(feed));
const cat = parseInt(getFeedCategory(feed));
if (!isNaN(cat)) {
ctr = getFeedUnread(cat, true);

View File

@ -25,12 +25,11 @@ Ajax.Base.prototype.initialize = Ajax.Base.prototype.initialize.wrap(
/* add method to remove element from array */
Array.prototype.remove = function(s) {
for (var i=0; i < this.length; i++) {
for (let i=0; i < this.length; i++) {
if (s == this[i]) this.splice(i, 1);
}
};
function report_error(message, filename, lineno, colno, error) {
exception_error(error, null, filename, lineno);
}
@ -42,7 +41,7 @@ function exception_error(e, e_compat, filename, lineno, colno) {
try {
console.error(e);
var msg = e.toString();
const msg = e.toString();
try {
new Ajax.Request("backend.php", {
@ -58,7 +57,7 @@ function exception_error(e, e_compat, filename, lineno, colno) {
console.error("Exception while trying to log the error.", e);
}
var content = "<div class='fatalError'><p>" + msg + "</p>";
let content = "<div class='fatalError'><p>" + msg + "</p>";
if (e.stack) {
content += "<div><b>Stack trace:</b></div>" +
@ -77,7 +76,7 @@ function exception_error(e, e_compat, filename, lineno, colno) {
if (dijit.byId("exceptionDlg"))
dijit.byId("exceptionDlg").destroyRecursive();
var dialog = new dijit.Dialog({
const dialog = new dijit.Dialog({
id: "exceptionDlg",
title: "Unhandled exception",
style: "width: 600px",
@ -101,7 +100,7 @@ function param_escape(arg) {
function notify_real(msg, no_hide, n_type) {
var n = $("notify");
const n = $("notify");
if (!n) return;
@ -183,7 +182,7 @@ function notify_info(msg, no_hide) {
function setCookie(name, value, lifetime, path, domain, secure) {
var d = false;
let d = false;
if (lifetime) {
d = new Date();
@ -216,9 +215,9 @@ function delCookie(name, path, domain) {
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
const dc = document.cookie;
const prefix = name + "=";
let begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
@ -226,7 +225,7 @@ function getCookie(name) {
else {
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
let end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
@ -246,13 +245,13 @@ function gotoMain() {
}
function toggleSelectRowById(sender, id) {
var row = $(id);
const row = $(id);
return toggleSelectRow(sender, row);
}
/* this is for dijit Checkbox */
function toggleSelectListRow2(sender) {
var row = sender.domNode.parentNode;
const row = sender.domNode.parentNode;
return toggleSelectRow(sender, row);
}
@ -301,7 +300,7 @@ function getURLParam(param){
}
function closeInfoBox() {
var dialog = dijit.byId("infoBox");
const dialog = dijit.byId("infoBox");
if (dialog) dialog.hide();
@ -313,7 +312,7 @@ function displayDlg(title, id, param, callback) {
notify_progress("Loading, please wait...", true);
var query = "?op=dlg&method=" +
const query = "?op=dlg&method=" +
param_escape(id) + "&param=" + param_escape(param);
new Ajax.Request("backend.php", {
@ -327,7 +326,7 @@ function displayDlg(title, id, param, callback) {
}
function infobox_callback2(transport, title) {
var dialog = false;
let dialog = false;
if (dijit.byId("infoBox")) {
dialog = dijit.byId("infoBox");
@ -336,7 +335,7 @@ function infobox_callback2(transport, title) {
//console.log("infobox_callback2");
notify('');
var content = transport.responseText;
const content = transport.responseText;
if (!dialog) {
dialog = new dijit.Dialog({
@ -390,7 +389,7 @@ function fatalError(code, msg, ext_info) {
msg = ERRORS[code];
}
var content = "<div><b>Error code:</b> " + code + "</div>" +
let content = "<div><b>Error code:</b> " + code + "</div>" +
"<p>" + msg + "</p>";
if (ext_info) {
@ -399,7 +398,7 @@ function fatalError(code, msg, ext_info) {
ext_info + "</textarea>";
}
var dialog = new dijit.Dialog({
const dialog = new dijit.Dialog({
title: "Fatal error",
style: "width: 600px",
content: content});
@ -413,9 +412,9 @@ function fatalError(code, msg, ext_info) {
}
function filterDlgCheckAction(sender) {
var action = sender.value;
const action = sender.value;
var action_param = $("filterDlg_paramBox");
const action_param = $("filterDlg_paramBox");
if (!action_param) {
console.log("filterDlgCheckAction: can't find action param box!");
@ -474,8 +473,8 @@ function strip_tags(s) {
function hotkey_prefix_timeout() {
var date = new Date();
var ts = Math.round(date.getTime() / 1000);
const date = new Date();
const ts = Math.round(date.getTime() / 1000);
if (hotkey_prefix_pressed && ts - hotkey_prefix_pressed >= 5) {
console.log("hotkey_prefix seems to be stuck, aborting");
@ -509,7 +508,7 @@ function uploadIconHandler(rc) {
function removeFeedIcon(id) {
if (confirm(__("Remove stored feed icon?"))) {
var query = "backend.php?op=pref-feeds&method=removeicon&feed_id=" + param_escape(id);
const query = "backend.php?op=pref-feeds&method=removeicon&feed_id=" + param_escape(id);
console.log(query);
@ -531,23 +530,21 @@ function removeFeedIcon(id) {
}
function uploadFeedIcon() {
var file = $("icon_file");
const file = $("icon_file");
if (file.value.length == 0) {
alert(__("Please select an image file to upload."));
} else {
if (confirm(__("Upload new icon for this feed?"))) {
} else if (confirm(__("Upload new icon for this feed?"))) {
notify_progress("Uploading, please wait...", true);
return true;
}
}
return false;
}
function addLabel(select, callback) {
var caption = prompt(__("Please enter label caption:"), "");
const caption = prompt(__("Please enter label caption:"), "");
if (caption != undefined) {
@ -556,7 +553,7 @@ function addLabel(select, callback) {
return false;
}
var query = "?op=pref-labels&method=add&caption=" +
let query = "?op=pref-labels&method=add&caption=" +
param_escape(caption);
if (select)
@ -581,7 +578,7 @@ function addLabel(select, callback) {
}
function quickAddFeed() {
var query = "backend.php?op=feeds&method=quickAddFeed";
const query = "backend.php?op=feeds&method=quickAddFeed";
// overlapping widgets
if (dijit.byId("batchSubDlg")) dijit.byId("batchSubDlg").destroyRecursive();
@ -592,7 +589,7 @@ function quickAddFeed() {
title: __("Subscribe to Feed"),
style: "width: 600px",
show_error: function(msg) {
var elem = $("fadd_error_message");
const elem = $("fadd_error_message");
elem.innerHTML = msg;
@ -604,7 +601,7 @@ function quickAddFeed() {
if (this.validate()) {
console.log(dojo.objectToQuery(this.attr('value')));
var feed_url = this.attr('value').feed;
const feed_url = this.attr('value').feed;
Element.show("feed_add_spinner");
Element.hide("fadd_error_message");
@ -623,7 +620,7 @@ function quickAddFeed() {
return;
}
var rc = reply['result'];
const rc = reply['result'];
notify('');
Element.hide("feed_add_spinner");
@ -656,7 +653,7 @@ function quickAddFeed() {
select.addOption({value: '', label: __("Expand to select feed")});
var count = 0;
for (var feedUrl in feeds) {
for (const feedUrl in feeds) {
select.addOption({value: feedUrl, label: feeds[feedUrl]});
count++;
}
@ -692,11 +689,11 @@ function quickAddFeed() {
}
function createNewRuleElement(parentNode, replaceNode) {
var form = document.forms["filter_new_rule_form"];
const form = document.forms["filter_new_rule_form"];
//form.reg_exp.value = form.reg_exp.value.replace(/(<([^>]+)>)/ig,"");
var query = "backend.php?op=pref-filters&method=printrulename&rule="+
const query = "backend.php?op=pref-filters&method=printrulename&rule="+
param_escape(dojo.formToJson(form));
console.log(query);
@ -705,9 +702,9 @@ function createNewRuleElement(parentNode, replaceNode) {
parameters: query,
onComplete: function (transport) {
try {
var li = dojo.create("li");
const li = dojo.create("li");
var cb = dojo.create("input", { type: "checkbox" }, li);
const cb = dojo.create("input", { type: "checkbox" }, li);
new dijit.form.CheckBox({
onChange: function() {
@ -736,7 +733,7 @@ function createNewRuleElement(parentNode, replaceNode) {
}
function createNewActionElement(parentNode, replaceNode) {
var form = document.forms["filter_new_action_form"];
const form = document.forms["filter_new_action_form"];
if (form.action_id.value == 7) {
form.action_param.value = form.action_param_label.value;
@ -744,7 +741,7 @@ function createNewActionElement(parentNode, replaceNode) {
form.action_param.value = form.action_param_plugin.value;
}
var query = "backend.php?op=pref-filters&method=printactionname&action="+
const query = "backend.php?op=pref-filters&method=printactionname&action="+
param_escape(dojo.formToJson(form));
console.log(query);
@ -753,9 +750,9 @@ function createNewActionElement(parentNode, replaceNode) {
parameters: query,
onComplete: function (transport) {
try {
var li = dojo.create("li");
const li = dojo.create("li");
var cb = dojo.create("input", { type: "checkbox" }, li);
const cb = dojo.create("input", { type: "checkbox" }, li);
new dijit.form.CheckBox({
onChange: function() {
@ -789,10 +786,10 @@ function addFilterRule(replaceNode, ruleStr) {
if (dijit.byId("filterNewRuleDlg"))
dijit.byId("filterNewRuleDlg").destroyRecursive();
var query = "backend.php?op=pref-filters&method=newrule&rule=" +
const query = "backend.php?op=pref-filters&method=newrule&rule=" +
param_escape(ruleStr);
var rule_dlg = new dijit.Dialog({
const rule_dlg = new dijit.Dialog({
id: "filterNewRuleDlg",
title: ruleStr ? __("Edit rule") : __("Add rule"),
style: "width: 600px",
@ -811,10 +808,10 @@ function addFilterAction(replaceNode, actionStr) {
if (dijit.byId("filterNewActionDlg"))
dijit.byId("filterNewActionDlg").destroyRecursive();
var query = "backend.php?op=pref-filters&method=newaction&action=" +
const query = "backend.php?op=pref-filters&method=newaction&action=" +
param_escape(actionStr);
var rule_dlg = new dijit.Dialog({
const rule_dlg = new dijit.Dialog({
id: "filterNewActionDlg",
title: actionStr ? __("Edit action") : __("Add action"),
style: "width: 600px",
@ -842,7 +839,7 @@ function editFilterTest(query) {
limit: 100,
max_offset: 10000,
getTestResults: function(query, offset) {
var updquery = query + "&offset=" + offset + "&limit=" + test_dlg.limit;
const updquery = query + "&offset=" + offset + "&limit=" + test_dlg.limit;
console.log("getTestResults:" + offset);
@ -850,7 +847,7 @@ function editFilterTest(query) {
parameters: updquery,
onComplete: function (transport) {
try {
var result = JSON.parse(transport.responseText);
const result = JSON.parse(transport.responseText);
if (result && dijit.byId("filterTestDlg") && dijit.byId("filterTestDlg").open) {
test_dlg.results += result.size();
@ -863,8 +860,8 @@ function editFilterTest(query) {
console.log(offset + " " + test_dlg.max_offset);
for (var i = 0; i < result.size(); i++) {
var tmp = new Element("table");
for (let i = 0; i < result.size(); i++) {
const tmp = new Element("table");
tmp.innerHTML = result[i];
dojo.parser.parse(tmp);
@ -920,7 +917,7 @@ function editFilterTest(query) {
}
function quickAddFilter() {
var query = "";
let query = "";
if (!inPreferences()) {
query = "backend.php?op=pref-filters&method=newfilter&feed=" +
param_escape(getActiveFeedId()) + "&is_cat=" +
@ -942,7 +939,7 @@ function quickAddFilter() {
title: __("Create Filter"),
style: "width: 600px",
test: function() {
var query = "backend.php?" + dojo.formToQuery("filter_new_form") + "&savemode=test";
const query = "backend.php?" + dojo.formToQuery("filter_new_form") + "&savemode=test";
editFilterTest(query);
},
@ -967,13 +964,13 @@ function quickAddFilter() {
});
},
editRule: function(e) {
var li = e.parentNode;
var rule = li.getElementsByTagName("INPUT")[1].value;
const li = e.parentNode;
const rule = li.getElementsByTagName("INPUT")[1].value;
addFilterRule(li, rule);
},
editAction: function(e) {
var li = e.parentNode;
var action = li.getElementsByTagName("INPUT")[1].value;
const li = e.parentNode;
const action = li.getElementsByTagName("INPUT")[1].value;
addFilterAction(li, action);
},
addAction: function() { addFilterAction(); },
@ -987,7 +984,7 @@ function quickAddFilter() {
execute: function() {
if (this.validate()) {
var query = dojo.formToQuery("filter_new_form");
const query = dojo.formToQuery("filter_new_form");
console.log(query);
@ -1005,30 +1002,30 @@ function quickAddFilter() {
href: query});
if (!inPreferences()) {
var selectedText = getSelectionText();
const selectedText = getSelectionText();
var lh = dojo.connect(dialog, "onLoad", function(){
dojo.disconnect(lh);
if (selectedText != "") {
var feed_id = activeFeedIsCat() ? 'CAT:' + parseInt(getActiveFeedId()) :
const feed_id = activeFeedIsCat() ? 'CAT:' + parseInt(getActiveFeedId()) :
getActiveFeedId();
var rule = { reg_exp: selectedText, feed_id: [feed_id], filter_type: 1 };
const rule = { reg_exp: selectedText, feed_id: [feed_id], filter_type: 1 };
addFilterRule(null, dojo.toJson(rule));
} else {
var query = "op=rpc&method=getlinktitlebyid&id=" + getActiveArticleId();
const query = "op=rpc&method=getlinktitlebyid&id=" + getActiveArticleId();
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
var reply = JSON.parse(transport.responseText);
const reply = JSON.parse(transport.responseText);
var title = false;
let title = false;
if (reply && reply.title) title = reply.title;
@ -1036,10 +1033,10 @@ function quickAddFilter() {
console.log(title + " " + getActiveFeedId());
var feed_id = activeFeedIsCat() ? 'CAT:' + parseInt(getActiveFeedId()) :
const feed_id = activeFeedIsCat() ? 'CAT:' + parseInt(getActiveFeedId()) :
getActiveFeedId();
var rule = { reg_exp: title, feed_id: [feed_id], filter_type: 1 };
const rule = { reg_exp: title, feed_id: [feed_id], filter_type: 1 };
addFilterRule(null, dojo.toJson(rule));
}
@ -1057,12 +1054,12 @@ function quickAddFilter() {
function unsubscribeFeed(feed_id, title) {
var msg = __("Unsubscribe from %s?").replace("%s", title);
const msg = __("Unsubscribe from %s?").replace("%s", title);
if (title == undefined || confirm(msg)) {
notify_progress("Removing feed...");
var query = "?op=pref-feeds&quiet=1&method=remove&ids=" + feed_id;
const query = "?op=pref-feeds&quiet=1&method=remove&ids=" + feed_id;
new Ajax.Request("backend.php", {
parameters: query,
@ -1095,14 +1092,14 @@ function backend_sanity_check_callback(transport) {
return;
}
var reply = JSON.parse(transport.responseText);
const reply = JSON.parse(transport.responseText);
if (!reply) {
fatalError(3, "Sanity check: invalid RPC reply", transport.responseText);
return;
}
var error_code = reply['error']['code'];
const error_code = reply['error']['code'];
if (error_code && error_code != 0) {
return fatalError(error_code, reply['error']['message']);
@ -1110,12 +1107,12 @@ function backend_sanity_check_callback(transport) {
console.log("sanity check ok");
var params = reply['init-params'];
const params = reply['init-params'];
if (params) {
console.log('reading init-params...');
for (var k in params) {
for (const k in params) {
console.log("IP: " + k + " => " + JSON.stringify(params[k]));
if (k == "label_base_index") _label_base_index = parseInt(params[k]);
}
@ -1133,22 +1130,22 @@ function backend_sanity_check_callback(transport) {
}
function genUrlChangeKey(feed, is_cat) {
var ok = confirm(__("Generate new syndication address for this feed?"));
const ok = confirm(__("Generate new syndication address for this feed?"));
if (ok) {
notify_progress("Trying to change address...", true);
var query = "?op=pref-feeds&method=regenFeedKey&id=" + param_escape(feed) +
const query = "?op=pref-feeds&method=regenFeedKey&id=" + param_escape(feed) +
"&is_cat=" + param_escape(is_cat);
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
var reply = JSON.parse(transport.responseText);
var new_link = reply.link;
const reply = JSON.parse(transport.responseText);
const new_link = reply.link;
var e = $('gen_feed_url');
const e = $('gen_feed_url');
if (new_link) {
@ -1172,19 +1169,19 @@ function genUrlChangeKey(feed, is_cat) {
// mode = all, none, invert
function selectTableRows(id, mode) {
var rows = $(id).rows;
const rows = $(id).rows;
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
var cb = false;
var dcb = false;
for (let i = 0; i < rows.length; i++) {
const row = rows[i];
let cb = false;
let dcb = false;
if (row.id && row.className) {
var bare_id = row.id.replace(/^[A-Z]*?-/, "");
var inputs = rows[i].getElementsByTagName("input");
const bare_id = row.id.replace(/^[A-Z]*?-/, "");
const inputs = rows[i].getElementsByTagName("input");
for (var j = 0; j < inputs.length; j++) {
var input = inputs[j];
for (let j = 0; j < inputs.length; j++) {
const input = inputs[j];
if (input.getAttribute("type") == "checkbox" &&
input.id.match(bare_id)) {
@ -1196,7 +1193,7 @@ function selectTableRows(id, mode) {
}
if (cb || dcb) {
var issel = row.hasClassName("Selected");
const issel = row.hasClassName("Selected");
if (mode == "all" && !issel) {
row.addClassName("Selected");
@ -1226,13 +1223,13 @@ function selectTableRows(id, mode) {
}
function getSelectedTableRowIds(id) {
var rows = [];
const rows = [];
var elem_rows = $(id).rows;
const elem_rows = $(id).rows;
for (var i = 0; i < elem_rows.length; i++) {
for (let i = 0; i < elem_rows.length; i++) {
if (elem_rows[i].hasClassName("Selected")) {
var bare_id = elem_rows[i].id.replace(/^[A-Z]*?-/, "");
const bare_id = elem_rows[i].id.replace(/^[A-Z]*?-/, "");
rows.push(bare_id);
}
}
@ -1244,7 +1241,7 @@ function editFeed(feed) {
if (feed <= 0)
return alert(__("You can't edit this kind of feed."));
var query = "backend.php?op=pref-feeds&method=editfeed&id=" +
const query = "backend.php?op=pref-feeds&method=editfeed&id=" +
param_escape(feed);
console.log(query);
@ -1280,7 +1277,7 @@ function editFeed(feed) {
}
function feedBrowser() {
var query = "backend.php?op=feeds&method=feedBrowser";
const query = "backend.php?op=feeds&method=feedBrowser";
if (dijit.byId("feedAddDlg"))
dijit.byId("feedAddDlg").hide();
@ -1293,11 +1290,11 @@ function feedBrowser() {
title: __("More Feeds"),
style: "width: 600px",
getSelectedFeedIds: function () {
var list = $$("#browseFeedList li[id*=FBROW]");
var selected = new Array();
const list = $$("#browseFeedList li[id*=FBROW]");
const selected = new Array();
list.each(function (child) {
var id = child.id.replace("FBROW-", "");
const id = child.id.replace("FBROW-", "");
if (child.hasClassName('Selected')) {
selected.push(id);
@ -1307,12 +1304,12 @@ function feedBrowser() {
return selected;
},
getSelectedFeeds: function () {
var list = $$("#browseFeedList li.Selected");
var selected = new Array();
const list = $$("#browseFeedList li.Selected");
const selected = new Array();
list.each(function (child) {
var title = child.getElementsBySelector("span.fb_feedTitle")[0].innerHTML;
var url = child.getElementsBySelector("a.fb_feedUrl")[0].href;
const title = child.getElementsBySelector("span.fb_feedTitle")[0].innerHTML;
const url = child.getElementsBySelector("a.fb_feedUrl")[0].href;
selected.push([title, url]);
@ -1322,8 +1319,8 @@ function feedBrowser() {
},
subscribe: function () {
var mode = this.attr('value').mode;
var selected = [];
const mode = this.attr('value').mode;
let selected = [];
if (mode == "1")
selected = this.getSelectedFeeds();
@ -1338,7 +1335,7 @@ function feedBrowser() {
// we use dojo.toJson instead of JSON.stringify because
// it somehow escapes everything TWICE, at least in Chrome 9
var query = "?op=rpc&method=massSubscribe&payload=" +
const query = "?op=rpc&method=massSubscribe&payload=" +
param_escape(dojo.toJson(selected)) + "&mode=" + param_escape(mode);
console.log(query);
@ -1357,7 +1354,7 @@ function feedBrowser() {
},
update: function () {
var query = dojo.objectToQuery(dialog.attr('value'));
const query = dojo.objectToQuery(dialog.attr('value'));
Element.show('feed_browser_spinner');
@ -1368,12 +1365,12 @@ function feedBrowser() {
Element.hide('feed_browser_spinner');
var c = $("browseFeedList");
const c = $("browseFeedList");
var reply = JSON.parse(transport.responseText);
const reply = JSON.parse(transport.responseText);
var r = reply['content'];
var mode = reply['mode'];
const r = reply['content'];
const mode = reply['mode'];
if (c && r) {
c.innerHTML = r;
@ -1391,18 +1388,18 @@ function feedBrowser() {
});
},
removeFromArchive: function () {
var selected = this.getSelectedFeedIds();
const selected = this.getSelectedFeedIds();
if (selected.length > 0) {
var pr = __("Remove selected feeds from the archive? Feeds with stored articles will not be removed.");
const pr = __("Remove selected feeds from the archive? Feeds with stored articles will not be removed.");
if (confirm(pr)) {
Element.show('feed_browser_spinner');
var query = "?op=rpc&method=remarchive&ids=" +
const query = "?op=rpc&method=remarchive&ids=" +
param_escape(selected.toString());
;
new Ajax.Request("backend.php", {
parameters: query,
@ -1425,7 +1422,7 @@ function feedBrowser() {
}
function showFeedsWithErrors() {
var query = "backend.php?op=pref-feeds&method=feedsWithErrors";
const query = "backend.php?op=pref-feeds&method=feedsWithErrors";
if (dijit.byId("errorFeedsDlg"))
dijit.byId("errorFeedsDlg").destroyRecursive();
@ -1438,17 +1435,17 @@ function showFeedsWithErrors() {
return getSelectedTableRowIds("prefErrorFeedList");
},
removeSelected: function() {
var sel_rows = this.getSelectedFeeds();
const sel_rows = this.getSelectedFeeds();
console.log(sel_rows);
if (sel_rows.length > 0) {
var ok = confirm(__("Remove selected feeds?"));
const ok = confirm(__("Remove selected feeds?"));
if (ok) {
notify_progress("Removing selected feeds...", true);
var query = "?op=pref-feeds&method=remove&ids="+
const query = "?op=pref-feeds&method=remove&ids="+
param_escape(sel_rows.toString());
new Ajax.Request("backend.php", {
@ -1474,17 +1471,17 @@ function showFeedsWithErrors() {
}
function get_timestamp() {
var date = new Date();
const date = new Date();
return Math.round(date.getTime() / 1000);
}
function helpDialog(topic) {
var 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();
var dialog = new dijit.Dialog({
const dialog = new dijit.Dialog({
id: "helpDlg",
title: __("Help"),
style: "width: 600px",
@ -1514,14 +1511,14 @@ function htmlspecialchars_decode (string, quote_style) {
// * returns 1: '<p>this -> &quot;</p>'
// * example 2: htmlspecialchars_decode("&amp;quot;");
// * returns 2: '&quot;'
var optTemp = 0,
let optTemp = 0,
i = 0,
noquotes = false;
if (typeof quote_style === 'undefined') {
quote_style = 2;
}
string = string.toString().replace(/&lt;/g, '<').replace(/&gt;/g, '>');
var OPTS = {
const OPTS = {
'ENT_NOQUOTES': 0,
'ENT_HTML_QUOTE_SINGLE': 1,
'ENT_HTML_QUOTE_DOUBLE': 2,
@ -1569,13 +1566,13 @@ function feed_to_label_id(feed) {
// http://stackoverflow.com/questions/6251937/how-to-get-selecteduser-highlighted-text-in-contenteditable-element-and-replac
function getSelectionText() {
var text = "";
let text = "";
if (typeof window.getSelection != "undefined") {
var sel = window.getSelection();
const sel = window.getSelection();
if (sel.rangeCount) {
var container = document.createElement("div");
for (var i = 0, len = sel.rangeCount; i < len; ++i) {
const container = document.createElement("div");
for (let i = 0, len = sel.rangeCount; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
}
text = container.innerHTML;
@ -1590,13 +1587,13 @@ function getSelectionText() {
}
function openUrlPopup(url) {
var w = window.open("");
const w = window.open("");
w.opener = null;
w.location = url;
}
function openArticlePopup(id) {
var w = window.open("",
const w = window.open("",
"ttrss_article_popup",
"height=900,width=900,resizable=yes,status=no,location=no,menubar=no,directories=no,scrollbars=yes,toolbar=no");

View File

@ -11,8 +11,8 @@ function notify_callback2(transport, sticky) {
function updateFeedList() {
var user_search = $("feed_search");
var search = "";
const user_search = $("feed_search");
let search = "";
if (user_search) { search = user_search.value; }
new Ajax.Request("backend.php", {
@ -36,14 +36,14 @@ function checkInactiveFeeds() {
}
function updateUsersList(sort_key) {
var user_search = $("user_search");
var search = "";
const user_search = $("user_search");
let search = "";
if (user_search) {
search = user_search.value;
}
var query = "?op=pref-users&sort="
+ param_escape(sort_key) +
const query = "?op=pref-users&sort=" +
param_escape(sort_key) +
"&search=" + param_escape(search);
new Ajax.Request("backend.php", {
@ -57,7 +57,7 @@ function updateUsersList(sort_key) {
}
function addUser() {
var login = prompt(__("Please enter login:"), "");
const login = prompt(__("Please enter login:"), "");
if (login == null) {
return false;
@ -70,7 +70,7 @@ function addUser() {
notify_progress("Adding user...");
var query = "?op=pref-users&method=add&login=" +
const query = "?op=pref-users&method=add&login=" +
param_escape(login);
new Ajax.Request("backend.php", {
@ -85,7 +85,7 @@ function addUser() {
function editUser(id) {
var query = "backend.php?op=pref-users&method=edit&id=" +
const query = "backend.php?op=pref-users&method=edit&id=" +
param_escape(id);
if (dijit.byId("userEditDlg"))
@ -99,7 +99,7 @@ function editUser(id) {
if (this.validate()) {
notify_progress("Saving data...", true);
var query = dojo.formToQuery("user_edit_form");
const query = dojo.formToQuery("user_edit_form");
new Ajax.Request("backend.php", {
parameters: query,
@ -118,7 +118,7 @@ function editUser(id) {
function editFilter(id) {
var query = "backend.php?op=pref-filters&method=edit&id=" + param_escape(id);
const query = "backend.php?op=pref-filters&method=edit&id=" + param_escape(id);
if (dijit.byId("feedEditDlg"))
dijit.byId("feedEditDlg").destroyRecursive();
@ -132,7 +132,7 @@ function editFilter(id) {
style: "width: 600px",
test: function () {
var query = "backend.php?" + dojo.formToQuery("filter_edit_form") + "&savemode=test";
const query = "backend.php?" + dojo.formToQuery("filter_edit_form") + "&savemode=test";
editFilterTest(query);
},
@ -157,26 +157,26 @@ function editFilter(id) {
});
},
editRule: function (e) {
var li = e.parentNode;
var rule = li.getElementsByTagName("INPUT")[1].value;
const li = e.parentNode;
const rule = li.getElementsByTagName("INPUT")[1].value;
addFilterRule(li, rule);
},
editAction: function (e) {
var li = e.parentNode;
var action = li.getElementsByTagName("INPUT")[1].value;
const li = e.parentNode;
const action = li.getElementsByTagName("INPUT")[1].value;
addFilterAction(li, action);
},
removeFilter: function () {
var msg = __("Remove filter?");
const msg = __("Remove filter?");
if (confirm(msg)) {
this.hide();
notify_progress("Removing filter...");
var id = this.attr('value').id;
const id = this.attr('value').id;
var query = "?op=pref-filters&method=remove&ids=" +
const query = "?op=pref-filters&method=remove&ids=" +
param_escape(id);
new Ajax.Request("backend.php", {
@ -208,7 +208,7 @@ function editFilter(id) {
notify_progress("Saving data...", true);
var query = dojo.formToQuery("filter_edit_form");
const query = dojo.formToQuery("filter_edit_form");
console.log(query);
@ -229,9 +229,9 @@ function editFilter(id) {
function getSelectedLabels() {
var tree = dijit.byId("labelTree");
var items = tree.model.getCheckedItems();
var rv = [];
const tree = dijit.byId("labelTree");
const items = tree.model.getCheckedItems();
const rv = [];
items.each(function(item) {
rv.push(tree.model.store.getValue(item, 'bare_id'));
@ -245,9 +245,9 @@ function getSelectedUsers() {
}
function getSelectedFeeds() {
var tree = dijit.byId("feedTree");
var items = tree.model.getCheckedItems();
var rv = [];
const tree = dijit.byId("feedTree");
const items = tree.model.getCheckedItems();
const rv = [];
items.each(function(item) {
if (item.id[0].match("FEED:"))
@ -258,9 +258,9 @@ function getSelectedFeeds() {
}
function getSelectedCategories() {
var tree = dijit.byId("feedTree");
var items = tree.model.getCheckedItems();
var rv = [];
const tree = dijit.byId("feedTree");
const items = tree.model.getCheckedItems();
const rv = [];
items.each(function(item) {
if (item.id[0].match("CAT:"))
@ -271,9 +271,9 @@ function getSelectedCategories() {
}
function getSelectedFilters() {
var tree = dijit.byId("filterTree");
var items = tree.model.getCheckedItems();
var rv = [];
const tree = dijit.byId("filterTree");
const items = tree.model.getCheckedItems();
const rv = [];
items.each(function(item) {
rv.push(tree.model.store.getValue(item, 'bare_id'));
@ -285,16 +285,16 @@ function getSelectedFilters() {
function removeSelectedLabels() {
var sel_rows = getSelectedLabels();
const sel_rows = getSelectedLabels();
if (sel_rows.length > 0) {
var ok = confirm(__("Remove selected labels?"));
const ok = confirm(__("Remove selected labels?"));
if (ok) {
notify_progress("Removing selected labels...");
var query = "?op=pref-labels&method=remove&ids="+
const query = "?op=pref-labels&method=remove&ids="+
param_escape(sel_rows.toString());
new Ajax.Request("backend.php", {
@ -313,16 +313,16 @@ function removeSelectedLabels() {
function removeSelectedUsers() {
var sel_rows = getSelectedUsers();
const sel_rows = getSelectedUsers();
if (sel_rows.length > 0) {
var ok = confirm(__("Remove selected users? Neither default admin nor your account will be removed."));
const ok = confirm(__("Remove selected users? Neither default admin nor your account will be removed."));
if (ok) {
notify_progress("Removing selected users...");
var query = "?op=pref-users&method=remove&ids=" +
const query = "?op=pref-users&method=remove&ids=" +
param_escape(sel_rows.toString());
new Ajax.Request("backend.php", {
@ -343,16 +343,16 @@ function removeSelectedUsers() {
function removeSelectedFilters() {
var sel_rows = getSelectedFilters();
const sel_rows = getSelectedFilters();
if (sel_rows.length > 0) {
var ok = confirm(__("Remove selected filters?"));
const ok = confirm(__("Remove selected filters?"));
if (ok) {
notify_progress("Removing selected filters...");
var query = "?op=pref-filters&method=remove&ids=" +
const query = "?op=pref-filters&method=remove&ids=" +
param_escape(sel_rows.toString());
new Ajax.Request("backend.php", {
@ -371,17 +371,17 @@ function removeSelectedFilters() {
function removeSelectedFeeds() {
var sel_rows = getSelectedFeeds();
const sel_rows = getSelectedFeeds();
if (sel_rows.length > 0) {
var ok = confirm(__("Unsubscribe from selected feeds?"));
const ok = confirm(__("Unsubscribe from selected feeds?"));
if (ok) {
notify_progress("Unsubscribing from selected feeds...", true);
var query = "?op=pref-feeds&method=remove&ids=" +
const query = "?op=pref-feeds&method=remove&ids=" +
param_escape(sel_rows.toString());
console.log(query);
@ -402,7 +402,7 @@ function removeSelectedFeeds() {
}
function editSelectedUser() {
var rows = getSelectedUsers();
const rows = getSelectedUsers();
if (rows.length == 0) {
alert(__("No users are selected."));
@ -421,7 +421,7 @@ function editSelectedUser() {
function resetSelectedUserPass() {
var rows = getSelectedUsers();
const rows = getSelectedUsers();
if (rows.length == 0) {
alert(__("No users are selected."));
@ -433,14 +433,14 @@ function resetSelectedUserPass() {
return;
}
var ok = confirm(__("Reset password of selected user?"));
const ok = confirm(__("Reset password of selected user?"));
if (ok) {
notify_progress("Resetting password for selected user...");
var id = rows[0];
const id = rows[0];
var query = "?op=pref-users&method=resetPass&id=" +
const query = "?op=pref-users&method=resetPass&id=" +
param_escape(id);
new Ajax.Request("backend.php", {
@ -455,7 +455,7 @@ function resetSelectedUserPass() {
function selectedUserDetails() {
var rows = getSelectedUsers();
const rows = getSelectedUsers();
if (rows.length == 0) {
alert(__("No users are selected."));
@ -467,9 +467,9 @@ function selectedUserDetails() {
return;
}
var id = rows[0];
const id = rows[0];
var query = "backend.php?op=pref-users&method=userdetails&id=" + id;
const query = "backend.php?op=pref-users&method=userdetails&id=" + id;
if (dijit.byId("userDetailsDlg"))
dijit.byId("userDetailsDlg").destroyRecursive();
@ -489,7 +489,7 @@ function selectedUserDetails() {
function editSelectedFilter() {
var rows = getSelectedFilters();
const rows = getSelectedFilters();
if (rows.length == 0) {
alert(__("No filters are selected."));
@ -508,19 +508,19 @@ function editSelectedFilter() {
}
function joinSelectedFilters() {
var rows = getSelectedFilters();
const rows = getSelectedFilters();
if (rows.length == 0) {
alert(__("No filters are selected."));
return;
}
var ok = confirm(__("Combine selected filters?"));
const ok = confirm(__("Combine selected filters?"));
if (ok) {
notify_progress("Joining filters...");
var query = "?op=pref-filters&method=join&ids="+
const query = "?op=pref-filters&method=join&ids="+
param_escape(rows.toString());
console.log(query);
@ -534,7 +534,7 @@ function joinSelectedFilters() {
}
function editSelectedFeed() {
var rows = getSelectedFeeds();
const rows = getSelectedFeeds();
if (rows.length == 0) {
alert(__("No feeds are selected."));
@ -552,7 +552,7 @@ function editSelectedFeed() {
}
function editSelectedFeeds() {
var rows = getSelectedFeeds();
const rows = getSelectedFeeds();
if (rows.length == 0) {
alert(__("No feeds are selected."));
@ -561,7 +561,7 @@ function editSelectedFeeds() {
notify_progress("Loading, please wait...");
var query = "backend.php?op=pref-feeds&method=editfeeds&ids=" +
const query = "backend.php?op=pref-feeds&method=editfeeds&ids=" +
param_escape(rows.toString());
console.log(query);
@ -580,7 +580,7 @@ function editSelectedFeeds() {
title: __("Edit Multiple Feeds"),
style: "width: 600px",
getChildByName: function (name) {
var rv = null;
let rv = null;
this.getChildren().each(
function (child) {
if (child.name == name) {
@ -602,7 +602,7 @@ function editSelectedFeeds() {
},
execute: function () {
if (this.validate() && confirm(__("Save changes to selected feeds?"))) {
var query = dojo.objectToQuery(this.attr('value'));
let query = dojo.objectToQuery(this.attr('value'));
/* Form.serialize ignores unchecked checkboxes */
@ -674,9 +674,9 @@ function opmlImportComplete(iframe) {
if (dijit.byId('opmlImportDlg'))
dijit.byId('opmlImportDlg').destroyRecursive();
var content = iframe.contentDocument.body.innerHTML;
const content = iframe.contentDocument.body.innerHTML;
var dialog = new dijit.Dialog({
const dialog = new dijit.Dialog({
id: "opmlImportDlg",
title: __("OPML Import"),
style: "width: 600px",
@ -694,7 +694,7 @@ function opmlImportComplete(iframe) {
function opmlImport() {
var opml_file = $("opml_file");
const opml_file = $("opml_file");
if (opml_file.value.length == 0) {
alert(__("Please choose an OPML file first."));
@ -710,8 +710,8 @@ function opmlImport() {
function updateFilterList() {
var user_search = $("filter_search");
var search = "";
const user_search = $("filter_search");
let search = "";
if (user_search) { search = user_search.value; }
new Ajax.Request("backend.php", {
@ -767,7 +767,7 @@ function selectTab(id, noupdate) {
updateSystemList();
}
var tab = dijit.byId(id + "Tab");
const tab = dijit.byId(id + "Tab");
dijit.byId("pref-tabs").selectChild(tab);
}
@ -778,17 +778,17 @@ function init_second_stage() {
loading_set_progress(50);
notify("");
var tab = getURLParam('tab');
let tab = getURLParam('tab');
if (tab) {
tab = dijit.byId(tab + "Tab");
if (tab) dijit.byId("pref-tabs").selectChild(tab);
}
var method = getURLParam('method');
const method = getURLParam('method');
if (method == 'editFeed') {
var param = getURLParam('methodparam');
const param = getURLParam('methodparam');
window.setTimeout(function() { editFeed(param) }, 100);
}
@ -846,7 +846,7 @@ function init() {
loading_set_progress(50);
var clientTzOffset = new Date().getTimezoneOffset() * 60;
const clientTzOffset = new Date().getTimezoneOffset() * 60;
new Ajax.Request("backend.php", {
parameters: {
@ -866,11 +866,11 @@ function init() {
function validatePrefsReset() {
var ok = confirm(__("Reset to defaults?"));
const ok = confirm(__("Reset to defaults?"));
if (ok) {
var query = "?op=pref-prefs&method=resetconfig";
const query = "?op=pref-prefs&method=resetconfig";
console.log(query);
new Ajax.Request("backend.php", {
@ -890,10 +890,10 @@ function pref_hotkey_handler(e) {
if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
var keycode = false;
var shift_key = false;
let keycode = false;
let shift_key = false;
var cmdline = $('cmdline');
const cmdline = $('cmdline');
try {
shift_key = e.shiftKey;
@ -907,7 +907,7 @@ function pref_hotkey_handler(e) {
keycode = e.which;
}
var keychar = String.fromCharCode(keycode);
let keychar = String.fromCharCode(keycode);
if (keycode == 27) { // escape
hotkey_prefix = false;
@ -922,8 +922,8 @@ function pref_hotkey_handler(e) {
if (!hotkey_prefix && hotkeys[0].indexOf(keychar) != -1) {
var date = new Date();
var ts = Math.round(date.getTime() / 1000);
const date = new Date();
const ts = Math.round(date.getTime() / 1000);
hotkey_prefix = keychar;
hotkey_prefix_pressed = ts;
@ -936,14 +936,14 @@ function pref_hotkey_handler(e) {
Element.hide(cmdline);
var hotkey = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
let hotkey = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
hotkey = hotkey_prefix ? hotkey_prefix + " " + hotkey : hotkey;
hotkey_prefix = false;
var hotkey_action = false;
let hotkey_action = false;
var hotkeys = getInitParam("hotkeys");
for (var sequence in hotkeys[1]) {
for (const sequence in hotkeys[1]) {
if (sequence == hotkey) {
hotkey_action = hotkeys[1][sequence];
break;
@ -970,10 +970,10 @@ function pref_hotkey_handler(e) {
function removeCategory(id, item) {
var ok = confirm(__("Remove category %s? Any nested feeds would be placed into Uncategorized.").replace("%s", item.name));
const ok = confirm(__("Remove category %s? Any nested feeds would be placed into Uncategorized.").replace("%s", item.name));
if (ok) {
var query = "?op=pref-feeds&method=removeCat&ids=" +
const query = "?op=pref-feeds&method=removeCat&ids=" +
param_escape(id);
notify_progress("Removing category...");
@ -990,16 +990,16 @@ function removeCategory(id, item) {
function removeSelectedCategories() {
var sel_rows = getSelectedCategories();
const sel_rows = getSelectedCategories();
if (sel_rows.length > 0) {
var ok = confirm(__("Remove selected categories?"));
const ok = confirm(__("Remove selected categories?"));
if (ok) {
notify_progress("Removing selected categories...");
var query = "?op=pref-feeds&method=removeCat&ids="+
const query = "?op=pref-feeds&method=removeCat&ids="+
param_escape(sel_rows.toString());
new Ajax.Request("backend.php", {
@ -1017,13 +1017,13 @@ function removeSelectedCategories() {
}
function createCategory() {
var title = prompt(__("Category title:"));
const title = prompt(__("Category title:"));
if (title) {
notify_progress("Creating category...");
var query = "?op=pref-feeds&method=addCat&cat=" +
const query = "?op=pref-feeds&method=addCat&cat=" +
param_escape(title);
new Ajax.Request("backend.php", {
@ -1037,7 +1037,7 @@ function createCategory() {
}
function showInactiveFeeds() {
var query = "backend.php?op=pref-feeds&method=inactiveFeeds";
const query = "backend.php?op=pref-feeds&method=inactiveFeeds";
if (dijit.byId("inactiveFeedsDlg"))
dijit.byId("inactiveFeedsDlg").destroyRecursive();
@ -1050,17 +1050,17 @@ function showInactiveFeeds() {
return getSelectedTableRowIds("prefInactiveFeedList");
},
removeSelected: function () {
var sel_rows = this.getSelectedFeeds();
const sel_rows = this.getSelectedFeeds();
console.log(sel_rows);
if (sel_rows.length > 0) {
var ok = confirm(__("Remove selected feeds?"));
const ok = confirm(__("Remove selected feeds?"));
if (ok) {
notify_progress("Removing selected feeds...", true);
var query = "?op=pref-feeds&method=remove&ids=" +
const query = "?op=pref-feeds&method=remove&ids=" +
param_escape(sel_rows.toString());
new Ajax.Request("backend.php", {
@ -1088,22 +1088,22 @@ function showInactiveFeeds() {
}
function opmlRegenKey() {
var ok = confirm(__("Replace current OPML publishing address with a new one?"));
const ok = confirm(__("Replace current OPML publishing address with a new one?"));
if (ok) {
notify_progress("Trying to change address...", true);
var query = "?op=pref-feeds&method=regenOPMLKey";
const query = "?op=pref-feeds&method=regenOPMLKey";
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function (transport) {
var reply = JSON.parse(transport.responseText);
const reply = JSON.parse(transport.responseText);
var new_link = reply.link;
const new_link = reply.link;
var e = $('pub_opml_url');
const e = $('pub_opml_url');
if (new_link) {
e.href = new_link;
@ -1123,13 +1123,13 @@ function opmlRegenKey() {
}
function labelColorReset() {
var labels = getSelectedLabels();
const labels = getSelectedLabels();
if (labels.length > 0) {
var ok = confirm(__("Reset selected labels to default colors?"));
const ok = confirm(__("Reset selected labels to default colors?"));
if (ok) {
var query = "?op=pref-labels&method=colorreset&ids=" +
const query = "?op=pref-labels&method=colorreset&ids=" +
param_escape(labels.toString());
new Ajax.Request("backend.php", {
@ -1154,7 +1154,7 @@ function editProfiles() {
if (dijit.byId("profileEditDlg"))
dijit.byId("profileEditDlg").destroyRecursive();
var query = "backend.php?op=pref-prefs&method=editPrefProfiles";
const query = "backend.php?op=pref-prefs&method=editPrefProfiles";
var dialog = new dijit.Dialog({
id: "profileEditDlg",
@ -1164,15 +1164,15 @@ function editProfiles() {
return getSelectedTableRowIds("prefFeedProfileList");
},
removeSelected: function () {
var sel_rows = this.getSelectedProfiles();
const sel_rows = this.getSelectedProfiles();
if (sel_rows.length > 0) {
var ok = confirm(__("Remove selected profiles? Active and default profiles will not be removed."));
const ok = confirm(__("Remove selected profiles? Active and default profiles will not be removed."));
if (ok) {
notify_progress("Removing selected profiles...", true);
var query = "?op=rpc&method=remprofiles&ids=" +
const query = "?op=rpc&method=remprofiles&ids=" +
param_escape(sel_rows.toString());
new Ajax.Request("backend.php", {
@ -1190,16 +1190,16 @@ function editProfiles() {
}
},
activateProfile: function () {
var sel_rows = this.getSelectedProfiles();
const sel_rows = this.getSelectedProfiles();
if (sel_rows.length == 1) {
var ok = confirm(__("Activate selected profile?"));
const ok = confirm(__("Activate selected profile?"));
if (ok) {
notify_progress("Loading, please wait...");
var query = "?op=rpc&method=setprofile&id=" +
const query = "?op=rpc&method=setprofile&id=" +
param_escape(sel_rows.toString());
new Ajax.Request("backend.php", {
@ -1218,7 +1218,7 @@ function editProfiles() {
if (this.validate()) {
notify_progress("Creating profile...", true);
var query = "?op=rpc&method=addprofile&title=" +
const query = "?op=rpc&method=addprofile&title=" +
param_escape(dialog.attr('value').newprofile);
new Ajax.Request("backend.php", {
@ -1243,16 +1243,16 @@ function editProfiles() {
function activatePrefProfile() {
var sel_rows = getSelectedFeedCats();
const sel_rows = getSelectedFeedCats();
if (sel_rows.length == 1) {
var ok = confirm(__("Activate selected profile?"));
const ok = confirm(__("Activate selected profile?"));
if (ok) {
notify_progress("Loading, please wait...");
var query = "?op=rpc&method=setprofile&id="+
const query = "?op=rpc&method=setprofile&id="+
param_escape(sel_rows.toString());
new Ajax.Request("backend.php", {
@ -1271,12 +1271,12 @@ function activatePrefProfile() {
function clearFeedAccessKeys() {
var ok = confirm(__("This will invalidate all previously generated feed URLs. Continue?"));
const ok = confirm(__("This will invalidate all previously generated feed URLs. Continue?"));
if (ok) {
notify_progress("Clearing URLs...");
var query = "?op=pref-feeds&method=clearKeys";
const query = "?op=pref-feeds&method=clearKeys";
new Ajax.Request("backend.php", {
parameters: query,
@ -1300,7 +1300,6 @@ function resetFilterOrder() {
}
function resetFeedOrder() {
notify_progress("Loading, please wait...");
@ -1324,7 +1323,7 @@ function resetCatOrder() {
}
function editCat(id, item) {
var new_name = prompt(__('Rename category to:'), item.name);
const new_name = prompt(__('Rename category to:'), item.name);
if (new_name && new_name != item.name) {
@ -1345,20 +1344,20 @@ function editCat(id, item) {
}
function editLabel(id) {
var query = "backend.php?op=pref-labels&method=edit&id=" +
const query = "backend.php?op=pref-labels&method=edit&id=" +
param_escape(id);
if (dijit.byId("labelEditDlg"))
dijit.byId("labelEditDlg").destroyRecursive();
var dialog = new dijit.Dialog({
const dialog = new dijit.Dialog({
id: "labelEditDlg",
title: __("Label Editor"),
style: "width: 600px",
setLabelColor: function (id, fg, bg) {
var kind = '';
var color = '';
let kind = '';
let color = '';
if (fg && bg) {
kind = 'both';
@ -1370,13 +1369,13 @@ function editLabel(id) {
color = bg;
}
var query = "?op=pref-labels&method=colorset&kind=" + kind +
const query = "?op=pref-labels&method=colorset&kind=" + kind +
"&ids=" + param_escape(id) + "&fg=" + param_escape(fg) +
"&bg=" + param_escape(bg) + "&color=" + param_escape(color);
// console.log(query);
var e = $("LICID-" + id);
const e = $("LICID-" + id);
if (e) {
if (fg) e.style.color = fg;
@ -1389,10 +1388,10 @@ function editLabel(id) {
},
execute: function () {
if (this.validate()) {
var caption = this.attr('value').caption;
var fg_color = this.attr('value').fg_color;
var bg_color = this.attr('value').bg_color;
var query = dojo.objectToQuery(this.attr('value'));
const caption = this.attr('value').caption;
const fg_color = this.attr('value').fg_color;
const bg_color = this.attr('value').bg_color;
const query = dojo.objectToQuery(this.attr('value'));
dijit.byId('labelTree').setNameById(id, caption);
this.setLabelColor(id, fg_color, bg_color);
@ -1414,12 +1413,12 @@ function editLabel(id) {
function customizeCSS() {
var query = "backend.php?op=pref-prefs&method=customizeCSS";
const query = "backend.php?op=pref-prefs&method=customizeCSS";
if (dijit.byId("cssEditDlg"))
dijit.byId("cssEditDlg").destroyRecursive();
var dialog = new dijit.Dialog({
const dialog = new dijit.Dialog({
id: "cssEditDlg",
title: __("Customize stylesheet"),
style: "width: 600px",
@ -1445,13 +1444,13 @@ function insertSSLserial(value) {
}
function gotoExportOpml(filename, settings) {
var tmp = settings ? 1 : 0;
const tmp = settings ? 1 : 0;
document.location.href = "backend.php?op=opml&method=export&filename=" + filename + "&settings=" + tmp;
}
function batchSubscribe() {
var query = "backend.php?op=pref-feeds&method=batchSubscribe";
const query = "backend.php?op=pref-feeds&method=batchSubscribe";
// overlapping widgets
if (dijit.byId("batchSubDlg")) dijit.byId("batchSubDlg").destroyRecursive();
@ -1501,7 +1500,7 @@ function clearSqlLog() {
if (confirm(__("Clear all messages in the error log?"))) {
notify_progress("Loading, please wait...");
var query = "?op=pref-system&method=clearLog";
const query = "?op=pref-system&method=clearLog";
new Ajax.Request("backend.php", {
parameters: query,

View File

@ -50,11 +50,11 @@ function updateFeedList() {
dijit.byId("feedTree").destroyRecursive();
}
var store = new dojo.data.ItemFileWriteStore({
const store = new dojo.data.ItemFileWriteStore({
url: "backend.php?op=pref_feeds&method=getfeedtree&mode=2"
});
var treeModel = new fox.FeedStoreModel({
const treeModel = new fox.FeedStoreModel({
store: store,
query: {
"type": getInitParam('enable_feed_cats') == 1 ? "category" : "feed"
@ -64,12 +64,12 @@ function updateFeedList() {
childrenAttrs: ["items"]
});
var tree = new fox.FeedTree({
const tree = new fox.FeedTree({
model: treeModel,
onClick: function (item, node) {
var id = String(item.id);
var is_cat = id.match("^CAT:");
var feed = id.substr(id.indexOf(":") + 1);
const id = String(item.id);
const is_cat = id.match("^CAT:");
const feed = id.substr(id.indexOf(":") + 1);
viewfeed({feed: feed, is_cat: is_cat});
return false;
},
@ -115,11 +115,11 @@ function updateFeedList() {
function catchupAllFeeds() {
var str = __("Mark all articles as read?");
const str = __("Mark all articles as read?");
if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
var query_str = "backend.php?op=feeds&method=catchupAll";
const query_str = "backend.php?op=feeds&method=catchupAll";
notify_progress("Marking all feeds as read...");
@ -154,13 +154,13 @@ function timeout() {
}
function search() {
var query = "backend.php?op=feeds&method=search&param=" +
const query = "backend.php?op=feeds&method=search&param=" +
param_escape(getActiveFeedId() + ":" + activeFeedIsCat());
if (dijit.byId("searchDlg"))
dijit.byId("searchDlg").destroyRecursive();
var dialog = new dijit.Dialog({
const dialog = new dijit.Dialog({
id: "searchDlg",
title: __("Search"),
style: "width: 600px",
@ -177,20 +177,12 @@ function search() {
}
function updateTitle() {
var tmp = "Tiny Tiny RSS";
let tmp = "Tiny Tiny RSS";
if (global_unread > 0) {
tmp = "(" + global_unread + ") " + tmp;
}
if (window.fluid) {
if (global_unread > 0) {
window.fluid.dockBadge = global_unread;
} else {
window.fluid.dockBadge = "";
}
}
document.title = tmp;
}
@ -258,12 +250,12 @@ function init() {
loading_set_progress(30);
var a = document.createElement('audio');
const a = document.createElement('audio');
var hasAudio = !!a.canPlayType;
var hasSandbox = "sandbox" in document.createElement("iframe");
var hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, ''));
var clientTzOffset = new Date().getTimezoneOffset() * 60;
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;
init_hotkey_actions();
@ -290,13 +282,13 @@ function init() {
function init_hotkey_actions() {
hotkey_actions["next_feed"] = function() {
var rv = dijit.byId("feedTree").getNextFeed(
const rv = dijit.byId("feedTree").getNextFeed(
getActiveFeedId(), activeFeedIsCat());
if (rv) viewfeed({feed: rv[0], is_cat: rv[1], can_wait: true})
};
hotkey_actions["prev_feed"] = function() {
var rv = dijit.byId("feedTree").getPreviousFeed(
const rv = dijit.byId("feedTree").getPreviousFeed(
getActiveFeedId(), activeFeedIsCat());
if (rv) viewfeed({feed: rv[0], is_cat: rv[1], can_wait: true})
@ -320,8 +312,8 @@ function init_hotkey_actions() {
moveToPost('prev', true, true);
};
hotkey_actions["collapse_article"] = function() {
var id = getActiveArticleId();
var elem = $("CICD-"+id);
const id = getActiveArticleId();
const elem = $("CICD-"+id);
if (elem) {
if (elem.visible()) {
@ -333,8 +325,8 @@ function init_hotkey_actions() {
}
};
hotkey_actions["toggle_expand"] = function() {
var id = getActiveArticleId();
var elem = $("CICD-"+id);
const id = getActiveArticleId();
const elem = $("CICD-"+id);
if (elem) {
if (elem.visible()) {
@ -358,10 +350,10 @@ function init_hotkey_actions() {
selectionToggleUnread(undefined, false, true);
};
hotkey_actions["edit_tags"] = function() {
var id = getActiveArticleId();
const id = getActiveArticleId();
if (id) {
editArticleTags(id);
};
}
}
hotkey_actions["open_in_new_window"] = function() {
if (getActiveArticleId()) {
@ -457,7 +449,7 @@ function init_hotkey_actions() {
reverseHeadlineOrder();
};
hotkey_actions["feed_toggle_vgroup"] = function() {
var query_str = "?op=rpc&method=togglepref&key=VFEED_GROUP_BY_FEED";
const query_str = "?op=rpc&method=togglepref&key=VFEED_GROUP_BY_FEED";
new Ajax.Request("backend.php", {
parameters: query_str,
@ -494,12 +486,12 @@ function init_hotkey_actions() {
gotoPreferences();
};
hotkey_actions["select_article_cursor"] = function() {
var id = getArticleUnderPointer();
const id = getArticleUnderPointer();
if (id) {
var row = $("RROW-" + id);
const row = $("RROW-" + id);
if (row) {
var cb = dijit.getEnclosingWidget(
const cb = dijit.getEnclosingWidget(
row.getElementsByClassName("rchk")[0]);
if (cb) {
@ -546,8 +538,8 @@ function init_hotkey_actions() {
hotkey_actions["toggle_combined_mode"] = function() {
notify_progress("Loading, please wait...");
var value = isCdmMode() ? "false" : "true";
var query = "?op=rpc&method=setpref&key=COMBINED_DISPLAY_MODE&value=" + value;
const value = isCdmMode() ? "false" : "true";
const query = "?op=rpc&method=setpref&key=COMBINED_DISPLAY_MODE&value=" + value;
new Ajax.Request("backend.php", {
parameters: query,
@ -563,8 +555,8 @@ function init_hotkey_actions() {
hotkey_actions["toggle_cdm_expanded"] = function() {
notify_progress("Loading, please wait...");
var value = getInitParam("cdm_expanded") ? "false" : "true";
var query = "?op=rpc&method=setpref&key=CDM_EXPANDED&value=" + value;
const value = getInitParam("cdm_expanded") ? "false" : "true";
const query = "?op=rpc&method=setpref&key=CDM_EXPANDED&value=" + value;
new Ajax.Request("backend.php", {
parameters: query,
@ -603,7 +595,7 @@ function init_second_stage() {
delCookie("ttrss_test");
var toolbar = document.forms["main_toolbar_form"];
const toolbar = document.forms["main_toolbar_form"];
dijit.getEnclosingWidget(toolbar.view_mode).attr('value',
getInitParam("default_view_mode"));
@ -611,10 +603,10 @@ function init_second_stage() {
dijit.getEnclosingWidget(toolbar.order_by).attr('value',
getInitParam("default_view_order_by"));
var feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
const feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
var hash_feed_id = hash_get('f');
var hash_feed_is_cat = hash_get('c') == "1";
const hash_feed_id = hash_get('f');
const hash_feed_is_cat = hash_get('c') == "1";
if (hash_feed_id != undefined) {
setActiveFeedId(hash_feed_id, hash_feed_is_cat);
@ -626,11 +618,11 @@ function init_second_stage() {
if ('sessionStorage' in window && window['sessionStorage'] !== null)
sessionStorage.clear();
var hotkeys = getInitParam("hotkeys");
var tmp = [];
const hotkeys = getInitParam("hotkeys");
const tmp = [];
for (var sequence in hotkeys[1]) {
var filtered = sequence.replace(/\|.*$/, "");
for (const sequence in hotkeys[1]) {
const filtered = sequence.replace(/\|.*$/, "");
tmp[filtered] = hotkeys[1][sequence];
}
@ -733,11 +725,11 @@ function quickMenuGo(opid) {
function toggleDispRead() {
var hide = !(getInitParam("hide_read_feeds") == "1");
const hide = !(getInitParam("hide_read_feeds") == "1");
hideOrShowFeeds(hide);
var query = "?op=rpc&method=setpref&key=HIDE_READ_FEEDS&value=" +
const query = "?op=rpc&method=setpref&key=HIDE_READ_FEEDS&value=" +
param_escape(hide);
setInitParam("hide_read_feeds", hide);
@ -753,8 +745,8 @@ function parse_runtime_info(data) {
//console.log("parsing runtime info...");
for (var k in data) {
var v = data[k];
for (const k in data) {
const v = data[k];
// console.log("RI: " + k + " => " + v);
@ -770,7 +762,7 @@ function parse_runtime_info(data) {
}
if (k == "update_result") {
var updatesIcon = dijit.byId("updatesIcon").domNode;
const updatesIcon = dijit.byId("updatesIcon").domNode;
if (v) {
Element.show(updatesIcon);
@ -801,7 +793,7 @@ function parse_runtime_info(data) {
function collapse_feedlist() {
Element.toggle("feeds-holder");
var splitter = $("feeds-holder_splitter");
const splitter = $("feeds-holder_splitter");
Element.visible("feeds-holder") ? splitter.show() : splitter.hide();
@ -815,7 +807,7 @@ function viewModeChanged() {
function rescoreCurrentFeed() {
var actid = getActiveFeedId();
const actid = getActiveFeedId();
if (activeFeedIsCat() || actid < 0) {
alert(__("You can't rescore this kind of feed."));
@ -827,13 +819,13 @@ function rescoreCurrentFeed() {
return;
}
var fn = getFeedName(actid);
var pr = __("Rescore articles in %s?").replace("%s", fn);
const fn = getFeedName(actid);
const pr = __("Rescore articles in %s?").replace("%s", fn);
if (confirm(pr)) {
notify_progress("Rescoring articles...");
var query = "?op=pref-feeds&method=rescore&quiet=1&ids=" + actid;
const query = "?op=pref-feeds&method=rescore&quiet=1&ids=" + actid;
new Ajax.Request("backend.php", {
parameters: query,
@ -847,9 +839,9 @@ function hotkey_handler(e) {
if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
var keycode = false;
let keycode = false;
var cmdline = $('cmdline');
const cmdline = $('cmdline');
if (window.event) {
keycode = window.event.keyCode;
@ -865,12 +857,12 @@ function hotkey_handler(e) {
if (keycode == 17) return; // ignore lone ctrl
var hotkeys = getInitParam("hotkeys");
var keychar = String.fromCharCode(keycode).toLowerCase();
const keychar = String.fromCharCode(keycode).toLowerCase();
if (!hotkey_prefix && hotkeys[0].indexOf(keychar) != -1) {
var date = new Date();
var ts = Math.round(date.getTime() / 1000);
const date = new Date();
const ts = Math.round(date.getTime() / 1000);
hotkey_prefix = keychar;
hotkey_prefix_pressed = ts;
@ -886,7 +878,7 @@ function hotkey_handler(e) {
Element.hide(cmdline);
var hotkey = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
let hotkey = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
// ensure ^*char notation
if (e.shiftKey) hotkey = "*" + hotkey;
@ -897,17 +889,17 @@ function hotkey_handler(e) {
hotkey = hotkey_prefix ? hotkey_prefix + " " + hotkey : hotkey;
hotkey_prefix = false;
var hotkey_action = false;
let hotkey_action = false;
var hotkeys = getInitParam("hotkeys");
for (var sequence in hotkeys[1]) {
for (const sequence in hotkeys[1]) {
if (sequence == hotkey) {
hotkey_action = hotkeys[1][sequence];
break;
}
}
var action = hotkey_actions[hotkey_action];
const action = hotkey_actions[hotkey_action];
if (action != null) {
action();
@ -922,10 +914,10 @@ function inPreferences() {
function reverseHeadlineOrder() {
var toolbar = document.forms["main_toolbar_form"];
var order_by = dijit.getEnclosingWidget(toolbar.order_by);
const toolbar = document.forms["main_toolbar_form"];
const order_by = dijit.getEnclosingWidget(toolbar.order_by);
var value = order_by.attr('value');
let value = order_by.attr('value');
if (value == "date_reverse")
value = "default";
@ -940,21 +932,21 @@ function reverseHeadlineOrder() {
function handle_rpc_json(transport, scheduled_call) {
var netalert_dijit = dijit.byId("net-alert");
var netalert = false;
const netalert_dijit = dijit.byId("net-alert");
let netalert = false;
if (netalert_dijit) netalert = netalert_dijit.domNode;
try {
var reply = JSON.parse(transport.responseText);
const reply = JSON.parse(transport.responseText);
if (reply) {
var error = reply['error'];
const error = reply['error'];
if (error) {
var code = error['code'];
var msg = error['msg'];
const code = error['code'];
const msg = error['msg'];
console.warn("[handle_rpc_json] received fatal error " + code + "/" + msg);
@ -964,7 +956,7 @@ function handle_rpc_json(transport, scheduled_call) {
}
}
var seq = reply['seq'];
const seq = reply['seq'];
if (seq) {
if (get_seq() != seq) {
@ -974,7 +966,7 @@ function handle_rpc_json(transport, scheduled_call) {
}
}
var message = reply['message'];
const message = reply['message'];
if (message) {
if (message == "UPDATE_COUNTERS") {
@ -984,24 +976,22 @@ function handle_rpc_json(transport, scheduled_call) {
}
}
var counters = reply['counters'];
const counters = reply['counters'];
if (counters)
parse_counters(counters, scheduled_call);
var runtime_info = reply['runtime-info'];
const runtime_info = reply['runtime-info'];
if (runtime_info)
parse_runtime_info(runtime_info);
if (netalert) netalert.hide();
} else {
if (netalert)
} else if (netalert)
netalert.show();
else
notify_error("Communication problem with server.");
}
} catch (e) {
if (netalert)
@ -1018,7 +1008,7 @@ function handle_rpc_json(transport, scheduled_call) {
function switchPanelMode(wide) {
if (isCdmMode()) return;
var article_id = getActiveArticleId();
const article_id = getActiveArticleId();
if (wide) {
dijit.byId("headlines-wrap-inner").attr("design", 'sidebar');
@ -1077,11 +1067,11 @@ function update_random_feed() {
}
function hash_get(key) {
var kv = window.location.hash.substring(1).toQueryParams();
const kv = window.location.hash.substring(1).toQueryParams();
return kv[key];
}
function hash_set(key, value) {
var kv = window.location.hash.substring(1).toQueryParams();
const kv = window.location.hash.substring(1).toQueryParams();
kv[key] = value;
window.location.hash = $H(kv).toQueryString();
}

File diff suppressed because it is too large Load Diff