var active_title_text = "";
var current_subtitle = "";
var daemon_enabled = false;
-var daemon_refresh_only = false;
//var _qfd_deleted_feed = 0;
var firsttime_update = true;
var _active_feed_id = 0;
var _active_feed_is_cat = false;
var number_of_feeds = 0;
-var sanity_check_done = false;
var _hfd_scrolltop = 0;
var hotkey_prefix = false;
var hotkey_prefix_pressed = false;
function getActiveFeedId() {
try {
- debug("gAFID: " + _active_feed_id);
+ //console.log("gAFID: " + _active_feed_id);
return _active_feed_id;
} catch (e) {
exception_error("getActiveFeedId", e);
function setActiveFeedId(id, is_cat) {
try {
- debug("sAFID(" + id + ", " + is_cat + ")");
+ //console.log("sAFID(" + id + ", " + is_cat + ")");
_active_feed_id = id;
if (is_cat != undefined) {
try {
- debug("toggleTags: " + show_all + "; " + display_tags);
+ console.log("toggleTags: " + show_all + "; " + display_tags);
var p = $("dispSwitchPrompt");
function dlg_frefresh_callback(transport, deleted_feed) {
if (getActiveFeedId() == deleted_feed) {
- var h = $("headlines-frame");
- if (h) {
- h.innerHTML = "<div class='whiteBox'>" + __('No feed selected.') + "</div>";
- }
+ setTimeout("viewfeed(-5)", 100);
}
setTimeout('updateFeedList(false, false)', 50);
closeInfoBox();
}
-function backend_sanity_check_callback(transport) {
-
- try {
-
- if (sanity_check_done) {
- fatalError(11, "Sanity check request received twice. This can indicate "+
- "presence of Firebug or some other disrupting extension. "+
- "Please disable it and try again.");
- return;
- }
-
- if (!transport.responseXML) {
- if (!store) {
- fatalError(3, "Sanity check: Received reply is not XML",
- transport.responseText);
- return;
- } else {
- init_offline();
- return;
- }
- }
-
- if (getURLParam("offline")) {
- return init_offline();
- }
-
- var reply = transport.responseXML.firstChild.firstChild;
-
- if (!reply) {
- fatalError(3, "Sanity check: invalid RPC reply", transport.responseText);
- return;
- }
-
- var error_code = reply.getAttribute("error-code");
-
- if (error_code && error_code != 0) {
- return fatalError(error_code, reply.getAttribute("error-msg"));
- }
-
- debug("sanity check ok");
-
- var params = reply.nextSibling;
+function scheduleFeedUpdate() {
- if (params) {
- debug('reading init-params...');
- var param = params.firstChild;
+ console.log("in scheduleFeedUpdate");
- while (param) {
- var k = param.getAttribute("key");
- var v = param.getAttribute("value");
- debug(k + " => " + v);
- init_params[k] = v;
-
- if (db) {
- db.execute("DELETE FROM init_params WHERE key = ?", [k]);
- db.execute("INSERT INTO init_params (key,value) VALUES (?, ?)",
- [k, v]);
- }
-
- param = param.nextSibling;
- }
- }
-
- sanity_check_done = true;
-
- init_second_stage();
-
- } catch (e) {
- exception_error("backend_sanity_check_callback", e, transport);
- }
-}
-
-function scheduleFeedUpdate(force) {
-
- debug("in scheduleFeedUpdate");
-
-/* if (!daemon_enabled && !daemon_refresh_only) {
- notify_progress("Updating feeds...", true);
- } */
-
- var query_str = "backend.php?op=rpc&subop=";
-
- if (force) {
- query_str = query_str + "forceUpdateAllFeeds";
- } else {
- query_str = query_str + "updateAllFeeds";
- }
+ var query_str = "backend.php?op=rpc&subop=updateAllFeeds";
var omode;
query_str = query_str + "&omode=" + omode;
query_str = query_str + "&uctr=" + global_unread;
- debug("REFETCH query: " + query_str);
+ console.log("REFETCH query: " + query_str);
new Ajax.Request("backend.php", {
parameters: query_str,
} });
}
-function updateFeedList(silent, fetch) {
-
-// if (silent != true) {
-// notify("Loading feed list...");
-// }
-
- debug("<b>updateFeedList</b>");
-
- if (offline_mode) return render_offline_feedlist();
-
- var query_str = "backend.php?op=feeds";
-
- if (display_tags) {
- query_str = query_str + "&tags=1";
- }
-
- if (getActiveFeedId() && !activeFeedIsCat()) {
- query_str = query_str + "&actid=" + getActiveFeedId();
- }
+function updateFeedList() {
+ try {
+ console.log("updateFeedList");
- if (fetch) query_str = query_str + "&fetch=yes";
-
-// var feeds_frame = $("feeds-frame");
-// feeds_frame.src = query_str;
-
- debug("updateFeedList Q=" + query_str);
-
- new Ajax.Request("backend.php", {
- parameters: query_str,
- onComplete: function(transport) {
- feedlist_callback2(transport);
- } });
+ if (offline_mode) return render_offline_feedlist();
+
+ var query_str = "backend.php?op=feeds";
+
+ if (display_tags) {
+ query_str = query_str + "&tags=1";
+ }
+
+ if (getActiveFeedId() && !activeFeedIsCat()) {
+ query_str = query_str + "&actid=" + getActiveFeedId();
+ }
+
+ new Ajax.Request("backend.php", {
+ parameters: query_str,
+ onComplete: function(transport) {
+ render_feedlist(transport.responseText);
+ } });
+ } catch (e) {
+ exception_error("updateFeedList", e);
+ }
}
function catchupAllFeeds() {
notify_progress("Marking all feeds as read...");
- debug("catchupAllFeeds Q=" + query_str);
+ console.log("catchupAllFeeds Q=" + query_str);
new Ajax.Request("backend.php", {
parameters: query_str,
tmp = tmp + " > " + active_title_text;
}
+ if (window.fluid) {
+ if (global_unread > 0) {
+ window.fluid.dockBadge = global_unread;
+ } else {
+ window.fluid.dockBadge = "";
+ }
+ }
+
document.title = tmp;
}
if (!genericSanityCheck())
return;
- if (getURLParam('debug')) {
- Element.show("debug_output");
- debug('debug mode activated');
- }
-
var params = "&ua=" + param_escape(navigator.userAgent);
loading_set_progress(30);
try {
- debug("resize_headlines: " + delta_x + ":" + delta_y);
+ console.log("resize_headlines: " + delta_x + ":" + delta_y);
var h_frame = $("headlines-frame");
var c_frame = $("content-frame");
}
}
- debug("resize_headlines: HOR-mode: " + hor_offset);
+ console.log("resize_headlines: HOR-mode: " + hor_offset);
c_frame.style.width = (400 + hor_offset) + "px";
h_frame.style.right = c_frame.offsetWidth - 1 + "px";
4) + "px";
resize_grab.style.display = "block";
- resize_handle.src = "themes/"+getInitParam('theme')+"/images/resize_handle_vert.png";
+ //resize_handle.src = "themes/"+getInitParam('theme')+"/images/resize_handle_vert.png";
resize_handle.style.paddingTop = (resize_grab.offsetHeight / 2 - 7) + "px";
} else {
}
}
- debug("resize_headlines: VER-mode: " + ver_offset);
+ console.log("resize_headlines: VER-mode: " + ver_offset);
h_frame.style.height = (300 - ver_offset) + "px";
c_frame.style.top = (h_frame.offsetTop + h_frame.offsetHeight + 0) + "px";
h_frame.style.height = h_frame.offsetHeight + "px";
+ // Workaround for Opera: force the content page to be re-rendered,
+ // so it is not truncated:
+ var content_pane = $("content-insert");
+ content_pane.innerHTML = content_pane.innerHTML;
}
if (getInitParam("cookie_lifetime") != 0) {
dropboxSelect(toolbar.order_by, getInitParam("default_view_order_by"));
daemon_enabled = getInitParam("daemon_enabled") == 1;
- daemon_refresh_only = getInitParam("daemon_refresh_only") == 1;
feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
/* var fl = cache_find_param("FEEDLIST", getInitParam("num_feeds"));
setTimeout('updateFeedList(false, false)', 50);
- debug("second stage ok");
+ console.log("second stage ok");
loading_set_progress(60);
ver_offset = parseInt(getCookie("ttrss_offset_ver"));
hor_offset = parseInt(getCookie("ttrss_offset_hor"));
- debug("got offsets from cookies: ver " + ver_offset + " hor " + hor_offset);
+ console.log("got offsets from cookies: ver " + ver_offset + " hor " + hor_offset);
/* fuck IE */
if (isNaN(hor_offset)) hor_offset = 0;
if (isNaN(ver_offset)) ver_offset = 0;
- debug("offsets from cookies [x:y]: " + hor_offset + ":" + ver_offset);
+ console.log("offsets from cookies [x:y]: " + hor_offset + ":" + ver_offset);
resize_headlines();
enable_offline_reading();
+ if (has_local_storage())
+ localStorage.clear();
+
} catch (e) {
exception_error("init_second_stage", e);
}
resize_headlines();
}
+ if (opid == "qmcToggleReorder") {
+ feedlist_sortable_enabled = !feedlist_sortable_enabled;
+
+ if (feedlist_sortable_enabled) {
+ notify_info("Category reordering enabled");
+ toggle_sortable_feedlist(true);
+ } else {
+ notify_info("Category reordering disabled");
+ toggle_sortable_feedlist(false);
+ }
+ }
+
if (opid == "qmcResetCats") {
if (confirm(__("Reset category order?"))) {
function parse_runtime_info(elem) {
if (!elem) {
- debug("parse_runtime_info: elem is null, aborting");
+ console.log("parse_runtime_info: elem is null, aborting");
return;
}
var param = elem.firstChild;
- debug("parse_runtime_info: " + param);
+ console.log("parse_runtime_info: " + param);
while (param) {
var k = param.getAttribute("key");
var v = param.getAttribute("value");
- debug("RI: " + k + " => " + v);
+ console.log("RI: " + k + " => " + v);
if (k == "num_feeds") {
init_params[k] = v;
function collapse_feedlist() {
try {
- debug("collapse_feedlist");
+ console.log("collapse_feedlist");
var theme = getInitParam("theme");
if (theme != "" &&
if (!Element.visible(fl)) {
Element.show(fl);
- fbtn.innerHTML = "<<";
+ fbtn.innerHTML = "<<";
if (theme != "graycube") {
} else {
Element.hide(fl);
- fbtn.innerHTML = ">>";
+ fbtn.innerHTML = ">>";
if (theme != "graycube") {
}
if (!hotkeys_enabled) {
- debug("hotkeys disabled");
+ console.log("hotkeys disabled");
return;
}
cmdline.innerHTML = keychar;
Element.show(cmdline);
- debug("KP: PREFIX=" + keycode + " CHAR=" + keychar + " TS=" + ts);
+ console.log("KP: PREFIX=" + keycode + " CHAR=" + keychar + " TS=" + ts);
return true;
}
if (!hotkey_prefix) {
- if (keycode == 68 && shift_key) { // d
- if (!Element.visible("debug_output")) {
- Element.show("debug_output");
- debug('debug mode activated');
- } else {
- Element.hide("debug_output");
- }
-
- return;
- }
-
if ((keycode == 191 || keychar == '?') && shift_key) { // ?
if (!Element.visible("hotkey_help_overlay")) {
//Element.show("hotkey_help_overlay");
if (keycode == 78 || keycode == 40) { // n, down
if (typeof moveToPost != 'undefined') {
moveToPost('next');
- return;
+ return false;
}
}
if (keycode == 80 || keycode == 38) { // p, up
if (typeof moveToPost != 'undefined') {
moveToPost('prev');
- return;
+ return false;
}
}
return;
}
+ if (keycode == 88) { // x
+ reverseHeadlineOrder();
+ return;
+ }
}
/* Prefix c */
}
if (hotkey_prefix) {
- debug("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode + " CHAR=" + keychar);
+ console.log("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode + " CHAR=" + keychar);
} else {
- debug("KP: CODE=" + keycode + " CHAR=" + keychar);
+ console.log("KP: CODE=" + keycode + " CHAR=" + keychar);
}
function inPreferences() {
return false;
}
+
+function reverseHeadlineOrder() {
+ try {
+
+ var query_str = "?op=rpc&subop=togglepref&key=REVERSE_HEADLINES";
+
+ new Ajax.Request("backend.php", {
+ parameters: query_str,
+ onComplete: function(transport) {
+ viewCurrentFeed();
+ } });
+
+ } catch (e) {
+ exception_error("reverseHeadlineOrder", e);
+ }
+}
+
+function showFeedsWithErrors() {
+ displayDlg('feedUpdateErrors');
+}
+