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 catchup_callback2(transport
, callback
) {
20 debug("catchup_callback2 " + transport
+ ", " + callback
);
22 all_counters_callback2(transport
);
24 setTimeout(callback
, 10);
27 exception_error("catchup_callback2", e
, transport
);
31 function clean_feed_selections() {
33 var feeds
= document
.getElementById("feedList").getElementsByTagName("LI");
35 for (var i
= 0; i
< feeds
.length
; i
++) {
36 if (feeds
[i
].id
&& feeds
[i
].id
.match("FEEDR-")) {
37 feeds
[i
].className
= feeds
[i
].className
.replace("Selected", "");
39 if (feeds
[i
].id
&& feeds
[i
].id
.match("FCAT-")) {
40 feeds
[i
].className
= feeds
[i
].className
.replace("Selected", "");
44 exception_error("clean_feed_selections", e
);
48 function headlines_callback2(transport
, feed_cur_page
) {
51 loading_set_progress(100);
53 debug("headlines_callback2 [page=" + feed_cur_page
+ "]");
55 if (!transport_error_check(transport
)) return;
57 clean_feed_selections();
62 if (transport
.responseXML
) {
63 var headlines
= transport
.responseXML
.getElementsByTagName("headlines")[0];
65 is_cat
= headlines
.getAttribute("is_cat");
66 feed_id
= headlines
.getAttribute("id");
67 setActiveFeedId(feed_id
, is_cat
);
72 var feedr
= document
.getElementById("FEEDR-" + feed_id
);
73 if (feedr
&& !feedr
.className
.match("Selected")) {
74 feedr
.className
= feedr
.className
+ "Selected";
77 var feedr
= document
.getElementById("FCAT-" + feed_id
);
78 if (feedr
&& !feedr
.className
.match("Selected")) {
79 feedr
.className
= feedr
.className
+ "Selected";
83 var f
= document
.getElementById("headlines-frame");
85 if (feed_cur_page
== 0) {
86 debug("resetting headlines scrollTop");
91 if (transport
.responseXML
) {
92 var headlines
= transport
.responseXML
.getElementsByTagName("headlines")[0];
93 var headlines_count_obj
= transport
.responseXML
.getElementsByTagName("headlines-count")[0];
94 var headlines_unread_obj
= transport
.responseXML
.getElementsByTagName("headlines-unread")[0];
95 var disable_cache_obj
= transport
.responseXML
.getElementsByTagName("disable-cache")[0];
97 var vgroup_last_feed_obj
= transport
.responseXML
.getElementsByTagName("vgroup-last-feed")[0];
99 var headlines_count
= headlines_count_obj
.getAttribute("value");
100 var headlines_unread
= headlines_unread_obj
.getAttribute("value");
101 var disable_cache
= disable_cache_obj
.getAttribute("value") != "0";
103 vgroup_last_feed
= vgroup_last_feed_obj
.getAttribute("value");
105 if (headlines_count
== 0) {
106 _infscroll_disable
= 1;
108 _infscroll_disable
= 0;
111 var counters
= transport
.responseXML
.getElementsByTagName("counters")[0];
112 var articles
= transport
.responseXML
.getElementsByTagName("article");
113 var runtime_info
= transport
.responseXML
.getElementsByTagName("runtime-info");
115 if (feed_cur_page
== 0) {
117 f
.innerHTML
= headlines
.firstChild
.nodeValue
;
119 var cache_prefix
= "";
127 cache_invalidate(cache_prefix
+ feed_id
);
129 if (!disable_cache
) {
130 cache_inject(cache_prefix
+ feed_id
,
131 headlines
.firstChild
.nodeValue
, headlines_unread
);
135 debug("headlines_callback: returned no data");
136 f
.innerHTML
= "<div class='whiteBox'>" + __('Could not update headlines (missing XML data)') + "</div>";
141 if (headlines_count
> 0) {
142 debug("adding some more headlines...");
144 var c
= document
.getElementById("headlinesList");
147 c
= document
.getElementById("headlinesInnerContainer");
150 var ids
= getSelectedArticleIds2();
152 c
.innerHTML
= c
.innerHTML
+ headlines
.firstChild
.nodeValue
;
154 debug("restore selected ids: " + ids
);
156 for (var i
= 0; i
< ids
.length
; i
++) {
157 markHeadline(ids
[i
]);
161 debug("no new headlines received");
164 debug("headlines_callback: returned no data");
165 notify_error("Error while trying to load more headlines");
171 for (var i
= 0; i
< articles
.length
; i
++) {
172 var a_id
= articles
[i
].getAttribute("id");
173 debug("found id: " + a_id
);
174 cache_inject(a_id
, articles
[i
].firstChild
.nodeValue
);
177 debug("no cached articles received");
181 debug("parsing piggybacked counters: " + counters
);
182 parse_counters(counters
, false);
184 debug("counters container not found in reply, requesting...");
189 debug("parsing runtime info: " + runtime_info
[0]);
190 parse_runtime_info(runtime_info
[0]);
192 debug("counters container not found in reply");
196 debug("headlines_callback: returned no XML object");
197 f
.innerHTML
= "<div class='whiteBox'>" + __('Could not update headlines (missing XML object)') + "</div>";
200 if (typeof correctPNG
!= 'undefined') {
204 if (_cdm_wd_timeout
) window
.clearTimeout(_cdm_wd_timeout
);
206 if (!document
.getElementById("headlinesList") &&
207 getActiveFeedId() != -3 &&
208 getInitParam("cdm_auto_catchup") == 1) {
209 debug("starting CDM watchdog");
210 _cdm_wd_timeout
= window
.setTimeout("cdmWatchdog()", 5000);
211 _cdm_wd_vishist
= new Array();
213 debug("not in CDM mode or watchdog disabled");
216 _feed_cur_page
= feed_cur_page
;
217 _infscroll_request_sent
= 0;
224 exception_error("headlines_callback2", e
, transport
);
228 function render_article(article
) {
230 var f
= document
.getElementById("content-frame");
235 var fi
= document
.getElementById("content-insert");
241 fi
.innerHTML
= article
;
244 exception_error("render_article", e
);
248 function showArticleInHeadlines(id
) {
252 cleanSelected("headlinesList");
254 var crow
= document
.getElementById("RROW-" + id
);
258 var article_is_unread
= crow
.className
.match("Unread");
260 crow
.className
= crow
.className
.replace("Unread", "");
262 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
264 var upd_img_pic
= document
.getElementById("FUPDPIC-" + id
);
266 var cache_prefix
= "";
268 if (activeFeedIsCat()) {
274 var view_mode
= false;
277 view_mode
= document
.forms
['main_toolbar_form'].view_mode
;
278 view_mode
= view_mode
[view_mode
.selectedIndex
].value
;
283 if (upd_img_pic
&& upd_img_pic
.src
.match("updated.png")) {
284 upd_img_pic
.src
= "images/blank_icon.gif";
286 cache_invalidate(cache_prefix
+ getActiveFeedId());
288 cache_inject(cache_prefix
+ getActiveFeedId(),
289 document
.getElementById("headlines-frame").innerHTML
,
290 get_feed_unread(getActiveFeedId()));
292 } else if (article_is_unread
&& view_mode
== "all_articles") {
294 cache_invalidate(cache_prefix
+ getActiveFeedId());
296 cache_inject(cache_prefix
+ getActiveFeedId(),
297 document
.getElementById("headlines-frame").innerHTML
,
298 get_feed_unread(getActiveFeedId())-1);
300 } else if (article_is_unread
) {
301 cache_invalidate(cache_prefix
+ getActiveFeedId());
307 exception_error("showArticleInHeadlines", e
);
311 function article_callback2(transport
, id
, feed_id
) {
313 debug("article_callback2 " + id
);
315 if (transport
.responseXML
) {
317 if (!transport_error_check(transport
)) return;
319 debug("looking for articles to cache...");
321 var articles
= transport
.responseXML
.getElementsByTagName("article");
323 for (var i
= 0; i
< articles
.length
; i
++) {
324 var a_id
= articles
[i
].getAttribute("id");
326 debug("found id: " + a_id
);
328 if (a_id
== active_post_id
) {
329 debug("active article, rendering...");
330 render_article(articles
[i
].firstChild
.nodeValue
);
333 cache_inject(a_id
, articles
[i
].firstChild
.nodeValue
);
336 if (id
!= last_requested_article
) {
337 debug("requested article id is out of sequence, aborting");
341 active_real_feed_id
= feed_id
;
344 showArticleInHeadlines(id
);
347 db
.execute("UPDATE articles SET unread = 0 WHERE id = ?", [id
]);
350 var reply
= transport
.responseXML
.firstChild
.firstChild
;
353 debug("article_callback: returned no XML object");
354 //var f = document.getElementById("content-frame");
355 //f.innerHTML = "<div class='whiteBox'>" + __('Could not display article (missing XML object)') + "</div>";
358 var date
= new Date();
359 last_article_view
= date
.getTime() / 1000;
361 if (typeof correctPNG
!= 'undefined') {
365 if (_reload_feedlist_after_view
) {
366 setTimeout('updateFeedList(false, false)', 50);
367 _reload_feedlist_after_view
= false;
369 if (transport
.responseXML
) {
370 var counters
= transport
.responseXML
.getElementsByTagName("counters")[0];
373 debug("parsing piggybacked counters: " + counters
);
374 parse_counters(counters
, false);
376 debug("counters container not found in reply, requesting...");
384 exception_error("article_callback2", e
, transport
);
388 function view_offline(id
, feed_id
) {
392 showArticleInHeadlines(id
);
395 db
.execute("UPDATE articles SET unread = 0 WHERE id = ?", [id
]);
398 render_article("FIXME");
399 update_feedlist_counters();
404 exception_error("view_offline", e
);
408 function view(id
, feed_id
, skip_history
) {
411 debug("loading article: " + id
+ "/" + feed_id
);
413 if (offline_mode
) return view_offline(id
, feed_id
);
415 var cached_article
= cache_find(id
);
417 debug("cache check result: " + (cached_article
!= false));
421 //setActiveFeedId(feed_id);
423 var query
= "backend.php?op=view&id=" + param_escape(id
) +
424 "&feed=" + param_escape(feed_id
);
426 var date
= new Date();
428 var neighbor_ids
= getRelativePostIds(active_post_id
);
430 /* only request uncached articles */
432 var cids_to_request
= Array();
434 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
435 if (!cache_check(neighbor_ids
[i
])) {
436 cids_to_request
.push(neighbor_ids
[i
]);
440 debug("additional ids: " + cids_to_request
.toString());
442 /* additional info for piggyback counters */
444 if (tagsAreDisplayed()) {
445 query
= query
+ "&omode=lt";
447 query
= query
+ "&omode=flc";
450 var date
= new Date();
451 var timestamp
= Math
.round(date
.getTime() / 1000);
452 query
= query
+ "&ts=" + timestamp
;
454 query
= query
+ "&cids=" + cids_to_request
.toString();
456 var crow
= document
.getElementById("RROW-" + id
);
457 var article_is_unread
= crow
.className
.match("Unread");
459 if (!async_counters_work
) {
460 query
= query
+ "&csync=true";
463 showArticleInHeadlines(id
);
465 if (!cached_article
) {
467 notify_progress("Loading, please wait...", true);
469 } else if (cached_article
&& article_is_unread
) {
471 query
= query
+ "&mode=prefetch";
473 render_article(cached_article
);
475 } else if (cached_article
) {
477 query
= query
+ "&mode=prefetch_old";
478 render_article(cached_article
);
484 last_requested_article
= id
;
486 new Ajax
.Request(query
, {
487 onComplete: function(transport
) {
488 article_callback2(transport
, id
, feed_id
);
494 exception_error("view", e
);
499 return toggleMark(id
);
503 return togglePub(id
);
506 function tMark_afh_off(effect
) {
508 var elem
= effect
.effects
[0].element
;
510 debug("tMark_afh_off : " + elem
.id
);
513 elem
.src
= elem
.src
.replace("mark_set", "mark_unset");
514 elem
.alt
= __("Star article");
519 exception_error("tMark_afh_off", e
);
523 function tPub_afh_off(effect
) {
525 var elem
= effect
.effects
[0].element
;
527 debug("tPub_afh_off : " + elem
.id
);
530 elem
.src
= elem
.src
.replace("pub_set", "pub_unset");
531 elem
.alt
= __("Publish article");
536 exception_error("tPub_afh_off", e
);
540 function toggleMark(id
, client_only
, no_effects
) {
544 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=mark";
546 query
= query
+ "&afid=" + getActiveFeedId();
548 if (tagsAreDisplayed()) {
549 query
= query
+ "&omode=tl";
551 query
= query
+ "&omode=flc";
554 var mark_img
= document
.getElementById("FMPIC-" + id
);
556 if (!mark_img
) return;
558 var vfeedu
= document
.getElementById("FEEDU--1");
559 var crow
= document
.getElementById("RROW-" + id
);
561 if (mark_img
.src
.match("mark_unset")) {
562 mark_img
.src
= mark_img
.src
.replace("mark_unset", "mark_set");
563 mark_img
.alt
= __("Unstar article");
564 query
= query
+ "&mark=1";
567 db
.execute("UPDATE articles SET marked = 1 WHERE id = ?", [id
]);
571 //mark_img.src = "images/mark_unset.png";
572 mark_img
.alt
= __("Please wait...");
573 query
= query
+ "&mark=0";
575 if (document
.getElementById("headlinesList") && !no_effects
) {
576 Effect
.Puff(mark_img
, {duration
: 0.25, afterFinish
: tMark_afh_off
});
578 mark_img
.src
= mark_img
.src
.replace("mark_set", "mark_unset");
579 mark_img
.alt
= __("Star article");
583 db
.execute("UPDATE articles SET marked = 0 WHERE id = ?", [id
]);
591 new Ajax
.Request(query
, {
592 onComplete: function(transport
) {
593 all_counters_callback2(transport
);
599 exception_error("toggleMark", e
);
603 function togglePub(id
, client_only
, no_effects
) {
607 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=publ";
609 query
= query
+ "&afid=" + getActiveFeedId();
611 if (tagsAreDisplayed()) {
612 query
= query
+ "&omode=tl";
614 query
= query
+ "&omode=flc";
617 var mark_img
= document
.getElementById("FPPIC-" + id
);
619 if (!mark_img
) return;
621 var vfeedu
= document
.getElementById("FEEDU--2");
622 var crow
= document
.getElementById("RROW-" + id
);
624 if (mark_img
.src
.match("pub_unset")) {
625 mark_img
.src
= mark_img
.src
.replace("pub_unset", "pub_set");
626 mark_img
.alt
= __("Unpublish article");
627 query
= query
+ "&pub=1";
631 //mark_img.src = "images/pub_unset.png";
632 mark_img
.alt
= __("Please wait...");
633 query
= query
+ "&pub=0";
635 if (document
.getElementById("headlinesList") && !no_effects
) {
636 Effect
.Puff(mark_img
, {duration
: 0.25, afterFinish
: tPub_afh_off
});
638 mark_img
.src
= mark_img
.src
.replace("pub_set", "pub_unset");
639 mark_img
.alt
= __("Publish article");
644 new Ajax
.Request(query
, {
645 onComplete: function(transport
) {
646 all_counters_callback2(transport
);
652 exception_error("togglePub", e
);
656 function correctHeadlinesOffset(id
) {
660 var hlist
= document
.getElementById("headlinesList");
661 var container
= document
.getElementById("headlinesInnerContainer");
662 var row
= document
.getElementById("RROW-" + id
);
664 var viewport
= container
.offsetHeight
;
666 var rel_offset_top
= row
.offsetTop
- container
.scrollTop
;
667 var rel_offset_bottom
= row
.offsetTop
+ row
.offsetHeight
- container
.scrollTop
;
669 debug("Rtop: " + rel_offset_top
+ " Rbtm: " + rel_offset_bottom
);
670 debug("Vport: " + viewport
);
672 if (rel_offset_top
<= 0 || rel_offset_top
> viewport
) {
673 container
.scrollTop
= row
.offsetTop
;
674 } else if (rel_offset_bottom
> viewport
) {
676 /* doesn't properly work with Opera in some cases because
677 Opera fucks up element scrolling */
679 container
.scrollTop
= row
.offsetTop
+ row
.offsetHeight
- viewport
;
683 exception_error("correctHeadlinesOffset", e
);
688 function moveToPost(mode
) {
695 rows
= cdmGetVisibleArticles();
697 rows
= getVisibleHeadlineIds();
703 if (!document
.getElementById('RROW-' + active_post_id
)) {
704 active_post_id
= false;
707 if (active_post_id
== false) {
708 next_id
= getFirstVisibleHeadlineId();
709 prev_id
= getLastVisibleHeadlineId();
711 for (var i
= 0; i
< rows
.length
; i
++) {
712 if (rows
[i
] == active_post_id
) {
719 if (mode
== "next") {
723 if (!cdmArticleIsActuallyVisible(next_id
)) {
724 cdmScrollToArticleId(next_id
);
726 cdmSelectArticles("none");
727 toggleUnread(next_id
, 0, true);
728 toggleSelected(next_id
);
731 correctHeadlinesOffset(next_id
);
732 view(next_id
, getActiveFeedId());
737 if (mode
== "prev") {
740 cdmScrollToArticleId(prev_id
);
741 cdmSelectArticles("none");
742 toggleUnread(prev_id
, 0, true);
743 toggleSelected(prev_id
);
745 correctHeadlinesOffset(prev_id
);
746 view(prev_id
, getActiveFeedId());
752 exception_error("moveToPost", e
);
756 function toggleSelected(id
) {
759 var cb
= document
.getElementById("RCHK-" + id
);
761 var row
= document
.getElementById("RROW-" + id
);
763 var nc
= row
.className
;
765 if (!nc
.match("Selected")) {
766 nc
= nc
+ "Selected";
771 // In CDM basically last selected article == active article
772 if (isCdmMode()) active_post_id
= id
;
774 nc
= nc
.replace("Selected", "");
784 exception_error("toggleSelected", e
);
788 function toggleUnread_afh(effect
) {
791 var elem
= effect
.element
;
792 elem
.style
.backgroundColor
= "";
795 exception_error("toggleUnread_afh", e
);
799 function toggleUnread(id
, cmode
, effect
) {
802 var row
= document
.getElementById("RROW-" + id
);
804 var nc
= row
.className
;
805 var is_selected
= row
.className
.match("Selected");
806 nc
= nc
.replace("Unread", "");
807 nc
= nc
.replace("Selected", "");
809 // since we are removing selection from the object, uncheck
810 // corresponding checkbox
812 var cb
= document
.getElementById("RCHK-" + id
);
817 // NOTE: I'm not sure that resetting selection here is a feature -fox
819 if (cmode
== undefined || cmode
== 2) {
820 if (row
.className
.match("Unread")) {
824 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
825 afterFinish
: toggleUnread_afh
,
826 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
830 row
.className
= nc
+ "Unread";
832 } else if (cmode
== 0) {
836 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
837 afterFinish
: toggleUnread_afh
,
838 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
840 } else if (cmode
== 1) {
841 row
.className
= nc
+ "Unread";
844 // Disable unmarking as selected for the time being (16.05.08) -fox
845 if (is_selected
) row
.className
= row
.className
+ "Selected";
847 if (cmode
== undefined) cmode
= 2;
849 var query
= "backend.php?op=rpc&subop=catchupSelected&ids=" +
850 param_escape(id
) + "&cmode=" + param_escape(cmode
);
852 // notify_progress("Loading, please wait...");
854 new Ajax
.Request(query
, {
855 onComplete: function(transport
) {
856 all_counters_callback2(transport
);
863 exception_error("toggleUnread", e
);
867 function selectionRemoveLabel(id
) {
870 var ids
= getSelectedArticleIds2();
872 if (ids
.length
== 0) {
873 alert(__("No articles are selected."));
877 // var ok = confirm(__("Remove selected articles from label?"));
881 var query
= "backend.php?op=rpc&subop=removeFromLabel&ids=" +
882 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
884 // notify_progress("Loading, please wait...");
886 cache_invalidate("F:" + (-11 - id
));
888 new Ajax
.Request(query
, {
889 onComplete: function(transport
) {
890 show_labels_in_headlines(transport
);
891 all_counters_callback2(transport
);
897 exception_error("selectionAssignLabel", e
);
902 function selectionAssignLabel(id
) {
905 var ids
= getSelectedArticleIds2();
907 if (ids
.length
== 0) {
908 alert(__("No articles are selected."));
912 // var ok = confirm(__("Assign selected articles to label?"));
916 cache_invalidate("F:" + (-11 - id
));
918 var query
= "backend.php?op=rpc&subop=assignToLabel&ids=" +
919 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
921 // notify_progress("Loading, please wait...");
923 new Ajax
.Request(query
, {
924 onComplete: function(transport
) {
925 show_labels_in_headlines(transport
);
926 all_counters_callback2(transport
);
932 exception_error("selectionAssignLabel", e
);
937 function selectionToggleUnread(cdm_mode
, set_state
, callback_func
, no_error
) {
942 rows
= cdmGetSelectedArticles();
944 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
947 if (rows
.length
== 0 && !no_error
) {
948 alert(__("No articles are selected."));
952 for (i
= 0; i
< rows
.length
; i
++) {
953 var row
= document
.getElementById("RROW-" + rows
[i
]);
955 var nc
= row
.className
;
956 nc
= nc
.replace("Unread", "");
957 nc
= nc
.replace("Selected", "");
959 if (set_state
== undefined) {
960 if (row
.className
.match("Unread")) {
961 row
.className
= nc
+ "Selected";
963 row
.className
= nc
+ "UnreadSelected";
967 if (set_state
== false) {
968 row
.className
= nc
+ "Selected";
971 if (set_state
== true) {
972 row
.className
= nc
+ "UnreadSelected";
977 if (rows
.length
> 0) {
981 if (set_state
== undefined) {
983 } else if (set_state
== true) {
985 } else if (set_state
== false) {
989 var query
= "backend.php?op=rpc&subop=catchupSelected&ids=" +
990 param_escape(rows
.toString()) + "&cmode=" + cmode
;
992 notify_progress("Loading, please wait...");
994 new Ajax
.Request(query
, {
995 onComplete: function(transport
) {
996 catchup_callback2(transport
, callback_func
);
1002 exception_error("selectionToggleUnread", e
);
1006 function selectionToggleMarked(cdm_mode
) {
1012 rows
= cdmGetSelectedArticles();
1014 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1017 if (rows
.length
== 0) {
1018 alert(__("No articles are selected."));
1022 for (i
= 0; i
< rows
.length
; i
++) {
1023 toggleMark(rows
[i
], true, true);
1026 if (rows
.length
> 0) {
1028 var query
= "backend.php?op=rpc&subop=markSelected&ids=" +
1029 param_escape(rows
.toString()) + "&cmode=2";
1031 query
= query
+ "&afid=" + getActiveFeedId();
1033 /* if (tagsAreDisplayed()) {
1034 query = query + "&omode=tl";
1036 query = query + "&omode=flc";
1039 query
= query
+ "&omode=lc";
1041 new Ajax
.Request(query
, {
1042 onComplete: function(transport
) {
1043 all_counters_callback2(transport
);
1049 exception_error("selectionToggleMarked", e
);
1053 function selectionTogglePublished(cdm_mode
) {
1059 rows
= cdmGetSelectedArticles();
1061 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1064 if (rows
.length
== 0) {
1065 alert(__("No articles are selected."));
1069 for (i
= 0; i
< rows
.length
; i
++) {
1070 togglePub(rows
[i
], true, true);
1073 if (rows
.length
> 0) {
1075 var query
= "backend.php?op=rpc&subop=publishSelected&ids=" +
1076 param_escape(rows
.toString()) + "&cmode=2";
1078 query
= query
+ "&afid=" + getActiveFeedId();
1080 /* if (tagsAreDisplayed()) {
1081 query = query + "&omode=tl";
1083 query = query + "&omode=flc";
1086 query
= query
+ "&omode=lc";
1088 new Ajax
.Request(query
, {
1089 onComplete: function(transport
) {
1090 all_counters_callback2(transport
);
1096 exception_error("selectionToggleMarked", e
);
1100 function cdmGetSelectedArticles() {
1101 var sel_articles
= new Array();
1102 var container
= document
.getElementById("headlinesInnerContainer");
1104 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1105 var child
= container
.childNodes
[i
];
1107 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Selected")) {
1108 var c_id
= child
.id
.replace("RROW-", "");
1109 sel_articles
.push(c_id
);
1113 return sel_articles
;
1116 function cdmGetVisibleArticles() {
1117 var sel_articles
= new Array();
1118 var container
= document
.getElementById("headlinesInnerContainer");
1120 if (!container
) return sel_articles
;
1122 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1123 var child
= container
.childNodes
[i
];
1125 if (child
.id
&& child
.id
.match("RROW-")) {
1126 var c_id
= child
.id
.replace("RROW-", "");
1127 sel_articles
.push(c_id
);
1131 return sel_articles
;
1134 function cdmGetUnreadArticles() {
1135 var sel_articles
= new Array();
1136 var container
= document
.getElementById("headlinesInnerContainer");
1138 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1139 var child
= container
.childNodes
[i
];
1141 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Unread")) {
1142 var c_id
= child
.id
.replace("RROW-", "");
1143 sel_articles
.push(c_id
);
1147 return sel_articles
;
1151 // mode = all,none,unread
1152 function cdmSelectArticles(mode
) {
1153 var container
= document
.getElementById("headlinesInnerContainer");
1155 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1156 var child
= container
.childNodes
[i
];
1158 if (child
.id
&& child
.id
.match("RROW-")) {
1159 var aid
= child
.id
.replace("RROW-", "");
1161 var cb
= document
.getElementById("RCHK-" + aid
);
1163 if (mode
== "all") {
1164 if (!child
.className
.match("Selected")) {
1165 child
.className
= child
.className
+ "Selected";
1168 } else if (mode
== "unread") {
1169 if (child
.className
.match("Unread") && !child
.className
.match("Selected")) {
1170 child
.className
= child
.className
+ "Selected";
1174 child
.className
= child
.className
.replace("Selected", "");
1181 function catchupPage() {
1183 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1185 var str
= __("Mark all visible articles in %s as read?");
1187 str
= str
.replace("%s", fn
);
1189 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1193 if (document
.getElementById("headlinesList")) {
1194 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true);
1195 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1196 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1198 cdmSelectArticles('all');
1199 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1200 cdmSelectArticles('none');
1204 function catchupSelection() {
1210 if (document
.getElementById("headlinesList")) {
1211 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1213 rows
= cdmGetSelectedArticles();
1216 if (rows
.length
== 0) {
1217 alert(__("No articles are selected."));
1222 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1224 var str
= __("Mark %d selected articles in %s as read?");
1226 str
= str
.replace("%d", rows
.length
);
1227 str
= str
.replace("%s", fn
);
1229 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1233 if (document
.getElementById("headlinesList")) {
1234 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1235 // selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1237 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1238 // cdmSelectArticles('none');
1242 exception_error("catchupSelection", e
);
1246 function editArticleTags(id
, feed_id
, cdm_enabled
) {
1247 displayDlg('editArticleTags', id
);
1251 function tag_saved_callback(transport
) {
1253 debug("in tag_saved_callback");
1258 if (tagsAreDisplayed()) {
1259 _reload_feedlist_after_view
= true;
1263 if (transport
.responseXML
) {
1264 var tags_str
= transport
.responseXML
.getElementsByTagName("tags-str")[0];
1267 var id
= tags_str
.getAttribute("id");
1270 var tags
= document
.getElementById("ATSTR-" + id
);
1272 tags
.innerHTML
= tags_str
.firstChild
.nodeValue
;
1279 exception_error("tag_saved_callback", e
);
1283 function editTagsSave() {
1285 notify_progress("Saving article tags...");
1287 var form
= document
.forms
["tag_edit_form"];
1289 var query
= Form
.serialize("tag_edit_form");
1291 query
= "backend.php?op=rpc&subop=setArticleTags&" + query
;
1295 new Ajax
.Request(query
, {
1296 onComplete: function(transport
) {
1297 tag_saved_callback(transport
);
1302 function editTagsInsert() {
1305 var form
= document
.forms
["tag_edit_form"];
1307 var found_tags
= form
.found_tags
;
1308 var tags_str
= form
.tags_str
;
1310 var tag
= found_tags
[found_tags
.selectedIndex
].value
;
1312 if (tags_str
.value
.length
> 0 &&
1313 tags_str
.value
.lastIndexOf(", ") != tags_str
.value
.length
- 2) {
1315 tags_str
.value
= tags_str
.value
+ ", ";
1318 tags_str
.value
= tags_str
.value
+ tag
+ ", ";
1320 found_tags
.selectedIndex
= 0;
1323 exception_error("editTagsInsert", e
);
1327 function cdmScrollViewport(where
) {
1328 debug("cdmScrollViewport: " + where
);
1330 var ctr
= document
.getElementById("headlinesInnerContainer");
1334 if (where
== "bottom") {
1335 ctr
.scrollTop
= ctr
.scrollHeight
;
1337 ctr
.scrollTop
= where
;
1341 function cdmArticleIsBelowViewport(id
) {
1343 var ctr
= document
.getElementById("headlinesInnerContainer");
1344 var e
= document
.getElementById("RROW-" + id
);
1346 if (!e
|| !ctr
) return;
1348 // article starts below viewport
1350 if (ctr
.scrollTop
< e
.offsetTop
) {
1357 exception_error("cdmArticleIsVisible", e
);
1361 function cdmArticleIsAboveViewport(id
) {
1363 var ctr
= document
.getElementById("headlinesInnerContainer");
1364 var e
= document
.getElementById("RROW-" + id
);
1366 if (!e
|| !ctr
) return;
1368 // article starts above viewport
1370 if (ctr
.scrollTop
> e
.offsetTop
+ e
.offsetHeight
) {
1377 exception_error("cdmArticleIsVisible", e
);
1381 function cdmScrollToArticleId(id
) {
1383 var ctr
= document
.getElementById("headlinesInnerContainer");
1384 var e
= document
.getElementById("RROW-" + id
);
1386 if (!e
|| !ctr
) return;
1388 ctr
.scrollTop
= e
.offsetTop
;
1391 exception_error("cdmScrollToArticleId", e
);
1395 function cdmArticleIsActuallyVisible(id
) {
1397 var ctr
= document
.getElementById("headlinesInnerContainer");
1398 var e
= document
.getElementById("RROW-" + id
);
1400 if (!e
|| !ctr
) return;
1402 // article fits in viewport OR article is longer than viewport and
1403 // its bottom is visible
1405 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1406 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1410 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1411 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1412 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1421 exception_error("cdmArticleIsVisible", e
);
1425 function cdmWatchdog() {
1429 var ctr
= document
.getElementById("headlinesInnerContainer");
1433 var ids
= new Array();
1435 var e
= ctr
.firstChild
;
1438 if (e
.className
&& e
.className
== "cdmArticleUnread" && e
.id
&&
1439 e
.id
.match("RROW-")) {
1441 // article fits in viewport OR article is longer than viewport and
1442 // its bottom is visible
1444 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1445 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1447 // debug(e.id + " is visible " + e.offsetTop + "." +
1448 // (e.offsetTop + e.offsetHeight) + " vs " + ctr.scrollTop + "." +
1449 // (ctr.scrollTop + ctr.offsetHeight));
1451 ids
.push(e
.id
.replace("RROW-", ""));
1453 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1454 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1455 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1457 ids
.push(e
.id
.replace("RROW-", ""));
1461 // method 2: article bottom is visible and is in upper 1/2 of the viewport
1463 /* if (e.offsetTop + e.offsetHeight >= ctr.scrollTop &&
1464 e.offsetTop + e.offsetHeight <= ctr.scrollTop + ctr.offsetHeight/2) {
1466 ids.push(e.id.replace("RROW-", ""));
1475 debug("cdmWatchdog, ids= " + ids
.toString());
1477 if (ids
.length
> 0) {
1479 for (var i
= 0; i
< ids
.length
; i
++) {
1480 var e
= document
.getElementById("RROW-" + ids
[i
]);
1482 e
.className
= e
.className
.replace("Unread", "");
1486 var query
= "backend.php?op=rpc&subop=catchupSelected&ids=" +
1487 param_escape(ids
.toString()) + "&cmode=0";
1489 new Ajax
.Request(query
, {
1490 onComplete: function(transport
) {
1491 all_counters_callback2(transport
);
1496 _cdm_wd_timeout
= window
.setTimeout("cdmWatchdog()", 4000);
1499 exception_error("cdmWatchdog", e
);
1505 function cache_inject(id
, article
, param
) {
1507 if (!cache_check_param(id
, param
)) {
1508 debug("cache_article: miss: " + id
+ " [p=" + param
+ "]");
1513 var date
= new Date();
1514 var ts
= Math
.round(date
.getTime() / 1000);
1516 db
.execute("INSERT INTO cache (id, article, param, added) VALUES (?, ?, ?, ?)",
1517 [id
, article
, param
, ts
]);
1520 var cache_obj
= new Array();
1522 cache_obj
["id"] = id
;
1523 cache_obj
["data"] = article
;
1524 cache_obj
["param"] = param
;
1526 article_cache
.push(cache_obj
);
1530 debug("cache_article: hit: " + id
+ " [p=" + param
+ "]");
1533 exception_error("cache_inject", e
);
1537 function cache_find(id
) {
1540 var rs
= db
.execute("SELECT article FROM cache WHERE id = ?", [id
]);
1542 if (rs
.isValidRow()) {
1547 for (var i
= 0; i
< article_cache
.length
; i
++) {
1548 if (article_cache
[i
]["id"] == id
) {
1549 return article_cache
[i
]["data"];
1556 function cache_find_param(id
, param
) {
1559 var rs
= db
.execute("SELECT article FROM cache WHERE id = ? AND param = ?",
1562 if (rs
.isValidRow()) {
1567 for (var i
= 0; i
< article_cache
.length
; i
++) {
1568 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1569 return article_cache
[i
]["data"];
1576 function cache_check(id
) {
1579 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ?",
1582 if (rs
.isValidRow()) {
1583 return rs
.field(0) != "0";
1587 for (var i
= 0; i
< article_cache
.length
; i
++) {
1588 if (article_cache
[i
]["id"] == id
) {
1596 function cache_check_param(id
, param
) {
1599 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ? AND param = ?",
1602 if (rs
.isValidRow()) {
1603 return rs
.field(0) != "0";
1607 for (var i
= 0; i
< article_cache
.length
; i
++) {
1608 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1616 function cache_expire() {
1618 var date
= new Date();
1619 var ts
= Math
.round(date
.getTime() / 1000);
1621 db
.execute("DELETE FROM cache WHERE added < ? - 1800 AND id LIKE 'FEEDLIST'", [ts
]);
1622 db
.execute("DELETE FROM cache WHERE added < ? - 600 AND (id LIKE 'F:%' OR id LIKE 'C:%')", [ts
]);
1623 db
.execute("DELETE FROM cache WHERE added < ? - 86400", [ts
]);
1627 while (article_cache
.length
> 25) {
1628 article_cache
.shift();
1633 function cache_empty() {
1634 article_cache
= new Array();
1637 function cache_invalidate(id
) {
1641 rs
= db
.execute("DELETE FROM cache WHERE id = ?", [id
]);
1642 return rs
.rowsAffected
!= 0;
1647 while (i
< article_cache
.length
) {
1648 if (article_cache
[i
]["id"] == id
) {
1649 debug("cache_invalidate: removed id " + id
);
1650 article_cache
.splice(i
, 1);
1657 debug("cache_invalidate: id not found: " + id
);
1660 exception_error("cache_invalidate", e
);
1664 function getActiveArticleId() {
1665 return active_post_id
;
1668 function cdmClicked(id
) {
1670 var elem
= document
.getElementById("RROW-" + id
);
1673 var id
= elem
.id
.replace("RROW-", "");
1674 active_post_id
= id
;
1676 cdmSelectArticles("none");
1677 toggleUnread(id
, 0, true);
1682 exception_error("cdmClicked", e
);
1686 function preload_article_callback(transport
) {
1688 if (transport
.responseXML
) {
1689 var articles
= transport
.responseXML
.getElementsByTagName("article");
1691 for (var i
= 0; i
< articles
.length
; i
++) {
1692 var id
= articles
[i
].getAttribute("id");
1693 if (!cache_check(id
)) {
1694 cache_inject(id
, articles
[i
].firstChild
.nodeValue
);
1695 debug("preloaded article: " + id
);
1700 exception_error("preload_article_callback", e
);
1704 function preloadArticleUnderPointer(id
) {
1706 if (getInitParam("bw_limit") == "1") return;
1708 if (post_under_pointer
== id
&& !cache_check(id
)) {
1710 debug("trying to preload article " + id
);
1712 var neighbor_ids
= getRelativePostIds(id
, 1);
1714 /* only request uncached articles */
1716 var cids_to_request
= Array();
1718 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
1719 if (!cache_check(neighbor_ids
[i
])) {
1720 cids_to_request
.push(neighbor_ids
[i
]);
1723 debug("additional ids: " + cids_to_request
.toString());
1725 cids_to_request
.push(id
);
1727 var query
= "backend.php?op=rpc&subop=getArticles&ids=" +
1728 cids_to_request
.toString();
1729 new Ajax
.Request(query
, {
1730 onComplete: function(transport
) {
1731 preload_article_callback(transport
);
1735 exception_error("preloadArticleUnderPointer", e
);
1739 function postMouseIn(id
) {
1741 if (post_under_pointer
!= id
) {
1742 post_under_pointer
= id
;
1744 window
.setTimeout("preloadArticleUnderPointer(" + id
+ ")", 250);
1749 exception_error("postMouseIn", e
);
1753 function postMouseOut(id
) {
1755 post_under_pointer
= false;
1757 exception_error("postMouseOut", e
);
1761 function headlines_scroll_handler() {
1764 var e
= document
.getElementById("headlinesInnerContainer");
1766 // don't do infinite scrolling when Limit == All
1768 var toolbar_form
= document
.forms
["main_toolbar_form"];
1770 var limit
= toolbar_form
.limit
[toolbar_form
.limit
.selectedIndex
];
1771 if (limit
.value
!= 0) {
1773 debug((e
.scrollTop
+ e
.offsetHeight
) + " vs " + e
.scrollHeight
+ " dis? " +
1774 _infscroll_disable
);
1776 if (e
.scrollTop
+ e
.offsetHeight
> e
.scrollHeight
- 100) {
1777 if (!_infscroll_disable
) {
1778 debug("more cowbell!");
1785 exception_error("headlines_scroll_handler", e
);
1789 function catchupRelativeToArticle(below
) {
1794 if (!getActiveArticleId()) {
1795 alert(__("No article is selected."));
1801 if (document
.getElementById("headlinesList")) {
1802 visible_ids
= getVisibleHeadlineIds();
1804 visible_ids
= cdmGetVisibleArticles();
1807 var ids_to_mark
= new Array();
1810 for (var i
= 0; i
< visible_ids
.length
; i
++) {
1811 if (visible_ids
[i
] != getActiveArticleId()) {
1812 var e
= document
.getElementById("RROW-" + visible_ids
[i
]);
1814 if (e
&& e
.className
.match("Unread")) {
1815 ids_to_mark
.push(visible_ids
[i
]);
1822 for (var i
= visible_ids
.length
-1; i
>= 0; i
--) {
1823 if (visible_ids
[i
] != getActiveArticleId()) {
1824 var e
= document
.getElementById("RROW-" + visible_ids
[i
]);
1826 if (e
&& e
.className
.match("Unread")) {
1827 ids_to_mark
.push(visible_ids
[i
]);
1835 if (ids_to_mark
.length
== 0) {
1836 alert(__("No articles found to mark"));
1838 var msg
= __("Mark %d article(s) as read?").replace("%d", ids_to_mark
.length
);
1842 for (var i
= 0; i
< ids_to_mark
.length
; i
++) {
1843 var e
= document
.getElementById("RROW-" + ids_to_mark
[i
]);
1844 e
.className
= e
.className
.replace("Unread", "");
1847 var query
= "backend.php?op=rpc&subop=catchupSelected&ids=" +
1848 param_escape(ids_to_mark
.toString()) + "&cmode=0";
1850 new Ajax
.Request(query
, {
1851 onComplete: function(transport
) {
1852 catchup_callback2(transport
);
1859 exception_error("catchupRelativeToArticle", e
);
1863 function cdmExpandArticle(a_id
) {
1865 var id
= 'CICD-' + a_id
;
1868 Element
.hide("CEXC-" + a_id
);
1871 Effect
.Appear(id
, {duration
: 0.5,
1872 beforeStart: function(effect
) {
1873 var h_id
= 'CICH-' + a_id
;
1874 var h_elem
= document
.getElementById(h_id
);
1875 if (h_elem
) { h_elem
.style
.display
= "none"; }
1877 toggleUnread(a_id
, 0);
1882 exception_error("appearBlockElementF", e
);
1887 function fixHeadlinesOrder(ids
) {
1889 for (var i
= 0; i
< ids
.length
; i
++) {
1890 var e
= document
.getElementById("RROW-" + ids
[i
]);
1894 e
.className
= e
.className
.replace("even", "odd");
1896 e
.className
= e
.className
.replace("odd", "even");
1901 exception_error("fixHeadlinesOrder", e
);
1905 function hideReadHeadlines() {
1909 var vis_ids
= new Array();
1911 if (document
.getElementById("headlinesList")) {
1912 ids
= getVisibleHeadlineIds();
1914 ids
= cdmGetVisibleArticles();
1917 var read_headlines_visible
= true;
1919 for (var i
= 0; i
< ids
.length
; i
++) {
1920 var row
= document
.getElementById("RROW-" + ids
[i
]);
1922 if (row
&& row
.className
) {
1923 if (read_headlines_visible
) {
1924 if (row
.className
.match("Unread") || row
.className
.match("Selected")) {
1926 vis_ids
.push(ids
[i
]);
1928 //Effect.Fade(row, {duration : 0.3});
1933 vis_ids
.push(ids
[i
]);
1938 fixHeadlinesOrder(vis_ids
);
1940 read_headlines_visible
= !read_headlines_visible
;
1943 exception_error("hideReadHeadlines", e
);
1947 function invertHeadlineSelection() {
1949 var rows
= new Array();
1953 r
= document
.getElementsByTagName("TR");
1955 r
= document
.getElementsByTagName("DIV");
1958 for (var i
= 0; i
< r
.length
; i
++) {
1959 if (r
[i
].id
&& r
[i
].id
.match("RROW-")) {
1964 for (var i
= 0; i
< rows
.length
; i
++) {
1965 var nc
= rows
[i
].className
;
1966 var id
= rows
[i
].id
.replace("RROW-", "");
1967 var cb
= document
.getElementById("RCHK-" + id
);
1969 if (!rows
[i
].className
.match("Selected")) {
1970 nc
= nc
+ "Selected";
1973 nc
= nc
.replace("Selected", "");
1977 rows
[i
].className
= nc
;
1982 exception_error("invertHeadlineSelection", e
);
1986 function getArticleUnderPointer() {
1987 return post_under_pointer
;
1990 function zoomToArticle(id
) {
1992 var w
= window
.open("backend.php?op=view&mode=zoom&id=" + param_escape(id
),
1994 "status=0,toolbar=0,location=0,width=450,height=300,scrollbars=1,menubar=0");
1997 exception_error("zoomToArticle", e
);
2001 function showOriginalArticleInline(id
) {
2004 var query
= "backend.php?op=rpc&subop=getArticleLink&id=" + id
;
2006 notify_progress("Loading, please wait...", true);
2008 new Ajax
.Request(query
, {
2009 onComplete: function(transport
) {
2011 if (transport
.responseXML
) {
2013 var link
= transport
.responseXML
.getElementsByTagName("link")[0];
2014 var id
= transport
.responseXML
.getElementsByTagName("id")[0];
2019 link
= link
.firstChild
.nodeValue
;
2021 var ci
= document
.getElementById("content-insert");
2023 var tmp
= "<iframe id=\"inline_orig_article\" width=\""+ci
.offsetWidth
+"\" height=\""+ci
.offsetHeight
+"\" style=\"border-width : 0px;\" src=\""+link
+"\"></iframe>";
2025 render_article(tmp
);
2032 exception_error("showOriginalArticleInline", e
);
2037 function scrollArticle(offset
) {
2040 var ci
= document
.getElementById("content-insert");
2042 ci
.scrollTop
+= offset
;
2045 var hi
= document
.getElementById("headlinesInnerContainer");
2047 hi
.scrollTop
+= offset
;
2052 exception_error("scrollArticle", e
);
2056 function show_labels_in_headlines(transport
) {
2058 if (transport
.responseXML
) {
2059 var info
= transport
.responseXML
.getElementsByTagName("info-for-headlines")[0];
2061 var elems
= info
.getElementsByTagName("entry");
2063 for (var l
= 0; l
< elems
.length
; l
++) {
2064 var e_id
= elems
[l
].getAttribute("id");
2068 var ctr
= document
.getElementById("HLLCTR-" + e_id
);
2071 ctr
.innerHTML
= elems
[l
].firstChild
.nodeValue
;
2079 exception_error("show_labels_in_headlines", e
);
2084 function toggleHeadlineActions() {
2086 var e
= document
.getElementById("headlineActionsBody");
2087 var p
= document
.getElementById("headlineActionsDrop");
2089 if (!Element
.visible(e
)) {
2096 e
.style
.left
= (p
.offsetLeft
+ 1) + "px";
2097 // e.style.top = (p.offsetTop + p.offsetHeight - 1) + "px";
2100 exception_error("toggleHeadlineActions", e
);