js: code cleanup
This commit is contained in:
parent
b4fdbcf4b7
commit
50eefedbfd
8 changed files with 48 additions and 87 deletions
12
feedlist.js
12
feedlist.js
|
@ -44,16 +44,6 @@ function render_feedlist(data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function feedlist_callback2(transport) {
|
|
||||||
try {
|
|
||||||
console.log("feedlist_callback2");
|
|
||||||
if (!transport_error_check(transport)) return;
|
|
||||||
render_feedlist(transport.responseText);
|
|
||||||
} catch (e) {
|
|
||||||
exception_error("feedlist_callback2", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function viewNextFeedPage() {
|
function viewNextFeedPage() {
|
||||||
try {
|
try {
|
||||||
//if (!getActiveFeedId()) return;
|
//if (!getActiveFeedId()) return;
|
||||||
|
@ -112,7 +102,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
var timestamp = Math.round(date.getTime() / 1000);
|
var timestamp = Math.round(date.getTime() / 1000);
|
||||||
|
|
||||||
console.log("<b>" + _infscroll_request_sent + " : " + timestamp + "</b>");
|
console.log(_infscroll_request_sent + " : " + timestamp);
|
||||||
|
|
||||||
if (_infscroll_request_sent && _infscroll_request_sent + 30 > timestamp) {
|
if (_infscroll_request_sent && _infscroll_request_sent + 30 > timestamp) {
|
||||||
console.log("infscroll request in progress, aborting");
|
console.log("infscroll request in progress, aborting");
|
||||||
|
|
21
functions.js
21
functions.js
|
@ -581,12 +581,9 @@ function parse_counters_reply(transport, scheduled_call) {
|
||||||
function all_counters_callback2(transport, async_call) {
|
function all_counters_callback2(transport, async_call) {
|
||||||
try {
|
try {
|
||||||
if (async_call) async_counters_work = true;
|
if (async_call) async_counters_work = true;
|
||||||
|
|
||||||
if (offline_mode) return;
|
if (offline_mode) return;
|
||||||
|
|
||||||
console.log("<b>all_counters_callback2 IN: " + transport + "</b>");
|
|
||||||
parse_counters_reply(transport);
|
parse_counters_reply(transport);
|
||||||
console.log("<b>all_counters_callback2 OUT: " + transport + "</b>");
|
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("all_counters_callback2", e, transport);
|
exception_error("all_counters_callback2", e, transport);
|
||||||
|
@ -1723,21 +1720,11 @@ function displayHelpInfobox(topic_id) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function focus_element(id) {
|
|
||||||
try {
|
|
||||||
var e = $(id);
|
|
||||||
if (e) e.focus();
|
|
||||||
} catch (e) {
|
|
||||||
exception_error("focus_element", e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function loading_set_progress(p) {
|
function loading_set_progress(p) {
|
||||||
try {
|
try {
|
||||||
if (p < last_progress_point || !Element.visible("overlay")) return;
|
if (p < last_progress_point || !Element.visible("overlay")) return;
|
||||||
|
|
||||||
console.log("<b>loading_set_progress : " + p + " (" + last_progress_point + ")</b>");
|
console.log("loading_set_progress : " + p + " (" + last_progress_point + ")");
|
||||||
|
|
||||||
var o = $("l_progress_i");
|
var o = $("l_progress_i");
|
||||||
|
|
||||||
|
@ -1892,7 +1879,7 @@ function displayNewContentPrompt(id) {
|
||||||
|
|
||||||
$('auxDlg').innerHTML = msg;
|
$('auxDlg').innerHTML = msg;
|
||||||
|
|
||||||
Element.show('auxDlg');
|
new Effect.Appear('auxDlg', {duration : 0.5});
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("displayNewContentPrompt", e);
|
exception_error("displayNewContentPrompt", e);
|
||||||
|
@ -2167,7 +2154,6 @@ function backend_sanity_check_callback(transport) {
|
||||||
|
|
||||||
if (params) {
|
if (params) {
|
||||||
console.log('reading init-params...');
|
console.log('reading init-params...');
|
||||||
//var param = params.firstChild;
|
|
||||||
|
|
||||||
params = JSON.parse(params.firstChild.nodeValue);
|
params = JSON.parse(params.firstChild.nodeValue);
|
||||||
|
|
||||||
|
@ -2177,7 +2163,7 @@ function backend_sanity_check_callback(transport) {
|
||||||
var k = params[i].param;
|
var k = params[i].param;
|
||||||
var v = params[i].value;
|
var v = params[i].value;
|
||||||
|
|
||||||
console.log(k + " => " + v);
|
if (getURLParam('debug')) console.log(k + " => " + v);
|
||||||
init_params[k] = v;
|
init_params[k] = v;
|
||||||
|
|
||||||
if (db) {
|
if (db) {
|
||||||
|
@ -2198,4 +2184,3 @@ function backend_sanity_check_callback(transport) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4131,9 +4131,9 @@
|
||||||
|
|
||||||
$sel_inv_link = "javascript:invertHeadlineSelection()";
|
$sel_inv_link = "javascript:invertHeadlineSelection()";
|
||||||
|
|
||||||
$tog_unread_link = "javascript:selectionToggleUnread(true)";
|
$tog_unread_link = "javascript:selectionToggleUnread()";
|
||||||
$tog_marked_link = "javascript:selectionToggleMarked(true)";
|
$tog_marked_link = "javascript:selectionToggleMarked()";
|
||||||
$tog_published_link = "javascript:selectionTogglePublished(true)";
|
$tog_published_link = "javascript:selectionTogglePublished()";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -286,7 +286,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($subop == "forceUpdateAllFeeds" || $subop == "updateAllFeeds") {
|
if ($subop == "updateAllFeeds") {
|
||||||
|
|
||||||
$global_unread_caller = sprintf("%d", $_REQUEST["uctr"]);
|
$global_unread_caller = sprintf("%d", $_REQUEST["uctr"]);
|
||||||
$global_unread = getGlobalUnread($link);
|
$global_unread = getGlobalUnread($link);
|
||||||
|
|
|
@ -166,8 +166,8 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
|
||||||
sel_none_link = "javascript:cdmSelectArticles('none')";
|
sel_none_link = "javascript:cdmSelectArticles('none')";
|
||||||
sel_inv_link = "javascript:invertHeadlineSelection()";
|
sel_inv_link = "javascript:invertHeadlineSelection()";
|
||||||
|
|
||||||
tog_unread_link = "javascript:selectionToggleUnread(true)";
|
tog_unread_link = "javascript:selectionToggleUnread()";
|
||||||
tog_marked_link = "javascript:selectionToggleMarked(true)";
|
tog_marked_link = "javascript:selectionToggleMarked()";
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp += __('Select:')+
|
tmp += __('Select:')+
|
||||||
|
|
2
prefs.js
2
prefs.js
|
@ -1380,7 +1380,7 @@ function pref_hotkey_handler(e) {
|
||||||
for (var i = 0; i < search_boxes.length; i++) {
|
for (var i = 0; i < search_boxes.length; i++) {
|
||||||
var elem = $(search_boxes[i]);
|
var elem = $(search_boxes[i]);
|
||||||
if (elem) {
|
if (elem) {
|
||||||
focus_element(search_boxes[i]);
|
$(search_boxes[i]).focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
60
tt-rss.js
60
tt-rss.js
|
@ -26,7 +26,7 @@ function activeFeedIsCat() {
|
||||||
|
|
||||||
function getActiveFeedId() {
|
function getActiveFeedId() {
|
||||||
try {
|
try {
|
||||||
console.log("gAFID: " + _active_feed_id);
|
//console.log("gAFID: " + _active_feed_id);
|
||||||
return _active_feed_id;
|
return _active_feed_id;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("getActiveFeedId", e);
|
exception_error("getActiveFeedId", e);
|
||||||
|
@ -35,7 +35,7 @@ function getActiveFeedId() {
|
||||||
|
|
||||||
function setActiveFeedId(id, is_cat) {
|
function setActiveFeedId(id, is_cat) {
|
||||||
try {
|
try {
|
||||||
console.log("sAFID(" + id + ", " + is_cat + ")");
|
//console.log("sAFID(" + id + ", " + is_cat + ")");
|
||||||
_active_feed_id = id;
|
_active_feed_id = id;
|
||||||
|
|
||||||
if (is_cat != undefined) {
|
if (is_cat != undefined) {
|
||||||
|
@ -93,17 +93,11 @@ function dlg_frefresh_callback(transport, deleted_feed) {
|
||||||
closeInfoBox();
|
closeInfoBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
function scheduleFeedUpdate(force) {
|
function scheduleFeedUpdate() {
|
||||||
|
|
||||||
console.log("in scheduleFeedUpdate");
|
console.log("in scheduleFeedUpdate");
|
||||||
|
|
||||||
var query_str = "backend.php?op=rpc&subop=";
|
var query_str = "backend.php?op=rpc&subop=updateAllFeeds";
|
||||||
|
|
||||||
if (force) {
|
|
||||||
query_str = query_str + "forceUpdateAllFeeds";
|
|
||||||
} else {
|
|
||||||
query_str = query_str + "updateAllFeeds";
|
|
||||||
}
|
|
||||||
|
|
||||||
var omode;
|
var omode;
|
||||||
|
|
||||||
|
@ -130,39 +124,31 @@ function scheduleFeedUpdate(force) {
|
||||||
} });
|
} });
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFeedList(silent, fetch) {
|
function updateFeedList() {
|
||||||
|
try {
|
||||||
|
console.log("updateFeedList");
|
||||||
|
|
||||||
// if (silent != true) {
|
if (offline_mode) return render_offline_feedlist();
|
||||||
// notify("Loading feed list...");
|
|
||||||
// }
|
|
||||||
|
|
||||||
console.log("<b>updateFeedList</b>");
|
var query_str = "backend.php?op=feeds";
|
||||||
|
|
||||||
if (offline_mode) return render_offline_feedlist();
|
if (display_tags) {
|
||||||
|
query_str = query_str + "&tags=1";
|
||||||
|
}
|
||||||
|
|
||||||
var query_str = "backend.php?op=feeds";
|
if (getActiveFeedId() && !activeFeedIsCat()) {
|
||||||
|
query_str = query_str + "&actid=" + getActiveFeedId();
|
||||||
|
}
|
||||||
|
|
||||||
if (display_tags) {
|
new Ajax.Request("backend.php", {
|
||||||
query_str = query_str + "&tags=1";
|
parameters: query_str,
|
||||||
|
onComplete: function(transport) {
|
||||||
|
render_feedlist(transport.responseText);
|
||||||
|
} });
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("updateFeedList", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getActiveFeedId() && !activeFeedIsCat()) {
|
|
||||||
query_str = query_str + "&actid=" + getActiveFeedId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fetch) query_str = query_str + "&fetch=yes";
|
|
||||||
|
|
||||||
// var feeds_frame = $("feeds-frame");
|
|
||||||
// feeds_frame.src = query_str;
|
|
||||||
|
|
||||||
console.log("updateFeedList Q=" + query_str);
|
|
||||||
|
|
||||||
new Ajax.Request("backend.php", {
|
|
||||||
parameters: query_str,
|
|
||||||
onComplete: function(transport) {
|
|
||||||
feedlist_callback2(transport);
|
|
||||||
} });
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function catchupAllFeeds() {
|
function catchupAllFeeds() {
|
||||||
|
|
20
viewfeed.js
20
viewfeed.js
|
@ -1001,11 +1001,11 @@ function selectionAssignLabel(id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectionToggleUnread(cdm_mode, set_state, callback_func, no_error) {
|
function selectionToggleUnread(set_state, callback_func, no_error) {
|
||||||
try {
|
try {
|
||||||
var rows;
|
var rows;
|
||||||
|
|
||||||
if (cdm_mode) {
|
if (isCdmMode()) {
|
||||||
rows = cdmGetSelectedArticles();
|
rows = cdmGetSelectedArticles();
|
||||||
} else {
|
} else {
|
||||||
rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
|
rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
|
||||||
|
@ -1085,12 +1085,12 @@ function selectionToggleUnread(cdm_mode, set_state, callback_func, no_error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectionToggleMarked(cdm_mode) {
|
function selectionToggleMarked() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
var rows;
|
var rows;
|
||||||
|
|
||||||
if (cdm_mode) {
|
if (isCdmMode()) {
|
||||||
rows = cdmGetSelectedArticles();
|
rows = cdmGetSelectedArticles();
|
||||||
} else {
|
} else {
|
||||||
rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
|
rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
|
||||||
|
@ -1129,12 +1129,12 @@ function selectionToggleMarked(cdm_mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectionTogglePublished(cdm_mode) {
|
function selectionTogglePublished() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
var rows;
|
var rows;
|
||||||
|
|
||||||
if (cdm_mode) {
|
if (isCdmMode()) {
|
||||||
rows = cdmGetSelectedArticles();
|
rows = cdmGetSelectedArticles();
|
||||||
} else {
|
} else {
|
||||||
rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
|
rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
|
||||||
|
@ -1266,11 +1266,11 @@ function catchupPage() {
|
||||||
|
|
||||||
if ($("headlinesList")) {
|
if ($("headlinesList")) {
|
||||||
selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true);
|
selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true);
|
||||||
selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
|
selectionToggleUnread(false, 'viewCurrentFeed()', true);
|
||||||
selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
|
selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
|
||||||
} else {
|
} else {
|
||||||
cdmSelectArticles('all');
|
cdmSelectArticles('all');
|
||||||
selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
|
selectionToggleUnread(false, 'viewCurrentFeed()', true)
|
||||||
cdmSelectArticles('none');
|
cdmSelectArticles('none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1411,9 +1411,9 @@ function catchupSelection() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($("headlinesList")) {
|
if ($("headlinesList")) {
|
||||||
selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
|
selectionToggleUnread(false, 'viewCurrentFeed()', true);
|
||||||
} else {
|
} else {
|
||||||
selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
|
selectionToggleUnread(false, 'viewCurrentFeed()', true)
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue