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" +
900 "&cmode=" + param_escape(cmode
);
902 var ids
= "?ids=" + param_escape(id
);
904 // notify_progress("Loading, please wait...");
906 new Ajax
.Request(query
, {
908 onComplete: function(transport
) {
909 all_counters_callback2(transport
);
915 exception_error("toggleUnread", e
);
919 function selectionRemoveLabel(id
) {
922 var ids
= getSelectedArticleIds2();
924 if (ids
.length
== 0) {
925 alert(__("No articles are selected."));
929 // var ok = confirm(__("Remove selected articles from label?"));
933 var query
= "backend.php?op=rpc&subop=removeFromLabel&ids=" +
934 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
936 // notify_progress("Loading, please wait...");
938 cache_invalidate("F:" + (-11 - id
));
940 new Ajax
.Request(query
, {
941 onComplete: function(transport
) {
942 show_labels_in_headlines(transport
);
943 all_counters_callback2(transport
);
949 exception_error("selectionAssignLabel", e
);
954 function selectionAssignLabel(id
) {
957 var ids
= getSelectedArticleIds2();
959 if (ids
.length
== 0) {
960 alert(__("No articles are selected."));
964 // var ok = confirm(__("Assign selected articles to label?"));
968 cache_invalidate("F:" + (-11 - id
));
970 var query
= "backend.php?op=rpc&subop=assignToLabel&ids=" +
971 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
973 // notify_progress("Loading, please wait...");
975 new Ajax
.Request(query
, {
976 onComplete: function(transport
) {
977 show_labels_in_headlines(transport
);
978 all_counters_callback2(transport
);
984 exception_error("selectionAssignLabel", e
);
989 function selectionToggleUnread(cdm_mode
, set_state
, callback_func
, no_error
) {
994 rows
= cdmGetSelectedArticles();
996 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
999 if (rows
.length
== 0 && !no_error
) {
1000 alert(__("No articles are selected."));
1004 for (i
= 0; i
< rows
.length
; i
++) {
1005 var row
= $("RROW-" + rows
[i
]);
1007 var nc
= row
.className
;
1008 nc
= nc
.replace("Unread", "");
1009 nc
= nc
.replace("Selected", "");
1011 if (set_state
== undefined) {
1012 if (row
.className
.match("Unread")) {
1013 row
.className
= nc
+ "Selected";
1015 row
.className
= nc
+ "UnreadSelected";
1018 db
.execute("UPDATE articles SET unread = NOT unread WHERE id = ?",
1023 if (set_state
== false) {
1024 row
.className
= nc
+ "Selected";
1026 db
.execute("UPDATE articles SET unread = 0 WHERE id = ?",
1031 if (set_state
== true) {
1032 row
.className
= nc
+ "UnreadSelected";
1034 db
.execute("UPDATE articles SET unread = 1 WHERE id = ?",
1041 if (rows
.length
> 0) {
1043 update_local_feedlist_counters();
1047 if (set_state
== undefined) {
1049 } else if (set_state
== true) {
1051 } else if (set_state
== false) {
1055 var query
= "backend.php?op=rpc&subop=catchupSelected" +
1058 var ids
= "?ids=" + param_escape(rows
.toString());
1060 notify_progress("Loading, please wait...");
1062 new Ajax
.Request(query
, {
1064 onComplete: function(transport
) {
1065 catchup_callback2(transport
, callback_func
);
1071 exception_error("selectionToggleUnread", e
);
1075 function selectionToggleMarked(cdm_mode
) {
1081 rows
= cdmGetSelectedArticles();
1083 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1086 if (rows
.length
== 0) {
1087 alert(__("No articles are selected."));
1091 for (i
= 0; i
< rows
.length
; i
++) {
1092 toggleMark(rows
[i
], true, true);
1095 update_local_feedlist_counters();
1097 if (rows
.length
> 0) {
1099 var query
= "backend.php?op=rpc&subop=markSelected&ids=" +
1100 param_escape(rows
.toString()) + "&cmode=2";
1102 query
= query
+ "&afid=" + getActiveFeedId();
1104 /* if (tagsAreDisplayed()) {
1105 query = query + "&omode=tl";
1107 query = query + "&omode=flc";
1110 query
= query
+ "&omode=lc";
1112 new Ajax
.Request(query
, {
1113 onComplete: function(transport
) {
1114 all_counters_callback2(transport
);
1120 exception_error("selectionToggleMarked", e
);
1124 function selectionTogglePublished(cdm_mode
) {
1130 rows
= cdmGetSelectedArticles();
1132 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1135 if (rows
.length
== 0) {
1136 alert(__("No articles are selected."));
1140 for (i
= 0; i
< rows
.length
; i
++) {
1141 togglePub(rows
[i
], true, true);
1144 if (rows
.length
> 0) {
1146 var query
= "backend.php?op=rpc&subop=publishSelected&ids=" +
1147 param_escape(rows
.toString()) + "&cmode=2";
1149 query
= query
+ "&afid=" + getActiveFeedId();
1151 /* if (tagsAreDisplayed()) {
1152 query = query + "&omode=tl";
1154 query = query + "&omode=flc";
1157 query
= query
+ "&omode=lc";
1159 new Ajax
.Request(query
, {
1160 onComplete: function(transport
) {
1161 all_counters_callback2(transport
);
1167 exception_error("selectionToggleMarked", e
);
1171 function cdmGetSelectedArticles() {
1172 var sel_articles
= new Array();
1173 var container
= $("headlinesInnerContainer");
1175 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1176 var child
= container
.childNodes
[i
];
1178 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Selected")) {
1179 var c_id
= child
.id
.replace("RROW-", "");
1180 sel_articles
.push(c_id
);
1184 return sel_articles
;
1187 function cdmGetVisibleArticles() {
1188 var sel_articles
= new Array();
1189 var container
= $("headlinesInnerContainer");
1191 if (!container
) return sel_articles
;
1193 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1194 var child
= container
.childNodes
[i
];
1196 if (child
.id
&& child
.id
.match("RROW-")) {
1197 var c_id
= child
.id
.replace("RROW-", "");
1198 sel_articles
.push(c_id
);
1202 return sel_articles
;
1205 function cdmGetUnreadArticles() {
1206 var sel_articles
= new Array();
1207 var container
= $("headlinesInnerContainer");
1209 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1210 var child
= container
.childNodes
[i
];
1212 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Unread")) {
1213 var c_id
= child
.id
.replace("RROW-", "");
1214 sel_articles
.push(c_id
);
1218 return sel_articles
;
1222 // mode = all,none,unread
1223 function cdmSelectArticles(mode
) {
1224 var container
= $("headlinesInnerContainer");
1226 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1227 var child
= container
.childNodes
[i
];
1229 if (child
.id
&& child
.id
.match("RROW-")) {
1230 var aid
= child
.id
.replace("RROW-", "");
1232 var cb
= $("RCHK-" + aid
);
1234 if (mode
== "all") {
1235 if (!child
.className
.match("Selected")) {
1236 child
.className
= child
.className
+ "Selected";
1239 } else if (mode
== "unread") {
1240 if (child
.className
.match("Unread") && !child
.className
.match("Selected")) {
1241 child
.className
= child
.className
+ "Selected";
1245 child
.className
= child
.className
.replace("Selected", "");
1252 function catchupPage() {
1254 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1256 var str
= __("Mark all visible articles in %s as read?");
1258 str
= str
.replace("%s", fn
);
1260 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1264 if ($("headlinesList")) {
1265 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true);
1266 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1267 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1269 cdmSelectArticles('all');
1270 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1271 cdmSelectArticles('none');
1275 function catchupSelection() {
1281 if ($("headlinesList")) {
1282 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1284 rows
= cdmGetSelectedArticles();
1287 if (rows
.length
== 0) {
1288 alert(__("No articles are selected."));
1293 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1295 var str
= __("Mark %d selected articles in %s as read?");
1297 str
= str
.replace("%d", rows
.length
);
1298 str
= str
.replace("%s", fn
);
1300 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1304 if ($("headlinesList")) {
1305 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1306 // selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1308 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1309 // cdmSelectArticles('none');
1313 exception_error("catchupSelection", e
);
1317 function editArticleTags(id
, feed_id
, cdm_enabled
) {
1318 displayDlg('editArticleTags', id
);
1322 function tag_saved_callback(transport
) {
1324 debug("in tag_saved_callback");
1329 if (tagsAreDisplayed()) {
1330 _reload_feedlist_after_view
= true;
1334 if (transport
.responseXML
) {
1335 var tags_str
= transport
.responseXML
.getElementsByTagName("tags-str")[0];
1338 var id
= tags_str
.getAttribute("id");
1341 var tags
= $("ATSTR-" + id
);
1343 tags
.innerHTML
= tags_str
.firstChild
.nodeValue
;
1350 exception_error("tag_saved_callback", e
);
1354 function editTagsSave() {
1356 notify_progress("Saving article tags...");
1358 var form
= document
.forms
["tag_edit_form"];
1360 var query
= Form
.serialize("tag_edit_form");
1362 query
= "backend.php?op=rpc&subop=setArticleTags&" + query
;
1366 new Ajax
.Request(query
, {
1367 onComplete: function(transport
) {
1368 tag_saved_callback(transport
);
1373 function editTagsInsert() {
1376 var form
= document
.forms
["tag_edit_form"];
1378 var found_tags
= form
.found_tags
;
1379 var tags_str
= form
.tags_str
;
1381 var tag
= found_tags
[found_tags
.selectedIndex
].value
;
1383 if (tags_str
.value
.length
> 0 &&
1384 tags_str
.value
.lastIndexOf(", ") != tags_str
.value
.length
- 2) {
1386 tags_str
.value
= tags_str
.value
+ ", ";
1389 tags_str
.value
= tags_str
.value
+ tag
+ ", ";
1391 found_tags
.selectedIndex
= 0;
1394 exception_error("editTagsInsert", e
);
1398 function cdmScrollViewport(where
) {
1399 debug("cdmScrollViewport: " + where
);
1401 var ctr
= $("headlinesInnerContainer");
1405 if (where
== "bottom") {
1406 ctr
.scrollTop
= ctr
.scrollHeight
;
1408 ctr
.scrollTop
= where
;
1412 function cdmArticleIsBelowViewport(id
) {
1414 var ctr
= $("headlinesInnerContainer");
1415 var e
= $("RROW-" + id
);
1417 if (!e
|| !ctr
) return;
1419 // article starts below viewport
1421 if (ctr
.scrollTop
< e
.offsetTop
) {
1428 exception_error("cdmArticleIsVisible", e
);
1432 function cdmArticleIsAboveViewport(id
) {
1434 var ctr
= $("headlinesInnerContainer");
1435 var e
= $("RROW-" + id
);
1437 if (!e
|| !ctr
) return;
1439 // article starts above viewport
1441 if (ctr
.scrollTop
> e
.offsetTop
+ e
.offsetHeight
) {
1448 exception_error("cdmArticleIsVisible", e
);
1452 function cdmScrollToArticleId(id
) {
1454 var ctr
= $("headlinesInnerContainer");
1455 var e
= $("RROW-" + id
);
1457 if (!e
|| !ctr
) return;
1459 ctr
.scrollTop
= e
.offsetTop
;
1462 exception_error("cdmScrollToArticleId", e
);
1466 function cdmArticleIsActuallyVisible(id
) {
1468 var ctr
= $("headlinesInnerContainer");
1469 var e
= $("RROW-" + id
);
1471 if (!e
|| !ctr
) return;
1473 // article fits in viewport OR article is longer than viewport and
1474 // its bottom is visible
1476 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1477 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1481 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1482 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1483 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1492 exception_error("cdmArticleIsVisible", e
);
1496 function cdmWatchdog() {
1500 var ctr
= $("headlinesInnerContainer");
1504 var ids
= new Array();
1506 var e
= ctr
.firstChild
;
1509 if (e
.className
&& e
.className
== "cdmArticleUnread" && e
.id
&&
1510 e
.id
.match("RROW-")) {
1512 // article fits in viewport OR article is longer than viewport and
1513 // its bottom is visible
1515 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1516 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1518 // debug(e.id + " is visible " + e.offsetTop + "." +
1519 // (e.offsetTop + e.offsetHeight) + " vs " + ctr.scrollTop + "." +
1520 // (ctr.scrollTop + ctr.offsetHeight));
1522 ids
.push(e
.id
.replace("RROW-", ""));
1524 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1525 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1526 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1528 ids
.push(e
.id
.replace("RROW-", ""));
1532 // method 2: article bottom is visible and is in upper 1/2 of the viewport
1534 /* if (e.offsetTop + e.offsetHeight >= ctr.scrollTop &&
1535 e.offsetTop + e.offsetHeight <= ctr.scrollTop + ctr.offsetHeight/2) {
1537 ids.push(e.id.replace("RROW-", ""));
1546 debug("cdmWatchdog, ids= " + ids
.toString());
1548 if (ids
.length
> 0) {
1550 for (var i
= 0; i
< ids
.length
; i
++) {
1551 var e
= $("RROW-" + ids
[i
]);
1553 e
.className
= e
.className
.replace("Unread", "");
1557 var query
= "backend.php?op=rpc&subop=catchupSelected" +
1560 var ids
= "?ids=" + param_escape(ids
.toString());
1562 new Ajax
.Request(query
, {
1564 onComplete: function(transport
) {
1565 all_counters_callback2(transport
);
1570 _cdm_wd_timeout
= window
.setTimeout("cdmWatchdog()", 4000);
1573 exception_error("cdmWatchdog", e
);
1579 function cache_inject(id
, article
, param
) {
1581 if (!cache_check_param(id
, param
)) {
1582 debug("cache_article: miss: " + id
+ " [p=" + param
+ "]");
1587 var date
= new Date();
1588 var ts
= Math
.round(date
.getTime() / 1000);
1590 db
.execute("INSERT INTO cache (id, article, param, added) VALUES (?, ?, ?, ?)",
1591 [id
, article
, param
, ts
]);
1594 var cache_obj
= new Array();
1596 cache_obj
["id"] = id
;
1597 cache_obj
["data"] = article
;
1598 cache_obj
["param"] = param
;
1600 article_cache
.push(cache_obj
);
1604 debug("cache_article: hit: " + id
+ " [p=" + param
+ "]");
1607 exception_error("cache_inject", e
);
1611 function cache_find(id
) {
1614 var rs
= db
.execute("SELECT article FROM cache WHERE id = ?", [id
]);
1617 if (rs
.isValidRow()) {
1618 var a
= rs
.field(0);
1626 for (var i
= 0; i
< article_cache
.length
; i
++) {
1627 if (article_cache
[i
]["id"] == id
) {
1628 return article_cache
[i
]["data"];
1635 function cache_find_param(id
, param
) {
1638 var rs
= db
.execute("SELECT article FROM cache WHERE id = ? AND param = ?",
1642 if (rs
.isValidRow()) {
1651 for (var i
= 0; i
< article_cache
.length
; i
++) {
1652 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1653 return article_cache
[i
]["data"];
1660 function cache_check(id
) {
1663 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ?",
1667 if (rs
.isValidRow()) {
1668 a
= rs
.field(0) != "0";
1676 for (var i
= 0; i
< article_cache
.length
; i
++) {
1677 if (article_cache
[i
]["id"] == id
) {
1685 function cache_check_param(id
, param
) {
1688 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ? AND param = ?",
1692 if (rs
.isValidRow()) {
1693 a
= rs
.field(0) != "0";
1701 for (var i
= 0; i
< article_cache
.length
; i
++) {
1702 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1710 function cache_expire() {
1712 var date
= new Date();
1713 var ts
= Math
.round(date
.getTime() / 1000);
1715 db
.execute("DELETE FROM cache WHERE added < ? - 1800 AND id LIKE 'FEEDLIST'", [ts
]);
1716 db
.execute("DELETE FROM cache WHERE added < ? - 600 AND (id LIKE 'F:%' OR id LIKE 'C:%')", [ts
]);
1717 db
.execute("DELETE FROM cache WHERE added < ? - 86400", [ts
]);
1721 while (article_cache
.length
> 25) {
1722 article_cache
.shift();
1727 function cache_empty() {
1728 article_cache
= new Array();
1731 function cache_invalidate(id
) {
1735 rs
= db
.execute("DELETE FROM cache WHERE id = ?", [id
]);
1736 return rs
.rowsAffected
!= 0;
1741 while (i
< article_cache
.length
) {
1742 if (article_cache
[i
]["id"] == id
) {
1743 debug("cache_invalidate: removed id " + id
);
1744 article_cache
.splice(i
, 1);
1751 debug("cache_invalidate: id not found: " + id
);
1754 exception_error("cache_invalidate", e
);
1758 function getActiveArticleId() {
1759 return active_post_id
;
1762 function cdmClicked(id
) {
1764 var elem
= $("RROW-" + id
);
1767 var id
= elem
.id
.replace("RROW-", "");
1768 active_post_id
= id
;
1770 // cdmSelectArticles("none");
1771 toggleUnread(id
, 0, true);
1772 // toggleSelected(id);
1776 exception_error("cdmClicked", e
);
1780 function preload_article_callback(transport
) {
1782 if (transport
.responseXML
) {
1783 var articles
= transport
.responseXML
.getElementsByTagName("article");
1785 for (var i
= 0; i
< articles
.length
; i
++) {
1786 var id
= articles
[i
].getAttribute("id");
1787 if (!cache_check(id
)) {
1788 cache_inject(id
, articles
[i
].firstChild
.nodeValue
);
1789 debug("preloaded article: " + id
);
1794 exception_error("preload_article_callback", e
);
1798 function preloadArticleUnderPointer(id
) {
1800 if (getInitParam("bw_limit") == "1") return;
1802 if (post_under_pointer
== id
&& !cache_check(id
)) {
1804 debug("trying to preload article " + id
);
1806 var neighbor_ids
= getRelativePostIds(id
, 1);
1808 /* only request uncached articles */
1810 var cids_to_request
= Array();
1812 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
1813 if (!cache_check(neighbor_ids
[i
])) {
1814 cids_to_request
.push(neighbor_ids
[i
]);
1817 debug("additional ids: " + cids_to_request
.toString());
1819 cids_to_request
.push(id
);
1821 var query
= "backend.php?op=rpc&subop=getArticles&ids=" +
1822 cids_to_request
.toString();
1823 new Ajax
.Request(query
, {
1824 onComplete: function(transport
) {
1825 preload_article_callback(transport
);
1829 exception_error("preloadArticleUnderPointer", e
);
1833 function postMouseIn(id
) {
1835 if (post_under_pointer
!= id
) {
1836 post_under_pointer
= id
;
1838 window
.setTimeout("preloadArticleUnderPointer(" + id
+ ")", 250);
1843 exception_error("postMouseIn", e
);
1847 function postMouseOut(id
) {
1849 post_under_pointer
= false;
1851 exception_error("postMouseOut", e
);
1855 function headlines_scroll_handler() {
1858 var e
= $("headlinesInnerContainer");
1860 // don't do infinite scrolling when Limit == All
1862 var toolbar_form
= document
.forms
["main_toolbar_form"];
1864 var limit
= toolbar_form
.limit
[toolbar_form
.limit
.selectedIndex
];
1865 if (limit
.value
!= 0) {
1867 debug((e
.scrollTop
+ e
.offsetHeight
) + " vs " + e
.scrollHeight
+ " dis? " +
1868 _infscroll_disable
);
1870 if (e
.scrollTop
+ e
.offsetHeight
> e
.scrollHeight
- 100) {
1871 if (!_infscroll_disable
) {
1872 debug("more cowbell!");
1879 exception_error("headlines_scroll_handler", e
);
1883 function catchupRelativeToArticle(below
) {
1888 if (!getActiveArticleId()) {
1889 alert(__("No article is selected."));
1895 if ($("headlinesList")) {
1896 visible_ids
= getVisibleHeadlineIds();
1898 visible_ids
= cdmGetVisibleArticles();
1901 var ids_to_mark
= new Array();
1904 for (var i
= 0; i
< visible_ids
.length
; i
++) {
1905 if (visible_ids
[i
] != getActiveArticleId()) {
1906 var e
= $("RROW-" + visible_ids
[i
]);
1908 if (e
&& e
.className
.match("Unread")) {
1909 ids_to_mark
.push(visible_ids
[i
]);
1916 for (var i
= visible_ids
.length
-1; i
>= 0; i
--) {
1917 if (visible_ids
[i
] != getActiveArticleId()) {
1918 var e
= $("RROW-" + visible_ids
[i
]);
1920 if (e
&& e
.className
.match("Unread")) {
1921 ids_to_mark
.push(visible_ids
[i
]);
1929 if (ids_to_mark
.length
== 0) {
1930 alert(__("No articles found to mark"));
1932 var msg
= __("Mark %d article(s) as read?").replace("%d", ids_to_mark
.length
);
1936 for (var i
= 0; i
< ids_to_mark
.length
; i
++) {
1937 var e
= $("RROW-" + ids_to_mark
[i
]);
1938 e
.className
= e
.className
.replace("Unread", "");
1941 var query
= "backend.php?op=rpc&subop=catchupSelected" +
1944 var ids
= "?ids=" + param_escape(ids_to_mark
.toString());
1946 new Ajax
.Request(query
, {
1948 onComplete: function(transport
) {
1949 catchup_callback2(transport
);
1956 exception_error("catchupRelativeToArticle", e
);
1960 function cdmExpandArticle(a_id
) {
1962 var id
= 'CICD-' + a_id
;
1965 Element
.hide("CEXC-" + a_id
);
1968 Effect
.Appear(id
, {duration
: 0.5,
1969 beforeStart: function(effect
) {
1970 var h_id
= 'CICH-' + a_id
;
1971 var h_elem
= $(h_id
);
1972 if (h_elem
) { h_elem
.style
.display
= "none"; }
1974 toggleUnread(a_id
, 0);
1979 exception_error("appearBlockElementF", e
);
1984 function fixHeadlinesOrder(ids
) {
1986 for (var i
= 0; i
< ids
.length
; i
++) {
1987 var e
= $("RROW-" + ids
[i
]);
1991 e
.className
= e
.className
.replace("even", "odd");
1993 e
.className
= e
.className
.replace("odd", "even");
1998 exception_error("fixHeadlinesOrder", e
);
2002 function hideReadHeadlines() {
2006 var vis_ids
= new Array();
2008 if ($("headlinesList")) {
2009 ids
= getVisibleHeadlineIds();
2011 ids
= cdmGetVisibleArticles();
2014 var read_headlines_visible
= true;
2016 for (var i
= 0; i
< ids
.length
; i
++) {
2017 var row
= $("RROW-" + ids
[i
]);
2019 if (row
&& row
.className
) {
2020 if (read_headlines_visible
) {
2021 if (row
.className
.match("Unread") || row
.className
.match("Selected")) {
2023 vis_ids
.push(ids
[i
]);
2025 //Effect.Fade(row, {duration : 0.3});
2030 vis_ids
.push(ids
[i
]);
2035 fixHeadlinesOrder(vis_ids
);
2037 read_headlines_visible
= !read_headlines_visible
;
2040 exception_error("hideReadHeadlines", e
);
2044 function invertHeadlineSelection() {
2046 var rows
= new Array();
2050 r
= document
.getElementsByTagName("TR");
2052 r
= document
.getElementsByTagName("DIV");
2055 for (var i
= 0; i
< r
.length
; i
++) {
2056 if (r
[i
].id
&& r
[i
].id
.match("RROW-")) {
2061 for (var i
= 0; i
< rows
.length
; i
++) {
2062 var nc
= rows
[i
].className
;
2063 var id
= rows
[i
].id
.replace("RROW-", "");
2064 var cb
= $("RCHK-" + id
);
2066 if (!rows
[i
].className
.match("Selected")) {
2067 nc
= nc
+ "Selected";
2070 nc
= nc
.replace("Selected", "");
2074 rows
[i
].className
= nc
;
2079 exception_error("invertHeadlineSelection", e
);
2083 function getArticleUnderPointer() {
2084 return post_under_pointer
;
2087 function zoomToArticle(id
) {
2089 var w
= window
.open("backend.php?op=view&mode=zoom&id=" + param_escape(id
),
2091 "status=0,toolbar=0,location=0,width=450,height=300,scrollbars=1,menubar=0");
2094 exception_error("zoomToArticle", e
);
2098 function showOriginalArticleInline(id
) {
2101 var query
= "backend.php?op=rpc&subop=getArticleLink&id=" + id
;
2103 notify_progress("Loading, please wait...", true);
2105 new Ajax
.Request(query
, {
2106 onComplete: function(transport
) {
2108 if (transport
.responseXML
) {
2110 var link
= transport
.responseXML
.getElementsByTagName("link")[0];
2111 var id
= transport
.responseXML
.getElementsByTagName("id")[0];
2116 link
= link
.firstChild
.nodeValue
;
2118 var ci
= $("content-insert");
2120 var tmp
= "<iframe id=\"inline_orig_article\" width=\""+ci
.offsetWidth
+"\" height=\""+ci
.offsetHeight
+"\" style=\"border-width : 0px;\" src=\""+link
+"\"></iframe>";
2122 render_article(tmp
);
2129 exception_error("showOriginalArticleInline", e
);
2134 function scrollArticle(offset
) {
2137 var ci
= $("content-insert");
2139 ci
.scrollTop
+= offset
;
2142 var hi
= $("headlinesInnerContainer");
2144 hi
.scrollTop
+= offset
;
2149 exception_error("scrollArticle", e
);
2153 function show_labels_in_headlines(transport
) {
2155 if (transport
.responseXML
) {
2156 var info
= transport
.responseXML
.getElementsByTagName("info-for-headlines")[0];
2158 var elems
= info
.getElementsByTagName("entry");
2160 for (var l
= 0; l
< elems
.length
; l
++) {
2161 var e_id
= elems
[l
].getAttribute("id");
2165 var ctr
= $("HLLCTR-" + e_id
);
2168 ctr
.innerHTML
= elems
[l
].firstChild
.nodeValue
;
2176 exception_error("show_labels_in_headlines", e
);
2181 function toggleHeadlineActions() {
2183 var e
= $("headlineActionsBody");
2184 var p
= $("headlineActionsDrop");
2186 if (!Element
.visible(e
)) {
2193 e
.style
.left
= (p
.offsetLeft
+ 1) + "px";
2194 e
.style
.top
= (p
.offsetTop
+ p
.offsetHeight
+ 2) + "px";
2197 exception_error("toggleHeadlineActions", e
);
2201 function publishWithNote(id
, def_note
) {
2203 if (!def_note
) def_note
= '';
2205 var note
= prompt(__("Please enter a note for this article:"), def_note
);
2207 if (note
!= undefined) {
2208 togglePub(id
, false, false, note
);
2212 exception_error("publishWithNote", e
);