1 var active_post_id
= false;
2 var last_article_view
= false;
3 var active_real_feed_id
= false;
5 // FIXME: kludges, needs proper implementation
6 var _reload_feedlist_after_view
= false;
8 var _cdm_wd_timeout
= false;
9 var _cdm_wd_vishist
= new Array();
11 var article_cache
= new Array();
13 var vgroup_last_feed
= false;
14 var post_under_pointer
= false;
16 var last_requested_article
= false;
18 function toggle_published_callback(transport
) {
20 if (transport
.responseXML
) {
22 all_counters_callback2(transport
);
24 var note
= transport
.responseXML
.getElementsByTagName("note")[0];
27 var note_id
= note
.getAttribute("id");
28 var note_size
= note
.getAttribute("size");
29 var note_content
= note
.firstChild
.nodeValue
;
31 var container
= $('POSTNOTE-' + note_id
);
33 cache_invalidate(note_id
);
36 if (note_size
== "0") {
37 Element
.hide(container
);
39 container
.innerHTML
= note_content
;
40 Element
.show(container
);
47 exception_error("toggle_published_callback", e
, transport
);
51 function catchup_callback2(transport
, callback
) {
53 debug("catchup_callback2 " + transport
+ ", " + callback
);
55 all_counters_callback2(transport
);
57 setTimeout(callback
, 10);
60 exception_error("catchup_callback2", e
, transport
);
64 function clean_feed_selections() {
66 var feeds
= $("feedList").getElementsByTagName("LI");
68 for (var i
= 0; i
< feeds
.length
; i
++) {
69 if (feeds
[i
].id
&& feeds
[i
].id
.match("FEEDR-")) {
70 feeds
[i
].className
= feeds
[i
].className
.replace("Selected", "");
72 if (feeds
[i
].id
&& feeds
[i
].id
.match("FCAT-")) {
73 feeds
[i
].className
= feeds
[i
].className
.replace("Selected", "");
77 exception_error("clean_feed_selections", e
);
81 function headlines_callback2(transport
, feed_cur_page
) {
84 if (!transport
.responseText
&& db
) {
85 offlineConfirmModeChange();
89 loading_set_progress(100);
91 debug("headlines_callback2 [page=" + feed_cur_page
+ "]");
93 if (!transport_error_check(transport
)) return;
95 clean_feed_selections();
100 if (transport
.responseXML
) {
101 var headlines
= transport
.responseXML
.getElementsByTagName("headlines")[0];
103 is_cat
= headlines
.getAttribute("is_cat");
104 feed_id
= headlines
.getAttribute("id");
105 setActiveFeedId(feed_id
, is_cat
);
110 var feedr
= $("FEEDR-" + feed_id
);
111 if (feedr
&& !feedr
.className
.match("Selected")) {
112 feedr
.className
= feedr
.className
+ "Selected";
115 var feedr
= $("FCAT-" + feed_id
);
116 if (feedr
&& !feedr
.className
.match("Selected")) {
117 feedr
.className
= feedr
.className
+ "Selected";
121 var f
= $("headlines-frame");
123 if (feed_cur_page
== 0) {
124 debug("resetting headlines scrollTop");
129 if (transport
.responseXML
) {
130 var headlines
= transport
.responseXML
.getElementsByTagName("headlines")[0];
131 var headlines_count_obj
= transport
.responseXML
.getElementsByTagName("headlines-count")[0];
132 var headlines_unread_obj
= transport
.responseXML
.getElementsByTagName("headlines-unread")[0];
133 var disable_cache_obj
= transport
.responseXML
.getElementsByTagName("disable-cache")[0];
135 var vgroup_last_feed_obj
= transport
.responseXML
.getElementsByTagName("vgroup-last-feed")[0];
137 var headlines_count
= headlines_count_obj
.getAttribute("value");
138 var headlines_unread
= headlines_unread_obj
.getAttribute("value");
139 var disable_cache
= disable_cache_obj
.getAttribute("value") != "0";
141 vgroup_last_feed
= vgroup_last_feed_obj
.getAttribute("value");
143 if (headlines_count
== 0) {
144 _infscroll_disable
= 1;
146 _infscroll_disable
= 0;
149 var counters
= transport
.responseXML
.getElementsByTagName("counters")[0];
150 var articles
= transport
.responseXML
.getElementsByTagName("article");
151 var runtime_info
= transport
.responseXML
.getElementsByTagName("runtime-info");
153 if (feed_cur_page
== 0) {
155 f
.innerHTML
= headlines
.firstChild
.nodeValue
;
157 var cache_prefix
= "";
165 cache_invalidate(cache_prefix
+ feed_id
);
167 if (!disable_cache
) {
168 cache_inject(cache_prefix
+ feed_id
,
169 headlines
.firstChild
.nodeValue
, headlines_unread
);
173 debug("headlines_callback: returned no data");
174 f
.innerHTML
= "<div class='whiteBox'>" + __('Could not update headlines (missing XML data)') + "</div>";
179 if (headlines_count
> 0) {
180 debug("adding some more headlines...");
182 var c
= $("headlinesList");
185 c
= $("headlinesInnerContainer");
188 var ids
= getSelectedArticleIds2();
190 c
.innerHTML
= c
.innerHTML
+ headlines
.firstChild
.nodeValue
;
192 debug("restore selected ids: " + ids
);
194 for (var i
= 0; i
< ids
.length
; i
++) {
195 markHeadline(ids
[i
]);
199 debug("no new headlines received");
202 debug("headlines_callback: returned no data");
203 notify_error("Error while trying to load more headlines");
209 for (var i
= 0; i
< articles
.length
; i
++) {
210 var a_id
= articles
[i
].getAttribute("id");
211 debug("found id: " + a_id
);
212 cache_inject(a_id
, articles
[i
].firstChild
.nodeValue
);
215 debug("no cached articles received");
219 debug("parsing piggybacked counters: " + counters
);
220 parse_counters(counters
, false);
222 debug("counters container not found in reply, requesting...");
227 debug("parsing runtime info: " + runtime_info
[0]);
228 parse_runtime_info(runtime_info
[0]);
230 debug("counters container not found in reply");
234 debug("headlines_callback: returned no XML object");
235 f
.innerHTML
= "<div class='whiteBox'>" + __('Could not update headlines (missing XML object)') + "</div>";
238 if (typeof correctPNG
!= 'undefined') {
242 if (_cdm_wd_timeout
) window
.clearTimeout(_cdm_wd_timeout
);
244 if (!$("headlinesList") &&
245 getActiveFeedId() != -3 &&
246 getInitParam("cdm_auto_catchup") == 1) {
247 debug("starting CDM watchdog");
248 _cdm_wd_timeout
= window
.setTimeout("cdmWatchdog()", 5000);
249 _cdm_wd_vishist
= new Array();
251 debug("not in CDM mode or watchdog disabled");
254 _feed_cur_page
= feed_cur_page
;
255 _infscroll_request_sent
= 0;
262 exception_error("headlines_callback2", e
, transport
);
266 function render_article(article
) {
268 var f
= $("content-frame");
273 var fi
= $("content-insert");
279 fi
.innerHTML
= article
;
281 // article.evalScripts();
284 exception_error("render_article", e
);
288 function showArticleInHeadlines(id
) {
292 cleanSelected("headlinesList");
294 var crow
= $("RROW-" + id
);
298 var article_is_unread
= crow
.className
.match("Unread");
300 crow
.className
= crow
.className
.replace("Unread", "");
302 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
304 var upd_img_pic
= $("FUPDPIC-" + id
);
306 var cache_prefix
= "";
308 if (activeFeedIsCat()) {
314 var view_mode
= false;
317 view_mode
= document
.forms
['main_toolbar_form'].view_mode
;
318 view_mode
= view_mode
[view_mode
.selectedIndex
].value
;
323 if (upd_img_pic
&& (upd_img_pic
.src
.match("updated.png") ||
324 upd_img_pic
.src
.match("fresh_sign.png"))) {
326 upd_img_pic
.src
= "images/blank_icon.gif";
328 cache_invalidate(cache_prefix
+ getActiveFeedId());
330 cache_inject(cache_prefix
+ getActiveFeedId(),
331 $("headlines-frame").innerHTML
,
332 get_feed_unread(getActiveFeedId()));
334 } else if (article_is_unread
&& view_mode
== "all_articles") {
336 cache_invalidate(cache_prefix
+ getActiveFeedId());
338 cache_inject(cache_prefix
+ getActiveFeedId(),
339 $("headlines-frame").innerHTML
,
340 get_feed_unread(getActiveFeedId())-1);
342 } else if (article_is_unread
) {
343 cache_invalidate(cache_prefix
+ getActiveFeedId());
349 exception_error("showArticleInHeadlines", e
);
353 function article_callback2(transport
, id
, feed_id
) {
355 debug("article_callback2 " + id
);
357 if (!transport
.responseText
&& db
) {
358 offlineConfirmModeChange();
362 if (transport
.responseXML
) {
364 if (!transport_error_check(transport
)) return;
366 debug("looking for articles to cache...");
368 var articles
= transport
.responseXML
.getElementsByTagName("article");
370 for (var i
= 0; i
< articles
.length
; i
++) {
371 var a_id
= articles
[i
].getAttribute("id");
373 debug("found id: " + a_id
);
375 if (a_id
== active_post_id
) {
376 debug("active article, rendering...");
377 render_article(articles
[i
].firstChild
.nodeValue
);
380 cache_inject(a_id
, articles
[i
].firstChild
.nodeValue
);
383 if (id
!= last_requested_article
) {
384 debug("requested article id is out of sequence, aborting");
388 active_real_feed_id
= feed_id
;
391 showArticleInHeadlines(id
);
394 db
.execute("UPDATE articles SET unread = 0 WHERE id = ?", [id
]);
397 var reply
= transport
.responseXML
.firstChild
.firstChild
;
400 debug("article_callback: returned no XML object");
401 //var f = $("content-frame");
402 //f.innerHTML = "<div class='whiteBox'>" + __('Could not display article (missing XML object)') + "</div>";
405 var date
= new Date();
406 last_article_view
= date
.getTime() / 1000;
408 if (typeof correctPNG
!= 'undefined') {
412 if (_reload_feedlist_after_view
) {
413 setTimeout('updateFeedList(false, false)', 50);
414 _reload_feedlist_after_view
= false;
416 if (transport
.responseXML
) {
417 var counters
= transport
.responseXML
.getElementsByTagName("counters")[0];
420 debug("parsing piggybacked counters: " + counters
);
421 parse_counters(counters
, false);
423 debug("counters container not found in reply, requesting...");
431 exception_error("article_callback2", e
, transport
);
435 function view(id
, feed_id
, skip_history
) {
438 debug("loading article: " + id
+ "/" + feed_id
);
440 if (offline_mode
) return view_offline(id
, feed_id
);
442 var cached_article
= cache_find(id
);
444 debug("cache check result: " + (cached_article
!= false));
448 //setActiveFeedId(feed_id);
450 var query
= "backend.php?op=view&id=" + param_escape(id
) +
451 "&feed=" + param_escape(feed_id
);
453 var date
= new Date();
455 var neighbor_ids
= getRelativePostIds(active_post_id
);
457 /* only request uncached articles */
459 var cids_to_request
= Array();
461 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
462 if (!cache_check(neighbor_ids
[i
])) {
463 cids_to_request
.push(neighbor_ids
[i
]);
467 debug("additional ids: " + cids_to_request
.toString());
469 /* additional info for piggyback counters */
471 if (tagsAreDisplayed()) {
472 query
= query
+ "&omode=lt";
474 query
= query
+ "&omode=flc";
477 var date
= new Date();
478 var timestamp
= Math
.round(date
.getTime() / 1000);
479 query
= query
+ "&ts=" + timestamp
;
481 query
= query
+ "&cids=" + cids_to_request
.toString();
483 var crow
= $("RROW-" + id
);
484 var article_is_unread
= crow
.className
.match("Unread");
486 if (!async_counters_work
) {
487 query
= query
+ "&csync=true";
490 showArticleInHeadlines(id
);
492 if (!cached_article
) {
494 notify_progress("Loading, please wait...", true);
496 } else if (cached_article
&& article_is_unread
) {
498 query
= query
+ "&mode=prefetch";
500 render_article(cached_article
);
502 } else if (cached_article
) {
504 query
= query
+ "&mode=prefetch_old";
505 render_article(cached_article
);
511 last_requested_article
= id
;
513 new Ajax
.Request(query
, {
514 onComplete: function(transport
) {
515 article_callback2(transport
, id
, feed_id
);
521 exception_error("view", e
);
526 return toggleMark(id
);
530 return togglePub(id
);
533 function tMark_afh_off(effect
) {
535 var elem
= effect
.effects
[0].element
;
537 debug("tMark_afh_off : " + elem
.id
);
540 elem
.src
= elem
.src
.replace("mark_set", "mark_unset");
541 elem
.alt
= __("Star article");
546 exception_error("tMark_afh_off", e
);
550 function tPub_afh_off(effect
) {
552 var elem
= effect
.effects
[0].element
;
554 debug("tPub_afh_off : " + elem
.id
);
557 elem
.src
= elem
.src
.replace("pub_set", "pub_unset");
558 elem
.alt
= __("Publish article");
563 exception_error("tPub_afh_off", e
);
567 function toggleMark(id
, client_only
, no_effects
) {
571 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=mark";
573 query
= query
+ "&afid=" + getActiveFeedId();
575 if (tagsAreDisplayed()) {
576 query
= query
+ "&omode=tl";
578 query
= query
+ "&omode=flc";
581 var mark_img
= $("FMPIC-" + id
);
583 if (!mark_img
) return;
585 var vfeedu
= $("FEEDU--1");
586 var crow
= $("RROW-" + id
);
588 if (mark_img
.src
.match("mark_unset")) {
589 mark_img
.src
= mark_img
.src
.replace("mark_unset", "mark_set");
590 mark_img
.alt
= __("Unstar article");
591 query
= query
+ "&mark=1";
594 db
.execute("UPDATE articles SET marked = 1 WHERE id = ?", [id
]);
598 //mark_img.src = "images/mark_unset.png";
599 mark_img
.alt
= __("Please wait...");
600 query
= query
+ "&mark=0";
602 if ($("headlinesList") && !no_effects
) {
603 Effect
.Puff(mark_img
, {duration
: 0.25, afterFinish
: tMark_afh_off
});
605 mark_img
.src
= mark_img
.src
.replace("mark_set", "mark_unset");
606 mark_img
.alt
= __("Star article");
610 db
.execute("UPDATE articles SET marked = 0 WHERE id = ?", [id
]);
615 if (!no_effects
) update_local_feedlist_counters();
620 new Ajax
.Request(query
, {
621 onComplete: function(transport
) {
622 all_counters_callback2(transport
);
628 exception_error("toggleMark", e
);
632 function togglePub(id
, client_only
, no_effects
, note
) {
636 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=publ";
638 query
= query
+ "&afid=" + getActiveFeedId();
640 if (note
!= undefined) {
641 query
= query
+ "¬e=" + param_escape(note
);
643 query
= query
+ "¬e=undefined";
646 if (tagsAreDisplayed()) {
647 query
= query
+ "&omode=tl";
649 query
= query
+ "&omode=flc";
652 var mark_img
= $("FPPIC-" + id
);
654 if (!mark_img
) return;
656 var vfeedu
= $("FEEDU--2");
657 var crow
= $("RROW-" + id
);
659 if (mark_img
.src
.match("pub_unset") || note
!= undefined) {
660 mark_img
.src
= mark_img
.src
.replace("pub_unset", "pub_set");
661 mark_img
.alt
= __("Unpublish article");
662 query
= query
+ "&pub=1";
665 //mark_img.src = "images/pub_unset.png";
666 mark_img
.alt
= __("Please wait...");
667 query
= query
+ "&pub=0";
669 if ($("headlinesList") && !no_effects
) {
670 Effect
.Puff(mark_img
, {duration
: 0.25, afterFinish
: tPub_afh_off
});
672 mark_img
.src
= mark_img
.src
.replace("pub_set", "pub_unset");
673 mark_img
.alt
= __("Publish article");
678 new Ajax
.Request(query
, {
679 onComplete: function(transport
) {
680 toggle_published_callback(transport
);
686 exception_error("togglePub", e
);
690 function correctHeadlinesOffset(id
) {
694 var hlist
= $("headlinesList");
695 var container
= $("headlinesInnerContainer");
696 var row
= $("RROW-" + id
);
698 var viewport
= container
.offsetHeight
;
700 var rel_offset_top
= row
.offsetTop
- container
.scrollTop
;
701 var rel_offset_bottom
= row
.offsetTop
+ row
.offsetHeight
- container
.scrollTop
;
703 debug("Rtop: " + rel_offset_top
+ " Rbtm: " + rel_offset_bottom
);
704 debug("Vport: " + viewport
);
706 if (rel_offset_top
<= 0 || rel_offset_top
> viewport
) {
707 container
.scrollTop
= row
.offsetTop
;
708 } else if (rel_offset_bottom
> viewport
) {
710 /* doesn't properly work with Opera in some cases because
711 Opera fucks up element scrolling */
713 container
.scrollTop
= row
.offsetTop
+ row
.offsetHeight
- viewport
;
717 exception_error("correctHeadlinesOffset", e
);
722 function moveToPost(mode
) {
729 rows
= cdmGetVisibleArticles();
731 rows
= getVisibleHeadlineIds();
737 if (!$('RROW-' + active_post_id
)) {
738 active_post_id
= false;
741 if (active_post_id
== false) {
742 next_id
= getFirstVisibleHeadlineId();
743 prev_id
= getLastVisibleHeadlineId();
745 for (var i
= 0; i
< rows
.length
; i
++) {
746 if (rows
[i
] == active_post_id
) {
753 if (mode
== "next") {
757 if (!cdmArticleIsActuallyVisible(next_id
)) {
758 cdmScrollToArticleId(next_id
);
760 cdmSelectArticles("none");
761 toggleUnread(next_id
, 0, true);
762 toggleSelected(next_id
);
765 correctHeadlinesOffset(next_id
);
766 view(next_id
, getActiveFeedId());
771 if (mode
== "prev") {
774 cdmScrollToArticleId(prev_id
);
775 cdmSelectArticles("none");
776 toggleUnread(prev_id
, 0, true);
777 toggleSelected(prev_id
);
779 correctHeadlinesOffset(prev_id
);
780 view(prev_id
, getActiveFeedId());
786 exception_error("moveToPost", e
);
790 function toggleSelected(id
) {
793 var cb
= $("RCHK-" + id
);
795 var row
= $("RROW-" + id
);
797 var nc
= row
.className
;
799 if (!nc
.match("Selected")) {
800 nc
= nc
+ "Selected";
805 // In CDM basically last selected article == active article
806 if (isCdmMode()) active_post_id
= id
;
808 nc
= nc
.replace("Selected", "");
818 exception_error("toggleSelected", e
);
822 function toggleUnread_afh(effect
) {
825 var elem
= effect
.element
;
826 elem
.style
.backgroundColor
= "";
829 exception_error("toggleUnread_afh", e
);
833 function toggleUnread(id
, cmode
, effect
) {
836 var row
= $("RROW-" + id
);
838 var nc
= row
.className
;
839 var is_selected
= row
.className
.match("Selected");
840 nc
= nc
.replace("Unread", "");
841 nc
= nc
.replace("Selected", "");
843 // since we are removing selection from the object, uncheck
844 // corresponding checkbox
846 var cb
= $("RCHK-" + id
);
851 // NOTE: I'm not sure that resetting selection here is a feature -fox
853 if (cmode
== undefined || cmode
== 2) {
854 if (row
.className
.match("Unread")) {
858 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
859 afterFinish
: toggleUnread_afh
,
860 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
864 row
.className
= nc
+ "Unread";
868 db
.execute("UPDATE articles SET unread = not unread "+
869 "WHERE id = ?", [id
]);
872 } else if (cmode
== 0) {
876 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
877 afterFinish
: toggleUnread_afh
,
878 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
882 db
.execute("UPDATE articles SET unread = 0 "+
883 "WHERE id = ?", [id
]);
886 } else if (cmode
== 1) {
887 row
.className
= nc
+ "Unread";
890 db
.execute("UPDATE articles SET unread = 1 "+
891 "WHERE id = ?", [id
]);
896 update_local_feedlist_counters();
898 // Disable unmarking as selected for the time being (16.05.08) -fox
899 if (is_selected
) row
.className
= row
.className
+ "Selected";
901 if (cmode
== undefined) cmode
= 2;
903 var query
= "backend.php?op=rpc&subop=catchupSelected" +
904 "&cmode=" + param_escape(cmode
);
906 var ids
= "?ids=" + param_escape(id
);
908 // notify_progress("Loading, please wait...");
910 new Ajax
.Request(query
, {
912 onComplete: function(transport
) {
913 all_counters_callback2(transport
);
919 exception_error("toggleUnread", e
);
923 function selectionRemoveLabel(id
) {
926 var ids
= getSelectedArticleIds2();
928 if (ids
.length
== 0) {
929 alert(__("No articles are selected."));
933 // var ok = confirm(__("Remove selected articles from label?"));
937 var query
= "backend.php?op=rpc&subop=removeFromLabel&ids=" +
938 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
940 // notify_progress("Loading, please wait...");
942 cache_invalidate("F:" + (-11 - id
));
944 new Ajax
.Request(query
, {
945 onComplete: function(transport
) {
946 show_labels_in_headlines(transport
);
947 all_counters_callback2(transport
);
953 exception_error("selectionAssignLabel", e
);
958 function selectionAssignLabel(id
) {
961 var ids
= getSelectedArticleIds2();
963 if (ids
.length
== 0) {
964 alert(__("No articles are selected."));
968 // var ok = confirm(__("Assign selected articles to label?"));
972 cache_invalidate("F:" + (-11 - id
));
974 var query
= "backend.php?op=rpc&subop=assignToLabel&ids=" +
975 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
977 // notify_progress("Loading, please wait...");
979 new Ajax
.Request(query
, {
980 onComplete: function(transport
) {
981 show_labels_in_headlines(transport
);
982 all_counters_callback2(transport
);
988 exception_error("selectionAssignLabel", e
);
993 function selectionToggleUnread(cdm_mode
, set_state
, callback_func
, no_error
) {
998 rows
= cdmGetSelectedArticles();
1000 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1003 if (rows
.length
== 0 && !no_error
) {
1004 alert(__("No articles are selected."));
1008 for (i
= 0; i
< rows
.length
; i
++) {
1009 var row
= $("RROW-" + rows
[i
]);
1011 var nc
= row
.className
;
1012 nc
= nc
.replace("Unread", "");
1013 nc
= nc
.replace("Selected", "");
1015 if (set_state
== undefined) {
1016 if (row
.className
.match("Unread")) {
1017 row
.className
= nc
+ "Selected";
1019 row
.className
= nc
+ "UnreadSelected";
1022 db
.execute("UPDATE articles SET unread = NOT unread WHERE id = ?",
1027 if (set_state
== false) {
1028 row
.className
= nc
+ "Selected";
1030 db
.execute("UPDATE articles SET unread = 0 WHERE id = ?",
1035 if (set_state
== true) {
1036 row
.className
= nc
+ "UnreadSelected";
1038 db
.execute("UPDATE articles SET unread = 1 WHERE id = ?",
1045 if (rows
.length
> 0) {
1047 update_local_feedlist_counters();
1051 if (set_state
== undefined) {
1053 } else if (set_state
== true) {
1055 } else if (set_state
== false) {
1059 var query
= "backend.php?op=rpc&subop=catchupSelected" +
1062 var ids
= "?ids=" + param_escape(rows
.toString());
1064 notify_progress("Loading, please wait...");
1066 new Ajax
.Request(query
, {
1068 onComplete: function(transport
) {
1069 catchup_callback2(transport
, callback_func
);
1075 exception_error("selectionToggleUnread", e
);
1079 function selectionToggleMarked(cdm_mode
) {
1085 rows
= cdmGetSelectedArticles();
1087 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1090 if (rows
.length
== 0) {
1091 alert(__("No articles are selected."));
1095 for (i
= 0; i
< rows
.length
; i
++) {
1096 toggleMark(rows
[i
], true, true);
1099 update_local_feedlist_counters();
1101 if (rows
.length
> 0) {
1103 var query
= "backend.php?op=rpc&subop=markSelected&ids=" +
1104 param_escape(rows
.toString()) + "&cmode=2";
1106 query
= query
+ "&afid=" + getActiveFeedId();
1108 /* if (tagsAreDisplayed()) {
1109 query = query + "&omode=tl";
1111 query = query + "&omode=flc";
1114 query
= query
+ "&omode=lc";
1116 new Ajax
.Request(query
, {
1117 onComplete: function(transport
) {
1118 all_counters_callback2(transport
);
1124 exception_error("selectionToggleMarked", e
);
1128 function selectionTogglePublished(cdm_mode
) {
1134 rows
= cdmGetSelectedArticles();
1136 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1139 if (rows
.length
== 0) {
1140 alert(__("No articles are selected."));
1144 for (i
= 0; i
< rows
.length
; i
++) {
1145 togglePub(rows
[i
], true, true);
1148 if (rows
.length
> 0) {
1150 var query
= "backend.php?op=rpc&subop=publishSelected&ids=" +
1151 param_escape(rows
.toString()) + "&cmode=2";
1153 query
= query
+ "&afid=" + getActiveFeedId();
1155 /* if (tagsAreDisplayed()) {
1156 query = query + "&omode=tl";
1158 query = query + "&omode=flc";
1161 query
= query
+ "&omode=lc";
1163 new Ajax
.Request(query
, {
1164 onComplete: function(transport
) {
1165 all_counters_callback2(transport
);
1171 exception_error("selectionToggleMarked", e
);
1175 function cdmGetSelectedArticles() {
1176 var sel_articles
= new Array();
1177 var container
= $("headlinesInnerContainer");
1179 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1180 var child
= container
.childNodes
[i
];
1182 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Selected")) {
1183 var c_id
= child
.id
.replace("RROW-", "");
1184 sel_articles
.push(c_id
);
1188 return sel_articles
;
1191 function cdmGetVisibleArticles() {
1192 var sel_articles
= new Array();
1193 var container
= $("headlinesInnerContainer");
1195 if (!container
) return sel_articles
;
1197 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1198 var child
= container
.childNodes
[i
];
1200 if (child
.id
&& child
.id
.match("RROW-")) {
1201 var c_id
= child
.id
.replace("RROW-", "");
1202 sel_articles
.push(c_id
);
1206 return sel_articles
;
1209 function cdmGetUnreadArticles() {
1210 var sel_articles
= new Array();
1211 var container
= $("headlinesInnerContainer");
1213 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1214 var child
= container
.childNodes
[i
];
1216 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Unread")) {
1217 var c_id
= child
.id
.replace("RROW-", "");
1218 sel_articles
.push(c_id
);
1222 return sel_articles
;
1226 // mode = all,none,unread
1227 function cdmSelectArticles(mode
) {
1228 var container
= $("headlinesInnerContainer");
1230 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1231 var child
= container
.childNodes
[i
];
1233 if (child
.id
&& child
.id
.match("RROW-")) {
1234 var aid
= child
.id
.replace("RROW-", "");
1236 var cb
= $("RCHK-" + aid
);
1238 if (mode
== "all") {
1239 if (!child
.className
.match("Selected")) {
1240 child
.className
= child
.className
+ "Selected";
1243 } else if (mode
== "unread") {
1244 if (child
.className
.match("Unread") && !child
.className
.match("Selected")) {
1245 child
.className
= child
.className
+ "Selected";
1249 child
.className
= child
.className
.replace("Selected", "");
1256 function catchupPage() {
1258 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1260 var str
= __("Mark all visible articles in %s as read?");
1262 str
= str
.replace("%s", fn
);
1264 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1268 if ($("headlinesList")) {
1269 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true);
1270 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1271 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1273 cdmSelectArticles('all');
1274 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1275 cdmSelectArticles('none');
1279 function catchupSelection() {
1285 if ($("headlinesList")) {
1286 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1288 rows
= cdmGetSelectedArticles();
1291 if (rows
.length
== 0) {
1292 alert(__("No articles are selected."));
1297 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1299 var str
= __("Mark %d selected articles in %s as read?");
1301 str
= str
.replace("%d", rows
.length
);
1302 str
= str
.replace("%s", fn
);
1304 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1308 if ($("headlinesList")) {
1309 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1310 // selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1312 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1313 // cdmSelectArticles('none');
1317 exception_error("catchupSelection", e
);
1321 function editArticleTags(id
, feed_id
, cdm_enabled
) {
1322 displayDlg('editArticleTags', id
);
1326 function tag_saved_callback(transport
) {
1328 debug("in tag_saved_callback");
1333 if (tagsAreDisplayed()) {
1334 _reload_feedlist_after_view
= true;
1338 if (transport
.responseXML
) {
1339 var tags_str
= transport
.responseXML
.getElementsByTagName("tags-str")[0];
1342 var id
= tags_str
.getAttribute("id");
1345 var tags
= $("ATSTR-" + id
);
1347 tags
.innerHTML
= tags_str
.firstChild
.nodeValue
;
1354 exception_error("tag_saved_callback", e
);
1358 function editTagsSave() {
1360 notify_progress("Saving article tags...");
1362 var form
= document
.forms
["tag_edit_form"];
1364 var query
= Form
.serialize("tag_edit_form");
1366 query
= "backend.php?op=rpc&subop=setArticleTags&" + query
;
1370 new Ajax
.Request(query
, {
1371 onComplete: function(transport
) {
1372 tag_saved_callback(transport
);
1377 function editTagsInsert() {
1380 var form
= document
.forms
["tag_edit_form"];
1382 var found_tags
= form
.found_tags
;
1383 var tags_str
= form
.tags_str
;
1385 var tag
= found_tags
[found_tags
.selectedIndex
].value
;
1387 if (tags_str
.value
.length
> 0 &&
1388 tags_str
.value
.lastIndexOf(", ") != tags_str
.value
.length
- 2) {
1390 tags_str
.value
= tags_str
.value
+ ", ";
1393 tags_str
.value
= tags_str
.value
+ tag
+ ", ";
1395 found_tags
.selectedIndex
= 0;
1398 exception_error("editTagsInsert", e
);
1402 function cdmScrollViewport(where
) {
1403 debug("cdmScrollViewport: " + where
);
1405 var ctr
= $("headlinesInnerContainer");
1409 if (where
== "bottom") {
1410 ctr
.scrollTop
= ctr
.scrollHeight
;
1412 ctr
.scrollTop
= where
;
1416 function cdmArticleIsBelowViewport(id
) {
1418 var ctr
= $("headlinesInnerContainer");
1419 var e
= $("RROW-" + id
);
1421 if (!e
|| !ctr
) return;
1423 // article starts below viewport
1425 if (ctr
.scrollTop
< e
.offsetTop
) {
1432 exception_error("cdmArticleIsVisible", e
);
1436 function cdmArticleIsAboveViewport(id
) {
1438 var ctr
= $("headlinesInnerContainer");
1439 var e
= $("RROW-" + id
);
1441 if (!e
|| !ctr
) return;
1443 // article starts above viewport
1445 if (ctr
.scrollTop
> e
.offsetTop
+ e
.offsetHeight
) {
1452 exception_error("cdmArticleIsVisible", e
);
1456 function cdmScrollToArticleId(id
) {
1458 var ctr
= $("headlinesInnerContainer");
1459 var e
= $("RROW-" + id
);
1461 if (!e
|| !ctr
) return;
1463 ctr
.scrollTop
= e
.offsetTop
;
1466 exception_error("cdmScrollToArticleId", e
);
1470 function cdmArticleIsActuallyVisible(id
) {
1472 var ctr
= $("headlinesInnerContainer");
1473 var e
= $("RROW-" + id
);
1475 if (!e
|| !ctr
) return;
1477 // article fits in viewport OR article is longer than viewport and
1478 // its bottom is visible
1480 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1481 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1485 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1486 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1487 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1496 exception_error("cdmArticleIsVisible", e
);
1500 function cdmWatchdog() {
1504 var ctr
= $("headlinesInnerContainer");
1508 var ids
= new Array();
1510 var e
= ctr
.firstChild
;
1513 if (e
.className
&& e
.className
== "cdmArticleUnread" && e
.id
&&
1514 e
.id
.match("RROW-")) {
1516 // article fits in viewport OR article is longer than viewport and
1517 // its bottom is visible
1519 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1520 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1522 // debug(e.id + " is visible " + e.offsetTop + "." +
1523 // (e.offsetTop + e.offsetHeight) + " vs " + ctr.scrollTop + "." +
1524 // (ctr.scrollTop + ctr.offsetHeight));
1526 ids
.push(e
.id
.replace("RROW-", ""));
1528 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1529 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1530 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1532 ids
.push(e
.id
.replace("RROW-", ""));
1536 // method 2: article bottom is visible and is in upper 1/2 of the viewport
1538 /* if (e.offsetTop + e.offsetHeight >= ctr.scrollTop &&
1539 e.offsetTop + e.offsetHeight <= ctr.scrollTop + ctr.offsetHeight/2) {
1541 ids.push(e.id.replace("RROW-", ""));
1550 debug("cdmWatchdog, ids= " + ids
.toString());
1552 if (ids
.length
> 0) {
1554 for (var i
= 0; i
< ids
.length
; i
++) {
1555 var e
= $("RROW-" + ids
[i
]);
1557 e
.className
= e
.className
.replace("Unread", "");
1561 var query
= "backend.php?op=rpc&subop=catchupSelected" +
1564 var ids
= "?ids=" + param_escape(ids
.toString());
1566 new Ajax
.Request(query
, {
1568 onComplete: function(transport
) {
1569 all_counters_callback2(transport
);
1574 _cdm_wd_timeout
= window
.setTimeout("cdmWatchdog()", 4000);
1577 exception_error("cdmWatchdog", e
);
1583 function cache_inject(id
, article
, param
) {
1585 if (!cache_check_param(id
, param
)) {
1586 debug("cache_article: miss: " + id
+ " [p=" + param
+ "]");
1591 var date
= new Date();
1592 var ts
= Math
.round(date
.getTime() / 1000);
1594 db
.execute("INSERT INTO cache (id, article, param, added) VALUES (?, ?, ?, ?)",
1595 [id
, article
, param
, ts
]);
1598 var cache_obj
= new Array();
1600 cache_obj
["id"] = id
;
1601 cache_obj
["data"] = article
;
1602 cache_obj
["param"] = param
;
1604 article_cache
.push(cache_obj
);
1608 debug("cache_article: hit: " + id
+ " [p=" + param
+ "]");
1611 exception_error("cache_inject", e
);
1615 function cache_find(id
) {
1618 var rs
= db
.execute("SELECT article FROM cache WHERE id = ?", [id
]);
1621 if (rs
.isValidRow()) {
1622 var a
= rs
.field(0);
1630 for (var i
= 0; i
< article_cache
.length
; i
++) {
1631 if (article_cache
[i
]["id"] == id
) {
1632 return article_cache
[i
]["data"];
1639 function cache_find_param(id
, param
) {
1642 var rs
= db
.execute("SELECT article FROM cache WHERE id = ? AND param = ?",
1646 if (rs
.isValidRow()) {
1655 for (var i
= 0; i
< article_cache
.length
; i
++) {
1656 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1657 return article_cache
[i
]["data"];
1664 function cache_check(id
) {
1667 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ?",
1671 if (rs
.isValidRow()) {
1672 a
= rs
.field(0) != "0";
1680 for (var i
= 0; i
< article_cache
.length
; i
++) {
1681 if (article_cache
[i
]["id"] == id
) {
1689 function cache_check_param(id
, param
) {
1692 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ? AND param = ?",
1696 if (rs
.isValidRow()) {
1697 a
= rs
.field(0) != "0";
1705 for (var i
= 0; i
< article_cache
.length
; i
++) {
1706 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1714 function cache_expire() {
1716 var date
= new Date();
1717 var ts
= Math
.round(date
.getTime() / 1000);
1719 db
.execute("DELETE FROM cache WHERE added < ? - 1800 AND id LIKE 'FEEDLIST'", [ts
]);
1720 db
.execute("DELETE FROM cache WHERE added < ? - 600 AND (id LIKE 'F:%' OR id LIKE 'C:%')", [ts
]);
1721 db
.execute("DELETE FROM cache WHERE added < ? - 86400", [ts
]);
1725 while (article_cache
.length
> 25) {
1726 article_cache
.shift();
1731 function cache_empty() {
1732 article_cache
= new Array();
1735 function cache_invalidate(id
) {
1739 rs
= db
.execute("DELETE FROM cache WHERE id = ?", [id
]);
1740 return rs
.rowsAffected
!= 0;
1745 while (i
< article_cache
.length
) {
1746 if (article_cache
[i
]["id"] == id
) {
1747 debug("cache_invalidate: removed id " + id
);
1748 article_cache
.splice(i
, 1);
1755 debug("cache_invalidate: id not found: " + id
);
1758 exception_error("cache_invalidate", e
);
1762 function getActiveArticleId() {
1763 return active_post_id
;
1766 function cdmClicked(id
) {
1768 var elem
= $("RROW-" + id
);
1771 var id
= elem
.id
.replace("RROW-", "");
1772 active_post_id
= id
;
1774 // cdmSelectArticles("none");
1775 toggleUnread(id
, 0, true);
1776 // toggleSelected(id);
1780 exception_error("cdmClicked", e
);
1784 function preload_article_callback(transport
) {
1786 if (transport
.responseXML
) {
1787 var articles
= transport
.responseXML
.getElementsByTagName("article");
1789 for (var i
= 0; i
< articles
.length
; i
++) {
1790 var id
= articles
[i
].getAttribute("id");
1791 if (!cache_check(id
)) {
1792 cache_inject(id
, articles
[i
].firstChild
.nodeValue
);
1793 debug("preloaded article: " + id
);
1798 exception_error("preload_article_callback", e
);
1802 function preloadArticleUnderPointer(id
) {
1804 if (getInitParam("bw_limit") == "1") return;
1806 if (post_under_pointer
== id
&& !cache_check(id
)) {
1808 debug("trying to preload article " + id
);
1810 var neighbor_ids
= getRelativePostIds(id
, 1);
1812 /* only request uncached articles */
1814 var cids_to_request
= Array();
1816 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
1817 if (!cache_check(neighbor_ids
[i
])) {
1818 cids_to_request
.push(neighbor_ids
[i
]);
1821 debug("additional ids: " + cids_to_request
.toString());
1823 cids_to_request
.push(id
);
1825 var query
= "backend.php?op=rpc&subop=getArticles&ids=" +
1826 cids_to_request
.toString();
1827 new Ajax
.Request(query
, {
1828 onComplete: function(transport
) {
1829 preload_article_callback(transport
);
1833 exception_error("preloadArticleUnderPointer", e
);
1837 function postMouseIn(id
) {
1839 if (post_under_pointer
!= id
) {
1840 post_under_pointer
= id
;
1842 window
.setTimeout("preloadArticleUnderPointer(" + id
+ ")", 250);
1847 exception_error("postMouseIn", e
);
1851 function postMouseOut(id
) {
1853 post_under_pointer
= false;
1855 exception_error("postMouseOut", e
);
1859 function headlines_scroll_handler() {
1862 var e
= $("headlinesInnerContainer");
1864 // don't do infinite scrolling when Limit == All
1866 var toolbar_form
= document
.forms
["main_toolbar_form"];
1868 var limit
= toolbar_form
.limit
[toolbar_form
.limit
.selectedIndex
];
1869 if (limit
.value
!= 0) {
1871 debug((e
.scrollTop
+ e
.offsetHeight
) + " vs " + e
.scrollHeight
+ " dis? " +
1872 _infscroll_disable
);
1874 if (e
.scrollTop
+ e
.offsetHeight
> e
.scrollHeight
- 100) {
1875 if (!_infscroll_disable
) {
1876 debug("more cowbell!");
1883 exception_error("headlines_scroll_handler", e
);
1887 function catchupRelativeToArticle(below
) {
1892 if (!getActiveArticleId()) {
1893 alert(__("No article is selected."));
1899 if ($("headlinesList")) {
1900 visible_ids
= getVisibleHeadlineIds();
1902 visible_ids
= cdmGetVisibleArticles();
1905 var ids_to_mark
= new Array();
1908 for (var i
= 0; i
< visible_ids
.length
; i
++) {
1909 if (visible_ids
[i
] != getActiveArticleId()) {
1910 var e
= $("RROW-" + visible_ids
[i
]);
1912 if (e
&& e
.className
.match("Unread")) {
1913 ids_to_mark
.push(visible_ids
[i
]);
1920 for (var i
= visible_ids
.length
-1; i
>= 0; i
--) {
1921 if (visible_ids
[i
] != getActiveArticleId()) {
1922 var e
= $("RROW-" + visible_ids
[i
]);
1924 if (e
&& e
.className
.match("Unread")) {
1925 ids_to_mark
.push(visible_ids
[i
]);
1933 if (ids_to_mark
.length
== 0) {
1934 alert(__("No articles found to mark"));
1936 var msg
= __("Mark %d article(s) as read?").replace("%d", ids_to_mark
.length
);
1940 for (var i
= 0; i
< ids_to_mark
.length
; i
++) {
1941 var e
= $("RROW-" + ids_to_mark
[i
]);
1942 e
.className
= e
.className
.replace("Unread", "");
1945 var query
= "backend.php?op=rpc&subop=catchupSelected" +
1948 var ids
= "?ids=" + param_escape(ids_to_mark
.toString());
1950 new Ajax
.Request(query
, {
1952 onComplete: function(transport
) {
1953 catchup_callback2(transport
);
1960 exception_error("catchupRelativeToArticle", e
);
1964 function cdmExpandArticle(a_id
) {
1966 var id
= 'CICD-' + a_id
;
1969 Element
.hide("CEXC-" + a_id
);
1972 Effect
.Appear(id
, {duration
: 0.5,
1973 beforeStart: function(effect
) {
1974 var h_id
= 'CICH-' + a_id
;
1975 var h_elem
= $(h_id
);
1976 if (h_elem
) { h_elem
.style
.display
= "none"; }
1978 toggleUnread(a_id
, 0);
1983 exception_error("appearBlockElementF", e
);
1988 function fixHeadlinesOrder(ids
) {
1990 for (var i
= 0; i
< ids
.length
; i
++) {
1991 var e
= $("RROW-" + ids
[i
]);
1995 e
.className
= e
.className
.replace("even", "odd");
1997 e
.className
= e
.className
.replace("odd", "even");
2002 exception_error("fixHeadlinesOrder", e
);
2006 function hideReadHeadlines() {
2010 var vis_ids
= new Array();
2012 if ($("headlinesList")) {
2013 ids
= getVisibleHeadlineIds();
2015 ids
= cdmGetVisibleArticles();
2018 var read_headlines_visible
= true;
2020 for (var i
= 0; i
< ids
.length
; i
++) {
2021 var row
= $("RROW-" + ids
[i
]);
2023 if (row
&& row
.className
) {
2024 if (read_headlines_visible
) {
2025 if (row
.className
.match("Unread") || row
.className
.match("Selected")) {
2027 vis_ids
.push(ids
[i
]);
2029 //Effect.Fade(row, {duration : 0.3});
2034 vis_ids
.push(ids
[i
]);
2039 fixHeadlinesOrder(vis_ids
);
2041 read_headlines_visible
= !read_headlines_visible
;
2044 exception_error("hideReadHeadlines", e
);
2048 function invertHeadlineSelection() {
2050 var rows
= new Array();
2054 r
= document
.getElementsByTagName("TR");
2056 r
= document
.getElementsByTagName("DIV");
2059 for (var i
= 0; i
< r
.length
; i
++) {
2060 if (r
[i
].id
&& r
[i
].id
.match("RROW-")) {
2065 for (var i
= 0; i
< rows
.length
; i
++) {
2066 var nc
= rows
[i
].className
;
2067 var id
= rows
[i
].id
.replace("RROW-", "");
2068 var cb
= $("RCHK-" + id
);
2070 if (!rows
[i
].className
.match("Selected")) {
2071 nc
= nc
+ "Selected";
2074 nc
= nc
.replace("Selected", "");
2078 rows
[i
].className
= nc
;
2083 exception_error("invertHeadlineSelection", e
);
2087 function getArticleUnderPointer() {
2088 return post_under_pointer
;
2091 function zoomToArticle(id
) {
2093 var w
= window
.open("backend.php?op=view&mode=zoom&id=" + param_escape(id
),
2095 "status=0,toolbar=0,location=0,width=450,height=300,scrollbars=1,menubar=0");
2098 exception_error("zoomToArticle", e
);
2102 function showOriginalArticleInline(id
) {
2105 var query
= "backend.php?op=rpc&subop=getArticleLink&id=" + id
;
2107 notify_progress("Loading, please wait...", true);
2109 new Ajax
.Request(query
, {
2110 onComplete: function(transport
) {
2112 if (transport
.responseXML
) {
2114 var link
= transport
.responseXML
.getElementsByTagName("link")[0];
2115 var id
= transport
.responseXML
.getElementsByTagName("id")[0];
2120 link
= link
.firstChild
.nodeValue
;
2122 var ci
= $("content-insert");
2124 var tmp
= "<iframe id=\"inline_orig_article\" width=\""+ci
.offsetWidth
+"\" height=\""+ci
.offsetHeight
+"\" style=\"border-width : 0px;\" src=\""+link
+"\"></iframe>";
2126 render_article(tmp
);
2133 exception_error("showOriginalArticleInline", e
);
2138 function scrollArticle(offset
) {
2141 var ci
= $("content-insert");
2143 ci
.scrollTop
+= offset
;
2146 var hi
= $("headlinesInnerContainer");
2148 hi
.scrollTop
+= offset
;
2153 exception_error("scrollArticle", e
);
2157 function show_labels_in_headlines(transport
) {
2159 if (transport
.responseXML
) {
2160 var info
= transport
.responseXML
.getElementsByTagName("info-for-headlines")[0];
2162 var elems
= info
.getElementsByTagName("entry");
2164 for (var l
= 0; l
< elems
.length
; l
++) {
2165 var e_id
= elems
[l
].getAttribute("id");
2169 var ctr
= $("HLLCTR-" + e_id
);
2172 ctr
.innerHTML
= elems
[l
].firstChild
.nodeValue
;
2180 exception_error("show_labels_in_headlines", e
);
2185 function toggleHeadlineActions() {
2187 var e
= $("headlineActionsBody");
2188 var p
= $("headlineActionsDrop");
2190 if (!Element
.visible(e
)) {
2197 e
.style
.left
= (p
.offsetLeft
+ 1) + "px";
2198 e
.style
.top
= (p
.offsetTop
+ p
.offsetHeight
+ 2) + "px";
2201 exception_error("toggleHeadlineActions", e
);
2205 function publishWithNote(id
, def_note
) {
2207 if (!def_note
) def_note
= '';
2209 var note
= prompt(__("Please enter a note for this article:"), def_note
);
2211 if (note
!= undefined) {
2212 togglePub(id
, false, false, note
);
2216 exception_error("publishWithNote", e
);