]>
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
) 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 (var 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 (var 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 (var 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());
908 if (getActiveFeedId() != 0) {
909 str
= __("Delete %d selected articles in %s?");
911 str
= __("Delete %d selected articles?");
914 str
= str
.replace("%d", rows
.length
);
915 str
= str
.replace("%s", fn
);
917 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
921 query
= "?op=rpc&subop=delete&ids=" + param_escape(rows
);
925 new Ajax
.Request("backend.php", {
927 onComplete: function(transport
) {
928 handle_rpc_json(transport
);
933 exception_error("deleteSelection", e
);
937 function archiveSelection() {
941 var rows
= getSelectedArticleIds2();
943 if (rows
.length
== 0) {
944 alert(__("No articles are selected."));
948 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
952 if (getActiveFeedId() != 0) {
953 str
= __("Archive %d selected articles in %s?");
956 str
= __("Move %d archived articles back?");
960 str
= str
.replace("%d", rows
.length
);
961 str
= str
.replace("%s", fn
);
963 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
967 query
= "?op=rpc&subop="+op
+"&ids=" + param_escape(rows
);
971 for (var i
= 0; i
< rows
.length
; i
++) {
972 cache_delete("article:" + rows
[i
]);
975 new Ajax
.Request("backend.php", {
977 onComplete: function(transport
) {
978 handle_rpc_json(transport
);
983 exception_error("archiveSelection", e
);
987 function catchupSelection() {
991 var rows
= getSelectedArticleIds2();
993 if (rows
.length
== 0) {
994 alert(__("No articles are selected."));
998 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1000 var str
= __("Mark %d selected articles in %s as read?");
1002 str
= str
.replace("%d", rows
.length
);
1003 str
= str
.replace("%s", fn
);
1005 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1009 selectionToggleUnread(false, 'viewCurrentFeed()', true);
1012 exception_error("catchupSelection", e
);
1016 function editArticleTags(id
) {
1017 var query
= "backend.php?op=dlg&id=editArticleTags¶m=" + param_escape(id
);
1019 if (dijit
.byId("editTagsDlg"))
1020 dijit
.byId("editTagsDlg").destroyRecursive();
1022 dialog
= new dijit
.Dialog({
1024 title
: __("Edit article Tags"),
1025 style
: "width: 600px",
1026 execute: function() {
1027 if (this.validate()) {
1028 var query
= dojo
.objectToQuery(this.attr('value'));
1030 notify_progress("Saving article tags...", true);
1032 new Ajax
.Request("backend.php", {
1034 onComplete: function(transport
) {
1038 var data
= JSON
.parse(transport
.responseText
);
1041 var tags_str
= article
.tags
;
1042 var id
= tags_str
.id
;
1044 var tags
= $("ATSTR-" + id
);
1045 var tooltip
= dijit
.byId("ATSTRTIP-" + id
);
1047 if (tags
) tags
.innerHTML
= tags_str
.content
;
1048 if (tooltip
) tooltip
.attr('label', tags_str
.content_full
);
1050 cache_delete("article:" + id
);
1059 var tmph
= dojo
.connect(dialog
, 'onLoad', function() {
1060 dojo
.disconnect(tmph
);
1062 new Ajax
.Autocompleter('tags_str', 'tags_choices',
1063 "backend.php?op=rpc&subop=completeTags",
1064 { tokens
: ',', paramName
: "search" });
1071 function cdmScrollToArticleId(id
) {
1073 var ctr
= $("headlines-frame");
1074 var e
= $("RROW-" + id
);
1076 if (!e
|| !ctr
) return;
1078 ctr
.scrollTop
= e
.offsetTop
;
1081 exception_error("cdmScrollToArticleId", e
);
1085 function getActiveArticleId() {
1086 return active_post_id
;
1089 function postMouseIn(id
) {
1090 post_under_pointer
= id
;
1093 function postMouseOut(id
) {
1094 post_under_pointer
= false;
1097 function headlines_scroll_handler(e
) {
1099 var hsp
= $("headlines-spacer");
1101 if (!_infscroll_disable
) {
1102 if (hsp
&& (e
.scrollTop
+ e
.offsetHeight
> hsp
.offsetTop
) ||
1103 e
.scrollTop
+ e
.offsetHeight
> e
.scrollHeight
- 100) {
1106 hsp
.innerHTML
= "<img src='images/indicator_tiny.gif'> " +
1107 __("Loading, please wait...");
1109 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
);
1129 //console.log("auto_catchup_batch: " + catchup_id_batch.toString());
1133 if (catchup_id_batch
.length
> 0) {
1134 window
.clearTimeout(catchup_timeout_id
);
1136 if (!_infscroll_request_sent
) {
1137 catchup_timeout_id
= window
.setTimeout('catchupBatchedArticles()',
1144 console
.warn("headlines_scroll_handler: " + e
);
1148 function catchupBatchedArticles() {
1150 if (catchup_id_batch
.length
> 0 && !_infscroll_request_sent
) {
1152 var query
= "?op=rpc&subop=catchupSelected" +
1153 "&cmode=0&ids=" + param_escape(catchup_id_batch
.toString());
1155 new Ajax
.Request("backend.php", {
1157 onComplete: function(transport
) {
1158 handle_rpc_json(transport
);
1160 catchup_id_batch
.each(function(id
) {
1161 var elem
= $("RROW-" + id
);
1162 if (elem
) elem
.removeClassName("Unread");
1165 catchup_id_batch
= [];
1170 exception_error("catchupBatchedArticles", e
);
1174 function catchupRelativeToArticle(below
) {
1179 if (!getActiveArticleId()) {
1180 alert(__("No article is selected."));
1184 var visible_ids
= getVisibleArticleIds();
1186 var ids_to_mark
= new Array();
1189 for (var i
= 0; i
< visible_ids
.length
; i
++) {
1190 if (visible_ids
[i
] != getActiveArticleId()) {
1191 var e
= $("RROW-" + visible_ids
[i
]);
1193 if (e
&& e
.hasClassName("Unread")) {
1194 ids_to_mark
.push(visible_ids
[i
]);
1201 for (var i
= visible_ids
.length
-1; i
>= 0; i
--) {
1202 if (visible_ids
[i
] != getActiveArticleId()) {
1203 var e
= $("RROW-" + visible_ids
[i
]);
1205 if (e
&& e
.hasClassName("Unread")) {
1206 ids_to_mark
.push(visible_ids
[i
]);
1214 if (ids_to_mark
.length
== 0) {
1215 alert(__("No articles found to mark"));
1217 var msg
= __("Mark %d article(s) as read?").replace("%d", ids_to_mark
.length
);
1219 if (getInitParam("confirm_feed_catchup") != 1 || confirm(msg
)) {
1221 for (var i
= 0; i
< ids_to_mark
.length
; i
++) {
1222 var e
= $("RROW-" + ids_to_mark
[i
]);
1223 e
.removeClassName("Unread");
1226 var query
= "?op=rpc&subop=catchupSelected" +
1227 "&cmode=0" + "&ids=" + param_escape(ids_to_mark
.toString());
1229 new Ajax
.Request("backend.php", {
1231 onComplete: function(transport
) {
1232 handle_rpc_json(transport
);
1239 exception_error("catchupRelativeToArticle", e
);
1243 function cdmExpandArticle(id
) {
1248 var elem
= $("CICD-" + active_post_id
);
1250 var upd_img_pic
= $("FUPDPIC-" + id
);
1252 if (upd_img_pic
&& (upd_img_pic
.src
.match("updated.png") ||
1253 upd_img_pic
.src
.match("fresh_sign.png"))) {
1255 upd_img_pic
.src
= "images/blank_icon.gif";
1258 if (id
== active_post_id
&& Element
.visible(elem
))
1261 selectArticles("none");
1263 var old_offset
= $("RROW-" + id
).offsetTop
;
1265 if (active_post_id
&& elem
&& !getInitParam("cdm_expanded")) {
1267 Element
.show("CEXC-" + active_post_id
);
1270 active_post_id
= id
;
1272 elem
= $("CICD-" + id
);
1274 if (!Element
.visible(elem
)) {
1276 Element
.hide("CEXC-" + id
);
1278 if ($("CWRAP-" + id
).innerHTML
== "") {
1280 $("FUPDPIC-" + id
).src
= "images/indicator_tiny.gif";
1282 $("CWRAP-" + id
).innerHTML
= "<div class=\"insensitive\">" +
1283 __("Loading, please wait...") + "</div>";
1285 var query
= "?op=rpc&subop=cdmGetArticle&id=" + param_escape(id
);
1287 var neighbor_ids
= getRelativePostIds(id
);
1289 /* only request uncached articles */
1290 var cids_to_request
= [];
1292 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
1293 if (cids_requested
.indexOf(neighbor_ids
[i
]) == -1)
1294 if ($("CWRAP-" + neighbor_ids
[i
]).innerHTML
== "") {
1295 cids_to_request
.push(neighbor_ids
[i
]);
1296 cids_requested
.push(neighbor_ids
[i
]);
1300 console
.log("additional ids: " + cids_to_request
.toString());
1302 query
= query
+ "&cids=" + cids_to_request
.toString();
1306 new Ajax
.Request("backend.php", {
1308 onComplete: function(transport
) {
1310 $("FUPDPIC-" + id
).src
= 'images/blank_icon.gif';
1312 handle_rpc_json(transport
);
1314 var reply
= JSON
.parse(transport
.responseText
);
1316 reply
.each(function(article
) {
1317 $("CWRAP-" + article
['id']).innerHTML
= article
['content'];
1318 cids_requested
.remove(article
['id']);
1325 var new_offset
= $("RROW-" + id
).offsetTop
;
1327 $("headlines-frame").scrollTop
+= (new_offset
-old_offset
);
1329 if ($("RROW-" + id
).offsetTop
!= old_offset
)
1330 $("headlines-frame").scrollTop
= new_offset
;
1332 toggleUnread(id
, 0, true);
1336 exception_error("cdmExpandArticle", e
);
1342 function fixHeadlinesOrder(ids
) {
1344 for (var i
= 0; i
< ids
.length
; i
++) {
1345 var e
= $("RROW-" + ids
[i
]);
1349 e
.removeClassName("even");
1350 e
.addClassName("odd");
1352 e
.removeClassName("odd");
1353 e
.addClassName("even");
1358 exception_error("fixHeadlinesOrder", e
);
1362 function getArticleUnderPointer() {
1363 return post_under_pointer
;
1366 function zoomToArticle(event
, id
) {
1368 var cached_article
= cache_get("article: " + id
);
1370 if (dijit
.byId("ATAB-" + id
))
1371 if (!event
|| !event
.shiftKey
)
1372 return dijit
.byId("content-tabs").selectChild(dijit
.byId("ATAB-" + id
));
1374 if (dijit
.byId("ATSTRTIP-" + id
))
1375 dijit
.byId("ATSTRTIP-" + id
).destroyRecursive();
1377 if (cached_article
) {
1378 //closeArticlePanel();
1380 var article_pane
= new dijit
.layout
.ContentPane({
1381 title
: __("Loading...") , content
: cached_article
,
1382 style
: 'padding : 0px;',
1386 dijit
.byId("content-tabs").addChild(article_pane
);
1388 if (!event
|| !event
.shiftKey
)
1389 dijit
.byId("content-tabs").selectChild(article_pane
);
1391 if ($("PTITLE-" + id
))
1392 article_pane
.attr('title', $("PTITLE-" + id
).innerHTML
);
1396 var query
= "?op=rpc&subop=getArticles&ids=" + param_escape(id
);
1398 notify_progress("Loading, please wait...", true);
1400 new Ajax
.Request("backend.php", {
1402 onComplete: function(transport
) {
1405 var reply
= JSON
.parse(transport
.responseText
);
1408 //closeArticlePanel();
1410 var content
= reply
[0]['content'];
1412 var article_pane
= new dijit
.layout
.ContentPane({
1413 title
: "article-" + id
, content
: content
,
1414 style
: 'padding : 0px;',
1418 dijit
.byId("content-tabs").addChild(article_pane
);
1420 if (!event
|| !event
.shiftKey
)
1421 dijit
.byId("content-tabs").selectChild(article_pane
);
1423 if ($("PTITLE-" + id
))
1424 article_pane
.attr('title', $("PTITLE-" + id
).innerHTML
);
1431 exception_error("zoomToArticle", e
);
1435 function scrollArticle(offset
) {
1438 var ci
= $("content-insert");
1440 ci
.scrollTop
+= offset
;
1443 var hi
= $("headlines-frame");
1445 hi
.scrollTop
+= offset
;
1450 exception_error("scrollArticle", e
);
1454 function show_labels_in_headlines(transport
) {
1456 var data
= JSON
.parse(transport
.responseText
);
1459 data
['info-for-headlines'].each(function(elem
) {
1460 var ctr
= $("HLLCTR-" + elem
.id
);
1462 if (ctr
) ctr
.innerHTML
= elem
.labels
;
1465 cache_headlines(getActiveFeedId(), activeFeedIsCat(), null, $("headlines-frame").innerHTML
);
1469 exception_error("show_labels_in_headlines", e
);
1473 /* function toggleHeadlineActions() {
1475 var e = $("headlineActionsBody");
1476 var p = $("headlineActionsDrop");
1478 if (!Element.visible(e)) {
1485 e.style.left = (p.offsetLeft + 1) + "px";
1486 e.style.top = (p.offsetTop + p.offsetHeight + 2) + "px";
1489 exception_error("toggleHeadlineActions", e);
1493 /* function publishWithNote(id, def_note) {
1495 if (!def_note) def_note = '';
1497 var note = prompt(__("Please enter a note for this article:"), def_note);
1499 if (note != undefined) {
1500 togglePub(id, false, false, note);
1504 exception_error("publishWithNote", e);
1508 function emailArticle(id
) {
1511 var ids
= getSelectedArticleIds2();
1513 if (ids
.length
== 0) {
1514 alert(__("No articles are selected."));
1518 id
= ids
.toString();
1521 if (dijit
.byId("emailArticleDlg"))
1522 dijit
.byId("emailArticleDlg").destroyRecursive();
1524 var query
= "backend.php?op=dlg&id=emailArticle¶m=" + param_escape(id
);
1526 dialog
= new dijit
.Dialog({
1527 id
: "emailArticleDlg",
1528 title
: __("Forward article by email"),
1529 style
: "width: 600px",
1530 execute: function() {
1531 if (this.validate()) {
1533 new Ajax
.Request("backend.php", {
1534 parameters
: dojo
.objectToQuery(this.attr('value')),
1535 onComplete: function(transport
) {
1537 var reply
= JSON
.parse(transport
.responseText
);
1539 var error
= reply
['error'];
1542 alert(__('Error sending email:') + ' ' + error
);
1544 notify_info('Your message has been sent.');
1553 var tmph
= dojo
.connect(dialog
, 'onLoad', function() {
1554 dojo
.disconnect(tmph
);
1556 new Ajax
.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
1557 "backend.php?op=rpc&subop=completeEmails",
1558 { tokens
: '', paramName
: "search" });
1563 /* displayDlg('emailArticle', id,
1565 document.forms['article_email_form'].destination.focus();
1567 new Ajax.Autocompleter('destination', 'destination_choices',
1568 "backend.php?op=rpc&subop=completeEmails",
1569 { tokens: '', paramName: "search" });
1574 exception_error("emailArticle", e
);
1578 function dismissArticle(id
) {
1580 var elem
= $("RROW-" + id
);
1582 toggleUnread(id
, 0, true);
1584 new Effect
.Fade(elem
, {duration
: 0.5});
1586 active_post_id
= false;
1589 exception_error("dismissArticle", e
);
1593 function dismissSelectedArticles() {
1596 var ids
= getVisibleArticleIds();
1600 for (var i
= 0; i
< ids
.length
; i
++) {
1601 var elem
= $("RROW-" + ids
[i
]);
1603 if (elem
.className
&& elem
.hasClassName("Selected") &&
1604 ids
[i
] != active_post_id
) {
1605 new Effect
.Fade(elem
, {duration
: 0.5});
1613 selectionToggleUnread(false);
1615 fixHeadlinesOrder(tmp
);
1618 exception_error("dismissSelectedArticles", e
);
1622 function dismissReadArticles() {
1625 var ids
= getVisibleArticleIds();
1628 for (var i
= 0; i
< ids
.length
; i
++) {
1629 var elem
= $("RROW-" + ids
[i
]);
1631 if (elem
.className
&& !elem
.hasClassName("Unread") &&
1632 !elem
.hasClassName("Selected")) {
1634 new Effect
.Fade(elem
, {duration
: 0.5});
1640 fixHeadlinesOrder(tmp
);
1643 exception_error("dismissSelectedArticles", e
);
1647 function getVisibleArticleIds() {
1652 getLoadedArticleIds().each(function(id
) {
1653 var elem
= $("RROW-" + id
);
1654 if (elem
&& Element
.visible(elem
))
1659 exception_error("getVisibleArticleIds", e
);
1665 function cdmClicked(event
, id
) {
1667 //var shift_key = event.shiftKey;
1671 if (!event
.ctrlKey
) {
1673 if (!getInitParam("cdm_expanded")) {
1674 return cdmExpandArticle(id
);
1677 selectArticles("none");
1680 var elem
= $("RROW-" + id
);
1683 elem
.removeClassName("Unread");
1685 var upd_img_pic
= $("FUPDPIC-" + id
);
1687 if (upd_img_pic
&& (upd_img_pic
.src
.match("updated.png") ||
1688 upd_img_pic
.src
.match("fresh_sign.png"))) {
1690 upd_img_pic
.src
= "images/blank_icon.gif";
1693 active_post_id
= id
;
1695 var query
= "?op=rpc&subop=catchupSelected" +
1696 "&cmode=0&ids=" + param_escape(id
);
1698 new Ajax
.Request("backend.php", {
1700 onComplete: function(transport
) {
1701 handle_rpc_json(transport
);
1708 toggleSelected(id
, true);
1709 toggleUnread(id
, 0, false);
1710 zoomToArticle(event
, id
);
1714 exception_error("cdmClicked");
1720 function postClicked(event
, id
) {
1723 if (!event
.ctrlKey
) {
1726 postOpenInNewTab(event
, id
);
1731 exception_error("postClicked");
1735 function hlOpenInNewTab(event
, id
) {
1736 toggleUnread(id
, 0, false);
1737 zoomToArticle(event
, id
);
1740 function postOpenInNewTab(event
, id
) {
1741 closeArticlePanel(id
);
1742 zoomToArticle(event
, id
);
1745 function hlClicked(event
, id
) {
1747 if (event
.which
== 2) {
1750 } else if (event
.altKey
) {
1751 openArticleInNewWindow(id
);
1752 } else if (!event
.ctrlKey
) {
1757 toggleUnread(id
, 0, false);
1758 zoomToArticle(event
, id
);
1763 exception_error("hlClicked");
1767 function getFirstVisibleHeadlineId() {
1768 var rows
= getVisibleArticleIds();
1773 function getLastVisibleHeadlineId() {
1774 var rows
= getVisibleArticleIds();
1775 return rows
[rows
.length
-1];
1778 function openArticleInNewWindow(id
) {
1779 toggleUnread(id
, 0, false);
1780 window
.open("backend.php?op=la&id=" + id
);
1783 function isCdmMode() {
1784 return getInitParam("combined_display_mode");
1787 function markHeadline(id
) {
1788 var row
= $("RROW-" + id
);
1790 var check
= $("RCHK-" + id
);
1793 check
.checked
= true;
1796 row
.addClassName("Selected");
1800 function getRelativePostIds(id
, limit
) {
1806 if (!limit
) limit
= 6; //3
1808 var ids
= getVisibleArticleIds();
1810 for (var i
= 0; i
< ids
.length
; i
++) {
1812 for (var k
= 1; k
<= limit
; k
++) {
1813 //if (i > k-1) tmp.push(ids[i-k]);
1814 if (i
< ids
.length
-k
) tmp
.push(ids
[i
+k
]);
1821 exception_error("getRelativePostIds", e
);
1827 function correctHeadlinesOffset(id
) {
1831 var container
= $("headlines-frame");
1832 var row
= $("RROW-" + id
);
1834 var viewport
= container
.offsetHeight
;
1836 var rel_offset_top
= row
.offsetTop
- container
.scrollTop
;
1837 var rel_offset_bottom
= row
.offsetTop
+ row
.offsetHeight
- container
.scrollTop
;
1839 //console.log("Rtop: " + rel_offset_top + " Rbtm: " + rel_offset_bottom);
1840 //console.log("Vport: " + viewport);
1842 if (rel_offset_top
<= 0 || rel_offset_top
> viewport
) {
1843 container
.scrollTop
= row
.offsetTop
;
1844 } else if (rel_offset_bottom
> viewport
) {
1846 /* doesn't properly work with Opera in some cases because
1847 Opera fucks up element scrolling */
1849 container
.scrollTop
= row
.offsetTop
+ row
.offsetHeight
- viewport
;
1853 exception_error("correctHeadlinesOffset", e
);
1858 function headlineActionsChange(elem
) {
1861 elem
.attr('value', 'false');
1863 exception_error("headlineActionsChange", e
);
1867 function closeArticlePanel() {
1869 var tabs
= dijit
.byId("content-tabs");
1870 var child
= tabs
.selectedChildWidget
;
1872 if (child
&& tabs
.getIndexOfChild(child
) > 0) {
1873 tabs
.removeChild(child
);
1876 if (dijit
.byId("content-insert"))
1877 dijit
.byId("headlines-wrap-inner").removeChild(
1878 dijit
.byId("content-insert"));
1882 function initHeadlinesMenu() {
1884 if (dijit
.byId("headlinesMenu"))
1885 dijit
.byId("headlinesMenu").destroyRecursive();
1890 nodes
= $$("#headlines-frame > div[id*=RROW]");
1892 nodes
= $$("#headlines-frame span[id*=RTITLE]");
1895 nodes
.each(function(node
) {
1899 var menu
= new dijit
.Menu({
1900 id
: "headlinesMenu",
1904 var tmph
= dojo
.connect(menu
, '_openMyself', function (event
) {
1905 var callerNode
= event
.target
, match
= null, tries
= 0;
1907 while (match
== null && callerNode
&& tries
<= 3) {
1908 match
= callerNode
.id
.match("^[A-Z]+[-]([0-9]+)$");
1909 callerNode
= callerNode
.parentNode
;
1913 if (match
) this.callerRowId
= parseInt(match
[1]);
1917 /* if (!isCdmMode())
1918 menu.addChild(new dijit.MenuItem({
1919 label: __("View article"),
1920 onClick: function(event) {
1921 view(this.getParent().callerRowId);
1924 menu
.addChild(new dijit
.MenuItem({
1925 label
: __("Open original article"),
1926 onClick: function(event
) {
1927 openArticleInNewWindow(this.getParent().callerRowId
);
1930 menu
.addChild(new dijit
.MenuItem({
1931 label
: __("View in a tt-rss tab"),
1932 onClick: function(event
) {
1933 hlOpenInNewTab(event
, this.getParent().callerRowId
);
1936 // menu.addChild(new dijit.MenuSeparator());
1938 var labels
= dijit
.byId("feedTree").model
.getItemsInCategory(-2);
1942 menu
.addChild(new dijit
.MenuSeparator());
1944 var labelAddMenu
= new dijit
.Menu({ownerMenu
: menu
});
1945 var labelDelMenu
= new dijit
.Menu({ownerMenu
: menu
});
1947 labels
.each(function(label
) {
1948 var id
= label
.id
[0];
1949 var bare_id
= id
.substr(id
.indexOf(":")+1);
1950 var name
= label
.name
[0];
1952 bare_id
= -11-bare_id
;
1954 labelAddMenu
.addChild(new dijit
.MenuItem({
1957 onClick: function(event
) {
1958 selectionAssignLabel(this.labelId
,
1959 [this.getParent().ownerMenu
.callerRowId
]);
1962 labelDelMenu
.addChild(new dijit
.MenuItem({
1965 onClick: function(event
) {
1966 selectionRemoveLabel(this.labelId
,
1967 [this.getParent().ownerMenu
.callerRowId
]);
1972 menu
.addChild(new dijit
.PopupMenuItem({
1973 label
: __("Assign label"),
1974 popup
: labelAddMenu
,
1977 menu
.addChild(new dijit
.PopupMenuItem({
1978 label
: __("Remove label"),
1979 popup
: labelDelMenu
,
1987 exception_error("initHeadlinesMenu", e
);
1991 function tweetArticle(id
) {
1993 var query
= "?op=rpc&subop=getTweetInfo&id=" + param_escape(id
);
1998 var ts
= d
.getTime();
2000 var w
= window
.open('backend.php?op=loading', 'ttrss_tweet',
2001 "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0");
2003 new Ajax
.Request("backend.php", {
2005 onComplete: function(transport
) {
2006 var ti
= JSON
.parse(transport
.responseText
);
2008 var share_url
= "http://twitter.com/share?_=" + ts
+
2009 "&text=" + param_escape(ti
.title
) +
2010 "&url=" + param_escape(ti
.link
);
2012 w
.location
.href
= share_url
;
2018 exception_error("tweetArticle", e
);
2022 function editArticleNote(id
) {
2025 var query
= "backend.php?op=dlg&id=editArticleNote¶m=" + param_escape(id
);
2027 if (dijit
.byId("editNoteDlg"))
2028 dijit
.byId("editNoteDlg").destroyRecursive();
2030 dialog
= new dijit
.Dialog({
2032 title
: __("Edit article note"),
2033 style
: "width: 600px",
2034 execute: function() {
2035 if (this.validate()) {
2036 var query
= dojo
.objectToQuery(this.attr('value'));
2038 notify_progress("Saving article note...", true);
2040 new Ajax
.Request("backend.php", {
2042 onComplete: function(transport
) {
2046 var reply
= JSON
.parse(transport
.responseText
);
2048 cache_delete("article:" + id
);
2050 var elem
= $("POSTNOTE-" + id
);
2054 elem
.innerHTML
= reply
.note
;
2056 if (reply
.raw_length
!= 0)
2057 new Effect
.Appear(elem
);
2069 exception_error("editArticleNote", e
);
2073 function player(elem
) {
2074 var aid
= elem
.getAttribute("audio-id");
2075 var status
= elem
.getAttribute("status");
2083 elem
.innerHTML
= __("Playing...");
2084 elem
.title
= __("Click to pause");
2085 elem
.addClassName("playing");
2089 elem
.innerHTML
= __("Play");
2090 elem
.title
= __("Click to play");
2091 elem
.removeClassName("playing");
2094 elem
.setAttribute("status", status
);
2096 alert("Your browser doesn't seem to support HTML5 audio.");
2100 function cache_set(id
, obj
) {
2101 //console.log("cache_set: " + id);
2104 sessionStorage
[id
] = obj
;
2106 sessionStorage
.clear();
2110 function cache_get(id
) {
2112 return sessionStorage
[id
];
2115 function cache_clear() {
2117 sessionStorage
.clear();
2120 function cache_delete(id
) {
2122 sessionStorage
.removeItem(id
);
2125 function cache_headlines(feed
, is_cat
, toolbar_obj
, content_obj
) {
2126 if (toolbar_obj
&& content_obj
) {
2127 cache_set("feed:" + feed
+ ":" + is_cat
,
2128 JSON
.stringify({toolbar
: toolbar_obj
, content
: content_obj
}));
2131 obj
= cache_get("feed:" + feed
+ ":" + is_cat
);
2134 obj
= JSON
.parse(obj
);
2136 if (toolbar_obj
) obj
.toolbar
= toolbar_obj
;
2137 if (content_obj
) obj
.content
= content_obj
;
2139 cache_set("feed:" + feed
+ ":" + is_cat
, JSON
.stringify(obj
));
2143 console
.warn("cache_headlines failed: " + e
);
2148 function render_local_headlines(feed
, is_cat
, obj
) {
2151 dijit
.byId("headlines-toolbar").attr('content',
2154 dijit
.byId("headlines-frame").attr('content',
2157 dojo
.parser
.parse('headlines-toolbar');
2159 $("headlines-frame").scrollTop
= 0;
2160 selectArticles('none');
2161 setActiveFeedId(feed
, is_cat
);
2162 initHeadlinesMenu();
2164 precache_headlines();
2167 exception_error("render_local_headlines", e
);
2171 function precache_headlines_idle() {
2173 if (!feed_precache_timeout_id
) {
2174 var feeds
= dijit
.byId("feedTree").getVisibleUnreadFeeds();
2177 feeds
.each(function(item
) {
2178 if (parseInt(item
[0]) > 0 && !cache_get("feed:" + item
[0] + ":" + item
[1]))
2179 uncached
.push(item
);
2182 if (uncached
.length
> 0) {
2183 var rf
= uncached
[Math
.floor(Math
.random()*uncached
.length
)];
2184 viewfeed(rf
[0], '', rf
[1], 0, true);
2187 precache_idle_timeout_id
= setTimeout("precache_headlines_idle()", 1000*30);
2190 exception_error("precache_headlines_idle", e
);
2194 function precache_headlines() {
2197 if (!feed_precache_timeout_id
) {
2198 feed_precache_timeout_id
= window
.setTimeout(function() {
2199 var nuf
= getNextUnreadFeed(getActiveFeedId(), activeFeedIsCat());
2200 var nf
= dijit
.byId("feedTree").getNextFeed(getActiveFeedId(), activeFeedIsCat());
2202 if (nuf
&& !cache_get("feed:" + nuf
+ ":" + activeFeedIsCat()))
2203 viewfeed(nuf
, '', activeFeedIsCat(), 0, true);
2205 if (nf
!= nuf
&& nf
&& !cache_get("feed:" + nf
[0] + ":" + nf
[1]))
2206 viewfeed(nf
[0], '', nf
[1], 0, true);
2208 window
.setTimeout(function() {
2209 feed_precache_timeout_id
= false;
2215 exception_error("precache_headlines", e
);
2219 function shareArticle(id
) {
2221 if (dijit
.byId("shareArticleDlg"))
2222 dijit
.byId("shareArticleDlg").destroyRecursive();
2224 var query
= "backend.php?op=dlg&id=shareArticle¶m=" + param_escape(id
);
2226 dialog
= new dijit
.Dialog({
2227 id
: "shareArticleDlg",
2228 title
: __("Share article by URL"),
2229 style
: "width: 600px",
2235 exception_error("emailArticle", e
);