]>
git.wh0rd.org - tt-rss.git/blob - js/tt-rss.js
1 var global_unread
= -1;
2 var hotkey_prefix
= false;
3 var hotkey_prefix_pressed
= false;
4 var hotkey_actions
= {};
5 var _widescreen_mode
= false;
7 var _active_feed_id
= 0;
8 var _active_feed_is_cat
= false;
19 function activeFeedIsCat() {
20 return _active_feed_is_cat
;
23 function getActiveFeedId() {
25 return _active_feed_id
;
27 exception_error("getActiveFeedId", e
);
31 function setActiveFeedId(id
, is_cat
) {
34 hash_set('c', is_cat
? 1 : 0);
37 _active_feed_is_cat
= is_cat
;
39 $("headlines-frame").setAttribute("feed-id", id
);
40 $("headlines-frame").setAttribute("is-cat", is_cat
? 1 : 0);
42 selectFeed(id
, is_cat
);
44 PluginHost
.run(PluginHost
.HOOK_FEED_SET_ACTIVE
, _active_article_id
);
46 exception_error("setActiveFeedId", e
);
51 function updateFeedList() {
54 // $("feeds-holder").innerHTML = "<div id=\"feedlistLoading\">" +
55 // __("Loading, please wait...") + "</div>";
57 Element
.show("feedlistLoading");
59 if (dijit
.byId("feedTree")) {
60 dijit
.byId("feedTree").destroyRecursive();
63 var store
= new dojo
.data
.ItemFileWriteStore({
64 url
: "backend.php?op=pref_feeds&method=getfeedtree&mode=2"});
66 var treeModel
= new fox
.FeedStoreModel({
69 "type": getInitParam('enable_feed_cats') == 1 ? "category" : "feed"
73 childrenAttrs
: ["items"]
76 var tree
= new fox
.FeedTree({
78 onClick: function (item
, node
) {
79 var id
= String(item
.id
);
80 var is_cat
= id
.match("^CAT:");
81 var feed
= id
.substr(id
.indexOf(":")+1);
82 viewfeed({feed
: feed
, is_cat
: is_cat
});
91 /* var menu = new dijit.Menu({id: 'feedMenu'});
93 menu.addChild(new dijit.MenuItem({
94 label: "Simple menu item"
97 // menu.bindDomNode(tree.domNode); */
99 var tmph
= dojo
.connect(dijit
.byId('feedMenu'), '_openMyself', function (event
) {
100 console
.log(dijit
.getEnclosingWidget(event
.target
));
101 dojo
.disconnect(tmph
);
104 $("feeds-holder").appendChild(tree
.domNode
);
106 var tmph
= dojo
.connect(tree
, 'onLoad', function() {
107 dojo
.disconnect(tmph
);
108 Element
.hide("feedlistLoading");
112 // var node = dijit.byId("feedTree")._itemNodesMap['FEED:-2'][0].domNode
113 // menu.bindDomNode(node);
115 loading_set_progress(25);
122 exception_error("updateFeedList", e
);
126 function catchupAllFeeds() {
128 var str
= __("Mark all articles as read?");
130 if (getInitParam("confirm_feed_catchup") != 1 || confirm(str
)) {
132 var query_str
= "backend.php?op=feeds&method=catchupAll";
134 notify_progress("Marking all feeds as read...");
136 //console.log("catchupAllFeeds Q=" + query_str);
138 new Ajax
.Request("backend.php", {
139 parameters
: query_str
,
140 onComplete: function(transport
) {
141 request_counters(true);
150 function viewCurrentFeed(method
) {
151 console
.log("viewCurrentFeed: " + method
);
153 if (getActiveFeedId() != undefined) {
154 viewfeed({feed
: getActiveFeedId(), is_cat
: activeFeedIsCat(), method
: method
});
156 return false; // block unneeded form submits
160 if (getInitParam("bw_limit") != "1") {
162 setTimeout(timeout
, 60*1000);
167 var query
= "backend.php?op=feeds&method=search¶m=" +
168 param_escape(getActiveFeedId() + ":" + activeFeedIsCat());
170 if (dijit
.byId("searchDlg"))
171 dijit
.byId("searchDlg").destroyRecursive();
173 dialog
= new dijit
.Dialog({
176 style
: "width: 600px",
177 execute: function() {
178 if (this.validate()) {
179 _search_query
= dojo
.objectToQuery(this.attr('value'));
189 function updateTitle() {
190 var tmp
= "Tiny Tiny RSS";
192 if (global_unread
> 0) {
193 tmp
= "(" + global_unread
+ ") " + tmp
;
197 if (global_unread
> 0) {
198 window
.fluid
.dockBadge
= global_unread
;
200 window
.fluid
.dockBadge
= "";
204 document
.title
= tmp
;
207 function genericSanityCheck() {
208 setCookie("ttrss_test", "TEST");
210 if (getCookie("ttrss_test") != "TEST") {
211 return fatalError(2);
220 //dojo.registerModulePath("fox", "../../js/");
222 require(["dojo/_base/kernel",
228 "dijit/ColorPalette",
231 "dijit/form/ComboButton",
232 "dijit/form/CheckBox",
233 "dijit/form/DropDownButton",
234 "dijit/form/FilteringSelect",
236 "dijit/form/RadioButton",
238 "dijit/form/SimpleTextarea",
239 "dijit/form/TextBox",
240 "dijit/form/ComboBox",
241 "dijit/form/ValidationTextBox",
242 "dijit/InlineEditBox",
243 "dijit/layout/AccordionContainer",
244 "dijit/layout/BorderContainer",
245 "dijit/layout/ContentPane",
246 "dijit/layout/TabContainer",
247 "dijit/PopupMenuItem",
251 "dijit/tree/dndSource",
252 "dijit/tree/ForestStoreModel",
253 "dojo/data/ItemFileWriteStore",
254 "fox/FeedTree" ], function (dojo
, ready
, parser
) {
260 if (!genericSanityCheck())
263 loading_set_progress(30);
265 var a
= document
.createElement('audio');
267 var hasAudio
= !!a
.canPlayType
;
268 var hasSandbox
= "sandbox" in document
.createElement("iframe");
269 var hasMp3
= !!(a
.canPlayType
&& a
.canPlayType('audio/mpeg;').replace(/no
/, ''));
270 var clientTzOffset
= new Date().getTimezoneOffset() * 60;
272 init_hotkey_actions();
274 new Ajax
.Request("backend.php", {
275 parameters
: {op
: "rpc", method
: "sanityCheck", hasAudio
: hasAudio
,
277 clientTzOffset
: clientTzOffset
,
278 hasSandbox
: hasSandbox
},
279 onComplete: function(transport
) {
280 backend_sanity_check_callback(transport
);
290 exception_error("init", e
);
294 function init_hotkey_actions() {
295 hotkey_actions
["next_feed"] = function() {
296 var rv
= dijit
.byId("feedTree").getNextFeed(
297 getActiveFeedId(), activeFeedIsCat());
299 if (rv
) viewfeed({feed
: rv
[0], is_cat
: rv
[1], can_wait
: true})
301 hotkey_actions
["prev_feed"] = function() {
302 var rv
= dijit
.byId("feedTree").getPreviousFeed(
303 getActiveFeedId(), activeFeedIsCat());
305 if (rv
) viewfeed({feed
: rv
[0], is_cat
: rv
[1], can_wait
: true})
307 hotkey_actions
["next_article"] = function() {
310 hotkey_actions
["prev_article"] = function() {
313 hotkey_actions
["next_article_noscroll"] = function() {
314 moveToPost('next', true);
316 hotkey_actions
["prev_article_noscroll"] = function() {
317 moveToPost('prev', true);
319 hotkey_actions
["next_article_noexpand"] = function() {
320 moveToPost('next', true, true);
322 hotkey_actions
["prev_article_noexpand"] = function() {
323 moveToPost('prev', true, true);
325 hotkey_actions
["collapse_article"] = function() {
326 var id
= getActiveArticleId();
327 var elem
= $("CICD-"+id
);
330 if (elem
.visible()) {
331 cdmCollapseArticle(null, id
);
334 cdmExpandArticle(id
);
338 hotkey_actions
["toggle_expand"] = function() {
339 var id
= getActiveArticleId();
340 var elem
= $("CICD-"+id
);
343 if (elem
.visible()) {
344 cdmCollapseArticle(null, id
, false);
347 cdmExpandArticle(id
);
351 hotkey_actions
["search_dialog"] = function() {
354 hotkey_actions
["toggle_mark"] = function() {
355 selectionToggleMarked(undefined, false, true);
357 hotkey_actions
["toggle_publ"] = function() {
358 selectionTogglePublished(undefined, false, true);
360 hotkey_actions
["toggle_unread"] = function() {
361 selectionToggleUnread(undefined, false, true);
363 hotkey_actions
["edit_tags"] = function() {
364 var id
= getActiveArticleId();
369 hotkey_actions
["open_in_new_window"] = function() {
370 if (getActiveArticleId()) {
371 openArticleInNewWindow(getActiveArticleId());
375 hotkey_actions
["catchup_below"] = function() {
376 catchupRelativeToArticle(1);
378 hotkey_actions
["catchup_above"] = function() {
379 catchupRelativeToArticle(0);
381 hotkey_actions
["article_scroll_down"] = function() {
382 var ctr
= $("content_insert") ? $("content_insert") : $("headlines-frame");
386 hotkey_actions
["article_scroll_up"] = function() {
387 var ctr
= $("content_insert") ? $("content_insert") : $("headlines-frame");
391 hotkey_actions
["close_article"] = function() {
393 if (!getInitParam("cdm_expanded")) {
394 cdmCollapseArticle(false, getActiveArticleId());
400 hotkey_actions
["email_article"] = function() {
401 if (typeof emailArticle
!= "undefined") {
403 } else if (typeof mailtoArticle
!= "undefined") {
406 alert(__("Please enable mail plugin first."));
409 hotkey_actions
["select_all"] = function() {
410 selectArticles('all');
412 hotkey_actions
["select_unread"] = function() {
413 selectArticles('unread');
415 hotkey_actions
["select_marked"] = function() {
416 selectArticles('marked');
418 hotkey_actions
["select_published"] = function() {
419 selectArticles('published');
421 hotkey_actions
["select_invert"] = function() {
422 selectArticles('invert');
424 hotkey_actions
["select_none"] = function() {
425 selectArticles('none');
427 hotkey_actions
["feed_refresh"] = function() {
428 if (getActiveFeedId() != undefined) {
429 viewfeed({feed
: getActiveFeedId(), is_cat
: activeFeedIsCat()});
433 hotkey_actions
["feed_unhide_read"] = function() {
436 hotkey_actions
["feed_subscribe"] = function() {
439 hotkey_actions
["feed_debug_update"] = function() {
440 if (!activeFeedIsCat() && parseInt(getActiveFeedId()) > 0) {
441 window
.open("backend.php?op=feeds&method=update_debugger&feed_id=" + getActiveFeedId() +
442 "&csrf_token=" + getInitParam("csrf_token"));
444 alert("You can't debug this kind of feed.");
448 hotkey_actions
["feed_debug_viewfeed"] = function() {
449 viewfeed({feed
: getActiveFeedId(), is_cat
: activeFeedIsCat(), viewfeed_debug
: true});
452 hotkey_actions
["feed_edit"] = function() {
453 if (activeFeedIsCat())
454 alert(__("You can't edit this kind of feed."));
456 editFeed(getActiveFeedId());
458 hotkey_actions
["feed_catchup"] = function() {
459 if (getActiveFeedId() != undefined) {
460 catchupCurrentFeed();
464 hotkey_actions
["feed_reverse"] = function() {
465 reverseHeadlineOrder();
467 hotkey_actions
["feed_toggle_vgroup"] = function() {
468 var query_str
= "?op=rpc&method=togglepref&key=VFEED_GROUP_BY_FEED";
470 new Ajax
.Request("backend.php", {
471 parameters
: query_str
,
472 onComplete: function(transport
) {
477 hotkey_actions
["catchup_all"] = function() {
480 hotkey_actions
["cat_toggle_collapse"] = function() {
481 if (activeFeedIsCat()) {
482 dijit
.byId("feedTree").collapseCat(getActiveFeedId());
486 hotkey_actions
["goto_all"] = function() {
487 viewfeed({feed
: -4});
489 hotkey_actions
["goto_fresh"] = function() {
490 viewfeed({feed
: -3});
492 hotkey_actions
["goto_marked"] = function() {
493 viewfeed({feed
: -1});
495 hotkey_actions
["goto_published"] = function() {
496 viewfeed({feed
: -2});
498 hotkey_actions
["goto_tagcloud"] = function() {
499 displayDlg(__("Tag cloud"), "printTagCloud");
501 hotkey_actions
["goto_prefs"] = function() {
504 hotkey_actions
["select_article_cursor"] = function() {
505 var id
= getArticleUnderPointer();
507 var row
= $("RROW-" + id
);
510 var cb
= dijit
.getEnclosingWidget(
511 row
.getElementsByClassName("rchk")[0]);
514 cb
.attr("checked", !cb
.attr("checked"));
515 toggleSelectRowById(cb
, "RROW-" + id
);
521 hotkey_actions
["create_label"] = function() {
524 hotkey_actions
["create_filter"] = function() {
527 hotkey_actions
["collapse_sidebar"] = function() {
530 hotkey_actions
["toggle_embed_original"] = function() {
531 if (typeof embedOriginalArticle
!= "undefined") {
532 if (getActiveArticleId())
533 embedOriginalArticle(getActiveArticleId());
535 alert(__("Please enable embed_original plugin first."));
538 hotkey_actions
["toggle_widescreen"] = function() {
540 _widescreen_mode
= !_widescreen_mode
;
542 // reset stored sizes because geometry changed
543 setCookie("ttrss_ci_width", 0);
544 setCookie("ttrss_ci_height", 0);
546 switchPanelMode(_widescreen_mode
);
548 alert(__("Widescreen is not available in combined mode."));
551 hotkey_actions
["help_dialog"] = function() {
554 hotkey_actions
["toggle_combined_mode"] = function() {
555 notify_progress("Loading, please wait...");
557 var value
= isCdmMode() ? "false" : "true";
558 var query
= "?op=rpc&method=setpref&key=COMBINED_DISPLAY_MODE&value=" + value
;
560 new Ajax
.Request("backend.php", {
562 onComplete: function(transport
) {
563 setInitParam("combined_display_mode",
564 !getInitParam("combined_display_mode"));
571 hotkey_actions
["toggle_cdm_expanded"] = function() {
572 notify_progress("Loading, please wait...");
574 var value
= getInitParam("cdm_expanded") ? "false" : "true";
575 var query
= "?op=rpc&method=setpref&key=CDM_EXPANDED&value=" + value
;
577 new Ajax
.Request("backend.php", {
579 onComplete: function(transport
) {
580 setInitParam("cdm_expanded", !getInitParam("cdm_expanded"));
586 function init_second_stage() {
592 if (parseInt(getCookie("ttrss_fh_width")) > 0) {
593 dijit
.byId("feeds-holder").domNode
.setStyle(
594 {width
: getCookie("ttrss_fh_width") + "px" });
597 dijit
.byId("main").resize();
599 var tmph
= dojo
.connect(dijit
.byId('feeds-holder'), 'resize',
601 if (args
&& args
.w
>= 0) {
602 setCookie("ttrss_fh_width", args
.w
, getInitParam("cookie_lifetime"));
606 var tmph
= dojo
.connect(dijit
.byId('content-insert'), 'resize',
608 if (args
&& args
.w
>= 0 && args
.h
>= 0) {
609 setCookie("ttrss_ci_width", args
.w
, getInitParam("cookie_lifetime"));
610 setCookie("ttrss_ci_height", args
.h
, getInitParam("cookie_lifetime"));
614 delCookie("ttrss_test");
616 var toolbar
= document
.forms
["main_toolbar_form"];
618 dijit
.getEnclosingWidget(toolbar
.view_mode
).attr('value',
619 getInitParam("default_view_mode"));
621 dijit
.getEnclosingWidget(toolbar
.order_by
).attr('value',
622 getInitParam("default_view_order_by"));
624 feeds_sort_by_unread
= getInitParam("feeds_sort_by_unread") == 1;
626 var hash_feed_id
= hash_get('f');
627 var hash_feed_is_cat
= hash_get('c') == "1";
629 if (hash_feed_id
!= undefined) {
630 setActiveFeedId(hash_feed_id
, hash_feed_is_cat
);
633 loading_set_progress(50);
635 // can't use cache_clear() here because viewfeed might not have initialized yet
636 if ('sessionStorage' in window
&& window
['sessionStorage'] !== null)
637 sessionStorage
.clear();
639 var hotkeys
= getInitParam("hotkeys");
642 for (sequence
in hotkeys
[1]) {
643 filtered
= sequence
.replace(/\|.*$/, "");
644 tmp
[filtered
] = hotkeys
[1][sequence
];
648 setInitParam("hotkeys", hotkeys
);
650 _widescreen_mode
= getInitParam("widescreen");
651 switchPanelMode(_widescreen_mode
);
653 console
.log("second stage ok");
655 if (getInitParam("simple_update")) {
656 console
.log("scheduling simple feed updater...");
657 window
.setTimeout(update_random_feed
, 30*1000);
661 exception_error("init_second_stage", e
);
665 function quickMenuGo(opid
) {
675 displayDlg(__("Tag cloud"), "printTagCloud");
684 window
.location
.href
= "backend.php?op=digest";
687 if (activeFeedIsCat())
688 alert(__("You can't edit this kind of feed."));
690 editFeed(getActiveFeedId());
692 case "qmcRemoveFeed":
693 var actid
= getActiveFeedId();
695 if (activeFeedIsCat()) {
696 alert(__("You can't unsubscribe from the category."));
701 alert(__("Please select some feed first."));
705 var fn
= getFeedName(actid
);
707 var pr
= __("Unsubscribe from %s?").replace("%s", fn
);
710 unsubscribeFeed(actid
);
713 case "qmcCatchupAll":
716 case "qmcShowOnlyUnread":
725 case "qmcRescoreFeed":
726 rescoreCurrentFeed();
728 case "qmcToggleWidescreen":
730 _widescreen_mode
= !_widescreen_mode
;
732 // reset stored sizes because geometry changed
733 setCookie("ttrss_ci_width", 0);
734 setCookie("ttrss_ci_height", 0);
736 switchPanelMode(_widescreen_mode
);
738 alert(__("Widescreen is not available in combined mode."));
745 console
.log("quickMenuGo: unknown action: " + opid
);
749 exception_error("quickMenuGo", e
);
753 function toggleDispRead() {
756 var hide
= !(getInitParam("hide_read_feeds") == "1");
758 hideOrShowFeeds(hide
);
760 var query
= "?op=rpc&method=setpref&key=HIDE_READ_FEEDS&value=" +
763 setInitParam("hide_read_feeds", hide
);
765 new Ajax
.Request("backend.php", {
767 onComplete: function(transport
) {
771 exception_error("toggleDispRead", e
);
775 function parse_runtime_info(data
) {
777 //console.log("parsing runtime info...");
782 // console.log("RI: " + k + " => " + v);
784 if (k
== "dep_ts" && parseInt(getInitParam("dep_ts")) > 0) {
785 if (parseInt(getInitParam("dep_ts")) < parseInt(v
) && getInitParam("reload_on_ts_change")) {
786 window
.location
.reload();
790 if (k
== "daemon_is_running" && v
!= 1) {
791 notify_error("<span onclick=\"explainError(1)\">Update daemon is not running.</span>", true);
795 if (k
== "update_result") {
796 var updatesIcon
= dijit
.byId("updatesIcon").domNode
;
799 Element
.show(updatesIcon
);
801 Element
.hide(updatesIcon
);
805 if (k
== "daemon_stamp_ok" && v
!= 1) {
806 notify_error("<span onclick=\"explainError(3)\">Update daemon is not updating feeds.</span>", true);
810 if (k
== "max_feed_id" || k
== "num_feeds") {
811 if (init_params
[k
] != v
) {
812 console
.log("feed count changed, need to reload feedlist.");
821 PluginHost
.run(PluginHost
.HOOK_RUNTIME_INFO_LOADED
, data
);
824 function collapse_feedlist() {
827 Element
.toggle("feeds-holder");
829 dijit
.byId("main").resize();
832 exception_error("collapse_feedlist", e
);
836 function viewModeChanged() {
838 return viewCurrentFeed('');
841 function rescoreCurrentFeed() {
843 var actid
= getActiveFeedId();
845 if (activeFeedIsCat() || actid
< 0) {
846 alert(__("You can't rescore this kind of feed."));
851 alert(__("Please select some feed first."));
855 var fn
= getFeedName(actid
);
856 var pr
= __("Rescore articles in %s?").replace("%s", fn
);
859 notify_progress("Rescoring articles...");
861 var query
= "?op=pref-feeds&method=rescore&quiet=1&ids=" + actid
;
863 new Ajax
.Request("backend.php", {
865 onComplete: function(transport
) {
871 function hotkey_handler(e
) {
874 if (e
.target
.nodeName
== "INPUT" || e
.target
.nodeName
== "TEXTAREA") return;
877 var shift_key
= false;
878 var ctrl_key
= false;
880 var meta_key
= false;
882 var cmdline
= $('cmdline');
884 shift_key
= e
.shiftKey
;
885 ctrl_key
= e
.ctrlKey
;
887 meta_key
= e
.metaKey
;
890 keycode
= window
.event
.keyCode
;
895 var keychar
= String
.fromCharCode(keycode
);
897 if (keycode
== 27) { // escape
898 hotkey_prefix
= false;
901 if (keycode
== 16) return; // ignore lone shift
902 if (keycode
== 17) return; // ignore lone ctrl
904 keychar
= keychar
.toLowerCase();
906 var hotkeys
= getInitParam("hotkeys");
908 if (!hotkey_prefix
&& hotkeys
[0].indexOf(keychar
) != -1) {
910 var date
= new Date();
911 var ts
= Math
.round(date
.getTime() / 1000);
913 hotkey_prefix
= keychar
;
914 hotkey_prefix_pressed
= ts
;
916 cmdline
.innerHTML
= keychar
;
917 Element
.show(cmdline
);
922 Element
.hide(cmdline
);
924 var hotkey
= keychar
.search(/[a-zA-Z0-9]/) != -1 ? keychar
: "(" + keycode
+ ")";
926 // ensure ^*char notation
927 if (shift_key
) hotkey
= "*" + hotkey
;
928 if (ctrl_key
) hotkey
= "^" + hotkey
;
929 if (alt_key
) hotkey
= "+" + hotkey
;
930 if (meta_key
) hotkey
= "%" + hotkey
;
932 hotkey
= hotkey_prefix
? hotkey_prefix
+ " " + hotkey
: hotkey
;
933 hotkey_prefix
= false;
935 var hotkey_action
= false;
936 var hotkeys
= getInitParam("hotkeys");
938 for (sequence
in hotkeys
[1]) {
939 if (sequence
== hotkey
) {
940 hotkey_action
= hotkeys
[1][sequence
];
945 var action
= hotkey_actions
[hotkey_action
];
947 if (action
!= null) {
953 exception_error("hotkey_handler", e
);
957 function inPreferences() {
961 function reverseHeadlineOrder() {
964 /* var query_str = "?op=rpc&method=togglepref&key=REVERSE_HEADLINES";
966 new Ajax.Request("backend.php", {
967 parameters: query_str,
968 onComplete: function(transport) {
972 var toolbar
= document
.forms
["main_toolbar_form"];
973 var order_by
= dijit
.getEnclosingWidget(toolbar
.order_by
);
975 var value
= order_by
.attr('value');
977 if (value
== "date_reverse")
980 value
= "date_reverse";
982 order_by
.attr('value', value
);
987 exception_error("reverseHeadlineOrder", e
);
991 function handle_rpc_json(transport
, scheduled_call
) {
993 var reply
= JSON
.parse(transport
.responseText
);
995 var netalert_dijit
= dijit
.byId("net-alert");
996 var netalert
= false;
999 netalert
= netalert_dijit
.domNode
;
1003 var error
= reply
['error'];
1006 var code
= error
['code'];
1007 var msg
= error
['msg'];
1009 console
.warn("[handle_rpc_json] received fatal error " + code
+ "/" + msg
);
1012 fatalError(code
, msg
);
1017 var seq
= reply
['seq'];
1020 if (get_seq() != seq
) {
1021 console
.log("[handle_rpc_json] sequence mismatch: " + seq
+
1022 " (want: " + get_seq() + ")");
1027 var message
= reply
['message'];
1030 if (message
== "UPDATE_COUNTERS") {
1031 console
.log("need to refresh counters...");
1032 setInitParam("last_article_id", -1);
1033 request_counters(true);
1037 var counters
= reply
['counters'];
1040 parse_counters(counters
, scheduled_call
);
1042 var runtime_info
= reply
['runtime-info'];
1045 parse_runtime_info(runtime_info
);
1047 if (netalert
) Element
.hide(netalert
);
1051 Element
.show(netalert
);
1053 notify_error("Communication problem with server.");
1058 Element
.show(netalert
);
1060 notify_error("Communication problem with server.");
1063 //exception_error("handle_rpc_json", e, transport);
1069 function switchPanelMode(wide
) {
1071 if (isCdmMode()) return;
1073 article_id
= getActiveArticleId();
1076 dijit
.byId("headlines-wrap-inner").attr("design", 'sidebar');
1077 dijit
.byId("content-insert").attr("region", "trailing");
1079 dijit
.byId("content-insert").domNode
.setStyle({width
: '50%',
1081 borderTopWidth
: '0px' });
1083 if (parseInt(getCookie("ttrss_ci_width")) > 0) {
1084 dijit
.byId("content-insert").domNode
.setStyle(
1085 {width
: getCookie("ttrss_ci_width") + "px" });
1088 $("headlines-frame").setStyle({ borderBottomWidth
: '0px' });
1089 $("headlines-frame").addClassName("wide");
1093 dijit
.byId("content-insert").attr("region", "bottom");
1095 dijit
.byId("content-insert").domNode
.setStyle({width
: 'auto',
1097 borderTopWidth
: '0px'});
1099 if (parseInt(getCookie("ttrss_ci_height")) > 0) {
1100 dijit
.byId("content-insert").domNode
.setStyle(
1101 {height
: getCookie("ttrss_ci_height") + "px" });
1104 $("headlines-frame").setStyle({ borderBottomWidth
: '1px' });
1105 $("headlines-frame").removeClassName("wide");
1109 closeArticlePanel();
1111 if (article_id
) view(article_id
);
1113 new Ajax
.Request("backend.php", {
1114 parameters
: "op=rpc&method=setpanelmode&wide=" + (wide
? 1 : 0),
1115 onComplete: function(transport
) {
1116 console
.log(transport
.responseText
);
1121 exception_error("switchPanelMode", e
);
1125 function update_random_feed() {
1127 console
.log("in update_random_feed");
1129 new Ajax
.Request("backend.php", {
1130 parameters
: "op=rpc&method=updateRandomFeed",
1131 onComplete: function(transport
) {
1132 handle_rpc_json(transport
, true);
1133 window
.setTimeout(update_random_feed
, 30*1000);
1137 exception_error("update_random_feed", e
);
1141 function hash_get(key
) {
1143 kv
= window
.location
.hash
.substring(1).toQueryParams();
1146 exception_error("hash_get", e
);
1149 function hash_set(key
, value
) {
1151 kv
= window
.location
.hash
.substring(1).toQueryParams();
1153 window
.location
.hash
= $H(kv
).toQueryString();
1155 exception_error("hash_set", e
);