]>
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",
227 "dijit/ColorPalette",
230 "dijit/form/ComboButton",
231 "dijit/form/CheckBox",
232 "dijit/form/DropDownButton",
233 "dijit/form/FilteringSelect",
235 "dijit/form/RadioButton",
237 "dijit/form/SimpleTextarea",
238 "dijit/form/TextBox",
239 "dijit/form/ComboBox",
240 "dijit/form/ValidationTextBox",
241 "dijit/InlineEditBox",
242 "dijit/layout/AccordionContainer",
243 "dijit/layout/BorderContainer",
244 "dijit/layout/ContentPane",
245 "dijit/layout/TabContainer",
246 "dijit/PopupMenuItem",
250 "dijit/tree/dndSource",
251 "dijit/tree/ForestStoreModel",
252 "dojo/data/ItemFileWriteStore",
253 "fox/FeedTree" ], function (dojo
, ready
, parser
) {
259 if (!genericSanityCheck())
262 loading_set_progress(30);
264 var a
= document
.createElement('audio');
266 var hasAudio
= !!a
.canPlayType
;
267 var hasSandbox
= "sandbox" in document
.createElement("iframe");
268 var hasMp3
= !!(a
.canPlayType
&& a
.canPlayType('audio/mpeg;').replace(/no
/, ''));
269 var clientTzOffset
= new Date().getTimezoneOffset() * 60;
271 init_hotkey_actions();
273 new Ajax
.Request("backend.php", {
274 parameters
: {op
: "rpc", method
: "sanityCheck", hasAudio
: hasAudio
,
276 clientTzOffset
: clientTzOffset
,
277 hasSandbox
: hasSandbox
},
278 onComplete: function(transport
) {
279 backend_sanity_check_callback(transport
);
289 exception_error("init", e
);
293 function init_hotkey_actions() {
294 hotkey_actions
["next_feed"] = function() {
295 var rv
= dijit
.byId("feedTree").getNextFeed(
296 getActiveFeedId(), activeFeedIsCat());
298 if (rv
) viewfeed({feed
: rv
[0], is_cat
: rv
[1], can_wait
: true})
300 hotkey_actions
["prev_feed"] = function() {
301 var rv
= dijit
.byId("feedTree").getPreviousFeed(
302 getActiveFeedId(), activeFeedIsCat());
304 if (rv
) viewfeed({feed
: rv
[0], is_cat
: rv
[1], can_wait
: true})
306 hotkey_actions
["next_article"] = function() {
309 hotkey_actions
["prev_article"] = function() {
312 hotkey_actions
["next_article_noscroll"] = function() {
313 moveToPost('next', true);
315 hotkey_actions
["prev_article_noscroll"] = function() {
316 moveToPost('prev', true);
318 hotkey_actions
["next_article_noexpand"] = function() {
319 moveToPost('next', true, true);
321 hotkey_actions
["prev_article_noexpand"] = function() {
322 moveToPost('prev', true, true);
324 hotkey_actions
["collapse_article"] = function() {
325 var id
= getActiveArticleId();
326 var elem
= $("CICD-"+id
);
329 if (elem
.visible()) {
330 cdmCollapseArticle(null, id
);
333 cdmExpandArticle(id
);
337 hotkey_actions
["toggle_expand"] = function() {
338 var id
= getActiveArticleId();
339 var elem
= $("CICD-"+id
);
342 if (elem
.visible()) {
343 cdmCollapseArticle(null, id
, false);
346 cdmExpandArticle(id
);
350 hotkey_actions
["search_dialog"] = function() {
353 hotkey_actions
["toggle_mark"] = function() {
354 selectionToggleMarked(undefined, false, true);
356 hotkey_actions
["toggle_publ"] = function() {
357 selectionTogglePublished(undefined, false, true);
359 hotkey_actions
["toggle_unread"] = function() {
360 selectionToggleUnread(undefined, false, true);
362 hotkey_actions
["edit_tags"] = function() {
363 var id
= getActiveArticleId();
368 hotkey_actions
["open_in_new_window"] = function() {
369 if (getActiveArticleId()) {
370 openArticleInNewWindow(getActiveArticleId());
374 hotkey_actions
["catchup_below"] = function() {
375 catchupRelativeToArticle(1);
377 hotkey_actions
["catchup_above"] = function() {
378 catchupRelativeToArticle(0);
380 hotkey_actions
["article_scroll_down"] = function() {
381 var ctr
= $("content_insert") ? $("content_insert") : $("headlines-frame");
385 hotkey_actions
["article_scroll_up"] = function() {
386 var ctr
= $("content_insert") ? $("content_insert") : $("headlines-frame");
390 hotkey_actions
["close_article"] = function() {
392 if (!getInitParam("cdm_expanded")) {
393 cdmCollapseArticle(false, getActiveArticleId());
399 hotkey_actions
["email_article"] = function() {
400 if (typeof emailArticle
!= "undefined") {
402 } else if (typeof mailtoArticle
!= "undefined") {
405 alert(__("Please enable mail plugin first."));
408 hotkey_actions
["select_all"] = function() {
409 selectArticles('all');
411 hotkey_actions
["select_unread"] = function() {
412 selectArticles('unread');
414 hotkey_actions
["select_marked"] = function() {
415 selectArticles('marked');
417 hotkey_actions
["select_published"] = function() {
418 selectArticles('published');
420 hotkey_actions
["select_invert"] = function() {
421 selectArticles('invert');
423 hotkey_actions
["select_none"] = function() {
424 selectArticles('none');
426 hotkey_actions
["feed_refresh"] = function() {
427 if (getActiveFeedId() != undefined) {
428 viewfeed({feed
: getActiveFeedId(), is_cat
: activeFeedIsCat()});
432 hotkey_actions
["feed_unhide_read"] = function() {
435 hotkey_actions
["feed_subscribe"] = function() {
438 hotkey_actions
["feed_debug_update"] = function() {
439 if (!activeFeedIsCat() && parseInt(getActiveFeedId()) > 0) {
440 window
.open("backend.php?op=feeds&method=update_debugger&feed_id=" + getActiveFeedId() +
441 "&csrf_token=" + getInitParam("csrf_token"));
443 alert("You can't debug this kind of feed.");
447 hotkey_actions
["feed_debug_viewfeed"] = function() {
448 viewfeed({feed
: getActiveFeedId(), is_cat
: activeFeedIsCat(), viewfeed_debug
: true});
451 hotkey_actions
["feed_edit"] = function() {
452 if (activeFeedIsCat())
453 alert(__("You can't edit this kind of feed."));
455 editFeed(getActiveFeedId());
457 hotkey_actions
["feed_catchup"] = function() {
458 if (getActiveFeedId() != undefined) {
459 catchupCurrentFeed();
463 hotkey_actions
["feed_reverse"] = function() {
464 reverseHeadlineOrder();
466 hotkey_actions
["feed_toggle_vgroup"] = function() {
467 var query_str
= "?op=rpc&method=togglepref&key=VFEED_GROUP_BY_FEED";
469 new Ajax
.Request("backend.php", {
470 parameters
: query_str
,
471 onComplete: function(transport
) {
476 hotkey_actions
["catchup_all"] = function() {
479 hotkey_actions
["cat_toggle_collapse"] = function() {
480 if (activeFeedIsCat()) {
481 dijit
.byId("feedTree").collapseCat(getActiveFeedId());
485 hotkey_actions
["goto_all"] = function() {
486 viewfeed({feed
: -4});
488 hotkey_actions
["goto_fresh"] = function() {
489 viewfeed({feed
: -3});
491 hotkey_actions
["goto_marked"] = function() {
492 viewfeed({feed
: -1});
494 hotkey_actions
["goto_published"] = function() {
495 viewfeed({feed
: -2});
497 hotkey_actions
["goto_tagcloud"] = function() {
498 displayDlg(__("Tag cloud"), "printTagCloud");
500 hotkey_actions
["goto_prefs"] = function() {
503 hotkey_actions
["select_article_cursor"] = function() {
504 var id
= getArticleUnderPointer();
506 var row
= $("RROW-" + id
);
509 var cb
= dijit
.getEnclosingWidget(
510 row
.getElementsByClassName("rchk")[0]);
513 cb
.attr("checked", !cb
.attr("checked"));
514 toggleSelectRowById(cb
, "RROW-" + id
);
520 hotkey_actions
["create_label"] = function() {
523 hotkey_actions
["create_filter"] = function() {
526 hotkey_actions
["collapse_sidebar"] = function() {
529 hotkey_actions
["toggle_embed_original"] = function() {
530 if (typeof embedOriginalArticle
!= "undefined") {
531 if (getActiveArticleId())
532 embedOriginalArticle(getActiveArticleId());
534 alert(__("Please enable embed_original plugin first."));
537 hotkey_actions
["toggle_widescreen"] = function() {
539 _widescreen_mode
= !_widescreen_mode
;
541 // reset stored sizes because geometry changed
542 setCookie("ttrss_ci_width", 0);
543 setCookie("ttrss_ci_height", 0);
545 switchPanelMode(_widescreen_mode
);
547 alert(__("Widescreen is not available in combined mode."));
550 hotkey_actions
["help_dialog"] = function() {
553 hotkey_actions
["toggle_combined_mode"] = function() {
554 notify_progress("Loading, please wait...");
556 var value
= isCdmMode() ? "false" : "true";
557 var query
= "?op=rpc&method=setpref&key=COMBINED_DISPLAY_MODE&value=" + value
;
559 new Ajax
.Request("backend.php", {
561 onComplete: function(transport
) {
562 setInitParam("combined_display_mode",
563 !getInitParam("combined_display_mode"));
570 hotkey_actions
["toggle_cdm_expanded"] = function() {
571 notify_progress("Loading, please wait...");
573 var value
= getInitParam("cdm_expanded") ? "false" : "true";
574 var query
= "?op=rpc&method=setpref&key=CDM_EXPANDED&value=" + value
;
576 new Ajax
.Request("backend.php", {
578 onComplete: function(transport
) {
579 setInitParam("cdm_expanded", !getInitParam("cdm_expanded"));
585 function init_second_stage() {
591 if (parseInt(getCookie("ttrss_fh_width")) > 0) {
592 dijit
.byId("feeds-holder").domNode
.setStyle(
593 {width
: getCookie("ttrss_fh_width") + "px" });
596 dijit
.byId("main").resize();
598 var tmph
= dojo
.connect(dijit
.byId('feeds-holder'), 'resize',
600 if (args
&& args
.w
>= 0) {
601 setCookie("ttrss_fh_width", args
.w
, getInitParam("cookie_lifetime"));
605 var tmph
= dojo
.connect(dijit
.byId('content-insert'), 'resize',
607 if (args
&& args
.w
>= 0 && args
.h
>= 0) {
608 setCookie("ttrss_ci_width", args
.w
, getInitParam("cookie_lifetime"));
609 setCookie("ttrss_ci_height", args
.h
, getInitParam("cookie_lifetime"));
613 delCookie("ttrss_test");
615 var toolbar
= document
.forms
["main_toolbar_form"];
617 dijit
.getEnclosingWidget(toolbar
.view_mode
).attr('value',
618 getInitParam("default_view_mode"));
620 dijit
.getEnclosingWidget(toolbar
.order_by
).attr('value',
621 getInitParam("default_view_order_by"));
623 feeds_sort_by_unread
= getInitParam("feeds_sort_by_unread") == 1;
625 var hash_feed_id
= hash_get('f');
626 var hash_feed_is_cat
= hash_get('c') == "1";
628 if (hash_feed_id
!= undefined) {
629 setActiveFeedId(hash_feed_id
, hash_feed_is_cat
);
632 loading_set_progress(50);
634 // can't use cache_clear() here because viewfeed might not have initialized yet
635 if ('sessionStorage' in window
&& window
['sessionStorage'] !== null)
636 sessionStorage
.clear();
638 var hotkeys
= getInitParam("hotkeys");
641 for (sequence
in hotkeys
[1]) {
642 filtered
= sequence
.replace(/\|.*$/, "");
643 tmp
[filtered
] = hotkeys
[1][sequence
];
647 setInitParam("hotkeys", hotkeys
);
649 _widescreen_mode
= getInitParam("widescreen");
650 switchPanelMode(_widescreen_mode
);
652 console
.log("second stage ok");
654 if (getInitParam("simple_update")) {
655 console
.log("scheduling simple feed updater...");
656 window
.setTimeout("update_random_feed()", 30*1000);
660 exception_error("init_second_stage", e
);
664 function quickMenuGo(opid
) {
674 displayDlg(__("Tag cloud"), "printTagCloud");
683 window
.location
.href
= "backend.php?op=digest";
686 if (activeFeedIsCat())
687 alert(__("You can't edit this kind of feed."));
689 editFeed(getActiveFeedId());
691 case "qmcRemoveFeed":
692 var actid
= getActiveFeedId();
694 if (activeFeedIsCat()) {
695 alert(__("You can't unsubscribe from the category."));
700 alert(__("Please select some feed first."));
704 var fn
= getFeedName(actid
);
706 var pr
= __("Unsubscribe from %s?").replace("%s", fn
);
709 unsubscribeFeed(actid
);
712 case "qmcCatchupAll":
715 case "qmcShowOnlyUnread":
724 case "qmcRescoreFeed":
725 rescoreCurrentFeed();
727 case "qmcToggleWidescreen":
729 _widescreen_mode
= !_widescreen_mode
;
731 // reset stored sizes because geometry changed
732 setCookie("ttrss_ci_width", 0);
733 setCookie("ttrss_ci_height", 0);
735 switchPanelMode(_widescreen_mode
);
737 alert(__("Widescreen is not available in combined mode."));
744 console
.log("quickMenuGo: unknown action: " + opid
);
748 exception_error("quickMenuGo", e
);
752 function toggleDispRead() {
755 var hide
= !(getInitParam("hide_read_feeds") == "1");
757 hideOrShowFeeds(hide
);
759 var query
= "?op=rpc&method=setpref&key=HIDE_READ_FEEDS&value=" +
762 setInitParam("hide_read_feeds", hide
);
764 new Ajax
.Request("backend.php", {
766 onComplete: function(transport
) {
770 exception_error("toggleDispRead", e
);
774 function parse_runtime_info(data
) {
776 //console.log("parsing runtime info...");
781 // console.log("RI: " + k + " => " + v);
783 if (k
== "dep_ts" && parseInt(getInitParam("dep_ts")) > 0) {
784 if (parseInt(getInitParam("dep_ts")) < parseInt(v
) && getInitParam("reload_on_ts_change")) {
785 window
.location
.reload();
789 if (k
== "daemon_is_running" && v
!= 1) {
790 notify_error("<span onclick=\"explainError(1)\">Update daemon is not running.</span>", true);
794 if (k
== "update_result") {
795 var updatesIcon
= dijit
.byId("updatesIcon").domNode
;
798 Element
.show(updatesIcon
);
800 Element
.hide(updatesIcon
);
804 if (k
== "daemon_stamp_ok" && v
!= 1) {
805 notify_error("<span onclick=\"explainError(3)\">Update daemon is not updating feeds.</span>", true);
809 if (k
== "max_feed_id" || k
== "num_feeds") {
810 if (init_params
[k
] != v
) {
811 console
.log("feed count changed, need to reload feedlist.");
820 PluginHost
.run(PluginHost
.HOOK_RUNTIME_INFO_LOADED
, data
);
823 function collapse_feedlist() {
826 Element
.toggle("feeds-holder");
828 dijit
.byId("main").resize();
831 exception_error("collapse_feedlist", e
);
835 function viewModeChanged() {
837 return viewCurrentFeed('');
840 function rescoreCurrentFeed() {
842 var actid
= getActiveFeedId();
844 if (activeFeedIsCat() || actid
< 0) {
845 alert(__("You can't rescore this kind of feed."));
850 alert(__("Please select some feed first."));
854 var fn
= getFeedName(actid
);
855 var pr
= __("Rescore articles in %s?").replace("%s", fn
);
858 notify_progress("Rescoring articles...");
860 var query
= "?op=pref-feeds&method=rescore&quiet=1&ids=" + actid
;
862 new Ajax
.Request("backend.php", {
864 onComplete: function(transport
) {
870 function hotkey_handler(e
) {
873 if (e
.target
.nodeName
== "INPUT" || e
.target
.nodeName
== "TEXTAREA") return;
876 var shift_key
= false;
877 var ctrl_key
= false;
879 var meta_key
= false;
881 var cmdline
= $('cmdline');
883 shift_key
= e
.shiftKey
;
884 ctrl_key
= e
.ctrlKey
;
886 meta_key
= e
.metaKey
;
889 keycode
= window
.event
.keyCode
;
894 var keychar
= String
.fromCharCode(keycode
);
896 if (keycode
== 27) { // escape
897 hotkey_prefix
= false;
900 if (keycode
== 16) return; // ignore lone shift
901 if (keycode
== 17) return; // ignore lone ctrl
903 keychar
= keychar
.toLowerCase();
905 var hotkeys
= getInitParam("hotkeys");
907 if (!hotkey_prefix
&& hotkeys
[0].indexOf(keychar
) != -1) {
909 var date
= new Date();
910 var ts
= Math
.round(date
.getTime() / 1000);
912 hotkey_prefix
= keychar
;
913 hotkey_prefix_pressed
= ts
;
915 cmdline
.innerHTML
= keychar
;
916 Element
.show(cmdline
);
921 Element
.hide(cmdline
);
923 var hotkey
= keychar
.search(/[a-zA-Z0-9]/) != -1 ? keychar
: "(" + keycode
+ ")";
925 // ensure ^*char notation
926 if (shift_key
) hotkey
= "*" + hotkey
;
927 if (ctrl_key
) hotkey
= "^" + hotkey
;
928 if (alt_key
) hotkey
= "+" + hotkey
;
929 if (meta_key
) hotkey
= "%" + hotkey
;
931 hotkey
= hotkey_prefix
? hotkey_prefix
+ " " + hotkey
: hotkey
;
932 hotkey_prefix
= false;
934 var hotkey_action
= false;
935 var hotkeys
= getInitParam("hotkeys");
937 for (sequence
in hotkeys
[1]) {
938 if (sequence
== hotkey
) {
939 hotkey_action
= hotkeys
[1][sequence
];
944 var action
= hotkey_actions
[hotkey_action
];
946 if (action
!= null) {
952 exception_error("hotkey_handler", e
);
956 function inPreferences() {
960 function reverseHeadlineOrder() {
963 /* var query_str = "?op=rpc&method=togglepref&key=REVERSE_HEADLINES";
965 new Ajax.Request("backend.php", {
966 parameters: query_str,
967 onComplete: function(transport) {
971 var toolbar
= document
.forms
["main_toolbar_form"];
972 var order_by
= dijit
.getEnclosingWidget(toolbar
.order_by
);
974 var value
= order_by
.attr('value');
976 if (value
== "date_reverse")
979 value
= "date_reverse";
981 order_by
.attr('value', value
);
986 exception_error("reverseHeadlineOrder", e
);
990 function handle_rpc_json(transport
, scheduled_call
) {
992 var reply
= JSON
.parse(transport
.responseText
);
994 var netalert_dijit
= dijit
.byId("net-alert");
995 var netalert
= false;
998 netalert
= netalert_dijit
.domNode
;
1002 var error
= reply
['error'];
1005 var code
= error
['code'];
1006 var msg
= error
['msg'];
1008 console
.warn("[handle_rpc_json] received fatal error " + code
+ "/" + msg
);
1011 fatalError(code
, msg
);
1016 var seq
= reply
['seq'];
1019 if (get_seq() != seq
) {
1020 console
.log("[handle_rpc_json] sequence mismatch: " + seq
+
1021 " (want: " + get_seq() + ")");
1026 var message
= reply
['message'];
1029 if (message
== "UPDATE_COUNTERS") {
1030 console
.log("need to refresh counters...");
1031 setInitParam("last_article_id", -1);
1032 request_counters(true);
1036 var counters
= reply
['counters'];
1039 parse_counters(counters
, scheduled_call
);
1041 var runtime_info
= reply
['runtime-info'];
1044 parse_runtime_info(runtime_info
);
1046 if (netalert
) Element
.hide(netalert
);
1050 Element
.show(netalert
);
1052 notify_error("Communication problem with server.");
1057 Element
.show(netalert
);
1059 notify_error("Communication problem with server.");
1062 //exception_error("handle_rpc_json", e, transport);
1068 function switchPanelMode(wide
) {
1070 if (isCdmMode()) return;
1072 article_id
= getActiveArticleId();
1075 dijit
.byId("headlines-wrap-inner").attr("design", 'sidebar');
1076 dijit
.byId("content-insert").attr("region", "trailing");
1078 dijit
.byId("content-insert").domNode
.setStyle({width
: '50%',
1080 borderTopWidth
: '0px' });
1082 if (parseInt(getCookie("ttrss_ci_width")) > 0) {
1083 dijit
.byId("content-insert").domNode
.setStyle(
1084 {width
: getCookie("ttrss_ci_width") + "px" });
1087 $("headlines-frame").setStyle({ borderBottomWidth
: '0px' });
1088 $("headlines-frame").addClassName("wide");
1092 dijit
.byId("content-insert").attr("region", "bottom");
1094 dijit
.byId("content-insert").domNode
.setStyle({width
: 'auto',
1096 borderTopWidth
: '0px'});
1098 if (parseInt(getCookie("ttrss_ci_height")) > 0) {
1099 dijit
.byId("content-insert").domNode
.setStyle(
1100 {height
: getCookie("ttrss_ci_height") + "px" });
1103 $("headlines-frame").setStyle({ borderBottomWidth
: '1px' });
1104 $("headlines-frame").removeClassName("wide");
1108 closeArticlePanel();
1110 if (article_id
) view(article_id
);
1112 new Ajax
.Request("backend.php", {
1113 parameters
: "op=rpc&method=setpanelmode&wide=" + (wide
? 1 : 0),
1114 onComplete: function(transport
) {
1115 console
.log(transport
.responseText
);
1120 exception_error("switchPanelMode", e
);
1124 function update_random_feed() {
1126 console
.log("in update_random_feed");
1128 new Ajax
.Request("backend.php", {
1129 parameters
: "op=rpc&method=updateRandomFeed",
1130 onComplete: function(transport
) {
1131 handle_rpc_json(transport
, true);
1132 window
.setTimeout("update_random_feed()", 30*1000);
1136 exception_error("update_random_feed", e
);
1140 function hash_get(key
) {
1142 kv
= window
.location
.hash
.substring(1).toQueryParams();
1145 exception_error("hash_get", e
);
1148 function hash_set(key
, value
) {
1150 kv
= window
.location
.hash
.substring(1).toQueryParams();
1152 window
.location
.hash
= $H(kv
).toQueryString();
1154 exception_error("hash_set", e
);