-var total_unread = 0;
var global_unread = -1;
-var firsttime_update = true;
var _active_feed_id = undefined;
var _active_feed_is_cat = false;
var hotkey_prefix = false;
var hotkey_prefix_pressed = false;
-var _force_scheduled_update = false;
-var last_scheduled_update = false;
var _widescreen_mode = false;
-
var _rpc_seq = 0;
function next_seq() {
});
var tree = new fox.FeedTree({
- persist: false,
model: treeModel,
- onOpen: function (item, node) {
- var id = String(item.id);
- var cat_id = id.substr(id.indexOf(":")+1);
-
- new Ajax.Request("backend.php",
- { parameters: "backend.php?op=feeds&method=collapse&cid=" +
- param_escape(cat_id) + "&mode=0" } );
- },
- onClose: function (item, node) {
- var id = String(item.id);
- var cat_id = id.substr(id.indexOf(":")+1);
-
- new Ajax.Request("backend.php",
- { parameters: "backend.php?op=feeds&method=collapse&cid=" +
- param_escape(cat_id) + "&mode=1" } );
-
- },
onClick: function (item, node) {
var id = String(item.id);
var is_cat = id.match("^CAT:");
id: "feedTree",
}, "feedTree");
- _force_scheduled_update = true;
-
/* var menu = new dijit.Menu({id: 'feedMenu'});
menu.addChild(new dijit.MenuItem({
dojo.disconnect(tmph);
Element.hide("feedlistLoading");
- tree.collapseHiddenCats();
-
feedlist_init();
// var node = dijit.byId("feedTree")._itemNodesMap['FEED:-2'][0].domNode
}
function timeout() {
- if (getInitParam("bw_limit") == "1") return;
-
- try {
- var date = new Date();
- var ts = Math.round(date.getTime() / 1000);
-
- if (ts - last_scheduled_update > 10 || _force_scheduled_update) {
-
- //console.log("timeout()");
-
- window.clearTimeout(counter_timeout_id);
-
- var query_str = "?op=rpc&method=getAllCounters&seq=" + next_seq();
-
- var omode;
-
- if (firsttime_update && !navigator.userAgent.match("Opera")) {
- firsttime_update = false;
- omode = "T";
- } else {
- omode = "flc";
- }
-
- query_str = query_str + "&omode=" + omode;
-
- if (!_force_scheduled_update)
- query_str = query_str + "&last_article_id=" + getInitParam("last_article_id");
-
- //console.log("[timeout]" + query_str);
-
- new Ajax.Request("backend.php", {
- parameters: query_str,
- onComplete: function(transport) {
- handle_rpc_json(transport, !_force_scheduled_update);
- _force_scheduled_update = false;
- } });
-
- last_scheduled_update = ts;
- }
-
- } catch (e) {
- exception_error("timeout", e);
+ if (getInitParam("bw_limit") != "1") {
+ request_counters();
+ setTimeout("timeout()", 60*1000);
}
-
- setTimeout("timeout()", 3000);
}
function search() {
dojo.require("fox.FeedTree");
- if (typeof themeBeforeLayout == 'function') {
- themeBeforeLayout();
- }
-
dojo.require("dijit.ColorPalette");
dojo.require("dijit.Dialog");
dojo.require("dijit.form.Button");
updateFeedList();
closeArticlePanel();
- if (typeof themeAfterLayout == 'function') {
- themeAfterLayout();
+ _widescreen_mode = getInitParam("widescreen");
+
+ if (_widescreen_mode) {
+ switchPanelMode(_widescreen_mode);
}
});
if ('sessionStorage' in window && window['sessionStorage'] !== null)
sessionStorage.clear();
+ var hotkeys = getInitParam("hotkeys");
+ var tmp = [];
+
+ for (sequence in hotkeys[1]) {
+ filtered = sequence.replace(/\|.*$/, "");
+ tmp[filtered] = hotkeys[1][sequence];
+ }
+
+ hotkeys[1] = tmp;
+ setInitParam("hotkeys", hotkeys);
+
console.log("second stage ok");
+ if (getInitParam("simple_update")) {
+ console.log("scheduling simple feed updater...");
+ window.setTimeout("update_random_feed()", 30*1000);
+ }
+
} catch (e) {
exception_error("init_second_stage", e);
}
function quickMenuGo(opid) {
try {
- if (opid == "qmcPrefs") {
+ switch (opid) {
+ case "qmcPrefs":
gotoPreferences();
- }
-
- if (opid == "qmcTagCloud") {
+ break;
+ case "qmcLogout":
+ gotoLogout();
+ break;
+ case "qmcTagCloud":
displayDlg("printTagCloud");
- }
-
- if (opid == "qmcTagSelect") {
+ break;
+ case "qmcTagSelect":
displayDlg("printTagSelect");
- }
-
- if (opid == "qmcSearch") {
+ break;
+ case "qmcSearch":
search();
- return;
- }
-
- if (opid == "qmcAddFeed") {
+ break;
+ case "qmcAddFeed":
quickAddFeed();
- return;
- }
-
- if (opid == "qmcDigest") {
+ break;
+ case "qmcDigest":
window.location.href = "backend.php?op=digest";
- return;
- }
-
- if (opid == "qmcEditFeed") {
+ break;
+ case "qmcEditFeed":
if (activeFeedIsCat())
alert(__("You can't edit this kind of feed."));
else
editFeed(getActiveFeedId());
- return;
- }
-
- if (opid == "qmcRemoveFeed") {
+ break;
+ case "qmcRemoveFeed":
var actid = getActiveFeedId();
if (activeFeedIsCat()) {
if (confirm(pr)) {
unsubscribeFeed(actid);
}
-
- return;
- }
-
- if (opid == "qmcCatchupAll") {
+ break;
+ case "qmcCatchupAll":
catchupAllFeeds();
- return;
- }
-
- if (opid == "qmcShowOnlyUnread") {
+ break;
+ case "qmcShowOnlyUnread":
toggleDispRead();
- return;
- }
-
- if (opid == "qmcAddFilter") {
+ break;
+ case "qmcAddFilter":
quickAddFilter();
- return;
- }
-
- if (opid == "qmcAddLabel") {
+ break;
+ case "qmcAddLabel":
addLabel();
- return;
- }
-
- if (opid == "qmcRescoreFeed") {
+ break;
+ case "qmcRescoreFeed":
rescoreCurrentFeed();
- return;
- }
-
- if (opid == "qmcToggleWidescreen") {
+ break;
+ case "qmcToggleWidescreen":
if (!isCdmMode()) {
_widescreen_mode = !_widescreen_mode;
switchPanelMode(_widescreen_mode);
}
- return;
- }
-
- if (opid == "qmcHKhelp") {
+ break;
+ case "qmcHKhelp":
helpDialog("main");
+ break;
+ default:
+ console.log("quickMenuGo: unknown action: " + opid);
}
} catch (e) {
// console.log("RI: " + k + " => " + v);
if (k == "new_version_available") {
- var icon = $("newVersionIcon");
- if (icon) {
- if (v == "1") {
- icon.style.display = "inline";
- } else {
- icon.style.display = "none";
- }
+ if (v == "1") {
+ Element.show(dijit.byId("newVersionIcon").domNode);
+ } else {
+ Element.hide(dijit.byId("newVersionIcon").domNode);
}
return;
}
return viewCurrentFeed('');
}
-/* function adjustArticleScore(id, score) {
- try {
-
- var pr = prompt(__("Assign score to article:"), score);
-
- if (pr != undefined) {
- var query = "?op=rpc&method=setScore&id=" + id + "&score=" + pr;
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function(transport) {
- viewCurrentFeed();
- } });
-
- }
- } catch (e) {
- exception_error("adjustArticleScore", e);
- }
-} */
-
function rescoreCurrentFeed() {
var actid = getActiveFeedId();
var cmdline = $('cmdline');
- try {
- shift_key = e.shiftKey;
- } catch (e) {
-
- }
+ shift_key = e.shiftKey;
+ ctrl_key = e.ctrlKey;
if (window.event) {
keycode = window.event.keyCode;
Element.hide(cmdline);
var hotkey = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
+ if (ctrl_key) hotkey = "^" + hotkey;
hotkey = hotkey_prefix ? hotkey_prefix + " " + hotkey : hotkey;
hotkey_prefix = false;
case "prev_article":
moveToPost('prev');
return false;
+ case "next_article_noscroll":
+ moveToPost('next', true);
+ return false;
+ case "prev_article_noscroll":
+ moveToPost('prev', true);
+ return false;
case "search_dialog":
search();
return ;
case "article_scroll_up":
scrollArticle(-50);
return false;
+ case "close_article":
+ closeArticlePanel();
+ return false;
case "email_article":
if (typeof emailArticle != "undefined") {
emailArticle();
if (message == "UPDATE_COUNTERS") {
console.log("need to refresh counters...");
setInitParam("last_article_id", -1);
- _force_scheduled_update = true;
+ request_counters(true);
}
}
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
+ Element.hide(dijit.byId("net-alert").domNode);
+
} else {
- notify_error("Error communicating with server.");
+ //notify_error("Error communicating with server.");
+ Element.show(dijit.byId("net-alert").domNode);
}
} catch (e) {
- notify_error("Error communicating with server.");
+ Element.show(dijit.byId("net-alert").domNode);
+ //notify_error("Error communicating with server.");
console.log(e);
//exception_error("handle_rpc_json", e, transport);
}
dijit.byId("content-insert").domNode.setStyle({width: '50%',
height: 'auto',
- 'border-top-width': '0px' });
+ borderLeftWidth: '1px',
+ borderLeftColor: '#c0c0c0',
+ borderTopWidth: '0px' });
- $("headlines-toolbar").setStyle({ 'border-bottom-width': '0px' });
+ $("headlines-toolbar").setStyle({ borderBottomWidth: '0px' });
} else {
dijit.byId("content-insert").domNode.setStyle({width: 'auto',
height: '50%',
- 'border-top-width': '1px'});
+ borderLeftWidth: '0px',
+ borderTopWidth: '1px'});
- $("headlines-toolbar").setStyle({ 'border-bottom-width': '1px' });
+ $("headlines-toolbar").setStyle({ borderBottomWidth: '1px' });
}
closeArticlePanel();
if (article_id) view(article_id);
+ new Ajax.Request("backend.php", {
+ parameters: "op=rpc&method=setpanelmode&wide=" + (wide ? 1 : 0),
+ onComplete: function(transport) {
+ console.log(transport.responseText);
+ } });
+
+
} catch (e) {
exception_error("switchPanelMode", e);
}
}
+
+function update_random_feed() {
+ try {
+ console.log("in update_random_feed");
+
+ new Ajax.Request("backend.php", {
+ parameters: "op=rpc&method=updateRandomFeed",
+ onComplete: function(transport) {
+ handle_rpc_json(transport, true);
+ window.setTimeout("update_random_feed()", 30*1000);
+ } });
+
+ } catch (e) {
+ exception_error("update_random_feed", e);
+ }
+}