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
;
282 exception_error("render_article", e
);
286 function showArticleInHeadlines(id
) {
290 cleanSelected("headlinesList");
292 var crow
= $("RROW-" + id
);
296 var article_is_unread
= crow
.className
.match("Unread");
298 crow
.className
= crow
.className
.replace("Unread", "");
300 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
302 var upd_img_pic
= $("FUPDPIC-" + id
);
304 var cache_prefix
= "";
306 if (activeFeedIsCat()) {
312 var view_mode
= false;
315 view_mode
= document
.forms
['main_toolbar_form'].view_mode
;
316 view_mode
= view_mode
[view_mode
.selectedIndex
].value
;
321 if (upd_img_pic
&& upd_img_pic
.src
.match("updated.png")) {
322 upd_img_pic
.src
= "images/blank_icon.gif";
324 cache_invalidate(cache_prefix
+ getActiveFeedId());
326 cache_inject(cache_prefix
+ getActiveFeedId(),
327 $("headlines-frame").innerHTML
,
328 get_feed_unread(getActiveFeedId()));
330 } else if (article_is_unread
&& view_mode
== "all_articles") {
332 cache_invalidate(cache_prefix
+ getActiveFeedId());
334 cache_inject(cache_prefix
+ getActiveFeedId(),
335 $("headlines-frame").innerHTML
,
336 get_feed_unread(getActiveFeedId())-1);
338 } else if (article_is_unread
) {
339 cache_invalidate(cache_prefix
+ getActiveFeedId());
345 exception_error("showArticleInHeadlines", e
);
349 function article_callback2(transport
, id
, feed_id
) {
351 debug("article_callback2 " + id
);
353 if (!transport
.responseText
&& db
) {
354 offlineConfirmModeChange();
358 if (transport
.responseXML
) {
360 if (!transport_error_check(transport
)) return;
362 debug("looking for articles to cache...");
364 var articles
= transport
.responseXML
.getElementsByTagName("article");
366 for (var i
= 0; i
< articles
.length
; i
++) {
367 var a_id
= articles
[i
].getAttribute("id");
369 debug("found id: " + a_id
);
371 if (a_id
== active_post_id
) {
372 debug("active article, rendering...");
373 render_article(articles
[i
].firstChild
.nodeValue
);
376 cache_inject(a_id
, articles
[i
].firstChild
.nodeValue
);
379 if (id
!= last_requested_article
) {
380 debug("requested article id is out of sequence, aborting");
384 active_real_feed_id
= feed_id
;
387 showArticleInHeadlines(id
);
390 db
.execute("UPDATE articles SET unread = 0 WHERE id = ?", [id
]);
393 var reply
= transport
.responseXML
.firstChild
.firstChild
;
396 debug("article_callback: returned no XML object");
397 //var f = $("content-frame");
398 //f.innerHTML = "<div class='whiteBox'>" + __('Could not display article (missing XML object)') + "</div>";
401 var date
= new Date();
402 last_article_view
= date
.getTime() / 1000;
404 if (typeof correctPNG
!= 'undefined') {
408 if (_reload_feedlist_after_view
) {
409 setTimeout('updateFeedList(false, false)', 50);
410 _reload_feedlist_after_view
= false;
412 if (transport
.responseXML
) {
413 var counters
= transport
.responseXML
.getElementsByTagName("counters")[0];
416 debug("parsing piggybacked counters: " + counters
);
417 parse_counters(counters
, false);
419 debug("counters container not found in reply, requesting...");
427 exception_error("article_callback2", e
, transport
);
431 function view(id
, feed_id
, skip_history
) {
434 debug("loading article: " + id
+ "/" + feed_id
);
436 if (offline_mode
) return view_offline(id
, feed_id
);
438 var cached_article
= cache_find(id
);
440 debug("cache check result: " + (cached_article
!= false));
444 //setActiveFeedId(feed_id);
446 var query
= "backend.php?op=view&id=" + param_escape(id
) +
447 "&feed=" + param_escape(feed_id
);
449 var date
= new Date();
451 var neighbor_ids
= getRelativePostIds(active_post_id
);
453 /* only request uncached articles */
455 var cids_to_request
= Array();
457 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
458 if (!cache_check(neighbor_ids
[i
])) {
459 cids_to_request
.push(neighbor_ids
[i
]);
463 debug("additional ids: " + cids_to_request
.toString());
465 /* additional info for piggyback counters */
467 if (tagsAreDisplayed()) {
468 query
= query
+ "&omode=lt";
470 query
= query
+ "&omode=flc";
473 var date
= new Date();
474 var timestamp
= Math
.round(date
.getTime() / 1000);
475 query
= query
+ "&ts=" + timestamp
;
477 query
= query
+ "&cids=" + cids_to_request
.toString();
479 var crow
= $("RROW-" + id
);
480 var article_is_unread
= crow
.className
.match("Unread");
482 if (!async_counters_work
) {
483 query
= query
+ "&csync=true";
486 showArticleInHeadlines(id
);
488 if (!cached_article
) {
490 notify_progress("Loading, please wait...", true);
492 } else if (cached_article
&& article_is_unread
) {
494 query
= query
+ "&mode=prefetch";
496 render_article(cached_article
);
498 } else if (cached_article
) {
500 query
= query
+ "&mode=prefetch_old";
501 render_article(cached_article
);
507 last_requested_article
= id
;
509 new Ajax
.Request(query
, {
510 onComplete: function(transport
) {
511 article_callback2(transport
, id
, feed_id
);
517 exception_error("view", e
);
522 return toggleMark(id
);
526 return togglePub(id
);
529 function tMark_afh_off(effect
) {
531 var elem
= effect
.effects
[0].element
;
533 debug("tMark_afh_off : " + elem
.id
);
536 elem
.src
= elem
.src
.replace("mark_set", "mark_unset");
537 elem
.alt
= __("Star article");
542 exception_error("tMark_afh_off", e
);
546 function tPub_afh_off(effect
) {
548 var elem
= effect
.effects
[0].element
;
550 debug("tPub_afh_off : " + elem
.id
);
553 elem
.src
= elem
.src
.replace("pub_set", "pub_unset");
554 elem
.alt
= __("Publish article");
559 exception_error("tPub_afh_off", e
);
563 function toggleMark(id
, client_only
, no_effects
) {
567 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=mark";
569 query
= query
+ "&afid=" + getActiveFeedId();
571 if (tagsAreDisplayed()) {
572 query
= query
+ "&omode=tl";
574 query
= query
+ "&omode=flc";
577 var mark_img
= $("FMPIC-" + id
);
579 if (!mark_img
) return;
581 var vfeedu
= $("FEEDU--1");
582 var crow
= $("RROW-" + id
);
584 if (mark_img
.src
.match("mark_unset")) {
585 mark_img
.src
= mark_img
.src
.replace("mark_unset", "mark_set");
586 mark_img
.alt
= __("Unstar article");
587 query
= query
+ "&mark=1";
590 db
.execute("UPDATE articles SET marked = 1 WHERE id = ?", [id
]);
594 //mark_img.src = "images/mark_unset.png";
595 mark_img
.alt
= __("Please wait...");
596 query
= query
+ "&mark=0";
598 if ($("headlinesList") && !no_effects
) {
599 Effect
.Puff(mark_img
, {duration
: 0.25, afterFinish
: tMark_afh_off
});
601 mark_img
.src
= mark_img
.src
.replace("mark_set", "mark_unset");
602 mark_img
.alt
= __("Star article");
606 db
.execute("UPDATE articles SET marked = 0 WHERE id = ?", [id
]);
611 if (!no_effects
) update_local_feedlist_counters();
616 new Ajax
.Request(query
, {
617 onComplete: function(transport
) {
618 all_counters_callback2(transport
);
624 exception_error("toggleMark", e
);
628 function togglePub(id
, client_only
, no_effects
, note
) {
632 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=publ";
634 query
= query
+ "&afid=" + getActiveFeedId();
636 if (note
!= undefined) {
637 query
= query
+ "¬e=" + param_escape(note
);
639 query
= query
+ "¬e=undefined";
642 if (tagsAreDisplayed()) {
643 query
= query
+ "&omode=tl";
645 query
= query
+ "&omode=flc";
648 var mark_img
= $("FPPIC-" + id
);
650 if (!mark_img
) return;
652 var vfeedu
= $("FEEDU--2");
653 var crow
= $("RROW-" + id
);
655 if (mark_img
.src
.match("pub_unset") || note
!= undefined) {
656 mark_img
.src
= mark_img
.src
.replace("pub_unset", "pub_set");
657 mark_img
.alt
= __("Unpublish article");
658 query
= query
+ "&pub=1";
661 //mark_img.src = "images/pub_unset.png";
662 mark_img
.alt
= __("Please wait...");
663 query
= query
+ "&pub=0";
665 if ($("headlinesList") && !no_effects
) {
666 Effect
.Puff(mark_img
, {duration
: 0.25, afterFinish
: tPub_afh_off
});
668 mark_img
.src
= mark_img
.src
.replace("pub_set", "pub_unset");
669 mark_img
.alt
= __("Publish article");
674 new Ajax
.Request(query
, {
675 onComplete: function(transport
) {
676 toggle_published_callback(transport
);
682 exception_error("togglePub", e
);
686 function correctHeadlinesOffset(id
) {
690 var hlist
= $("headlinesList");
691 var container
= $("headlinesInnerContainer");
692 var row
= $("RROW-" + id
);
694 var viewport
= container
.offsetHeight
;
696 var rel_offset_top
= row
.offsetTop
- container
.scrollTop
;
697 var rel_offset_bottom
= row
.offsetTop
+ row
.offsetHeight
- container
.scrollTop
;
699 debug("Rtop: " + rel_offset_top
+ " Rbtm: " + rel_offset_bottom
);
700 debug("Vport: " + viewport
);
702 if (rel_offset_top
<= 0 || rel_offset_top
> viewport
) {
703 container
.scrollTop
= row
.offsetTop
;
704 } else if (rel_offset_bottom
> viewport
) {
706 /* doesn't properly work with Opera in some cases because
707 Opera fucks up element scrolling */
709 container
.scrollTop
= row
.offsetTop
+ row
.offsetHeight
- viewport
;
713 exception_error("correctHeadlinesOffset", e
);
718 function moveToPost(mode
) {
725 rows
= cdmGetVisibleArticles();
727 rows
= getVisibleHeadlineIds();
733 if (!$('RROW-' + active_post_id
)) {
734 active_post_id
= false;
737 if (active_post_id
== false) {
738 next_id
= getFirstVisibleHeadlineId();
739 prev_id
= getLastVisibleHeadlineId();
741 for (var i
= 0; i
< rows
.length
; i
++) {
742 if (rows
[i
] == active_post_id
) {
749 if (mode
== "next") {
753 if (!cdmArticleIsActuallyVisible(next_id
)) {
754 cdmScrollToArticleId(next_id
);
756 cdmSelectArticles("none");
757 toggleUnread(next_id
, 0, true);
758 toggleSelected(next_id
);
761 correctHeadlinesOffset(next_id
);
762 view(next_id
, getActiveFeedId());
767 if (mode
== "prev") {
770 cdmScrollToArticleId(prev_id
);
771 cdmSelectArticles("none");
772 toggleUnread(prev_id
, 0, true);
773 toggleSelected(prev_id
);
775 correctHeadlinesOffset(prev_id
);
776 view(prev_id
, getActiveFeedId());
782 exception_error("moveToPost", e
);
786 function toggleSelected(id
) {
789 var cb
= $("RCHK-" + id
);
791 var row
= $("RROW-" + id
);
793 var nc
= row
.className
;
795 if (!nc
.match("Selected")) {
796 nc
= nc
+ "Selected";
801 // In CDM basically last selected article == active article
802 if (isCdmMode()) active_post_id
= id
;
804 nc
= nc
.replace("Selected", "");
814 exception_error("toggleSelected", e
);
818 function toggleUnread_afh(effect
) {
821 var elem
= effect
.element
;
822 elem
.style
.backgroundColor
= "";
825 exception_error("toggleUnread_afh", e
);
829 function toggleUnread(id
, cmode
, effect
) {
832 var row
= $("RROW-" + id
);
834 var nc
= row
.className
;
835 var is_selected
= row
.className
.match("Selected");
836 nc
= nc
.replace("Unread", "");
837 nc
= nc
.replace("Selected", "");
839 // since we are removing selection from the object, uncheck
840 // corresponding checkbox
842 var cb
= $("RCHK-" + id
);
847 // NOTE: I'm not sure that resetting selection here is a feature -fox
849 if (cmode
== undefined || cmode
== 2) {
850 if (row
.className
.match("Unread")) {
854 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
855 afterFinish
: toggleUnread_afh
,
856 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
860 row
.className
= nc
+ "Unread";
864 db
.execute("UPDATE articles SET unread = not unread "+
865 "WHERE id = ?", [id
]);
868 } else if (cmode
== 0) {
872 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
873 afterFinish
: toggleUnread_afh
,
874 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
878 db
.execute("UPDATE articles SET unread = 0 "+
879 "WHERE id = ?", [id
]);
882 } else if (cmode
== 1) {
883 row
.className
= nc
+ "Unread";
886 db
.execute("UPDATE articles SET unread = 1 "+
887 "WHERE id = ?", [id
]);
892 update_local_feedlist_counters();
894 // Disable unmarking as selected for the time being (16.05.08) -fox
895 if (is_selected
) row
.className
= row
.className
+ "Selected";
897 if (cmode
== undefined) cmode
= 2;
899 var query
= "backend.php?op=rpc&subop=catchupSelected&ids=" +
900 param_escape(id
) + "&cmode=" + param_escape(cmode
);
902 // notify_progress("Loading, please wait...");
904 new Ajax
.Request(query
, {
905 onComplete: function(transport
) {
906 all_counters_callback2(transport
);
912 exception_error("toggleUnread", e
);
916 function selectionRemoveLabel(id
) {
919 var ids
= getSelectedArticleIds2();
921 if (ids
.length
== 0) {
922 alert(__("No articles are selected."));
926 // var ok = confirm(__("Remove selected articles from label?"));
930 var query
= "backend.php?op=rpc&subop=removeFromLabel&ids=" +
931 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
933 // notify_progress("Loading, please wait...");
935 cache_invalidate("F:" + (-11 - id
));
937 new Ajax
.Request(query
, {
938 onComplete: function(transport
) {
939 show_labels_in_headlines(transport
);
940 all_counters_callback2(transport
);
946 exception_error("selectionAssignLabel", e
);
951 function selectionAssignLabel(id
) {
954 var ids
= getSelectedArticleIds2();
956 if (ids
.length
== 0) {
957 alert(__("No articles are selected."));
961 // var ok = confirm(__("Assign selected articles to label?"));
965 cache_invalidate("F:" + (-11 - id
));
967 var query
= "backend.php?op=rpc&subop=assignToLabel&ids=" +
968 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
970 // notify_progress("Loading, please wait...");
972 new Ajax
.Request(query
, {
973 onComplete: function(transport
) {
974 show_labels_in_headlines(transport
);
975 all_counters_callback2(transport
);
981 exception_error("selectionAssignLabel", e
);
986 function selectionToggleUnread(cdm_mode
, set_state
, callback_func
, no_error
) {
991 rows
= cdmGetSelectedArticles();
993 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
996 if (rows
.length
== 0 && !no_error
) {
997 alert(__("No articles are selected."));
1001 for (i
= 0; i
< rows
.length
; i
++) {
1002 var row
= $("RROW-" + rows
[i
]);
1004 var nc
= row
.className
;
1005 nc
= nc
.replace("Unread", "");
1006 nc
= nc
.replace("Selected", "");
1008 if (set_state
== undefined) {
1009 if (row
.className
.match("Unread")) {
1010 row
.className
= nc
+ "Selected";
1012 row
.className
= nc
+ "UnreadSelected";
1015 db
.execute("UPDATE articles SET unread = NOT unread WHERE id = ?",
1020 if (set_state
== false) {
1021 row
.className
= nc
+ "Selected";
1023 db
.execute("UPDATE articles SET unread = 0 WHERE id = ?",
1028 if (set_state
== true) {
1029 row
.className
= nc
+ "UnreadSelected";
1031 db
.execute("UPDATE articles SET unread = 1 WHERE id = ?",
1038 if (rows
.length
> 0) {
1040 update_local_feedlist_counters();
1044 if (set_state
== undefined) {
1046 } else if (set_state
== true) {
1048 } else if (set_state
== false) {
1052 var query
= "backend.php?op=rpc&subop=catchupSelected&ids=" +
1053 param_escape(rows
.toString()) + "&cmode=" + cmode
;
1055 notify_progress("Loading, please wait...");
1057 new Ajax
.Request(query
, {
1058 onComplete: function(transport
) {
1059 catchup_callback2(transport
, callback_func
);
1065 exception_error("selectionToggleUnread", e
);
1069 function selectionToggleMarked(cdm_mode
) {
1075 rows
= cdmGetSelectedArticles();
1077 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1080 if (rows
.length
== 0) {
1081 alert(__("No articles are selected."));
1085 for (i
= 0; i
< rows
.length
; i
++) {
1086 toggleMark(rows
[i
], true, true);
1089 update_local_feedlist_counters();
1091 if (rows
.length
> 0) {
1093 var query
= "backend.php?op=rpc&subop=markSelected&ids=" +
1094 param_escape(rows
.toString()) + "&cmode=2";
1096 query
= query
+ "&afid=" + getActiveFeedId();
1098 /* if (tagsAreDisplayed()) {
1099 query = query + "&omode=tl";
1101 query = query + "&omode=flc";
1104 query
= query
+ "&omode=lc";
1106 new Ajax
.Request(query
, {
1107 onComplete: function(transport
) {
1108 all_counters_callback2(transport
);
1114 exception_error("selectionToggleMarked", e
);
1118 function selectionTogglePublished(cdm_mode
) {
1124 rows
= cdmGetSelectedArticles();
1126 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1129 if (rows
.length
== 0) {
1130 alert(__("No articles are selected."));
1134 for (i
= 0; i
< rows
.length
; i
++) {
1135 togglePub(rows
[i
], true, true);
1138 if (rows
.length
> 0) {
1140 var query
= "backend.php?op=rpc&subop=publishSelected&ids=" +
1141 param_escape(rows
.toString()) + "&cmode=2";
1143 query
= query
+ "&afid=" + getActiveFeedId();
1145 /* if (tagsAreDisplayed()) {
1146 query = query + "&omode=tl";
1148 query = query + "&omode=flc";
1151 query
= query
+ "&omode=lc";
1153 new Ajax
.Request(query
, {
1154 onComplete: function(transport
) {
1155 all_counters_callback2(transport
);
1161 exception_error("selectionToggleMarked", e
);
1165 function cdmGetSelectedArticles() {
1166 var sel_articles
= new Array();
1167 var container
= $("headlinesInnerContainer");
1169 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1170 var child
= container
.childNodes
[i
];
1172 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Selected")) {
1173 var c_id
= child
.id
.replace("RROW-", "");
1174 sel_articles
.push(c_id
);
1178 return sel_articles
;
1181 function cdmGetVisibleArticles() {
1182 var sel_articles
= new Array();
1183 var container
= $("headlinesInnerContainer");
1185 if (!container
) return sel_articles
;
1187 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1188 var child
= container
.childNodes
[i
];
1190 if (child
.id
&& child
.id
.match("RROW-")) {
1191 var c_id
= child
.id
.replace("RROW-", "");
1192 sel_articles
.push(c_id
);
1196 return sel_articles
;
1199 function cdmGetUnreadArticles() {
1200 var sel_articles
= new Array();
1201 var container
= $("headlinesInnerContainer");
1203 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1204 var child
= container
.childNodes
[i
];
1206 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Unread")) {
1207 var c_id
= child
.id
.replace("RROW-", "");
1208 sel_articles
.push(c_id
);
1212 return sel_articles
;
1216 // mode = all,none,unread
1217 function cdmSelectArticles(mode
) {
1218 var container
= $("headlinesInnerContainer");
1220 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1221 var child
= container
.childNodes
[i
];
1223 if (child
.id
&& child
.id
.match("RROW-")) {
1224 var aid
= child
.id
.replace("RROW-", "");
1226 var cb
= $("RCHK-" + aid
);
1228 if (mode
== "all") {
1229 if (!child
.className
.match("Selected")) {
1230 child
.className
= child
.className
+ "Selected";
1233 } else if (mode
== "unread") {
1234 if (child
.className
.match("Unread") && !child
.className
.match("Selected")) {
1235 child
.className
= child
.className
+ "Selected";
1239 child
.className
= child
.className
.replace("Selected", "");
1246 function catchupPage() {
1248 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1250 var str
= __("Mark all visible articles in %s as read?");
1252 str
= str
.replace("%s", fn
);
1254 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1258 if ($("headlinesList")) {
1259 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true);
1260 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1261 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1263 cdmSelectArticles('all');
1264 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1265 cdmSelectArticles('none');
1269 function catchupSelection() {
1275 if ($("headlinesList")) {
1276 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1278 rows
= cdmGetSelectedArticles();
1281 if (rows
.length
== 0) {
1282 alert(__("No articles are selected."));
1287 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1289 var str
= __("Mark %d selected articles in %s as read?");
1291 str
= str
.replace("%d", rows
.length
);
1292 str
= str
.replace("%s", fn
);
1294 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1298 if ($("headlinesList")) {
1299 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1300 // selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1302 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1303 // cdmSelectArticles('none');
1307 exception_error("catchupSelection", e
);
1311 function editArticleTags(id
, feed_id
, cdm_enabled
) {
1312 displayDlg('editArticleTags', id
);
1316 function tag_saved_callback(transport
) {
1318 debug("in tag_saved_callback");
1323 if (tagsAreDisplayed()) {
1324 _reload_feedlist_after_view
= true;
1328 if (transport
.responseXML
) {
1329 var tags_str
= transport
.responseXML
.getElementsByTagName("tags-str")[0];
1332 var id
= tags_str
.getAttribute("id");
1335 var tags
= $("ATSTR-" + id
);
1337 tags
.innerHTML
= tags_str
.firstChild
.nodeValue
;
1344 exception_error("tag_saved_callback", e
);
1348 function editTagsSave() {
1350 notify_progress("Saving article tags...");
1352 var form
= document
.forms
["tag_edit_form"];
1354 var query
= Form
.serialize("tag_edit_form");
1356 query
= "backend.php?op=rpc&subop=setArticleTags&" + query
;
1360 new Ajax
.Request(query
, {
1361 onComplete: function(transport
) {
1362 tag_saved_callback(transport
);
1367 function editTagsInsert() {
1370 var form
= document
.forms
["tag_edit_form"];
1372 var found_tags
= form
.found_tags
;
1373 var tags_str
= form
.tags_str
;
1375 var tag
= found_tags
[found_tags
.selectedIndex
].value
;
1377 if (tags_str
.value
.length
> 0 &&
1378 tags_str
.value
.lastIndexOf(", ") != tags_str
.value
.length
- 2) {
1380 tags_str
.value
= tags_str
.value
+ ", ";
1383 tags_str
.value
= tags_str
.value
+ tag
+ ", ";
1385 found_tags
.selectedIndex
= 0;
1388 exception_error("editTagsInsert", e
);
1392 function cdmScrollViewport(where
) {
1393 debug("cdmScrollViewport: " + where
);
1395 var ctr
= $("headlinesInnerContainer");
1399 if (where
== "bottom") {
1400 ctr
.scrollTop
= ctr
.scrollHeight
;
1402 ctr
.scrollTop
= where
;
1406 function cdmArticleIsBelowViewport(id
) {
1408 var ctr
= $("headlinesInnerContainer");
1409 var e
= $("RROW-" + id
);
1411 if (!e
|| !ctr
) return;
1413 // article starts below viewport
1415 if (ctr
.scrollTop
< e
.offsetTop
) {
1422 exception_error("cdmArticleIsVisible", e
);
1426 function cdmArticleIsAboveViewport(id
) {
1428 var ctr
= $("headlinesInnerContainer");
1429 var e
= $("RROW-" + id
);
1431 if (!e
|| !ctr
) return;
1433 // article starts above viewport
1435 if (ctr
.scrollTop
> e
.offsetTop
+ e
.offsetHeight
) {
1442 exception_error("cdmArticleIsVisible", e
);
1446 function cdmScrollToArticleId(id
) {
1448 var ctr
= $("headlinesInnerContainer");
1449 var e
= $("RROW-" + id
);
1451 if (!e
|| !ctr
) return;
1453 ctr
.scrollTop
= e
.offsetTop
;
1456 exception_error("cdmScrollToArticleId", e
);
1460 function cdmArticleIsActuallyVisible(id
) {
1462 var ctr
= $("headlinesInnerContainer");
1463 var e
= $("RROW-" + id
);
1465 if (!e
|| !ctr
) return;
1467 // article fits in viewport OR article is longer than viewport and
1468 // its bottom is visible
1470 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1471 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1475 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1476 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1477 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1486 exception_error("cdmArticleIsVisible", e
);
1490 function cdmWatchdog() {
1494 var ctr
= $("headlinesInnerContainer");
1498 var ids
= new Array();
1500 var e
= ctr
.firstChild
;
1503 if (e
.className
&& e
.className
== "cdmArticleUnread" && e
.id
&&
1504 e
.id
.match("RROW-")) {
1506 // article fits in viewport OR article is longer than viewport and
1507 // its bottom is visible
1509 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1510 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1512 // debug(e.id + " is visible " + e.offsetTop + "." +
1513 // (e.offsetTop + e.offsetHeight) + " vs " + ctr.scrollTop + "." +
1514 // (ctr.scrollTop + ctr.offsetHeight));
1516 ids
.push(e
.id
.replace("RROW-", ""));
1518 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1519 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1520 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1522 ids
.push(e
.id
.replace("RROW-", ""));
1526 // method 2: article bottom is visible and is in upper 1/2 of the viewport
1528 /* if (e.offsetTop + e.offsetHeight >= ctr.scrollTop &&
1529 e.offsetTop + e.offsetHeight <= ctr.scrollTop + ctr.offsetHeight/2) {
1531 ids.push(e.id.replace("RROW-", ""));
1540 debug("cdmWatchdog, ids= " + ids
.toString());
1542 if (ids
.length
> 0) {
1544 for (var i
= 0; i
< ids
.length
; i
++) {
1545 var e
= $("RROW-" + ids
[i
]);
1547 e
.className
= e
.className
.replace("Unread", "");
1551 var query
= "backend.php?op=rpc&subop=catchupSelected&ids=" +
1552 param_escape(ids
.toString()) + "&cmode=0";
1554 new Ajax
.Request(query
, {
1555 onComplete: function(transport
) {
1556 all_counters_callback2(transport
);
1561 _cdm_wd_timeout
= window
.setTimeout("cdmWatchdog()", 4000);
1564 exception_error("cdmWatchdog", e
);
1570 function cache_inject(id
, article
, param
) {
1572 if (!cache_check_param(id
, param
)) {
1573 debug("cache_article: miss: " + id
+ " [p=" + param
+ "]");
1578 var date
= new Date();
1579 var ts
= Math
.round(date
.getTime() / 1000);
1581 db
.execute("INSERT INTO cache (id, article, param, added) VALUES (?, ?, ?, ?)",
1582 [id
, article
, param
, ts
]);
1585 var cache_obj
= new Array();
1587 cache_obj
["id"] = id
;
1588 cache_obj
["data"] = article
;
1589 cache_obj
["param"] = param
;
1591 article_cache
.push(cache_obj
);
1595 debug("cache_article: hit: " + id
+ " [p=" + param
+ "]");
1598 exception_error("cache_inject", e
);
1602 function cache_find(id
) {
1605 var rs
= db
.execute("SELECT article FROM cache WHERE id = ?", [id
]);
1608 if (rs
.isValidRow()) {
1609 var a
= rs
.field(0);
1617 for (var i
= 0; i
< article_cache
.length
; i
++) {
1618 if (article_cache
[i
]["id"] == id
) {
1619 return article_cache
[i
]["data"];
1626 function cache_find_param(id
, param
) {
1629 var rs
= db
.execute("SELECT article FROM cache WHERE id = ? AND param = ?",
1633 if (rs
.isValidRow()) {
1642 for (var i
= 0; i
< article_cache
.length
; i
++) {
1643 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1644 return article_cache
[i
]["data"];
1651 function cache_check(id
) {
1654 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ?",
1658 if (rs
.isValidRow()) {
1659 a
= rs
.field(0) != "0";
1667 for (var i
= 0; i
< article_cache
.length
; i
++) {
1668 if (article_cache
[i
]["id"] == id
) {
1676 function cache_check_param(id
, param
) {
1679 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ? AND param = ?",
1683 if (rs
.isValidRow()) {
1684 a
= rs
.field(0) != "0";
1692 for (var i
= 0; i
< article_cache
.length
; i
++) {
1693 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1701 function cache_expire() {
1703 var date
= new Date();
1704 var ts
= Math
.round(date
.getTime() / 1000);
1706 db
.execute("DELETE FROM cache WHERE added < ? - 1800 AND id LIKE 'FEEDLIST'", [ts
]);
1707 db
.execute("DELETE FROM cache WHERE added < ? - 600 AND (id LIKE 'F:%' OR id LIKE 'C:%')", [ts
]);
1708 db
.execute("DELETE FROM cache WHERE added < ? - 86400", [ts
]);
1712 while (article_cache
.length
> 25) {
1713 article_cache
.shift();
1718 function cache_empty() {
1719 article_cache
= new Array();
1722 function cache_invalidate(id
) {
1726 rs
= db
.execute("DELETE FROM cache WHERE id = ?", [id
]);
1727 return rs
.rowsAffected
!= 0;
1732 while (i
< article_cache
.length
) {
1733 if (article_cache
[i
]["id"] == id
) {
1734 debug("cache_invalidate: removed id " + id
);
1735 article_cache
.splice(i
, 1);
1742 debug("cache_invalidate: id not found: " + id
);
1745 exception_error("cache_invalidate", e
);
1749 function getActiveArticleId() {
1750 return active_post_id
;
1753 function cdmClicked(id
) {
1755 var elem
= $("RROW-" + id
);
1758 var id
= elem
.id
.replace("RROW-", "");
1759 active_post_id
= id
;
1761 // cdmSelectArticles("none");
1762 toggleUnread(id
, 0, true);
1763 // toggleSelected(id);
1767 exception_error("cdmClicked", e
);
1771 function preload_article_callback(transport
) {
1773 if (transport
.responseXML
) {
1774 var articles
= transport
.responseXML
.getElementsByTagName("article");
1776 for (var i
= 0; i
< articles
.length
; i
++) {
1777 var id
= articles
[i
].getAttribute("id");
1778 if (!cache_check(id
)) {
1779 cache_inject(id
, articles
[i
].firstChild
.nodeValue
);
1780 debug("preloaded article: " + id
);
1785 exception_error("preload_article_callback", e
);
1789 function preloadArticleUnderPointer(id
) {
1791 if (getInitParam("bw_limit") == "1") return;
1793 if (post_under_pointer
== id
&& !cache_check(id
)) {
1795 debug("trying to preload article " + id
);
1797 var neighbor_ids
= getRelativePostIds(id
, 1);
1799 /* only request uncached articles */
1801 var cids_to_request
= Array();
1803 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
1804 if (!cache_check(neighbor_ids
[i
])) {
1805 cids_to_request
.push(neighbor_ids
[i
]);
1808 debug("additional ids: " + cids_to_request
.toString());
1810 cids_to_request
.push(id
);
1812 var query
= "backend.php?op=rpc&subop=getArticles&ids=" +
1813 cids_to_request
.toString();
1814 new Ajax
.Request(query
, {
1815 onComplete: function(transport
) {
1816 preload_article_callback(transport
);
1820 exception_error("preloadArticleUnderPointer", e
);
1824 function postMouseIn(id
) {
1826 if (post_under_pointer
!= id
) {
1827 post_under_pointer
= id
;
1829 window
.setTimeout("preloadArticleUnderPointer(" + id
+ ")", 250);
1834 exception_error("postMouseIn", e
);
1838 function postMouseOut(id
) {
1840 post_under_pointer
= false;
1842 exception_error("postMouseOut", e
);
1846 function headlines_scroll_handler() {
1849 var e
= $("headlinesInnerContainer");
1851 // don't do infinite scrolling when Limit == All
1853 var toolbar_form
= document
.forms
["main_toolbar_form"];
1855 var limit
= toolbar_form
.limit
[toolbar_form
.limit
.selectedIndex
];
1856 if (limit
.value
!= 0) {
1858 debug((e
.scrollTop
+ e
.offsetHeight
) + " vs " + e
.scrollHeight
+ " dis? " +
1859 _infscroll_disable
);
1861 if (e
.scrollTop
+ e
.offsetHeight
> e
.scrollHeight
- 100) {
1862 if (!_infscroll_disable
) {
1863 debug("more cowbell!");
1870 exception_error("headlines_scroll_handler", e
);
1874 function catchupRelativeToArticle(below
) {
1879 if (!getActiveArticleId()) {
1880 alert(__("No article is selected."));
1886 if ($("headlinesList")) {
1887 visible_ids
= getVisibleHeadlineIds();
1889 visible_ids
= cdmGetVisibleArticles();
1892 var ids_to_mark
= new Array();
1895 for (var i
= 0; i
< visible_ids
.length
; i
++) {
1896 if (visible_ids
[i
] != getActiveArticleId()) {
1897 var e
= $("RROW-" + visible_ids
[i
]);
1899 if (e
&& e
.className
.match("Unread")) {
1900 ids_to_mark
.push(visible_ids
[i
]);
1907 for (var i
= visible_ids
.length
-1; i
>= 0; i
--) {
1908 if (visible_ids
[i
] != getActiveArticleId()) {
1909 var e
= $("RROW-" + visible_ids
[i
]);
1911 if (e
&& e
.className
.match("Unread")) {
1912 ids_to_mark
.push(visible_ids
[i
]);
1920 if (ids_to_mark
.length
== 0) {
1921 alert(__("No articles found to mark"));
1923 var msg
= __("Mark %d article(s) as read?").replace("%d", ids_to_mark
.length
);
1927 for (var i
= 0; i
< ids_to_mark
.length
; i
++) {
1928 var e
= $("RROW-" + ids_to_mark
[i
]);
1929 e
.className
= e
.className
.replace("Unread", "");
1932 var query
= "backend.php?op=rpc&subop=catchupSelected&ids=" +
1933 param_escape(ids_to_mark
.toString()) + "&cmode=0";
1935 new Ajax
.Request(query
, {
1936 onComplete: function(transport
) {
1937 catchup_callback2(transport
);
1944 exception_error("catchupRelativeToArticle", e
);
1948 function cdmExpandArticle(a_id
) {
1950 var id
= 'CICD-' + a_id
;
1953 Element
.hide("CEXC-" + a_id
);
1956 Effect
.Appear(id
, {duration
: 0.5,
1957 beforeStart: function(effect
) {
1958 var h_id
= 'CICH-' + a_id
;
1959 var h_elem
= $(h_id
);
1960 if (h_elem
) { h_elem
.style
.display
= "none"; }
1962 toggleUnread(a_id
, 0);
1967 exception_error("appearBlockElementF", e
);
1972 function fixHeadlinesOrder(ids
) {
1974 for (var i
= 0; i
< ids
.length
; i
++) {
1975 var e
= $("RROW-" + ids
[i
]);
1979 e
.className
= e
.className
.replace("even", "odd");
1981 e
.className
= e
.className
.replace("odd", "even");
1986 exception_error("fixHeadlinesOrder", e
);
1990 function hideReadHeadlines() {
1994 var vis_ids
= new Array();
1996 if ($("headlinesList")) {
1997 ids
= getVisibleHeadlineIds();
1999 ids
= cdmGetVisibleArticles();
2002 var read_headlines_visible
= true;
2004 for (var i
= 0; i
< ids
.length
; i
++) {
2005 var row
= $("RROW-" + ids
[i
]);
2007 if (row
&& row
.className
) {
2008 if (read_headlines_visible
) {
2009 if (row
.className
.match("Unread") || row
.className
.match("Selected")) {
2011 vis_ids
.push(ids
[i
]);
2013 //Effect.Fade(row, {duration : 0.3});
2018 vis_ids
.push(ids
[i
]);
2023 fixHeadlinesOrder(vis_ids
);
2025 read_headlines_visible
= !read_headlines_visible
;
2028 exception_error("hideReadHeadlines", e
);
2032 function invertHeadlineSelection() {
2034 var rows
= new Array();
2038 r
= document
.getElementsByTagName("TR");
2040 r
= document
.getElementsByTagName("DIV");
2043 for (var i
= 0; i
< r
.length
; i
++) {
2044 if (r
[i
].id
&& r
[i
].id
.match("RROW-")) {
2049 for (var i
= 0; i
< rows
.length
; i
++) {
2050 var nc
= rows
[i
].className
;
2051 var id
= rows
[i
].id
.replace("RROW-", "");
2052 var cb
= $("RCHK-" + id
);
2054 if (!rows
[i
].className
.match("Selected")) {
2055 nc
= nc
+ "Selected";
2058 nc
= nc
.replace("Selected", "");
2062 rows
[i
].className
= nc
;
2067 exception_error("invertHeadlineSelection", e
);
2071 function getArticleUnderPointer() {
2072 return post_under_pointer
;
2075 function zoomToArticle(id
) {
2077 var w
= window
.open("backend.php?op=view&mode=zoom&id=" + param_escape(id
),
2079 "status=0,toolbar=0,location=0,width=450,height=300,scrollbars=1,menubar=0");
2082 exception_error("zoomToArticle", e
);
2086 function showOriginalArticleInline(id
) {
2089 var query
= "backend.php?op=rpc&subop=getArticleLink&id=" + id
;
2091 notify_progress("Loading, please wait...", true);
2093 new Ajax
.Request(query
, {
2094 onComplete: function(transport
) {
2096 if (transport
.responseXML
) {
2098 var link
= transport
.responseXML
.getElementsByTagName("link")[0];
2099 var id
= transport
.responseXML
.getElementsByTagName("id")[0];
2104 link
= link
.firstChild
.nodeValue
;
2106 var ci
= $("content-insert");
2108 var tmp
= "<iframe id=\"inline_orig_article\" width=\""+ci
.offsetWidth
+"\" height=\""+ci
.offsetHeight
+"\" style=\"border-width : 0px;\" src=\""+link
+"\"></iframe>";
2110 render_article(tmp
);
2117 exception_error("showOriginalArticleInline", e
);
2122 function scrollArticle(offset
) {
2125 var ci
= $("content-insert");
2127 ci
.scrollTop
+= offset
;
2130 var hi
= $("headlinesInnerContainer");
2132 hi
.scrollTop
+= offset
;
2137 exception_error("scrollArticle", e
);
2141 function show_labels_in_headlines(transport
) {
2143 if (transport
.responseXML
) {
2144 var info
= transport
.responseXML
.getElementsByTagName("info-for-headlines")[0];
2146 var elems
= info
.getElementsByTagName("entry");
2148 for (var l
= 0; l
< elems
.length
; l
++) {
2149 var e_id
= elems
[l
].getAttribute("id");
2153 var ctr
= $("HLLCTR-" + e_id
);
2156 ctr
.innerHTML
= elems
[l
].firstChild
.nodeValue
;
2164 exception_error("show_labels_in_headlines", e
);
2169 function toggleHeadlineActions() {
2171 var e
= $("headlineActionsBody");
2172 var p
= $("headlineActionsDrop");
2174 if (!Element
.visible(e
)) {
2181 e
.style
.left
= (p
.offsetLeft
+ 1) + "px";
2182 e
.style
.top
= (p
.offsetTop
+ p
.offsetHeight
+ 2) + "px";
2185 exception_error("toggleHeadlineActions", e
);
2189 function publishWithNote(id
, def_note
) {
2191 if (!def_note
) def_note
= '';
2193 var note
= prompt(__("Please enter a note for this article:"), def_note
);
2195 if (note
!= undefined) {
2196 togglePub(id
, false, false, note
);
2200 exception_error("publishWithNote", e
);