]>
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
});
90 /* var menu = new dijit.Menu({id: 'feedMenu'});
92 menu.addChild(new dijit.MenuItem({
93 label: "Simple menu item"
96 // menu.bindDomNode(tree.domNode); */
98 var tmph
= dojo
.connect(dijit
.byId('feedMenu'), '_openMyself', function (event
) {
99 console
.log(dijit
.getEnclosingWidget(event
.target
));
100 dojo
.disconnect(tmph
);
103 $("feeds-holder").appendChild(tree
.domNode
);
105 var tmph
= dojo
.connect(tree
, 'onLoad', function() {
106 dojo
.disconnect(tmph
);
107 Element
.hide("feedlistLoading");
111 // var node = dijit.byId("feedTree")._itemNodesMap['FEED:-2'][0].domNode
112 // menu.bindDomNode(node);
114 loading_set_progress(25);
121 exception_error("updateFeedList", e
);
125 function catchupAllFeeds() {
127 var str
= __("Mark all articles as read?");
129 if (getInitParam("confirm_feed_catchup") != 1 || confirm(str
)) {
131 var query_str
= "backend.php?op=feeds&method=catchupAll";
133 notify_progress("Marking all feeds as read...");
135 //console.log("catchupAllFeeds Q=" + query_str);
137 new Ajax
.Request("backend.php", {
138 parameters
: query_str
,
139 onComplete: function(transport
) {
140 request_counters(true);
149 function viewCurrentFeed(method
) {
150 console
.log("viewCurrentFeed: " + method
);
152 if (getActiveFeedId() != undefined) {
153 viewfeed({feed
: getActiveFeedId(), is_cat
: activeFeedIsCat(), method
: method
});
155 return false; // block unneeded form submits
159 if (getInitParam("bw_limit") != "1") {
161 setTimeout("timeout()", 60*1000);
166 var query
= "backend.php?op=feeds&method=search¶m=" +
167 param_escape(getActiveFeedId() + ":" + activeFeedIsCat());
169 if (dijit
.byId("searchDlg"))
170 dijit
.byId("searchDlg").destroyRecursive();
172 dialog
= new dijit
.Dialog({
175 style
: "width: 600px",
176 execute: function() {
177 if (this.validate()) {
178 _search_query
= dojo
.objectToQuery(this.attr('value'));
188 function updateTitle() {
189 var tmp
= "Tiny Tiny RSS";
191 if (global_unread
> 0) {
192 tmp
= "(" + global_unread
+ ") " + tmp
;
196 if (global_unread
> 0) {
197 window
.fluid
.dockBadge
= global_unread
;
199 window
.fluid
.dockBadge
= "";
203 document
.title
= tmp
;
206 function genericSanityCheck() {
207 setCookie("ttrss_test", "TEST");
209 if (getCookie("ttrss_test") != "TEST") {
210 return fatalError(2);
219 //dojo.registerModulePath("fox", "../../js/");
221 require(["dojo/_base/kernel",
226 "dijit/ColorPalette",
229 "dijit/form/ComboButton",
230 "dijit/form/CheckBox",
231 "dijit/form/DropDownButton",
232 "dijit/form/FilteringSelect",
234 "dijit/form/RadioButton",
236 "dijit/form/SimpleTextarea",
237 "dijit/form/TextBox",
238 "dijit/form/ComboBox",
239 "dijit/form/ValidationTextBox",
240 "dijit/InlineEditBox",
241 "dijit/layout/AccordionContainer",
242 "dijit/layout/BorderContainer",
243 "dijit/layout/ContentPane",
244 "dijit/layout/TabContainer",
245 "dijit/PopupMenuItem",
249 "dijit/tree/dndSource",
250 "dijit/tree/ForestStoreModel",
251 "dojo/data/ItemFileWriteStore",
252 "fox/FeedTree" ], function (dojo
, ready
, parser
) {
258 if (!genericSanityCheck())
261 loading_set_progress(30);
263 var a
= document
.createElement('audio');
265 var hasAudio
= !!a
.canPlayType
;
266 var hasSandbox
= "sandbox" in document
.createElement("iframe");
267 var hasMp3
= !!(a
.canPlayType
&& a
.canPlayType('audio/mpeg;').replace(/no
/, ''));
268 var clientTzOffset
= new Date().getTimezoneOffset() * 60;
270 init_hotkey_actions();
272 new Ajax
.Request("backend.php", {
273 parameters
: {op
: "rpc", method
: "sanityCheck", hasAudio
: hasAudio
,
275 clientTzOffset
: clientTzOffset
,
276 hasSandbox
: hasSandbox
},
277 onComplete: function(transport
) {
278 backend_sanity_check_callback(transport
);
288 exception_error("init", e
);
292 function init_hotkey_actions() {
293 hotkey_actions
["next_feed"] = function() {
294 var rv
= dijit
.byId("feedTree").getNextFeed(
295 getActiveFeedId(), activeFeedIsCat());
297 if (rv
) viewfeed({feed
: rv
[0], is_cat
: rv
[1], can_wait
: true})
299 hotkey_actions
["prev_feed"] = function() {
300 var rv
= dijit
.byId("feedTree").getPreviousFeed(
301 getActiveFeedId(), activeFeedIsCat());
303 if (rv
) viewfeed({feed
: rv
[0], is_cat
: rv
[1], can_wait
: true})
305 hotkey_actions
["next_article"] = function() {
308 hotkey_actions
["prev_article"] = function() {
311 hotkey_actions
["next_article_noscroll"] = function() {
312 moveToPost('next', true);
314 hotkey_actions
["prev_article_noscroll"] = function() {
315 moveToPost('prev', true);
317 hotkey_actions
["next_article_noexpand"] = function() {
318 moveToPost('next', true, true);
320 hotkey_actions
["prev_article_noexpand"] = function() {
321 moveToPost('prev', true, true);
323 hotkey_actions
["collapse_article"] = function() {
324 var id
= getActiveArticleId();
325 var elem
= $("CICD-"+id
);
328 if (elem
.visible()) {
329 cdmCollapseArticle(null, id
);
332 cdmExpandArticle(id
);
336 hotkey_actions
["toggle_expand"] = function() {
337 var id
= getActiveArticleId();
338 var elem
= $("CICD-"+id
);
341 if (elem
.visible()) {
342 cdmCollapseArticle(null, id
, false);
345 cdmExpandArticle(id
);
349 hotkey_actions
["search_dialog"] = function() {
352 hotkey_actions
["toggle_mark"] = function() {
353 selectionToggleMarked(undefined, false, true);
355 hotkey_actions
["toggle_publ"] = function() {
356 selectionTogglePublished(undefined, false, true);
358 hotkey_actions
["toggle_unread"] = function() {
359 selectionToggleUnread(undefined, false, true);
361 hotkey_actions
["edit_tags"] = function() {
362 var id
= getActiveArticleId();
367 hotkey_actions
["open_in_new_window"] = function() {
368 if (getActiveArticleId()) {
369 openArticleInNewWindow(getActiveArticleId());
373 hotkey_actions
["catchup_below"] = function() {
374 catchupRelativeToArticle(1);
376 hotkey_actions
["catchup_above"] = function() {
377 catchupRelativeToArticle(0);
379 hotkey_actions
["article_scroll_down"] = function() {
380 var ctr
= $("content_insert") ? $("content_insert") : $("headlines-frame");
384 hotkey_actions
["article_scroll_up"] = function() {
385 var ctr
= $("content_insert") ? $("content_insert") : $("headlines-frame");
389 hotkey_actions
["close_article"] = function() {
391 if (!getInitParam("cdm_expanded")) {
392 cdmCollapseArticle(false, getActiveArticleId());
398 hotkey_actions
["email_article"] = function() {
399 if (typeof emailArticle
!= "undefined") {
401 } else if (typeof mailtoArticle
!= "undefined") {
404 alert(__("Please enable mail plugin first."));
407 hotkey_actions
["select_all"] = function() {
408 selectArticles('all');
410 hotkey_actions
["select_unread"] = function() {
411 selectArticles('unread');
413 hotkey_actions
["select_marked"] = function() {
414 selectArticles('marked');
416 hotkey_actions
["select_published"] = function() {
417 selectArticles('published');
419 hotkey_actions
["select_invert"] = function() {
420 selectArticles('invert');
422 hotkey_actions
["select_none"] = function() {
423 selectArticles('none');
425 hotkey_actions
["feed_refresh"] = function() {
426 if (getActiveFeedId() != undefined) {
427 viewfeed({feed
: getActiveFeedId(), is_cat
: activeFeedIsCat()});
431 hotkey_actions
["feed_unhide_read"] = function() {
434 hotkey_actions
["feed_subscribe"] = function() {
437 hotkey_actions
["feed_debug_update"] = function() {
438 if (!activeFeedIsCat() && parseInt(getActiveFeedId()) > 0) {
439 window
.open("backend.php?op=feeds&method=update_debugger&feed_id=" + getActiveFeedId() +
440 "&csrf_token=" + getInitParam("csrf_token"));
442 alert("You can't debug this kind of feed.");
446 hotkey_actions
["feed_debug_viewfeed"] = function() {
447 viewfeed({feed
: getActiveFeedId(), is_cat
: activeFeedIsCat(), viewfeed_debug
: true});
450 hotkey_actions
["feed_edit"] = function() {
451 if (activeFeedIsCat())
452 alert(__("You can't edit this kind of feed."));
454 editFeed(getActiveFeedId());
456 hotkey_actions
["feed_catchup"] = function() {
457 if (getActiveFeedId() != undefined) {
458 catchupCurrentFeed();
462 hotkey_actions
["feed_reverse"] = function() {
463 reverseHeadlineOrder();
465 hotkey_actions
["feed_toggle_vgroup"] = function() {
466 var query_str
= "?op=rpc&method=togglepref&key=VFEED_GROUP_BY_FEED";
468 new Ajax
.Request("backend.php", {
469 parameters
: query_str
,
470 onComplete: function(transport
) {
475 hotkey_actions
["catchup_all"] = function() {
478 hotkey_actions
["cat_toggle_collapse"] = function() {
479 if (activeFeedIsCat()) {
480 dijit
.byId("feedTree").collapseCat(getActiveFeedId());
484 hotkey_actions
["goto_all"] = function() {
485 viewfeed({feed
: -4});
487 hotkey_actions
["goto_fresh"] = function() {
488 viewfeed({feed
: -3});
490 hotkey_actions
["goto_marked"] = function() {
491 viewfeed({feed
: -1});
493 hotkey_actions
["goto_published"] = function() {
494 viewfeed({feed
: -2});
496 hotkey_actions
["goto_tagcloud"] = function() {
497 displayDlg(__("Tag cloud"), "printTagCloud");
499 hotkey_actions
["goto_prefs"] = function() {
502 hotkey_actions
["select_article_cursor"] = function() {
503 var id
= getArticleUnderPointer();
505 var row
= $("RROW-" + id
);
508 var cb
= dijit
.getEnclosingWidget(
509 row
.getElementsByClassName("rchk")[0]);
512 cb
.attr("checked", !cb
.attr("checked"));
513 toggleSelectRowById(cb
, "RROW-" + id
);
519 hotkey_actions
["create_label"] = function() {
522 hotkey_actions
["create_filter"] = function() {
525 hotkey_actions
["collapse_sidebar"] = function() {
528 hotkey_actions
["toggle_embed_original"] = function() {
529 if (typeof embedOriginalArticle
!= "undefined") {
530 if (getActiveArticleId())
531 embedOriginalArticle(getActiveArticleId());
533 alert(__("Please enable embed_original plugin first."));
536 hotkey_actions
["toggle_widescreen"] = function() {
538 _widescreen_mode
= !_widescreen_mode
;
540 // reset stored sizes because geometry changed
541 setCookie("ttrss_ci_width", 0);
542 setCookie("ttrss_ci_height", 0);
544 switchPanelMode(_widescreen_mode
);
546 alert(__("Widescreen is not available in combined mode."));
549 hotkey_actions
["help_dialog"] = function() {
552 hotkey_actions
["toggle_combined_mode"] = function() {
553 notify_progress("Loading, please wait...");
555 var value
= isCdmMode() ? "false" : "true";
556 var query
= "?op=rpc&method=setpref&key=COMBINED_DISPLAY_MODE&value=" + value
;
558 new Ajax
.Request("backend.php", {
560 onComplete: function(transport
) {
561 setInitParam("combined_display_mode",
562 !getInitParam("combined_display_mode"));
569 hotkey_actions
["toggle_cdm_expanded"] = function() {
570 notify_progress("Loading, please wait...");
572 var value
= getInitParam("cdm_expanded") ? "false" : "true";
573 var query
= "?op=rpc&method=setpref&key=CDM_EXPANDED&value=" + value
;
575 new Ajax
.Request("backend.php", {
577 onComplete: function(transport
) {
578 setInitParam("cdm_expanded", !getInitParam("cdm_expanded"));
584 function init_second_stage() {
590 if (parseInt(getCookie("ttrss_fh_width")) > 0) {
591 dijit
.byId("feeds-holder").domNode
.setStyle(
592 {width
: getCookie("ttrss_fh_width") + "px" });
595 dijit
.byId("main").resize();
597 var tmph
= dojo
.connect(dijit
.byId('feeds-holder'), 'resize',
599 if (args
&& args
.w
>= 0) {
600 setCookie("ttrss_fh_width", args
.w
, getInitParam("cookie_lifetime"));
604 var tmph
= dojo
.connect(dijit
.byId('content-insert'), 'resize',
606 if (args
&& args
.w
>= 0 && args
.h
>= 0) {
607 setCookie("ttrss_ci_width", args
.w
, getInitParam("cookie_lifetime"));
608 setCookie("ttrss_ci_height", args
.h
, getInitParam("cookie_lifetime"));
612 delCookie("ttrss_test");
614 var toolbar
= document
.forms
["main_toolbar_form"];
616 dijit
.getEnclosingWidget(toolbar
.view_mode
).attr('value',
617 getInitParam("default_view_mode"));
619 dijit
.getEnclosingWidget(toolbar
.order_by
).attr('value',
620 getInitParam("default_view_order_by"));
622 feeds_sort_by_unread
= getInitParam("feeds_sort_by_unread") == 1;
624 var hash_feed_id
= hash_get('f');
625 var hash_feed_is_cat
= hash_get('c') == "1";
627 if (hash_feed_id
!= undefined) {
628 setActiveFeedId(hash_feed_id
, hash_feed_is_cat
);
631 loading_set_progress(50);
633 // can't use cache_clear() here because viewfeed might not have initialized yet
634 if ('sessionStorage' in window
&& window
['sessionStorage'] !== null)
635 sessionStorage
.clear();
637 var hotkeys
= getInitParam("hotkeys");
640 for (sequence
in hotkeys
[1]) {
641 filtered
= sequence
.replace(/\|.*$/, "");
642 tmp
[filtered
] = hotkeys
[1][sequence
];
646 setInitParam("hotkeys", hotkeys
);
648 _widescreen_mode
= getInitParam("widescreen");
649 switchPanelMode(_widescreen_mode
);
651 console
.log("second stage ok");
653 if (getInitParam("simple_update")) {
654 console
.log("scheduling simple feed updater...");
655 window
.setTimeout("update_random_feed()", 30*1000);
659 exception_error("init_second_stage", e
);
663 function quickMenuGo(opid
) {
673 displayDlg(__("Tag cloud"), "printTagCloud");
682 window
.location
.href
= "backend.php?op=digest";
685 if (activeFeedIsCat())
686 alert(__("You can't edit this kind of feed."));
688 editFeed(getActiveFeedId());
690 case "qmcRemoveFeed":
691 var actid
= getActiveFeedId();
693 if (activeFeedIsCat()) {
694 alert(__("You can't unsubscribe from the category."));
699 alert(__("Please select some feed first."));
703 var fn
= getFeedName(actid
);
705 var pr
= __("Unsubscribe from %s?").replace("%s", fn
);
708 unsubscribeFeed(actid
);
711 case "qmcCatchupAll":
714 case "qmcShowOnlyUnread":
723 case "qmcRescoreFeed":
724 rescoreCurrentFeed();
726 case "qmcToggleWidescreen":
728 _widescreen_mode
= !_widescreen_mode
;
730 // reset stored sizes because geometry changed
731 setCookie("ttrss_ci_width", 0);
732 setCookie("ttrss_ci_height", 0);
734 switchPanelMode(_widescreen_mode
);
736 alert(__("Widescreen is not available in combined mode."));
743 console
.log("quickMenuGo: unknown action: " + opid
);
747 exception_error("quickMenuGo", e
);
751 function toggleDispRead() {
754 var hide
= !(getInitParam("hide_read_feeds") == "1");
756 hideOrShowFeeds(hide
);
758 var query
= "?op=rpc&method=setpref&key=HIDE_READ_FEEDS&value=" +
761 setInitParam("hide_read_feeds", hide
);
763 new Ajax
.Request("backend.php", {
765 onComplete: function(transport
) {
769 exception_error("toggleDispRead", e
);
773 function parse_runtime_info(data
) {
775 //console.log("parsing runtime info...");
780 // console.log("RI: " + k + " => " + v);
782 if (k
== "dep_ts" && parseInt(getInitParam("dep_ts")) > 0) {
783 if (parseInt(getInitParam("dep_ts")) < parseInt(v
) && getInitParam("reload_on_ts_change")) {
784 window
.location
.reload();
788 if (k
== "daemon_is_running" && v
!= 1) {
789 notify_error("<span onclick=\"explainError(1)\">Update daemon is not running.</span>", true);
793 if (k
== "update_result") {
794 var updatesIcon
= dijit
.byId("updatesIcon").domNode
;
797 Element
.show(updatesIcon
);
799 Element
.hide(updatesIcon
);
803 if (k
== "daemon_stamp_ok" && v
!= 1) {
804 notify_error("<span onclick=\"explainError(3)\">Update daemon is not updating feeds.</span>", true);
808 if (k
== "max_feed_id" || k
== "num_feeds") {
809 if (init_params
[k
] != v
) {
810 console
.log("feed count changed, need to reload feedlist.");
819 PluginHost
.run(PluginHost
.HOOK_RUNTIME_INFO_LOADED
, data
);
822 function collapse_feedlist() {
825 Element
.toggle("feeds-holder");
827 dijit
.byId("main").resize();
830 exception_error("collapse_feedlist", e
);
834 function viewModeChanged() {
836 return viewCurrentFeed('');
839 function rescoreCurrentFeed() {
841 var actid
= getActiveFeedId();
843 if (activeFeedIsCat() || actid
< 0) {
844 alert(__("You can't rescore this kind of feed."));
849 alert(__("Please select some feed first."));
853 var fn
= getFeedName(actid
);
854 var pr
= __("Rescore articles in %s?").replace("%s", fn
);
857 notify_progress("Rescoring articles...");
859 var query
= "?op=pref-feeds&method=rescore&quiet=1&ids=" + actid
;
861 new Ajax
.Request("backend.php", {
863 onComplete: function(transport
) {
869 function hotkey_handler(e
) {
872 if (e
.target
.nodeName
== "INPUT" || e
.target
.nodeName
== "TEXTAREA") return;
875 var shift_key
= false;
876 var ctrl_key
= false;
878 var meta_key
= false;
880 var cmdline
= $('cmdline');
882 shift_key
= e
.shiftKey
;
883 ctrl_key
= e
.ctrlKey
;
885 meta_key
= e
.metaKey
;
888 keycode
= window
.event
.keyCode
;
893 var keychar
= String
.fromCharCode(keycode
);
895 if (keycode
== 27) { // escape
896 hotkey_prefix
= false;
899 if (keycode
== 16) return; // ignore lone shift
900 if (keycode
== 17) return; // ignore lone ctrl
902 keychar
= keychar
.toLowerCase();
904 var hotkeys
= getInitParam("hotkeys");
906 if (!hotkey_prefix
&& hotkeys
[0].indexOf(keychar
) != -1) {
908 var date
= new Date();
909 var ts
= Math
.round(date
.getTime() / 1000);
911 hotkey_prefix
= keychar
;
912 hotkey_prefix_pressed
= ts
;
914 cmdline
.innerHTML
= keychar
;
915 Element
.show(cmdline
);
920 Element
.hide(cmdline
);
922 var hotkey
= keychar
.search(/[a-zA-Z0-9]/) != -1 ? keychar
: "(" + keycode
+ ")";
924 // ensure ^*char notation
925 if (shift_key
) hotkey
= "*" + hotkey
;
926 if (ctrl_key
) hotkey
= "^" + hotkey
;
927 if (alt_key
) hotkey
= "+" + hotkey
;
928 if (meta_key
) hotkey
= "%" + hotkey
;
930 hotkey
= hotkey_prefix
? hotkey_prefix
+ " " + hotkey
: hotkey
;
931 hotkey_prefix
= false;
933 var hotkey_action
= false;
934 var hotkeys
= getInitParam("hotkeys");
936 for (sequence
in hotkeys
[1]) {
937 if (sequence
== hotkey
) {
938 hotkey_action
= hotkeys
[1][sequence
];
943 var action
= hotkey_actions
[hotkey_action
];
945 if (action
!= null) {
951 exception_error("hotkey_handler", e
);
955 function inPreferences() {
959 function reverseHeadlineOrder() {
962 /* var query_str = "?op=rpc&method=togglepref&key=REVERSE_HEADLINES";
964 new Ajax.Request("backend.php", {
965 parameters: query_str,
966 onComplete: function(transport) {
970 var toolbar
= document
.forms
["main_toolbar_form"];
971 var order_by
= dijit
.getEnclosingWidget(toolbar
.order_by
);
973 var value
= order_by
.attr('value');
975 if (value
== "date_reverse")
978 value
= "date_reverse";
980 order_by
.attr('value', value
);
985 exception_error("reverseHeadlineOrder", e
);
989 function handle_rpc_json(transport
, scheduled_call
) {
991 var reply
= JSON
.parse(transport
.responseText
);
993 var netalert_dijit
= dijit
.byId("net-alert");
994 var netalert
= false;
997 netalert
= netalert_dijit
.domNode
;
1001 var error
= reply
['error'];
1004 var code
= error
['code'];
1005 var msg
= error
['msg'];
1007 console
.warn("[handle_rpc_json] received fatal error " + code
+ "/" + msg
);
1010 fatalError(code
, msg
);
1015 var seq
= reply
['seq'];
1018 if (get_seq() != seq
) {
1019 console
.log("[handle_rpc_json] sequence mismatch: " + seq
+
1020 " (want: " + get_seq() + ")");
1025 var message
= reply
['message'];
1028 if (message
== "UPDATE_COUNTERS") {
1029 console
.log("need to refresh counters...");
1030 setInitParam("last_article_id", -1);
1031 request_counters(true);
1035 var counters
= reply
['counters'];
1038 parse_counters(counters
, scheduled_call
);
1040 var runtime_info
= reply
['runtime-info'];
1043 parse_runtime_info(runtime_info
);
1045 if (netalert
) Element
.hide(netalert
);
1049 Element
.show(netalert
);
1051 notify_error("Communication problem with server.");
1056 Element
.show(netalert
);
1058 notify_error("Communication problem with server.");
1061 //exception_error("handle_rpc_json", e, transport);
1067 function switchPanelMode(wide
) {
1069 if (isCdmMode()) return;
1071 article_id
= getActiveArticleId();
1074 dijit
.byId("headlines-wrap-inner").attr("design", 'sidebar');
1075 dijit
.byId("content-insert").attr("region", "trailing");
1077 dijit
.byId("content-insert").domNode
.setStyle({width
: '50%',
1079 borderTopWidth
: '0px' });
1081 if (parseInt(getCookie("ttrss_ci_width")) > 0) {
1082 dijit
.byId("content-insert").domNode
.setStyle(
1083 {width
: getCookie("ttrss_ci_width") + "px" });
1086 $("headlines-frame").setStyle({ borderBottomWidth
: '0px' });
1087 $("headlines-frame").addClassName("wide");
1091 dijit
.byId("content-insert").attr("region", "bottom");
1093 dijit
.byId("content-insert").domNode
.setStyle({width
: 'auto',
1095 borderTopWidth
: '0px'});
1097 if (parseInt(getCookie("ttrss_ci_height")) > 0) {
1098 dijit
.byId("content-insert").domNode
.setStyle(
1099 {height
: getCookie("ttrss_ci_height") + "px" });
1102 $("headlines-frame").setStyle({ borderBottomWidth
: '1px' });
1103 $("headlines-frame").removeClassName("wide");
1107 closeArticlePanel();
1109 if (article_id
) view(article_id
);
1111 new Ajax
.Request("backend.php", {
1112 parameters
: "op=rpc&method=setpanelmode&wide=" + (wide
? 1 : 0),
1113 onComplete: function(transport
) {
1114 console
.log(transport
.responseText
);
1119 exception_error("switchPanelMode", e
);
1123 function update_random_feed() {
1125 console
.log("in update_random_feed");
1127 new Ajax
.Request("backend.php", {
1128 parameters
: "op=rpc&method=updateRandomFeed",
1129 onComplete: function(transport
) {
1130 handle_rpc_json(transport
, true);
1131 window
.setTimeout("update_random_feed()", 30*1000);
1135 exception_error("update_random_feed", e
);
1139 function hash_get(key
) {
1141 kv
= window
.location
.hash
.substring(1).toQueryParams();
1144 exception_error("hash_get", e
);
1147 function hash_set(key
, value
) {
1149 kv
= window
.location
.hash
.substring(1).toQueryParams();
1151 window
.location
.hash
= $H(kv
).toQueryString();
1153 exception_error("hash_set", e
);