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");
403 exception_error("view_offline", e
);
407 function view(id
, feed_id
, skip_history
) {
410 debug("loading article: " + id
+ "/" + feed_id
);
412 if (offline_mode
) return view_offline(id
, feed_id
);
414 var cached_article
= cache_find(id
);
416 debug("cache check result: " + (cached_article
!= false));
420 //setActiveFeedId(feed_id);
422 var query
= "backend.php?op=view&id=" + param_escape(id
) +
423 "&feed=" + param_escape(feed_id
);
425 var date
= new Date();
427 var neighbor_ids
= getRelativePostIds(active_post_id
);
429 /* only request uncached articles */
431 var cids_to_request
= Array();
433 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
434 if (!cache_check(neighbor_ids
[i
])) {
435 cids_to_request
.push(neighbor_ids
[i
]);
439 debug("additional ids: " + cids_to_request
.toString());
441 /* additional info for piggyback counters */
443 if (tagsAreDisplayed()) {
444 query
= query
+ "&omode=lt";
446 query
= query
+ "&omode=flc";
449 var date
= new Date();
450 var timestamp
= Math
.round(date
.getTime() / 1000);
451 query
= query
+ "&ts=" + timestamp
;
453 query
= query
+ "&cids=" + cids_to_request
.toString();
455 var crow
= document
.getElementById("RROW-" + id
);
456 var article_is_unread
= crow
.className
.match("Unread");
458 if (!async_counters_work
) {
459 query
= query
+ "&csync=true";
462 showArticleInHeadlines(id
);
464 if (!cached_article
) {
466 notify_progress("Loading, please wait...", true);
468 } else if (cached_article
&& article_is_unread
) {
470 query
= query
+ "&mode=prefetch";
472 render_article(cached_article
);
474 } else if (cached_article
) {
476 query
= query
+ "&mode=prefetch_old";
477 render_article(cached_article
);
483 last_requested_article
= id
;
485 new Ajax
.Request(query
, {
486 onComplete: function(transport
) {
487 article_callback2(transport
, id
, feed_id
);
493 exception_error("view", e
);
498 return toggleMark(id
);
502 return togglePub(id
);
505 function tMark_afh_off(effect
) {
507 var elem
= effect
.effects
[0].element
;
509 debug("tMark_afh_off : " + elem
.id
);
512 elem
.src
= elem
.src
.replace("mark_set", "mark_unset");
513 elem
.alt
= __("Star article");
518 exception_error("tMark_afh_off", e
);
522 function tPub_afh_off(effect
) {
524 var elem
= effect
.effects
[0].element
;
526 debug("tPub_afh_off : " + elem
.id
);
529 elem
.src
= elem
.src
.replace("pub_set", "pub_unset");
530 elem
.alt
= __("Publish article");
535 exception_error("tPub_afh_off", e
);
539 function toggleMark(id
, client_only
, no_effects
) {
543 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=mark";
545 query
= query
+ "&afid=" + getActiveFeedId();
547 if (tagsAreDisplayed()) {
548 query
= query
+ "&omode=tl";
550 query
= query
+ "&omode=flc";
553 var mark_img
= document
.getElementById("FMPIC-" + id
);
555 if (!mark_img
) return;
557 var vfeedu
= document
.getElementById("FEEDU--1");
558 var crow
= document
.getElementById("RROW-" + id
);
560 if (mark_img
.src
.match("mark_unset")) {
561 mark_img
.src
= mark_img
.src
.replace("mark_unset", "mark_set");
562 mark_img
.alt
= __("Unstar article");
563 query
= query
+ "&mark=1";
566 db
.execute("UPDATE articles SET marked = 1 WHERE id = ?", [id
]);
570 //mark_img.src = "images/mark_unset.png";
571 mark_img
.alt
= __("Please wait...");
572 query
= query
+ "&mark=0";
574 if (document
.getElementById("headlinesList") && !no_effects
) {
575 Effect
.Puff(mark_img
, {duration
: 0.25, afterFinish
: tMark_afh_off
});
577 mark_img
.src
= mark_img
.src
.replace("mark_set", "mark_unset");
578 mark_img
.alt
= __("Star article");
582 db
.execute("UPDATE articles SET marked = 0 WHERE id = ?", [id
]);
590 new Ajax
.Request(query
, {
591 onComplete: function(transport
) {
592 all_counters_callback2(transport
);
598 exception_error("toggleMark", e
);
602 function togglePub(id
, client_only
, no_effects
) {
606 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=publ";
608 query
= query
+ "&afid=" + getActiveFeedId();
610 if (tagsAreDisplayed()) {
611 query
= query
+ "&omode=tl";
613 query
= query
+ "&omode=flc";
616 var mark_img
= document
.getElementById("FPPIC-" + id
);
618 if (!mark_img
) return;
620 var vfeedu
= document
.getElementById("FEEDU--2");
621 var crow
= document
.getElementById("RROW-" + id
);
623 if (mark_img
.src
.match("pub_unset")) {
624 mark_img
.src
= mark_img
.src
.replace("pub_unset", "pub_set");
625 mark_img
.alt
= __("Unpublish article");
626 query
= query
+ "&pub=1";
630 //mark_img.src = "images/pub_unset.png";
631 mark_img
.alt
= __("Please wait...");
632 query
= query
+ "&pub=0";
634 if (document
.getElementById("headlinesList") && !no_effects
) {
635 Effect
.Puff(mark_img
, {duration
: 0.25, afterFinish
: tPub_afh_off
});
637 mark_img
.src
= mark_img
.src
.replace("pub_set", "pub_unset");
638 mark_img
.alt
= __("Publish article");
643 new Ajax
.Request(query
, {
644 onComplete: function(transport
) {
645 all_counters_callback2(transport
);
651 exception_error("togglePub", e
);
655 function correctHeadlinesOffset(id
) {
659 var hlist
= document
.getElementById("headlinesList");
660 var container
= document
.getElementById("headlinesInnerContainer");
661 var row
= document
.getElementById("RROW-" + id
);
663 var viewport
= container
.offsetHeight
;
665 var rel_offset_top
= row
.offsetTop
- container
.scrollTop
;
666 var rel_offset_bottom
= row
.offsetTop
+ row
.offsetHeight
- container
.scrollTop
;
668 debug("Rtop: " + rel_offset_top
+ " Rbtm: " + rel_offset_bottom
);
669 debug("Vport: " + viewport
);
671 if (rel_offset_top
<= 0 || rel_offset_top
> viewport
) {
672 container
.scrollTop
= row
.offsetTop
;
673 } else if (rel_offset_bottom
> viewport
) {
675 /* doesn't properly work with Opera in some cases because
676 Opera fucks up element scrolling */
678 container
.scrollTop
= row
.offsetTop
+ row
.offsetHeight
- viewport
;
682 exception_error("correctHeadlinesOffset", e
);
687 function moveToPost(mode
) {
694 rows
= cdmGetVisibleArticles();
696 rows
= getVisibleHeadlineIds();
702 if (!document
.getElementById('RROW-' + active_post_id
)) {
703 active_post_id
= false;
706 if (active_post_id
== false) {
707 next_id
= getFirstVisibleHeadlineId();
708 prev_id
= getLastVisibleHeadlineId();
710 for (var i
= 0; i
< rows
.length
; i
++) {
711 if (rows
[i
] == active_post_id
) {
718 if (mode
== "next") {
722 if (!cdmArticleIsActuallyVisible(next_id
)) {
723 cdmScrollToArticleId(next_id
);
725 cdmSelectArticles("none");
726 toggleUnread(next_id
, 0, true);
727 toggleSelected(next_id
);
730 correctHeadlinesOffset(next_id
);
731 view(next_id
, getActiveFeedId());
736 if (mode
== "prev") {
739 cdmScrollToArticleId(prev_id
);
740 cdmSelectArticles("none");
741 toggleUnread(prev_id
, 0, true);
742 toggleSelected(prev_id
);
744 correctHeadlinesOffset(prev_id
);
745 view(prev_id
, getActiveFeedId());
751 exception_error("moveToPost", e
);
755 function toggleSelected(id
) {
758 var cb
= document
.getElementById("RCHK-" + id
);
760 var row
= document
.getElementById("RROW-" + id
);
762 var nc
= row
.className
;
764 if (!nc
.match("Selected")) {
765 nc
= nc
+ "Selected";
770 // In CDM basically last selected article == active article
771 if (isCdmMode()) active_post_id
= id
;
773 nc
= nc
.replace("Selected", "");
783 exception_error("toggleSelected", e
);
787 function toggleUnread_afh(effect
) {
790 var elem
= effect
.element
;
791 elem
.style
.backgroundColor
= "";
794 exception_error("toggleUnread_afh", e
);
798 function toggleUnread(id
, cmode
, effect
) {
801 var row
= document
.getElementById("RROW-" + id
);
803 var nc
= row
.className
;
804 var is_selected
= row
.className
.match("Selected");
805 nc
= nc
.replace("Unread", "");
806 nc
= nc
.replace("Selected", "");
808 // since we are removing selection from the object, uncheck
809 // corresponding checkbox
811 var cb
= document
.getElementById("RCHK-" + id
);
816 // NOTE: I'm not sure that resetting selection here is a feature -fox
818 if (cmode
== undefined || cmode
== 2) {
819 if (row
.className
.match("Unread")) {
823 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
824 afterFinish
: toggleUnread_afh
,
825 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
829 row
.className
= nc
+ "Unread";
831 } else if (cmode
== 0) {
835 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
836 afterFinish
: toggleUnread_afh
,
837 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
839 } else if (cmode
== 1) {
840 row
.className
= nc
+ "Unread";
843 // Disable unmarking as selected for the time being (16.05.08) -fox
844 if (is_selected
) row
.className
= row
.className
+ "Selected";
846 if (cmode
== undefined) cmode
= 2;
848 var query
= "backend.php?op=rpc&subop=catchupSelected&ids=" +
849 param_escape(id
) + "&cmode=" + param_escape(cmode
);
851 // notify_progress("Loading, please wait...");
853 new Ajax
.Request(query
, {
854 onComplete: function(transport
) {
855 all_counters_callback2(transport
);
862 exception_error("toggleUnread", e
);
866 function selectionRemoveLabel(id
) {
869 var ids
= getSelectedArticleIds2();
871 if (ids
.length
== 0) {
872 alert(__("No articles are selected."));
876 // var ok = confirm(__("Remove selected articles from label?"));
880 var query
= "backend.php?op=rpc&subop=removeFromLabel&ids=" +
881 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
883 // notify_progress("Loading, please wait...");
885 cache_invalidate("F:" + (-11 - id
));
887 new Ajax
.Request(query
, {
888 onComplete: function(transport
) {
889 show_labels_in_headlines(transport
);
890 all_counters_callback2(transport
);
896 exception_error("selectionAssignLabel", e
);
901 function selectionAssignLabel(id
) {
904 var ids
= getSelectedArticleIds2();
906 if (ids
.length
== 0) {
907 alert(__("No articles are selected."));
911 // var ok = confirm(__("Assign selected articles to label?"));
915 cache_invalidate("F:" + (-11 - id
));
917 var query
= "backend.php?op=rpc&subop=assignToLabel&ids=" +
918 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
920 // notify_progress("Loading, please wait...");
922 new Ajax
.Request(query
, {
923 onComplete: function(transport
) {
924 show_labels_in_headlines(transport
);
925 all_counters_callback2(transport
);
931 exception_error("selectionAssignLabel", e
);
936 function selectionToggleUnread(cdm_mode
, set_state
, callback_func
, no_error
) {
941 rows
= cdmGetSelectedArticles();
943 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
946 if (rows
.length
== 0 && !no_error
) {
947 alert(__("No articles are selected."));
951 for (i
= 0; i
< rows
.length
; i
++) {
952 var row
= document
.getElementById("RROW-" + rows
[i
]);
954 var nc
= row
.className
;
955 nc
= nc
.replace("Unread", "");
956 nc
= nc
.replace("Selected", "");
958 if (set_state
== undefined) {
959 if (row
.className
.match("Unread")) {
960 row
.className
= nc
+ "Selected";
962 row
.className
= nc
+ "UnreadSelected";
966 if (set_state
== false) {
967 row
.className
= nc
+ "Selected";
970 if (set_state
== true) {
971 row
.className
= nc
+ "UnreadSelected";
976 if (rows
.length
> 0) {
980 if (set_state
== undefined) {
982 } else if (set_state
== true) {
984 } else if (set_state
== false) {
988 var query
= "backend.php?op=rpc&subop=catchupSelected&ids=" +
989 param_escape(rows
.toString()) + "&cmode=" + cmode
;
991 notify_progress("Loading, please wait...");
993 new Ajax
.Request(query
, {
994 onComplete: function(transport
) {
995 catchup_callback2(transport
, callback_func
);
1001 exception_error("selectionToggleUnread", e
);
1005 function selectionToggleMarked(cdm_mode
) {
1011 rows
= cdmGetSelectedArticles();
1013 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1016 if (rows
.length
== 0) {
1017 alert(__("No articles are selected."));
1021 for (i
= 0; i
< rows
.length
; i
++) {
1022 toggleMark(rows
[i
], true, true);
1025 if (rows
.length
> 0) {
1027 var query
= "backend.php?op=rpc&subop=markSelected&ids=" +
1028 param_escape(rows
.toString()) + "&cmode=2";
1030 query
= query
+ "&afid=" + getActiveFeedId();
1032 /* if (tagsAreDisplayed()) {
1033 query = query + "&omode=tl";
1035 query = query + "&omode=flc";
1038 query
= query
+ "&omode=lc";
1040 new Ajax
.Request(query
, {
1041 onComplete: function(transport
) {
1042 all_counters_callback2(transport
);
1048 exception_error("selectionToggleMarked", e
);
1052 function selectionTogglePublished(cdm_mode
) {
1058 rows
= cdmGetSelectedArticles();
1060 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1063 if (rows
.length
== 0) {
1064 alert(__("No articles are selected."));
1068 for (i
= 0; i
< rows
.length
; i
++) {
1069 togglePub(rows
[i
], true, true);
1072 if (rows
.length
> 0) {
1074 var query
= "backend.php?op=rpc&subop=publishSelected&ids=" +
1075 param_escape(rows
.toString()) + "&cmode=2";
1077 query
= query
+ "&afid=" + getActiveFeedId();
1079 /* if (tagsAreDisplayed()) {
1080 query = query + "&omode=tl";
1082 query = query + "&omode=flc";
1085 query
= query
+ "&omode=lc";
1087 new Ajax
.Request(query
, {
1088 onComplete: function(transport
) {
1089 all_counters_callback2(transport
);
1095 exception_error("selectionToggleMarked", e
);
1099 function cdmGetSelectedArticles() {
1100 var sel_articles
= new Array();
1101 var container
= document
.getElementById("headlinesInnerContainer");
1103 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1104 var child
= container
.childNodes
[i
];
1106 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Selected")) {
1107 var c_id
= child
.id
.replace("RROW-", "");
1108 sel_articles
.push(c_id
);
1112 return sel_articles
;
1115 function cdmGetVisibleArticles() {
1116 var sel_articles
= new Array();
1117 var container
= document
.getElementById("headlinesInnerContainer");
1119 if (!container
) return sel_articles
;
1121 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1122 var child
= container
.childNodes
[i
];
1124 if (child
.id
&& child
.id
.match("RROW-")) {
1125 var c_id
= child
.id
.replace("RROW-", "");
1126 sel_articles
.push(c_id
);
1130 return sel_articles
;
1133 function cdmGetUnreadArticles() {
1134 var sel_articles
= new Array();
1135 var container
= document
.getElementById("headlinesInnerContainer");
1137 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1138 var child
= container
.childNodes
[i
];
1140 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Unread")) {
1141 var c_id
= child
.id
.replace("RROW-", "");
1142 sel_articles
.push(c_id
);
1146 return sel_articles
;
1150 // mode = all,none,unread
1151 function cdmSelectArticles(mode
) {
1152 var container
= document
.getElementById("headlinesInnerContainer");
1154 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1155 var child
= container
.childNodes
[i
];
1157 if (child
.id
&& child
.id
.match("RROW-")) {
1158 var aid
= child
.id
.replace("RROW-", "");
1160 var cb
= document
.getElementById("RCHK-" + aid
);
1162 if (mode
== "all") {
1163 if (!child
.className
.match("Selected")) {
1164 child
.className
= child
.className
+ "Selected";
1167 } else if (mode
== "unread") {
1168 if (child
.className
.match("Unread") && !child
.className
.match("Selected")) {
1169 child
.className
= child
.className
+ "Selected";
1173 child
.className
= child
.className
.replace("Selected", "");
1180 function catchupPage() {
1182 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1184 var str
= __("Mark all visible articles in %s as read?");
1186 str
= str
.replace("%s", fn
);
1188 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1192 if (document
.getElementById("headlinesList")) {
1193 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true);
1194 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1195 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1197 cdmSelectArticles('all');
1198 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1199 cdmSelectArticles('none');
1203 function catchupSelection() {
1209 if (document
.getElementById("headlinesList")) {
1210 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1212 rows
= cdmGetSelectedArticles();
1215 if (rows
.length
== 0) {
1216 alert(__("No articles are selected."));
1221 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1223 var str
= __("Mark %d selected articles in %s as read?");
1225 str
= str
.replace("%d", rows
.length
);
1226 str
= str
.replace("%s", fn
);
1228 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1232 if (document
.getElementById("headlinesList")) {
1233 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1234 // selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1236 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1237 // cdmSelectArticles('none');
1241 exception_error("catchupSelection", e
);
1245 function editArticleTags(id
, feed_id
, cdm_enabled
) {
1246 displayDlg('editArticleTags', id
);
1250 function tag_saved_callback(transport
) {
1252 debug("in tag_saved_callback");
1257 if (tagsAreDisplayed()) {
1258 _reload_feedlist_after_view
= true;
1262 if (transport
.responseXML
) {
1263 var tags_str
= transport
.responseXML
.getElementsByTagName("tags-str")[0];
1266 var id
= tags_str
.getAttribute("id");
1269 var tags
= document
.getElementById("ATSTR-" + id
);
1271 tags
.innerHTML
= tags_str
.firstChild
.nodeValue
;
1278 exception_error("tag_saved_callback", e
);
1282 function editTagsSave() {
1284 notify_progress("Saving article tags...");
1286 var form
= document
.forms
["tag_edit_form"];
1288 var query
= Form
.serialize("tag_edit_form");
1290 query
= "backend.php?op=rpc&subop=setArticleTags&" + query
;
1294 new Ajax
.Request(query
, {
1295 onComplete: function(transport
) {
1296 tag_saved_callback(transport
);
1301 function editTagsInsert() {
1304 var form
= document
.forms
["tag_edit_form"];
1306 var found_tags
= form
.found_tags
;
1307 var tags_str
= form
.tags_str
;
1309 var tag
= found_tags
[found_tags
.selectedIndex
].value
;
1311 if (tags_str
.value
.length
> 0 &&
1312 tags_str
.value
.lastIndexOf(", ") != tags_str
.value
.length
- 2) {
1314 tags_str
.value
= tags_str
.value
+ ", ";
1317 tags_str
.value
= tags_str
.value
+ tag
+ ", ";
1319 found_tags
.selectedIndex
= 0;
1322 exception_error("editTagsInsert", e
);
1326 function cdmScrollViewport(where
) {
1327 debug("cdmScrollViewport: " + where
);
1329 var ctr
= document
.getElementById("headlinesInnerContainer");
1333 if (where
== "bottom") {
1334 ctr
.scrollTop
= ctr
.scrollHeight
;
1336 ctr
.scrollTop
= where
;
1340 function cdmArticleIsBelowViewport(id
) {
1342 var ctr
= document
.getElementById("headlinesInnerContainer");
1343 var e
= document
.getElementById("RROW-" + id
);
1345 if (!e
|| !ctr
) return;
1347 // article starts below viewport
1349 if (ctr
.scrollTop
< e
.offsetTop
) {
1356 exception_error("cdmArticleIsVisible", e
);
1360 function cdmArticleIsAboveViewport(id
) {
1362 var ctr
= document
.getElementById("headlinesInnerContainer");
1363 var e
= document
.getElementById("RROW-" + id
);
1365 if (!e
|| !ctr
) return;
1367 // article starts above viewport
1369 if (ctr
.scrollTop
> e
.offsetTop
+ e
.offsetHeight
) {
1376 exception_error("cdmArticleIsVisible", e
);
1380 function cdmScrollToArticleId(id
) {
1382 var ctr
= document
.getElementById("headlinesInnerContainer");
1383 var e
= document
.getElementById("RROW-" + id
);
1385 if (!e
|| !ctr
) return;
1387 ctr
.scrollTop
= e
.offsetTop
;
1390 exception_error("cdmScrollToArticleId", e
);
1394 function cdmArticleIsActuallyVisible(id
) {
1396 var ctr
= document
.getElementById("headlinesInnerContainer");
1397 var e
= document
.getElementById("RROW-" + id
);
1399 if (!e
|| !ctr
) return;
1401 // article fits in viewport OR article is longer than viewport and
1402 // its bottom is visible
1404 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1405 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1409 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1410 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1411 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1420 exception_error("cdmArticleIsVisible", e
);
1424 function cdmWatchdog() {
1428 var ctr
= document
.getElementById("headlinesInnerContainer");
1432 var ids
= new Array();
1434 var e
= ctr
.firstChild
;
1437 if (e
.className
&& e
.className
== "cdmArticleUnread" && e
.id
&&
1438 e
.id
.match("RROW-")) {
1440 // article fits in viewport OR article is longer than viewport and
1441 // its bottom is visible
1443 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1444 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1446 // debug(e.id + " is visible " + e.offsetTop + "." +
1447 // (e.offsetTop + e.offsetHeight) + " vs " + ctr.scrollTop + "." +
1448 // (ctr.scrollTop + ctr.offsetHeight));
1450 ids
.push(e
.id
.replace("RROW-", ""));
1452 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1453 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1454 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1456 ids
.push(e
.id
.replace("RROW-", ""));
1460 // method 2: article bottom is visible and is in upper 1/2 of the viewport
1462 /* if (e.offsetTop + e.offsetHeight >= ctr.scrollTop &&
1463 e.offsetTop + e.offsetHeight <= ctr.scrollTop + ctr.offsetHeight/2) {
1465 ids.push(e.id.replace("RROW-", ""));
1474 debug("cdmWatchdog, ids= " + ids
.toString());
1476 if (ids
.length
> 0) {
1478 for (var i
= 0; i
< ids
.length
; i
++) {
1479 var e
= document
.getElementById("RROW-" + ids
[i
]);
1481 e
.className
= e
.className
.replace("Unread", "");
1485 var query
= "backend.php?op=rpc&subop=catchupSelected&ids=" +
1486 param_escape(ids
.toString()) + "&cmode=0";
1488 new Ajax
.Request(query
, {
1489 onComplete: function(transport
) {
1490 all_counters_callback2(transport
);
1495 _cdm_wd_timeout
= window
.setTimeout("cdmWatchdog()", 4000);
1498 exception_error("cdmWatchdog", e
);
1504 function cache_inject(id
, article
, param
) {
1506 if (!cache_check_param(id
, param
)) {
1507 debug("cache_article: miss: " + id
+ " [p=" + param
+ "]");
1512 var date
= new Date();
1513 var ts
= Math
.round(date
.getTime() / 1000);
1515 db
.execute("INSERT INTO cache (id, article, param, added) VALUES (?, ?, ?, ?)",
1516 [id
, article
, param
, ts
]);
1519 var cache_obj
= new Array();
1521 cache_obj
["id"] = id
;
1522 cache_obj
["data"] = article
;
1523 cache_obj
["param"] = param
;
1525 article_cache
.push(cache_obj
);
1529 debug("cache_article: hit: " + id
+ " [p=" + param
+ "]");
1532 exception_error("cache_inject", e
);
1536 function cache_find(id
) {
1539 var rs
= db
.execute("SELECT article FROM cache WHERE id = ?", [id
]);
1541 if (rs
.isValidRow()) {
1546 for (var i
= 0; i
< article_cache
.length
; i
++) {
1547 if (article_cache
[i
]["id"] == id
) {
1548 return article_cache
[i
]["data"];
1555 function cache_find_param(id
, param
) {
1558 var rs
= db
.execute("SELECT article FROM cache WHERE id = ? AND param = ?",
1561 if (rs
.isValidRow()) {
1566 for (var i
= 0; i
< article_cache
.length
; i
++) {
1567 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1568 return article_cache
[i
]["data"];
1575 function cache_check(id
) {
1578 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ?",
1581 if (rs
.isValidRow()) {
1582 return rs
.field(0) != "0";
1586 for (var i
= 0; i
< article_cache
.length
; i
++) {
1587 if (article_cache
[i
]["id"] == id
) {
1595 function cache_check_param(id
, param
) {
1598 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ? AND param = ?",
1601 if (rs
.isValidRow()) {
1602 return rs
.field(0) != "0";
1606 for (var i
= 0; i
< article_cache
.length
; i
++) {
1607 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1615 function cache_expire() {
1617 var date
= new Date();
1618 var ts
= Math
.round(date
.getTime() / 1000);
1620 db
.execute("DELETE FROM cache WHERE added < ? - 1800 AND id LIKE 'FEEDLIST'", [ts
]);
1621 db
.execute("DELETE FROM cache WHERE added < ? - 600 AND (id LIKE 'F:%' OR id LIKE 'C:%')", [ts
]);
1622 db
.execute("DELETE FROM cache WHERE added < ? - 86400", [ts
]);
1626 while (article_cache
.length
> 25) {
1627 article_cache
.shift();
1632 function cache_empty() {
1633 article_cache
= new Array();
1636 function cache_invalidate(id
) {
1640 rs
= db
.execute("DELETE FROM cache WHERE id = ?", [id
]);
1641 return rs
.rowsAffected
!= 0;
1646 while (i
< article_cache
.length
) {
1647 if (article_cache
[i
]["id"] == id
) {
1648 debug("cache_invalidate: removed id " + id
);
1649 article_cache
.splice(i
, 1);
1656 debug("cache_invalidate: id not found: " + id
);
1659 exception_error("cache_invalidate", e
);
1663 function getActiveArticleId() {
1664 return active_post_id
;
1667 function cdmClicked(id
) {
1669 var elem
= document
.getElementById("RROW-" + id
);
1672 var id
= elem
.id
.replace("RROW-", "");
1673 active_post_id
= id
;
1675 cdmSelectArticles("none");
1676 toggleUnread(id
, 0, true);
1681 exception_error("cdmClicked", e
);
1685 function preload_article_callback(transport
) {
1687 if (transport
.responseXML
) {
1688 var articles
= transport
.responseXML
.getElementsByTagName("article");
1690 for (var i
= 0; i
< articles
.length
; i
++) {
1691 var id
= articles
[i
].getAttribute("id");
1692 if (!cache_check(id
)) {
1693 cache_inject(id
, articles
[i
].firstChild
.nodeValue
);
1694 debug("preloaded article: " + id
);
1699 exception_error("preload_article_callback", e
);
1703 function preloadArticleUnderPointer(id
) {
1705 if (getInitParam("bw_limit") == "1") return;
1707 if (post_under_pointer
== id
&& !cache_check(id
)) {
1709 debug("trying to preload article " + id
);
1711 var neighbor_ids
= getRelativePostIds(id
, 1);
1713 /* only request uncached articles */
1715 var cids_to_request
= Array();
1717 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
1718 if (!cache_check(neighbor_ids
[i
])) {
1719 cids_to_request
.push(neighbor_ids
[i
]);
1722 debug("additional ids: " + cids_to_request
.toString());
1724 cids_to_request
.push(id
);
1726 var query
= "backend.php?op=rpc&subop=getArticles&ids=" +
1727 cids_to_request
.toString();
1728 new Ajax
.Request(query
, {
1729 onComplete: function(transport
) {
1730 preload_article_callback(transport
);
1734 exception_error("preloadArticleUnderPointer", e
);
1738 function postMouseIn(id
) {
1740 if (post_under_pointer
!= id
) {
1741 post_under_pointer
= id
;
1743 window
.setTimeout("preloadArticleUnderPointer(" + id
+ ")", 250);
1748 exception_error("postMouseIn", e
);
1752 function postMouseOut(id
) {
1754 post_under_pointer
= false;
1756 exception_error("postMouseOut", e
);
1760 function headlines_scroll_handler() {
1763 var e
= document
.getElementById("headlinesInnerContainer");
1765 // don't do infinite scrolling when Limit == All
1767 var toolbar_form
= document
.forms
["main_toolbar_form"];
1769 var limit
= toolbar_form
.limit
[toolbar_form
.limit
.selectedIndex
];
1770 if (limit
.value
!= 0) {
1772 debug((e
.scrollTop
+ e
.offsetHeight
) + " vs " + e
.scrollHeight
+ " dis? " +
1773 _infscroll_disable
);
1775 if (e
.scrollTop
+ e
.offsetHeight
> e
.scrollHeight
- 100) {
1776 if (!_infscroll_disable
) {
1777 debug("more cowbell!");
1784 exception_error("headlines_scroll_handler", e
);
1788 function catchupRelativeToArticle(below
) {
1793 if (!getActiveArticleId()) {
1794 alert(__("No article is selected."));
1800 if (document
.getElementById("headlinesList")) {
1801 visible_ids
= getVisibleHeadlineIds();
1803 visible_ids
= cdmGetVisibleArticles();
1806 var ids_to_mark
= new Array();
1809 for (var i
= 0; i
< visible_ids
.length
; i
++) {
1810 if (visible_ids
[i
] != getActiveArticleId()) {
1811 var e
= document
.getElementById("RROW-" + visible_ids
[i
]);
1813 if (e
&& e
.className
.match("Unread")) {
1814 ids_to_mark
.push(visible_ids
[i
]);
1821 for (var i
= visible_ids
.length
-1; i
>= 0; i
--) {
1822 if (visible_ids
[i
] != getActiveArticleId()) {
1823 var e
= document
.getElementById("RROW-" + visible_ids
[i
]);
1825 if (e
&& e
.className
.match("Unread")) {
1826 ids_to_mark
.push(visible_ids
[i
]);
1834 if (ids_to_mark
.length
== 0) {
1835 alert(__("No articles found to mark"));
1837 var msg
= __("Mark %d article(s) as read?").replace("%d", ids_to_mark
.length
);
1841 for (var i
= 0; i
< ids_to_mark
.length
; i
++) {
1842 var e
= document
.getElementById("RROW-" + ids_to_mark
[i
]);
1843 e
.className
= e
.className
.replace("Unread", "");
1846 var query
= "backend.php?op=rpc&subop=catchupSelected&ids=" +
1847 param_escape(ids_to_mark
.toString()) + "&cmode=0";
1849 new Ajax
.Request(query
, {
1850 onComplete: function(transport
) {
1851 catchup_callback2(transport
);
1858 exception_error("catchupRelativeToArticle", e
);
1862 function cdmExpandArticle(a_id
) {
1864 var id
= 'CICD-' + a_id
;
1867 Element
.hide("CEXC-" + a_id
);
1870 Effect
.Appear(id
, {duration
: 0.5,
1871 beforeStart: function(effect
) {
1872 var h_id
= 'CICH-' + a_id
;
1873 var h_elem
= document
.getElementById(h_id
);
1874 if (h_elem
) { h_elem
.style
.display
= "none"; }
1876 toggleUnread(a_id
, 0);
1881 exception_error("appearBlockElementF", e
);
1886 function fixHeadlinesOrder(ids
) {
1888 for (var i
= 0; i
< ids
.length
; i
++) {
1889 var e
= document
.getElementById("RROW-" + ids
[i
]);
1893 e
.className
= e
.className
.replace("even", "odd");
1895 e
.className
= e
.className
.replace("odd", "even");
1900 exception_error("fixHeadlinesOrder", e
);
1904 function hideReadHeadlines() {
1908 var vis_ids
= new Array();
1910 if (document
.getElementById("headlinesList")) {
1911 ids
= getVisibleHeadlineIds();
1913 ids
= cdmGetVisibleArticles();
1916 var read_headlines_visible
= true;
1918 for (var i
= 0; i
< ids
.length
; i
++) {
1919 var row
= document
.getElementById("RROW-" + ids
[i
]);
1921 if (row
&& row
.className
) {
1922 if (read_headlines_visible
) {
1923 if (row
.className
.match("Unread") || row
.className
.match("Selected")) {
1925 vis_ids
.push(ids
[i
]);
1927 //Effect.Fade(row, {duration : 0.3});
1932 vis_ids
.push(ids
[i
]);
1937 fixHeadlinesOrder(vis_ids
);
1939 read_headlines_visible
= !read_headlines_visible
;
1942 exception_error("hideReadHeadlines", e
);
1946 function invertHeadlineSelection() {
1948 var rows
= new Array();
1952 r
= document
.getElementsByTagName("TR");
1954 r
= document
.getElementsByTagName("DIV");
1957 for (var i
= 0; i
< r
.length
; i
++) {
1958 if (r
[i
].id
&& r
[i
].id
.match("RROW-")) {
1963 for (var i
= 0; i
< rows
.length
; i
++) {
1964 var nc
= rows
[i
].className
;
1965 var id
= rows
[i
].id
.replace("RROW-", "");
1966 var cb
= document
.getElementById("RCHK-" + id
);
1968 if (!rows
[i
].className
.match("Selected")) {
1969 nc
= nc
+ "Selected";
1972 nc
= nc
.replace("Selected", "");
1976 rows
[i
].className
= nc
;
1981 exception_error("invertHeadlineSelection", e
);
1985 function getArticleUnderPointer() {
1986 return post_under_pointer
;
1989 function zoomToArticle(id
) {
1991 var w
= window
.open("backend.php?op=view&mode=zoom&id=" + param_escape(id
),
1993 "status=0,toolbar=0,location=0,width=450,height=300,scrollbars=1,menubar=0");
1996 exception_error("zoomToArticle", e
);
2000 function showOriginalArticleInline(id
) {
2003 var query
= "backend.php?op=rpc&subop=getArticleLink&id=" + id
;
2005 notify_progress("Loading, please wait...", true);
2007 new Ajax
.Request(query
, {
2008 onComplete: function(transport
) {
2010 if (transport
.responseXML
) {
2012 var link
= transport
.responseXML
.getElementsByTagName("link")[0];
2013 var id
= transport
.responseXML
.getElementsByTagName("id")[0];
2018 link
= link
.firstChild
.nodeValue
;
2020 var ci
= document
.getElementById("content-insert");
2022 var tmp
= "<iframe id=\"inline_orig_article\" width=\""+ci
.offsetWidth
+"\" height=\""+ci
.offsetHeight
+"\" style=\"border-width : 0px;\" src=\""+link
+"\"></iframe>";
2024 render_article(tmp
);
2031 exception_error("showOriginalArticleInline", e
);
2036 function scrollArticle(offset
) {
2039 var ci
= document
.getElementById("content-insert");
2041 ci
.scrollTop
+= offset
;
2044 var hi
= document
.getElementById("headlinesInnerContainer");
2046 hi
.scrollTop
+= offset
;
2051 exception_error("scrollArticle", e
);
2055 function show_labels_in_headlines(transport
) {
2057 if (transport
.responseXML
) {
2058 var info
= transport
.responseXML
.getElementsByTagName("info-for-headlines")[0];
2060 var elems
= info
.getElementsByTagName("entry");
2062 for (var l
= 0; l
< elems
.length
; l
++) {
2063 var e_id
= elems
[l
].getAttribute("id");
2067 var ctr
= document
.getElementById("HLLCTR-" + e_id
);
2070 ctr
.innerHTML
= elems
[l
].firstChild
.nodeValue
;
2078 exception_error("show_labels_in_headlines", e
);
2083 function toggleHeadlineActions() {
2085 var e
= document
.getElementById("headlineActionsBody");
2086 var p
= document
.getElementById("headlineActionsDrop");
2088 if (!Element
.visible(e
)) {
2095 e
.style
.left
= (p
.offsetLeft
+ 1) + "px";
2096 // e.style.top = (p.offsetTop + p.offsetHeight - 1) + "px";
2099 exception_error("toggleHeadlineActions", e
);