]>
git.wh0rd.org - tt-rss.git/blob - viewfeed.js
1 var active_post_id
= false;
3 var article_cache
= new Array();
5 var vgroup_last_feed
= false;
6 var post_under_pointer
= false;
8 var last_requested_article
= false;
10 var catchup_id_batch
= [];
11 var catchup_timeout_id
= false;
12 var feed_precache_timeout_id
= false;
13 var precache_idle_timeout_id
= false;
15 var cids_requested
= [];
17 var has_storage
= 'sessionStorage' in window
&& window
['sessionStorage'] !== null;
19 function headlines_callback2(transport
, offset
, background
, infscroll_req
) {
21 handle_rpc_json(transport
);
23 loading_set_progress(25);
25 console
.log("headlines_callback2 [offset=" + offset
+ "] B:" + background
+ " I:" + infscroll_req
);
33 reply
= JSON
.parse(transport
.responseText
);
40 is_cat
= reply
['headlines']['is_cat'];
41 feed_id
= reply
['headlines']['id'];
44 var content
= reply
['headlines']['content'];
46 if (getInitParam("cdm_auto_catchup") == 1) {
47 content
= content
+ "<div id='headlines-spacer'></div>";
50 cache_headlines(feed_id
, is_cat
, reply
['headlines']['toolbar'], content
);
54 setActiveFeedId(feed_id
, is_cat
);
57 if (offset
== 0 && infscroll_req
== false) {
58 $("headlines-frame").scrollTop
= 0;
62 var headlines_count
= reply
['headlines-info']['count'];
64 vgroup_last_feed
= reply
['headlines-info']['vgroup_last_feed'];
66 if (parseInt(headlines_count
) < getInitParam("default_article_limit")) {
67 _infscroll_disable
= 1;
69 _infscroll_disable
= 0;
72 var counters
= reply
['counters'];
73 var articles
= reply
['articles'];
74 var runtime_info
= reply
['runtime-info'];
76 if (offset
== 0 && infscroll_req
== false) {
77 dijit
.byId("headlines-frame").attr('content',
78 reply
['headlines']['content']);
80 dijit
.byId("headlines-toolbar").attr('content',
81 reply
['headlines']['toolbar']);
84 if (getInitParam("cdm_auto_catchup") == 1) {
85 var hsp
= $("headlines-spacer");
86 if (!hsp
) hsp
= new Element("DIV", {"id": "headlines-spacer"});
87 dijit
.byId('headlines-frame').domNode
.appendChild(hsp
);
94 if (headlines_count
> 0 && feed_id
== getActiveFeedId() && is_cat
== activeFeedIsCat()) {
95 console
.log("adding some more headlines...");
97 var c
= dijit
.byId("headlines-frame");
98 var ids
= getSelectedArticleIds2();
100 $("headlines-tmp").innerHTML
= reply
['headlines']['content'];
102 var hsp
= $("headlines-spacer");
105 c
.domNode
.removeChild(hsp
);
107 $$("#headlines-tmp > div").each(function(row
) {
108 if ($$("#headlines-frame DIV[id="+row
.id
+"]").length
== 0) {
109 row
.style
.display
= 'none';
110 c
.domNode
.appendChild(row
);
112 row
.parentNode
.removeChild(row
);
116 if (!hsp
) hsp
= new Element("DIV", {"id": "headlines-spacer"});
118 fixHeadlinesOrder(getLoadedArticleIds());
120 if (getInitParam("cdm_auto_catchup") == 1) {
121 c
.domNode
.appendChild(hsp
);
124 console
.log("restore selected ids: " + ids
);
126 for (var i
= 0; i
< ids
.length
; i
++) {
127 markHeadline(ids
[i
]);
132 $$("#headlines-frame > div[id*=RROW]").each(
134 if (!Element
.visible(child
))
135 new Effect
.Appear(child
, { duration
: 0.5 });
139 console
.log("no new headlines received");
141 var hsp
= $("headlines-spacer");
143 if (hsp
) hsp
.innerHTML
= "";
147 if (headlines_count
> 0)
148 cache_headlines(feed_id
, is_cat
, reply
['headlines']['toolbar'], $("headlines-frame").innerHTML
);
151 for (var i
= 0; i
< articles
.length
; i
++) {
152 var a_id
= articles
[i
]['id'];
153 cache_set("article:" + a_id
, articles
[i
]['content']);
156 console
.log("no cached articles received");
159 // do not precache stuff after fresh feed
161 precache_headlines();
164 parse_counters(counters
);
169 console
.error("Invalid object received: " + transport
.responseText
);
170 dijit
.byId("headlines-frame").attr('content', "<div class='whiteBox'>" +
171 __('Could not update headlines (invalid object received - see error console for details)') +
175 _infscroll_request_sent
= 0;
180 exception_error("headlines_callback2", e
, transport
);
184 function render_article(article
) {
186 dijit
.byId("headlines-wrap-inner").addChild(
187 dijit
.byId("content-insert"));
189 var c
= dijit
.byId("content-insert");
192 c
.domNode
.scrollTop
= 0;
195 c
.attr('content', article
);
197 correctHeadlinesOffset(getActiveArticleId());
204 exception_error("render_article", e
);
208 function showArticleInHeadlines(id
) {
212 selectArticles("none");
214 var crow
= $("RROW-" + id
);
218 var article_is_unread
= crow
.hasClassName("Unread");
220 crow
.removeClassName("Unread");
222 selectArticles('none');
224 var upd_img_pic
= $("FUPDPIC-" + id
);
226 var view_mode
= false;
229 view_mode
= document
.forms
['main_toolbar_form'].view_mode
;
230 view_mode
= view_mode
[view_mode
.selectedIndex
].value
;
235 if (upd_img_pic
&& (upd_img_pic
.src
.match("updated.png") ||
236 upd_img_pic
.src
.match("fresh_sign.png"))) {
238 upd_img_pic
.src
= "images/blank_icon.gif";
240 cache_headlines(getActiveFeedId(), activeFeedIsCat(), null, $("headlines-frame").innerHTML
);
242 } else if (article_is_unread
&& view_mode
== "all_articles") {
243 cache_headlines(getActiveFeedId(), activeFeedIsCat(), null, $("headlines-frame").innerHTML
);
248 if (article_is_unread
)
249 _force_scheduled_update
= true;
252 exception_error("showArticleInHeadlines", e
);
256 function article_callback2(transport
, id
) {
258 console
.log("article_callback2 " + id
);
260 handle_rpc_json(transport
);
265 reply
= JSON
.parse(transport
.responseText
);
272 var upic
= $('FUPDPIC-' + id
);
274 if (upic
) upic
.src
= 'images/blank_icon.gif';
276 reply
.each(function(article
) {
277 if (active_post_id
== article
['id']) {
278 render_article(article
['content']);
280 cids_requested
.remove(article
['id']);
282 cache_set("article:" + article
['id'], article
['content']);
285 // if (id != last_requested_article) {
286 // console.log("requested article id is out of sequence, aborting");
291 console
.error("Invalid object received: " + transport
.responseText
);
293 render_article("<div class='whiteBox'>" +
294 __('Could not display article (invalid object received - see error console for details)') + "</div>");
300 if (!_infscroll_disable
&&
301 $$("#headlines-frame > div[id*=RROW]").last().hasClassName("Selected")) {
311 exception_error("article_callback2", e
, transport
);
317 console
.log("loading article: " + id
);
319 var cached_article
= cache_get("article:" + id
);
321 console
.log("cache check result: " + (cached_article
!= false));
325 var query
= "?op=view&id=" + param_escape(id
);
327 var neighbor_ids
= getRelativePostIds(id
);
329 /* only request uncached articles */
331 var cids_to_request
= [];
333 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
334 if (cids_requested
.indexOf(neighbor_ids
[i
]) == -1)
335 if (!cache_get("article:" + neighbor_ids
[i
])) {
336 cids_to_request
.push(neighbor_ids
[i
]);
337 cids_requested
.push(neighbor_ids
[i
]);
341 console
.log("additional ids: " + cids_to_request
.toString());
343 query
= query
+ "&cids=" + cids_to_request
.toString();
345 var crow
= $("RROW-" + id
);
346 var article_is_unread
= crow
.hasClassName("Unread");
349 showArticleInHeadlines(id
);
351 precache_headlines();
353 if (!cached_article
) {
355 var upic
= $('FUPDPIC-' + id
);
358 upic
.src
= getInitParam("sign_progress");
361 } else if (cached_article
&& article_is_unread
) {
363 query
= query
+ "&mode=prefetch";
365 render_article(cached_article
);
367 } else if (cached_article
) {
369 query
= query
+ "&mode=prefetch_old";
370 render_article(cached_article
);
372 // if we don't need to request any relative ids, we might as well skip
373 // the server roundtrip altogether
374 if (cids_to_request
.length
== 0) {
377 if (!_infscroll_disable
&&
378 $$("#headlines-frame > div[id*=RROW]").last().hasClassName("Selected")) {
390 last_requested_article
= id
;
394 new Ajax
.Request("backend.php", {
396 onComplete: function(transport
) {
397 article_callback2(transport
, id
);
403 exception_error("view", e
);
408 return toggleMark(id
);
412 return togglePub(id
);
415 function toggleMark(id
, client_only
) {
417 var query
= "?op=rpc&id=" + id
+ "&subop=mark";
419 var img
= $("FMPIC-" + id
);
423 if (img
.src
.match("mark_unset")) {
424 img
.src
= img
.src
.replace("mark_unset", "mark_set");
425 img
.alt
= __("Unstar article");
426 query
= query
+ "&mark=1";
429 img
.src
= img
.src
.replace("mark_set", "mark_unset");
430 img
.alt
= __("Star article");
431 query
= query
+ "&mark=0";
434 cache_headlines(getActiveFeedId(), activeFeedIsCat(), null, $("headlines-frame").innerHTML
);
437 new Ajax
.Request("backend.php", {
439 onComplete: function(transport
) {
440 handle_rpc_json(transport
);
445 exception_error("toggleMark", e
);
449 function togglePub(id
, client_only
, no_effects
, note
) {
451 var query
= "?op=rpc&id=" + id
+ "&subop=publ";
453 if (note
!= undefined) {
454 query
= query
+ "¬e=" + param_escape(note
);
456 query
= query
+ "¬e=undefined";
459 var img
= $("FPPIC-" + id
);
463 if (img
.src
.match("pub_unset") || note
!= undefined) {
464 img
.src
= img
.src
.replace("pub_unset", "pub_set");
465 img
.alt
= __("Unpublish article");
466 query
= query
+ "&pub=1";
469 img
.src
= img
.src
.replace("pub_set", "pub_unset");
470 img
.alt
= __("Publish article");
472 query
= query
+ "&pub=0";
475 cache_headlines(getActiveFeedId(), activeFeedIsCat(), null, $("headlines-frame").innerHTML
);
478 new Ajax
.Request("backend.php", {
480 onComplete: function(transport
) {
481 handle_rpc_json(transport
);
486 exception_error("togglePub", e
);
490 function moveToPost(mode
) {
494 var rows
= getVisibleArticleIds();
499 if (!$('RROW-' + active_post_id
)) {
500 active_post_id
= false;
503 if (active_post_id
== false) {
504 next_id
= getFirstVisibleHeadlineId();
505 prev_id
= getLastVisibleHeadlineId();
507 for (var i
= 0; i
< rows
.length
; i
++) {
508 if (rows
[i
] == active_post_id
) {
515 if (mode
== "next") {
519 cdmExpandArticle(next_id
);
520 cdmScrollToArticleId(next_id
);
523 correctHeadlinesOffset(next_id
);
524 view(next_id
, getActiveFeedId());
529 if (mode
== "prev") {
532 cdmExpandArticle(prev_id
);
533 cdmScrollToArticleId(prev_id
);
535 correctHeadlinesOffset(prev_id
);
536 view(prev_id
, getActiveFeedId());
542 exception_error("moveToPost", e
);
546 function toggleSelected(id
, force_on
) {
549 var cb
= $("RCHK-" + id
);
550 var row
= $("RROW-" + id
);
553 if (row
.hasClassName('Selected') && !force_on
) {
554 row
.removeClassName('Selected');
555 if (cb
) cb
.checked
= false;
557 row
.addClassName('Selected');
558 if (cb
) cb
.checked
= true;
562 exception_error("toggleSelected", e
);
566 function toggleUnread_afh(effect
) {
569 var elem
= effect
.element
;
570 elem
.style
.backgroundColor
= "";
573 exception_error("toggleUnread_afh", e
);
577 function toggleUnread(id
, cmode
, effect
) {
580 var row
= $("RROW-" + id
);
582 if (cmode
== undefined || cmode
== 2) {
583 if (row
.hasClassName("Unread")) {
584 row
.removeClassName("Unread");
587 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
588 afterFinish
: toggleUnread_afh
,
589 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
593 row
.addClassName("Unread");
596 } else if (cmode
== 0) {
598 row
.removeClassName("Unread");
601 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
602 afterFinish
: toggleUnread_afh
,
603 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
606 } else if (cmode
== 1) {
607 row
.addClassName("Unread");
610 if (cmode
== undefined) cmode
= 2;
612 var query
= "?op=rpc&subop=catchupSelected" +
613 "&cmode=" + param_escape(cmode
) + "&ids=" + param_escape(id
);
615 // notify_progress("Loading, please wait...");
617 new Ajax
.Request("backend.php", {
619 onComplete: function(transport
) {
620 handle_rpc_json(transport
);
626 exception_error("toggleUnread", e
);
630 function selectionRemoveLabel(id
, ids
) {
633 if (!ids
) var ids
= getSelectedArticleIds2();
635 if (ids
.length
== 0) {
636 alert(__("No articles are selected."));
640 var query
= "?op=rpc&subop=removeFromLabel&ids=" +
641 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
645 new Ajax
.Request("backend.php", {
647 onComplete: function(transport
) {
648 handle_rpc_json(transport
);
649 show_labels_in_headlines(transport
);
653 exception_error("selectionAssignLabel", e
);
658 function selectionAssignLabel(id
, ids
) {
661 if (!ids
) ids
= getSelectedArticleIds2();
663 if (ids
.length
== 0) {
664 alert(__("No articles are selected."));
668 var query
= "?op=rpc&subop=assignToLabel&ids=" +
669 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
673 new Ajax
.Request("backend.php", {
675 onComplete: function(transport
) {
676 handle_rpc_json(transport
);
677 show_labels_in_headlines(transport
);
681 exception_error("selectionAssignLabel", e
);
686 function selectionToggleUnread(set_state
, callback
, no_error
) {
688 var rows
= getSelectedArticleIds2();
690 if (rows
.length
== 0 && !no_error
) {
691 alert(__("No articles are selected."));
695 for (i
= 0; i
< rows
.length
; i
++) {
696 var row
= $("RROW-" + rows
[i
]);
698 if (set_state
== undefined) {
699 if (row
.hasClassName("Unread")) {
700 row
.removeClassName("Unread");
702 row
.addClassName("Unread");
706 if (set_state
== false) {
707 row
.removeClassName("Unread");
710 if (set_state
== true) {
711 row
.addClassName("Unread");
716 if (rows
.length
> 0) {
720 if (set_state
== undefined) {
722 } else if (set_state
== true) {
724 } else if (set_state
== false) {
728 var query
= "?op=rpc&subop=catchupSelected" +
729 "&cmode=" + cmode
+ "&ids=" + param_escape(rows
.toString());
731 notify_progress("Loading, please wait...");
733 new Ajax
.Request("backend.php", {
735 onComplete: function(transport
) {
736 handle_rpc_json(transport
);
737 if (callback
) callback(transport
);
743 exception_error("selectionToggleUnread", e
);
747 function selectionToggleMarked() {
750 var rows
= getSelectedArticleIds2();
752 if (rows
.length
== 0) {
753 alert(__("No articles are selected."));
757 for (i
= 0; i
< rows
.length
; i
++) {
758 toggleMark(rows
[i
], true, true);
761 if (rows
.length
> 0) {
763 var query
= "?op=rpc&subop=markSelected&ids=" +
764 param_escape(rows
.toString()) + "&cmode=2";
766 new Ajax
.Request("backend.php", {
768 onComplete: function(transport
) {
769 handle_rpc_json(transport
);
775 exception_error("selectionToggleMarked", e
);
779 function selectionTogglePublished() {
782 var rows
= getSelectedArticleIds2();
784 if (rows
.length
== 0) {
785 alert(__("No articles are selected."));
789 for (i
= 0; i
< rows
.length
; i
++) {
790 togglePub(rows
[i
], true, true);
793 if (rows
.length
> 0) {
795 var query
= "?op=rpc&subop=publishSelected&ids=" +
796 param_escape(rows
.toString()) + "&cmode=2";
798 new Ajax
.Request("backend.php", {
800 onComplete: function(transport
) {
801 handle_rpc_json(transport
);
807 exception_error("selectionToggleMarked", e
);
811 function getSelectedArticleIds2() {
815 $$("#headlines-frame > div[id*=RROW][class*=Selected]").each(
817 rv
.push(child
.id
.replace("RROW-", ""));
823 function getLoadedArticleIds() {
826 var children
= $$("#headlines-frame > div[id*=RROW-]");
828 children
.each(function(child
) {
829 rv
.push(child
.id
.replace("RROW-", ""));
836 // mode = all,none,unread,invert
837 function selectArticles(mode
) {
840 var children
= $$("#headlines-frame > div[id*=RROW]");
842 children
.each(function(child
) {
843 var id
= child
.id
.replace("RROW-", "");
844 var cb
= $("RCHK-" + id
);
847 child
.addClassName("Selected");
849 } else if (mode
== "unread") {
850 if (child
.hasClassName("Unread")) {
851 child
.addClassName("Selected");
854 child
.removeClassName("Selected");
857 } else if (mode
== "invert") {
858 if (child
.hasClassName("Selected")) {
859 child
.removeClassName("Selected");
862 child
.addClassName("Selected");
867 child
.removeClassName("Selected");
873 exception_error("selectArticles", e
);
877 function catchupPage() {
879 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
881 var str
= __("Mark all visible articles in %s as read?");
883 str
= str
.replace("%s", fn
);
885 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
889 selectArticles('all');
890 selectionToggleUnread(false, 'viewCurrentFeed()', true)
891 selectArticles('none');
894 function deleteSelection() {
898 var rows
= getSelectedArticleIds2();
900 if (rows
.length
== 0) {
901 alert(__("No articles are selected."));
905 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
909 if (getActiveFeedId() != 0) {
910 str
= __("Delete %d selected articles in %s?");
912 str
= __("Delete %d selected articles?");
915 str
= str
.replace("%d", rows
.length
);
916 str
= str
.replace("%s", fn
);
918 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
922 query
= "?op=rpc&subop=delete&ids=" + param_escape(rows
);
926 new Ajax
.Request("backend.php", {
928 onComplete: function(transport
) {
929 handle_rpc_json(transport
);
934 exception_error("deleteSelection", e
);
938 function archiveSelection() {
942 var rows
= getSelectedArticleIds2();
944 if (rows
.length
== 0) {
945 alert(__("No articles are selected."));
949 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
953 if (getActiveFeedId() != 0) {
954 str
= __("Archive %d selected articles in %s?");
957 str
= __("Move %d archived articles back?");
961 str
= str
.replace("%d", rows
.length
);
962 str
= str
.replace("%s", fn
);
964 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
968 query
= "?op=rpc&subop="+op
+"&ids=" + param_escape(rows
);
972 for (var i
= 0; i
< rows
.length
; i
++) {
973 cache_delete("article:" + rows
[i
]);
976 new Ajax
.Request("backend.php", {
978 onComplete: function(transport
) {
979 handle_rpc_json(transport
);
984 exception_error("archiveSelection", e
);
988 function catchupSelection() {
992 var rows
= getSelectedArticleIds2();
994 if (rows
.length
== 0) {
995 alert(__("No articles are selected."));
999 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1001 var str
= __("Mark %d selected articles in %s as read?");
1003 str
= str
.replace("%d", rows
.length
);
1004 str
= str
.replace("%s", fn
);
1006 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1010 selectionToggleUnread(false, 'viewCurrentFeed()', true)
1013 exception_error("catchupSelection", e
);
1017 function editArticleTags(id
) {
1018 var query
= "backend.php?op=dlg&id=editArticleTags¶m=" + param_escape(id
);
1020 if (dijit
.byId("editTagsDlg"))
1021 dijit
.byId("editTagsDlg").destroyRecursive();
1023 dialog
= new dijit
.Dialog({
1025 title
: __("Edit article Tags"),
1026 style
: "width: 600px",
1027 execute: function() {
1028 if (this.validate()) {
1029 var query
= dojo
.objectToQuery(this.attr('value'));
1031 notify_progress("Saving article tags...", true);
1033 new Ajax
.Request("backend.php", {
1035 onComplete: function(transport
) {
1039 var data
= JSON
.parse(transport
.responseText
);
1042 var tags_str
= article
.tags
;
1043 var id
= tags_str
.id
;
1045 var tags
= $("ATSTR-" + id
);
1046 var tooltip
= dijit
.byId("ATSTRTIP-" + id
);
1048 if (tags
) tags
.innerHTML
= tags_str
.content
;
1049 if (tooltip
) tooltip
.attr('label', tags_str
.content_full
);
1051 cache_delete("article:" + id
);
1060 var tmph
= dojo
.connect(dialog
, 'onLoad', function() {
1061 dojo
.disconnect(tmph
);
1063 new Ajax
.Autocompleter('tags_str', 'tags_choices',
1064 "backend.php?op=rpc&subop=completeTags",
1065 { tokens
: ',', paramName
: "search" });
1072 function cdmScrollToArticleId(id
) {
1074 var ctr
= $("headlines-frame");
1075 var e
= $("RROW-" + id
);
1077 if (!e
|| !ctr
) return;
1079 ctr
.scrollTop
= e
.offsetTop
;
1082 exception_error("cdmScrollToArticleId", e
);
1086 function getActiveArticleId() {
1087 return active_post_id
;
1090 function postMouseIn(id
) {
1091 post_under_pointer
= id
;
1094 function postMouseOut(id
) {
1095 post_under_pointer
= false;
1098 function headlines_scroll_handler(e
) {
1100 var hsp
= $("headlines-spacer");
1102 if (!_infscroll_disable
) {
1103 if (hsp
&& (e
.scrollTop
+ e
.offsetHeight
> hsp
.offsetTop
) ||
1104 e
.scrollTop
+ e
.offsetHeight
> e
.scrollHeight
- 100) {
1107 hsp
.innerHTML
= "<img src='images/indicator_tiny.gif'> " +
1108 __("Loading, please wait...");
1110 loadMoreHeadlines();
1114 if (hsp
) hsp
.innerHTML
= "";
1117 if (getInitParam("cdm_auto_catchup") == 1) {
1119 $$("#headlines-frame > div[id*=RROW][class*=Unread]").each(
1121 if ($("headlines-frame").scrollTop
>
1122 (child
.offsetTop
+ child
.offsetHeight
/2)) {
1124 var id
= child
.id
.replace("RROW-", "");
1126 if (catchup_id_batch
.indexOf(id
) == -1)
1127 catchup_id_batch
.push(id
);
1131 if (catchup_id_batch
.length
> 0 && !_infscroll_request_sent
) {
1132 window
.clearTimeout(catchup_timeout_id
);
1133 catchup_timeout_id
= window
.setTimeout('catchupBatchedArticles()',
1139 console
.warn("headlines_scroll_handler: " + e
);
1143 function catchupBatchedArticles() {
1145 if (catchup_id_batch
.length
> 0 && !_infscroll_request_sent
) {
1147 var query
= "?op=rpc&subop=catchupSelected" +
1148 "&cmode=0&ids=" + param_escape(catchup_id_batch
.toString());
1150 new Ajax
.Request("backend.php", {
1152 onComplete: function(transport
) {
1153 handle_rpc_json(transport
);
1155 catchup_id_batch
.each(function(id
) {
1156 var elem
= $("RROW-" + id
);
1157 if (elem
) elem
.removeClassName("Unread");
1160 catchup_id_batch
= [];
1165 exception_error("catchupBatchedArticles", e
);
1169 function catchupRelativeToArticle(below
) {
1174 if (!getActiveArticleId()) {
1175 alert(__("No article is selected."));
1179 var visible_ids
= getVisibleArticleIds();
1181 var ids_to_mark
= new Array();
1184 for (var i
= 0; i
< visible_ids
.length
; i
++) {
1185 if (visible_ids
[i
] != getActiveArticleId()) {
1186 var e
= $("RROW-" + visible_ids
[i
]);
1188 if (e
&& e
.hasClassName("Unread")) {
1189 ids_to_mark
.push(visible_ids
[i
]);
1196 for (var i
= visible_ids
.length
-1; i
>= 0; i
--) {
1197 if (visible_ids
[i
] != getActiveArticleId()) {
1198 var e
= $("RROW-" + visible_ids
[i
]);
1200 if (e
&& e
.hasClassName("Unread")) {
1201 ids_to_mark
.push(visible_ids
[i
]);
1209 if (ids_to_mark
.length
== 0) {
1210 alert(__("No articles found to mark"));
1212 var msg
= __("Mark %d article(s) as read?").replace("%d", ids_to_mark
.length
);
1214 if (getInitParam("confirm_feed_catchup") != 1 || confirm(msg
)) {
1216 for (var i
= 0; i
< ids_to_mark
.length
; i
++) {
1217 var e
= $("RROW-" + ids_to_mark
[i
]);
1218 e
.removeClassName("Unread");
1221 var query
= "?op=rpc&subop=catchupSelected" +
1222 "&cmode=0" + "&ids=" + param_escape(ids_to_mark
.toString());
1224 new Ajax
.Request("backend.php", {
1226 onComplete: function(transport
) {
1227 handle_rpc_json(transport
);
1234 exception_error("catchupRelativeToArticle", e
);
1238 function cdmExpandArticle(id
) {
1243 var elem
= $("CICD-" + active_post_id
);
1245 var upd_img_pic
= $("FUPDPIC-" + id
);
1247 if (upd_img_pic
&& (upd_img_pic
.src
.match("updated.png") ||
1248 upd_img_pic
.src
.match("fresh_sign.png"))) {
1250 upd_img_pic
.src
= "images/blank_icon.gif";
1253 if (id
== active_post_id
&& Element
.visible(elem
))
1256 selectArticles("none");
1258 var old_offset
= $("RROW-" + id
).offsetTop
;
1260 if (active_post_id
&& elem
&& !getInitParam("cdm_expanded")) {
1262 Element
.show("CEXC-" + active_post_id
);
1265 active_post_id
= id
;
1267 elem
= $("CICD-" + id
);
1269 if (!Element
.visible(elem
)) {
1271 Element
.hide("CEXC-" + id
);
1273 if ($("CWRAP-" + id
).innerHTML
== "") {
1275 $("FUPDPIC-" + id
).src
= "images/indicator_tiny.gif";
1277 $("CWRAP-" + id
).innerHTML
= "<div class=\"insensitive\">" +
1278 __("Loading, please wait...") + "</div>";
1280 var query
= "?op=rpc&subop=cdmGetArticle&id=" + param_escape(id
);
1282 var neighbor_ids
= getRelativePostIds(id
);
1284 /* only request uncached articles */
1285 var cids_to_request
= [];
1287 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
1288 if (cids_requested
.indexOf(neighbor_ids
[i
]) == -1)
1289 if ($("CWRAP-" + neighbor_ids
[i
]).innerHTML
== "") {
1290 cids_to_request
.push(neighbor_ids
[i
]);
1291 cids_requested
.push(neighbor_ids
[i
]);
1295 console
.log("additional ids: " + cids_to_request
.toString());
1297 query
= query
+ "&cids=" + cids_to_request
.toString();
1301 new Ajax
.Request("backend.php", {
1303 onComplete: function(transport
) {
1305 $("FUPDPIC-" + id
).src
= 'images/blank_icon.gif';
1307 handle_rpc_json(transport
);
1309 var reply
= JSON
.parse(transport
.responseText
);
1311 reply
.each(function(article
) {
1312 $("CWRAP-" + article
['id']).innerHTML
= article
['content']
1313 cids_requested
.remove(article
['id']);
1320 var new_offset
= $("RROW-" + id
).offsetTop
;
1322 $("headlines-frame").scrollTop
+= (new_offset
-old_offset
);
1324 if ($("RROW-" + id
).offsetTop
!= old_offset
)
1325 $("headlines-frame").scrollTop
= new_offset
;
1327 toggleUnread(id
, 0, true);
1331 exception_error("cdmExpandArticle", e
);
1337 function fixHeadlinesOrder(ids
) {
1339 for (var i
= 0; i
< ids
.length
; i
++) {
1340 var e
= $("RROW-" + ids
[i
]);
1344 e
.removeClassName("even");
1345 e
.addClassName("odd");
1347 e
.removeClassName("odd");
1348 e
.addClassName("even");
1353 exception_error("fixHeadlinesOrder", e
);
1357 function getArticleUnderPointer() {
1358 return post_under_pointer
;
1361 function zoomToArticle(event
, id
) {
1363 var cached_article
= cache_get("article: " + id
);
1365 if (dijit
.byId("ATAB-" + id
))
1366 if (!event
|| !event
.shiftKey
)
1367 return dijit
.byId("content-tabs").selectChild(dijit
.byId("ATAB-" + id
));
1369 if (dijit
.byId("ATSTRTIP-" + id
))
1370 dijit
.byId("ATSTRTIP-" + id
).destroyRecursive();
1372 if (cached_article
) {
1373 //closeArticlePanel();
1375 var article_pane
= new dijit
.layout
.ContentPane({
1376 title
: __("Loading...") , content
: cached_article
,
1377 style
: 'padding : 0px;',
1381 dijit
.byId("content-tabs").addChild(article_pane
);
1383 if (!event
|| !event
.shiftKey
)
1384 dijit
.byId("content-tabs").selectChild(article_pane
);
1386 if ($("PTITLE-" + id
))
1387 article_pane
.attr('title', $("PTITLE-" + id
).innerHTML
);
1391 var query
= "?op=rpc&subop=getArticles&ids=" + param_escape(id
);
1393 notify_progress("Loading, please wait...", true);
1395 new Ajax
.Request("backend.php", {
1397 onComplete: function(transport
) {
1400 var reply
= JSON
.parse(transport
.responseText
);
1403 //closeArticlePanel();
1405 var content
= reply
[0]['content'];
1407 var article_pane
= new dijit
.layout
.ContentPane({
1408 title
: "article-" + id
, content
: content
,
1409 style
: 'padding : 0px;',
1413 dijit
.byId("content-tabs").addChild(article_pane
);
1415 if (!event
|| !event
.shiftKey
)
1416 dijit
.byId("content-tabs").selectChild(article_pane
);
1418 if ($("PTITLE-" + id
))
1419 article_pane
.attr('title', $("PTITLE-" + id
).innerHTML
);
1426 exception_error("zoomToArticle", e
);
1430 function scrollArticle(offset
) {
1433 var ci
= $("content-insert");
1435 ci
.scrollTop
+= offset
;
1438 var hi
= $("headlines-frame");
1440 hi
.scrollTop
+= offset
;
1445 exception_error("scrollArticle", e
);
1449 function show_labels_in_headlines(transport
) {
1451 var data
= JSON
.parse(transport
.responseText
);
1454 data
['info-for-headlines'].each(function(elem
) {
1455 var ctr
= $("HLLCTR-" + elem
.id
);
1457 if (ctr
) ctr
.innerHTML
= elem
.labels
;
1460 cache_headlines(getActiveFeedId(), activeFeedIsCat(), null, $("headlines-frame").innerHTML
);
1464 exception_error("show_labels_in_headlines", e
);
1468 /* function toggleHeadlineActions() {
1470 var e = $("headlineActionsBody");
1471 var p = $("headlineActionsDrop");
1473 if (!Element.visible(e)) {
1480 e.style.left = (p.offsetLeft + 1) + "px";
1481 e.style.top = (p.offsetTop + p.offsetHeight + 2) + "px";
1484 exception_error("toggleHeadlineActions", e);
1488 /* function publishWithNote(id, def_note) {
1490 if (!def_note) def_note = '';
1492 var note = prompt(__("Please enter a note for this article:"), def_note);
1494 if (note != undefined) {
1495 togglePub(id, false, false, note);
1499 exception_error("publishWithNote", e);
1503 function emailArticle(id
) {
1506 var ids
= getSelectedArticleIds2();
1508 if (ids
.length
== 0) {
1509 alert(__("No articles are selected."));
1513 id
= ids
.toString();
1516 if (dijit
.byId("emailArticleDlg"))
1517 dijit
.byId("emailArticleDlg").destroyRecursive();
1519 var query
= "backend.php?op=dlg&id=emailArticle¶m=" + param_escape(id
);
1521 dialog
= new dijit
.Dialog({
1522 id
: "emailArticleDlg",
1523 title
: __("Forward article by email"),
1524 style
: "width: 600px",
1525 execute: function() {
1526 if (this.validate()) {
1528 new Ajax
.Request("backend.php", {
1529 parameters
: dojo
.objectToQuery(this.attr('value')),
1530 onComplete: function(transport
) {
1532 var reply
= JSON
.parse(transport
.responseText
);
1534 var error
= reply
['error'];
1537 alert(__('Error sending email:') + ' ' + error
);
1539 notify_info('Your message has been sent.');
1548 var tmph
= dojo
.connect(dialog
, 'onLoad', function() {
1549 dojo
.disconnect(tmph
);
1551 new Ajax
.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
1552 "backend.php?op=rpc&subop=completeEmails",
1553 { tokens
: '', paramName
: "search" });
1558 /* displayDlg('emailArticle', id,
1560 document.forms['article_email_form'].destination.focus();
1562 new Ajax.Autocompleter('destination', 'destination_choices',
1563 "backend.php?op=rpc&subop=completeEmails",
1564 { tokens: '', paramName: "search" });
1569 exception_error("emailArticle", e
);
1573 function dismissArticle(id
) {
1575 var elem
= $("RROW-" + id
);
1577 toggleUnread(id
, 0, true);
1579 new Effect
.Fade(elem
, {duration
: 0.5});
1581 active_post_id
= false;
1584 exception_error("dismissArticle", e
);
1588 function dismissSelectedArticles() {
1591 var ids
= getVisibleArticleIds();
1595 for (var i
= 0; i
< ids
.length
; i
++) {
1596 var elem
= $("RROW-" + ids
[i
]);
1598 if (elem
.className
&& elem
.hasClassName("Selected") &&
1599 ids
[i
] != active_post_id
) {
1600 new Effect
.Fade(elem
, {duration
: 0.5});
1608 selectionToggleUnread(false);
1610 fixHeadlinesOrder(tmp
);
1613 exception_error("dismissSelectedArticles", e
);
1617 function dismissReadArticles() {
1620 var ids
= getVisibleArticleIds();
1623 for (var i
= 0; i
< ids
.length
; i
++) {
1624 var elem
= $("RROW-" + ids
[i
]);
1626 if (elem
.className
&& !elem
.hasClassName("Unread") &&
1627 !elem
.hasClassName("Selected")) {
1629 new Effect
.Fade(elem
, {duration
: 0.5});
1635 fixHeadlinesOrder(tmp
);
1638 exception_error("dismissSelectedArticles", e
);
1642 function getVisibleArticleIds() {
1647 getLoadedArticleIds().each(function(id
) {
1648 var elem
= $("RROW-" + id
);
1649 if (elem
&& Element
.visible(elem
))
1654 exception_error("getVisibleArticleIds", e
);
1660 function cdmClicked(event
, id
) {
1662 var shift_key
= event
.shiftKey
;
1666 if (!event
.ctrlKey
) {
1668 if (!getInitParam("cdm_expanded")) {
1669 return cdmExpandArticle(id
);
1672 selectArticles("none");
1675 var elem
= $("RROW-" + id
);
1678 elem
.removeClassName("Unread");
1680 var upd_img_pic
= $("FUPDPIC-" + id
);
1682 if (upd_img_pic
&& (upd_img_pic
.src
.match("updated.png") ||
1683 upd_img_pic
.src
.match("fresh_sign.png"))) {
1685 upd_img_pic
.src
= "images/blank_icon.gif";
1688 active_post_id
= id
;
1690 var query
= "?op=rpc&subop=catchupSelected" +
1691 "&cmode=0&ids=" + param_escape(id
);
1693 new Ajax
.Request("backend.php", {
1695 onComplete: function(transport
) {
1696 handle_rpc_json(transport
);
1703 toggleSelected(id
, true);
1704 toggleUnread(id
, 0, false);
1705 zoomToArticle(event
, id
);
1709 exception_error("cdmClicked");
1715 function postClicked(event
, id
) {
1718 if (!event
.ctrlKey
) {
1721 postOpenInNewTab(event
, id
);
1726 exception_error("postClicked");
1730 function hlOpenInNewTab(event
, id
) {
1731 toggleUnread(id
, 0, false);
1732 zoomToArticle(event
, id
);
1735 function postOpenInNewTab(event
, id
) {
1736 closeArticlePanel(id
);
1737 zoomToArticle(event
, id
);
1740 function hlClicked(event
, id
) {
1742 if (event
.which
== 2) {
1745 } else if (event
.altKey
) {
1746 openArticleInNewWindow(id
);
1747 } else if (!event
.ctrlKey
) {
1752 toggleUnread(id
, 0, false);
1753 zoomToArticle(event
, id
);
1758 exception_error("hlClicked");
1762 function getFirstVisibleHeadlineId() {
1763 var rows
= getVisibleArticleIds();
1768 function getLastVisibleHeadlineId() {
1769 var rows
= getVisibleArticleIds();
1770 return rows
[rows
.length
-1];
1773 function openArticleInNewWindow(id
) {
1774 toggleUnread(id
, 0, false);
1775 window
.open("backend.php?op=la&id=" + id
);
1778 function isCdmMode() {
1779 return getInitParam("combined_display_mode");
1782 function markHeadline(id
) {
1783 var row
= $("RROW-" + id
);
1785 var check
= $("RCHK-" + id
);
1788 check
.checked
= true;
1791 row
.addClassName("Selected");
1795 function getRelativePostIds(id
, limit
) {
1801 if (!limit
) limit
= 6; //3
1803 var ids
= getVisibleArticleIds();
1805 for (var i
= 0; i
< ids
.length
; i
++) {
1807 for (var k
= 1; k
<= limit
; k
++) {
1808 //if (i > k-1) tmp.push(ids[i-k]);
1809 if (i
< ids
.length
-k
) tmp
.push(ids
[i
+k
]);
1816 exception_error("getRelativePostIds", e
);
1822 function correctHeadlinesOffset(id
) {
1826 var container
= $("headlines-frame");
1827 var row
= $("RROW-" + id
);
1829 var viewport
= container
.offsetHeight
;
1831 var rel_offset_top
= row
.offsetTop
- container
.scrollTop
;
1832 var rel_offset_bottom
= row
.offsetTop
+ row
.offsetHeight
- container
.scrollTop
;
1834 //console.log("Rtop: " + rel_offset_top + " Rbtm: " + rel_offset_bottom);
1835 //console.log("Vport: " + viewport);
1837 if (rel_offset_top
<= 0 || rel_offset_top
> viewport
) {
1838 container
.scrollTop
= row
.offsetTop
;
1839 } else if (rel_offset_bottom
> viewport
) {
1841 /* doesn't properly work with Opera in some cases because
1842 Opera fucks up element scrolling */
1844 container
.scrollTop
= row
.offsetTop
+ row
.offsetHeight
- viewport
;
1848 exception_error("correctHeadlinesOffset", e
);
1853 function headlineActionsChange(elem
) {
1856 elem
.attr('value', 'false');
1858 exception_error("headlineActionsChange", e
);
1862 function closeArticlePanel() {
1864 var tabs
= dijit
.byId("content-tabs");
1865 var child
= tabs
.selectedChildWidget
;
1867 if (child
&& tabs
.getIndexOfChild(child
) > 0) {
1868 tabs
.removeChild(child
);
1871 if (dijit
.byId("content-insert"))
1872 dijit
.byId("headlines-wrap-inner").removeChild(
1873 dijit
.byId("content-insert"));
1877 function initHeadlinesMenu() {
1879 if (dijit
.byId("headlinesMenu"))
1880 dijit
.byId("headlinesMenu").destroyRecursive();
1885 nodes
= $$("#headlines-frame > div[id*=RROW]");
1887 nodes
= $$("#headlines-frame span[id*=RTITLE]");
1890 nodes
.each(function(node
) {
1894 var menu
= new dijit
.Menu({
1895 id
: "headlinesMenu",
1899 var tmph
= dojo
.connect(menu
, '_openMyself', function (event
) {
1900 var callerNode
= event
.target
, match
= null, tries
= 0;
1902 while (match
== null && callerNode
&& tries
<= 3) {
1903 match
= callerNode
.id
.match("^[A-Z]+[-]([0-9]+)$");
1904 callerNode
= callerNode
.parentNode
;
1908 if (match
) this.callerRowId
= parseInt(match
[1]);
1912 /* if (!isCdmMode())
1913 menu.addChild(new dijit.MenuItem({
1914 label: __("View article"),
1915 onClick: function(event) {
1916 view(this.getParent().callerRowId);
1919 menu
.addChild(new dijit
.MenuItem({
1920 label
: __("Open original article"),
1921 onClick: function(event
) {
1922 openArticleInNewWindow(this.getParent().callerRowId
);
1925 menu
.addChild(new dijit
.MenuItem({
1926 label
: __("View in a tt-rss tab"),
1927 onClick: function(event
) {
1928 hlOpenInNewTab(event
, this.getParent().callerRowId
);
1931 // menu.addChild(new dijit.MenuSeparator());
1933 var labels
= dijit
.byId("feedTree").model
.getItemsInCategory(-2);
1937 menu
.addChild(new dijit
.MenuSeparator());
1939 var labelAddMenu
= new dijit
.Menu({ownerMenu
: menu
});
1940 var labelDelMenu
= new dijit
.Menu({ownerMenu
: menu
});
1942 labels
.each(function(label
) {
1943 var id
= label
.id
[0];
1944 var bare_id
= id
.substr(id
.indexOf(":")+1);
1945 var name
= label
.name
[0];
1947 bare_id
= -11-bare_id
;
1949 labelAddMenu
.addChild(new dijit
.MenuItem({
1952 onClick: function(event
) {
1953 selectionAssignLabel(this.labelId
,
1954 [this.getParent().ownerMenu
.callerRowId
]);
1957 labelDelMenu
.addChild(new dijit
.MenuItem({
1960 onClick: function(event
) {
1961 selectionRemoveLabel(this.labelId
,
1962 [this.getParent().ownerMenu
.callerRowId
]);
1967 menu
.addChild(new dijit
.PopupMenuItem({
1968 label
: __("Assign label"),
1969 popup
: labelAddMenu
,
1972 menu
.addChild(new dijit
.PopupMenuItem({
1973 label
: __("Remove label"),
1974 popup
: labelDelMenu
,
1982 exception_error("initHeadlinesMenu", e
);
1986 function tweetArticle(id
) {
1988 var query
= "?op=rpc&subop=getTweetInfo&id=" + param_escape(id
);
1993 var ts
= d
.getTime();
1995 var w
= window
.open('backend.php?op=loading', 'ttrss_tweet',
1996 "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0");
1998 new Ajax
.Request("backend.php", {
2000 onComplete: function(transport
) {
2001 var ti
= JSON
.parse(transport
.responseText
);
2003 var share_url
= "http://twitter.com/share?_=" + ts
+
2004 "&text=" + param_escape(ti
.title
) +
2005 "&url=" + param_escape(ti
.link
);
2007 w
.location
.href
= share_url
;
2013 exception_error("tweetArticle", e
);
2017 function editArticleNote(id
) {
2020 var query
= "backend.php?op=dlg&id=editArticleNote¶m=" + param_escape(id
);
2022 if (dijit
.byId("editNoteDlg"))
2023 dijit
.byId("editNoteDlg").destroyRecursive();
2025 dialog
= new dijit
.Dialog({
2027 title
: __("Edit article note"),
2028 style
: "width: 600px",
2029 execute: function() {
2030 if (this.validate()) {
2031 var query
= dojo
.objectToQuery(this.attr('value'));
2033 notify_progress("Saving article note...", true);
2035 new Ajax
.Request("backend.php", {
2037 onComplete: function(transport
) {
2041 var reply
= JSON
.parse(transport
.responseText
);
2043 cache_delete("article:" + id
);
2045 var elem
= $("POSTNOTE-" + id
);
2049 elem
.innerHTML
= reply
.note
;
2051 if (reply
.raw_length
!= 0)
2052 new Effect
.Appear(elem
);
2064 exception_error("editArticleNote", e
);
2068 function player(elem
) {
2069 var aid
= elem
.getAttribute("audio-id");
2070 var status
= elem
.getAttribute("status");
2078 elem
.innerHTML
= __("Playing...");
2079 elem
.title
= __("Click to pause");
2080 elem
.addClassName("playing");
2084 elem
.innerHTML
= __("Play");
2085 elem
.title
= __("Click to play");
2086 elem
.removeClassName("playing");
2089 elem
.setAttribute("status", status
);
2091 alert("Your browser doesn't seem to support HTML5 audio.");
2095 function cache_set(id
, obj
) {
2096 //console.log("cache_set: " + id);
2099 sessionStorage
[id
] = obj
;
2101 sessionStorage
.clear();
2105 function cache_get(id
) {
2107 return sessionStorage
[id
];
2110 function cache_clear() {
2112 sessionStorage
.clear();
2115 function cache_delete(id
) {
2117 sessionStorage
.removeItem(id
);
2120 function cache_headlines(feed
, is_cat
, toolbar_obj
, content_obj
) {
2121 if (toolbar_obj
&& content_obj
) {
2122 cache_set("feed:" + feed
+ ":" + is_cat
,
2123 JSON
.stringify({toolbar
: toolbar_obj
, content
: content_obj
}));
2126 obj
= cache_get("feed:" + feed
+ ":" + is_cat
);
2129 obj
= JSON
.parse(obj
);
2131 if (toolbar_obj
) obj
.toolbar
= toolbar_obj
;
2132 if (content_obj
) obj
.content
= content_obj
;
2134 cache_set("feed:" + feed
+ ":" + is_cat
, JSON
.stringify(obj
));
2138 console
.warn("cache_headlines failed: " + e
);
2143 function render_local_headlines(feed
, is_cat
, obj
) {
2146 dijit
.byId("headlines-toolbar").attr('content',
2149 dijit
.byId("headlines-frame").attr('content',
2152 dojo
.parser
.parse('headlines-toolbar');
2154 $("headlines-frame").scrollTop
= 0;
2155 selectArticles('none');
2156 setActiveFeedId(feed
, is_cat
);
2157 initHeadlinesMenu();
2159 precache_headlines();
2162 exception_error("render_local_headlines", e
);
2166 function precache_headlines_idle() {
2168 if (!feed_precache_timeout_id
) {
2169 var feeds
= dijit
.byId("feedTree").getVisibleUnreadFeeds();
2172 feeds
.each(function(item
) {
2173 if (parseInt(item
[0]) > 0 && !cache_get("feed:" + item
[0] + ":" + item
[1]))
2174 uncached
.push(item
);
2177 if (uncached
.length
> 0) {
2178 var rf
= uncached
[Math
.floor(Math
.random()*uncached
.length
)];
2179 viewfeed(rf
[0], '', rf
[1], 0, true);
2182 precache_idle_timeout_id
= setTimeout("precache_headlines_idle()", 5000);
2185 exception_error("precache_headlines_idle", e
);
2189 function precache_headlines() {
2192 if (!feed_precache_timeout_id
) {
2193 feed_precache_timeout_id
= window
.setTimeout(function() {
2194 var nuf
= getNextUnreadFeed(getActiveFeedId(), activeFeedIsCat());
2195 var nf
= dijit
.byId("feedTree").getNextFeed(getActiveFeedId(), activeFeedIsCat());
2197 if (nuf
&& !cache_get("feed:" + nuf
+ ":" + activeFeedIsCat()))
2198 viewfeed(nuf
, '', activeFeedIsCat(), 0, true);
2200 if (nf
!= nuf
&& nf
&& !cache_get("feed:" + nf
[0] + ":" + nf
[1]))
2201 viewfeed(nf
[0], '', nf
[1], 0, true);
2203 window
.setTimeout(function() {
2204 feed_precache_timeout_id
= false;
2210 exception_error("precache_headlines", e
);
2214 function shareArticle(id
) {
2216 if (dijit
.byId("shareArticleDlg"))
2217 dijit
.byId("shareArticleDlg").destroyRecursive();
2219 var query
= "backend.php?op=dlg&id=shareArticle¶m=" + param_escape(id
);
2221 dialog
= new dijit
.Dialog({
2222 id
: "shareArticleDlg",
2223 title
: __("Share article by URL"),
2224 style
: "width: 600px",
2230 exception_error("emailArticle", e
);