1 var active_post_id
= false;
2 var last_article_view
= false;
3 var active_real_feed_id
= false;
5 // FIXME: kludges, needs proper implementation
6 var _reload_feedlist_after_view
= false;
8 var _cdm_wd_timeout
= false;
9 var _cdm_wd_vishist
= new Array();
11 var article_cache
= new Array();
13 var vgroup_last_feed
= false;
14 var post_under_pointer
= false;
16 var last_requested_article
= false;
18 function toggle_published_callback(transport
) {
20 if (transport
.responseXML
) {
22 all_counters_callback2(transport
);
24 var note
= transport
.responseXML
.getElementsByTagName("note")[0];
27 var note_id
= note
.getAttribute("id");
28 var note_size
= note
.getAttribute("size");
29 var note_content
= note
.firstChild
.nodeValue
;
31 var container
= $('POSTNOTE-' + note_id
);
33 cache_invalidate(note_id
);
36 if (note_size
== "0") {
37 Element
.hide(container
);
39 container
.innerHTML
= note_content
;
40 Element
.show(container
);
47 exception_error("toggle_published_callback", e
, transport
);
51 function catchup_callback2(transport
, callback
) {
53 debug("catchup_callback2 " + transport
+ ", " + callback
);
55 all_counters_callback2(transport
);
57 setTimeout(callback
, 10);
60 exception_error("catchup_callback2", e
, transport
);
64 function clean_feed_selections() {
66 var feeds
= $("feedList").getElementsByTagName("LI");
68 for (var i
= 0; i
< feeds
.length
; i
++) {
69 if (feeds
[i
].id
&& feeds
[i
].id
.match("FEEDR-")) {
70 feeds
[i
].className
= feeds
[i
].className
.replace("Selected", "");
72 if (feeds
[i
].id
&& feeds
[i
].id
.match("FCAT-")) {
73 feeds
[i
].className
= feeds
[i
].className
.replace("Selected", "");
77 exception_error("clean_feed_selections", e
);
81 function headlines_callback2(transport
, feed_cur_page
) {
84 if (!transport
.responseText
&& db
) {
85 offlineConfirmModeChange();
89 loading_set_progress(100);
91 debug("headlines_callback2 [page=" + feed_cur_page
+ "]");
93 if (!transport_error_check(transport
)) return;
95 clean_feed_selections();
100 if (transport
.responseXML
) {
101 var headlines
= transport
.responseXML
.getElementsByTagName("headlines")[0];
103 is_cat
= headlines
.getAttribute("is_cat");
104 feed_id
= headlines
.getAttribute("id");
105 setActiveFeedId(feed_id
, is_cat
);
110 var feedr
= $("FEEDR-" + feed_id
);
111 if (feedr
&& !feedr
.className
.match("Selected")) {
112 feedr
.className
= feedr
.className
+ "Selected";
115 var feedr
= $("FCAT-" + feed_id
);
116 if (feedr
&& !feedr
.className
.match("Selected")) {
117 feedr
.className
= feedr
.className
+ "Selected";
121 var f
= $("headlines-frame");
123 if (feed_cur_page
== 0) {
124 debug("resetting headlines scrollTop");
129 if (transport
.responseXML
) {
130 var headlines
= transport
.responseXML
.getElementsByTagName("headlines")[0];
131 var headlines_count_obj
= transport
.responseXML
.getElementsByTagName("headlines-count")[0];
132 var headlines_unread_obj
= transport
.responseXML
.getElementsByTagName("headlines-unread")[0];
133 var disable_cache_obj
= transport
.responseXML
.getElementsByTagName("disable-cache")[0];
135 var vgroup_last_feed_obj
= transport
.responseXML
.getElementsByTagName("vgroup-last-feed")[0];
137 var headlines_count
= headlines_count_obj
.getAttribute("value");
138 var headlines_unread
= headlines_unread_obj
.getAttribute("value");
139 var disable_cache
= disable_cache_obj
.getAttribute("value") != "0";
141 vgroup_last_feed
= vgroup_last_feed_obj
.getAttribute("value");
143 if (headlines_count
== 0) {
144 _infscroll_disable
= 1;
146 _infscroll_disable
= 0;
149 var counters
= transport
.responseXML
.getElementsByTagName("counters")[0];
150 var articles
= transport
.responseXML
.getElementsByTagName("article");
151 var runtime_info
= transport
.responseXML
.getElementsByTagName("runtime-info");
153 if (feed_cur_page
== 0) {
155 f
.innerHTML
= headlines
.firstChild
.nodeValue
;
157 var cache_prefix
= "";
165 cache_invalidate(cache_prefix
+ feed_id
);
167 if (!disable_cache
) {
168 cache_inject(cache_prefix
+ feed_id
,
169 headlines
.firstChild
.nodeValue
, headlines_unread
);
173 debug("headlines_callback: returned no data");
174 f
.innerHTML
= "<div class='whiteBox'>" + __('Could not update headlines (missing XML data)') + "</div>";
179 if (headlines_count
> 0) {
180 debug("adding some more headlines...");
182 var c
= $("headlinesList");
185 c
= $("headlinesInnerContainer");
188 var ids
= getSelectedArticleIds2();
190 c
.innerHTML
= c
.innerHTML
+ headlines
.firstChild
.nodeValue
;
192 debug("restore selected ids: " + ids
);
194 for (var i
= 0; i
< ids
.length
; i
++) {
195 markHeadline(ids
[i
]);
199 debug("no new headlines received");
202 debug("headlines_callback: returned no data");
203 notify_error("Error while trying to load more headlines");
209 for (var i
= 0; i
< articles
.length
; i
++) {
210 var a_id
= articles
[i
].getAttribute("id");
211 debug("found id: " + a_id
);
212 cache_inject(a_id
, articles
[i
].firstChild
.nodeValue
);
215 debug("no cached articles received");
219 debug("parsing piggybacked counters: " + counters
);
220 parse_counters(counters
, false);
222 debug("counters container not found in reply, requesting...");
227 debug("parsing runtime info: " + runtime_info
[0]);
228 parse_runtime_info(runtime_info
[0]);
230 debug("counters container not found in reply");
234 debug("headlines_callback: returned no XML object");
235 f
.innerHTML
= "<div class='whiteBox'>" + __('Could not update headlines (missing XML object)') + "</div>";
238 if (typeof correctPNG
!= 'undefined') {
242 if (_cdm_wd_timeout
) window
.clearTimeout(_cdm_wd_timeout
);
244 if (!$("headlinesList") &&
245 getActiveFeedId() != -3 &&
246 getInitParam("cdm_auto_catchup") == 1) {
247 debug("starting CDM watchdog");
248 _cdm_wd_timeout
= window
.setTimeout("cdmWatchdog()", 5000);
249 _cdm_wd_vishist
= new Array();
251 debug("not in CDM mode or watchdog disabled");
254 _feed_cur_page
= feed_cur_page
;
255 _infscroll_request_sent
= 0;
262 exception_error("headlines_callback2", e
, transport
);
266 function render_article(article
) {
268 var f
= $("content-frame");
273 var fi
= $("content-insert");
279 fi
.innerHTML
= article
;
281 article
.evalScripts();
284 exception_error("render_article", e
);
288 function showArticleInHeadlines(id
) {
292 cleanSelected("headlinesList");
294 var crow
= $("RROW-" + id
);
298 var article_is_unread
= crow
.className
.match("Unread");
300 crow
.className
= crow
.className
.replace("Unread", "");
302 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
304 var upd_img_pic
= $("FUPDPIC-" + id
);
306 var cache_prefix
= "";
308 if (activeFeedIsCat()) {
314 var view_mode
= false;
317 view_mode
= document
.forms
['main_toolbar_form'].view_mode
;
318 view_mode
= view_mode
[view_mode
.selectedIndex
].value
;
323 if (upd_img_pic
&& upd_img_pic
.src
.match("updated.png")) {
324 upd_img_pic
.src
= "images/blank_icon.gif";
326 cache_invalidate(cache_prefix
+ getActiveFeedId());
328 cache_inject(cache_prefix
+ getActiveFeedId(),
329 $("headlines-frame").innerHTML
,
330 get_feed_unread(getActiveFeedId()));
332 } else if (article_is_unread
&& view_mode
== "all_articles") {
334 cache_invalidate(cache_prefix
+ getActiveFeedId());
336 cache_inject(cache_prefix
+ getActiveFeedId(),
337 $("headlines-frame").innerHTML
,
338 get_feed_unread(getActiveFeedId())-1);
340 } else if (article_is_unread
) {
341 cache_invalidate(cache_prefix
+ getActiveFeedId());
347 exception_error("showArticleInHeadlines", e
);
351 function article_callback2(transport
, id
, feed_id
) {
353 debug("article_callback2 " + id
);
355 if (!transport
.responseText
&& db
) {
356 offlineConfirmModeChange();
360 if (transport
.responseXML
) {
362 if (!transport_error_check(transport
)) return;
364 debug("looking for articles to cache...");
366 var articles
= transport
.responseXML
.getElementsByTagName("article");
368 for (var i
= 0; i
< articles
.length
; i
++) {
369 var a_id
= articles
[i
].getAttribute("id");
371 debug("found id: " + a_id
);
373 if (a_id
== active_post_id
) {
374 debug("active article, rendering...");
375 render_article(articles
[i
].firstChild
.nodeValue
);
378 cache_inject(a_id
, articles
[i
].firstChild
.nodeValue
);
381 if (id
!= last_requested_article
) {
382 debug("requested article id is out of sequence, aborting");
386 active_real_feed_id
= feed_id
;
389 showArticleInHeadlines(id
);
392 db
.execute("UPDATE articles SET unread = 0 WHERE id = ?", [id
]);
395 var reply
= transport
.responseXML
.firstChild
.firstChild
;
398 debug("article_callback: returned no XML object");
399 //var f = $("content-frame");
400 //f.innerHTML = "<div class='whiteBox'>" + __('Could not display article (missing XML object)') + "</div>";
403 var date
= new Date();
404 last_article_view
= date
.getTime() / 1000;
406 if (typeof correctPNG
!= 'undefined') {
410 if (_reload_feedlist_after_view
) {
411 setTimeout('updateFeedList(false, false)', 50);
412 _reload_feedlist_after_view
= false;
414 if (transport
.responseXML
) {
415 var counters
= transport
.responseXML
.getElementsByTagName("counters")[0];
418 debug("parsing piggybacked counters: " + counters
);
419 parse_counters(counters
, false);
421 debug("counters container not found in reply, requesting...");
429 exception_error("article_callback2", e
, transport
);
433 function view(id
, feed_id
, skip_history
) {
436 debug("loading article: " + id
+ "/" + feed_id
);
438 if (offline_mode
) return view_offline(id
, feed_id
);
440 var cached_article
= cache_find(id
);
442 debug("cache check result: " + (cached_article
!= false));
446 //setActiveFeedId(feed_id);
448 var query
= "backend.php?op=view&id=" + param_escape(id
) +
449 "&feed=" + param_escape(feed_id
);
451 var date
= new Date();
453 var neighbor_ids
= getRelativePostIds(active_post_id
);
455 /* only request uncached articles */
457 var cids_to_request
= Array();
459 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
460 if (!cache_check(neighbor_ids
[i
])) {
461 cids_to_request
.push(neighbor_ids
[i
]);
465 debug("additional ids: " + cids_to_request
.toString());
467 /* additional info for piggyback counters */
469 if (tagsAreDisplayed()) {
470 query
= query
+ "&omode=lt";
472 query
= query
+ "&omode=flc";
475 var date
= new Date();
476 var timestamp
= Math
.round(date
.getTime() / 1000);
477 query
= query
+ "&ts=" + timestamp
;
479 query
= query
+ "&cids=" + cids_to_request
.toString();
481 var crow
= $("RROW-" + id
);
482 var article_is_unread
= crow
.className
.match("Unread");
484 if (!async_counters_work
) {
485 query
= query
+ "&csync=true";
488 showArticleInHeadlines(id
);
490 if (!cached_article
) {
492 notify_progress("Loading, please wait...", true);
494 } else if (cached_article
&& article_is_unread
) {
496 query
= query
+ "&mode=prefetch";
498 render_article(cached_article
);
500 } else if (cached_article
) {
502 query
= query
+ "&mode=prefetch_old";
503 render_article(cached_article
);
509 last_requested_article
= id
;
511 new Ajax
.Request(query
, {
512 onComplete: function(transport
) {
513 article_callback2(transport
, id
, feed_id
);
519 exception_error("view", e
);
524 return toggleMark(id
);
528 return togglePub(id
);
531 function tMark_afh_off(effect
) {
533 var elem
= effect
.effects
[0].element
;
535 debug("tMark_afh_off : " + elem
.id
);
538 elem
.src
= elem
.src
.replace("mark_set", "mark_unset");
539 elem
.alt
= __("Star article");
544 exception_error("tMark_afh_off", e
);
548 function tPub_afh_off(effect
) {
550 var elem
= effect
.effects
[0].element
;
552 debug("tPub_afh_off : " + elem
.id
);
555 elem
.src
= elem
.src
.replace("pub_set", "pub_unset");
556 elem
.alt
= __("Publish article");
561 exception_error("tPub_afh_off", e
);
565 function toggleMark(id
, client_only
, no_effects
) {
569 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=mark";
571 query
= query
+ "&afid=" + getActiveFeedId();
573 if (tagsAreDisplayed()) {
574 query
= query
+ "&omode=tl";
576 query
= query
+ "&omode=flc";
579 var mark_img
= $("FMPIC-" + id
);
581 if (!mark_img
) return;
583 var vfeedu
= $("FEEDU--1");
584 var crow
= $("RROW-" + id
);
586 if (mark_img
.src
.match("mark_unset")) {
587 mark_img
.src
= mark_img
.src
.replace("mark_unset", "mark_set");
588 mark_img
.alt
= __("Unstar article");
589 query
= query
+ "&mark=1";
592 db
.execute("UPDATE articles SET marked = 1 WHERE id = ?", [id
]);
596 //mark_img.src = "images/mark_unset.png";
597 mark_img
.alt
= __("Please wait...");
598 query
= query
+ "&mark=0";
600 if ($("headlinesList") && !no_effects
) {
601 Effect
.Puff(mark_img
, {duration
: 0.25, afterFinish
: tMark_afh_off
});
603 mark_img
.src
= mark_img
.src
.replace("mark_set", "mark_unset");
604 mark_img
.alt
= __("Star article");
608 db
.execute("UPDATE articles SET marked = 0 WHERE id = ?", [id
]);
613 if (!no_effects
) update_local_feedlist_counters();
618 new Ajax
.Request(query
, {
619 onComplete: function(transport
) {
620 all_counters_callback2(transport
);
626 exception_error("toggleMark", e
);
630 function togglePub(id
, client_only
, no_effects
, note
) {
634 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=publ";
636 query
= query
+ "&afid=" + getActiveFeedId();
638 if (note
!= undefined) {
639 query
= query
+ "¬e=" + param_escape(note
);
641 query
= query
+ "¬e=undefined";
644 if (tagsAreDisplayed()) {
645 query
= query
+ "&omode=tl";
647 query
= query
+ "&omode=flc";
650 var mark_img
= $("FPPIC-" + id
);
652 if (!mark_img
) return;
654 var vfeedu
= $("FEEDU--2");
655 var crow
= $("RROW-" + id
);
657 if (mark_img
.src
.match("pub_unset") || note
!= undefined) {
658 mark_img
.src
= mark_img
.src
.replace("pub_unset", "pub_set");
659 mark_img
.alt
= __("Unpublish article");
660 query
= query
+ "&pub=1";
663 //mark_img.src = "images/pub_unset.png";
664 mark_img
.alt
= __("Please wait...");
665 query
= query
+ "&pub=0";
667 if ($("headlinesList") && !no_effects
) {
668 Effect
.Puff(mark_img
, {duration
: 0.25, afterFinish
: tPub_afh_off
});
670 mark_img
.src
= mark_img
.src
.replace("pub_set", "pub_unset");
671 mark_img
.alt
= __("Publish article");
676 new Ajax
.Request(query
, {
677 onComplete: function(transport
) {
678 toggle_published_callback(transport
);
684 exception_error("togglePub", e
);
688 function correctHeadlinesOffset(id
) {
692 var hlist
= $("headlinesList");
693 var container
= $("headlinesInnerContainer");
694 var row
= $("RROW-" + id
);
696 var viewport
= container
.offsetHeight
;
698 var rel_offset_top
= row
.offsetTop
- container
.scrollTop
;
699 var rel_offset_bottom
= row
.offsetTop
+ row
.offsetHeight
- container
.scrollTop
;
701 debug("Rtop: " + rel_offset_top
+ " Rbtm: " + rel_offset_bottom
);
702 debug("Vport: " + viewport
);
704 if (rel_offset_top
<= 0 || rel_offset_top
> viewport
) {
705 container
.scrollTop
= row
.offsetTop
;
706 } else if (rel_offset_bottom
> viewport
) {
708 /* doesn't properly work with Opera in some cases because
709 Opera fucks up element scrolling */
711 container
.scrollTop
= row
.offsetTop
+ row
.offsetHeight
- viewport
;
715 exception_error("correctHeadlinesOffset", e
);
720 function moveToPost(mode
) {
727 rows
= cdmGetVisibleArticles();
729 rows
= getVisibleHeadlineIds();
735 if (!$('RROW-' + active_post_id
)) {
736 active_post_id
= false;
739 if (active_post_id
== false) {
740 next_id
= getFirstVisibleHeadlineId();
741 prev_id
= getLastVisibleHeadlineId();
743 for (var i
= 0; i
< rows
.length
; i
++) {
744 if (rows
[i
] == active_post_id
) {
751 if (mode
== "next") {
755 if (!cdmArticleIsActuallyVisible(next_id
)) {
756 cdmScrollToArticleId(next_id
);
758 cdmSelectArticles("none");
759 toggleUnread(next_id
, 0, true);
760 toggleSelected(next_id
);
763 correctHeadlinesOffset(next_id
);
764 view(next_id
, getActiveFeedId());
769 if (mode
== "prev") {
772 cdmScrollToArticleId(prev_id
);
773 cdmSelectArticles("none");
774 toggleUnread(prev_id
, 0, true);
775 toggleSelected(prev_id
);
777 correctHeadlinesOffset(prev_id
);
778 view(prev_id
, getActiveFeedId());
784 exception_error("moveToPost", e
);
788 function toggleSelected(id
) {
791 var cb
= $("RCHK-" + id
);
793 var row
= $("RROW-" + id
);
795 var nc
= row
.className
;
797 if (!nc
.match("Selected")) {
798 nc
= nc
+ "Selected";
803 // In CDM basically last selected article == active article
804 if (isCdmMode()) active_post_id
= id
;
806 nc
= nc
.replace("Selected", "");
816 exception_error("toggleSelected", e
);
820 function toggleUnread_afh(effect
) {
823 var elem
= effect
.element
;
824 elem
.style
.backgroundColor
= "";
827 exception_error("toggleUnread_afh", e
);
831 function toggleUnread(id
, cmode
, effect
) {
834 var row
= $("RROW-" + id
);
836 var nc
= row
.className
;
837 var is_selected
= row
.className
.match("Selected");
838 nc
= nc
.replace("Unread", "");
839 nc
= nc
.replace("Selected", "");
841 // since we are removing selection from the object, uncheck
842 // corresponding checkbox
844 var cb
= $("RCHK-" + id
);
849 // NOTE: I'm not sure that resetting selection here is a feature -fox
851 if (cmode
== undefined || cmode
== 2) {
852 if (row
.className
.match("Unread")) {
856 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
857 afterFinish
: toggleUnread_afh
,
858 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
862 row
.className
= nc
+ "Unread";
866 db
.execute("UPDATE articles SET unread = not unread "+
867 "WHERE id = ?", [id
]);
870 } else if (cmode
== 0) {
874 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
875 afterFinish
: toggleUnread_afh
,
876 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
880 db
.execute("UPDATE articles SET unread = 0 "+
881 "WHERE id = ?", [id
]);
884 } else if (cmode
== 1) {
885 row
.className
= nc
+ "Unread";
888 db
.execute("UPDATE articles SET unread = 1 "+
889 "WHERE id = ?", [id
]);
894 update_local_feedlist_counters();
896 // Disable unmarking as selected for the time being (16.05.08) -fox
897 if (is_selected
) row
.className
= row
.className
+ "Selected";
899 if (cmode
== undefined) cmode
= 2;
901 var query
= "backend.php?op=rpc&subop=catchupSelected" +
902 "&cmode=" + param_escape(cmode
);
904 var ids
= "?ids=" + param_escape(id
);
906 // notify_progress("Loading, please wait...");
908 new Ajax
.Request(query
, {
910 onComplete: function(transport
) {
911 all_counters_callback2(transport
);
917 exception_error("toggleUnread", e
);
921 function selectionRemoveLabel(id
) {
924 var ids
= getSelectedArticleIds2();
926 if (ids
.length
== 0) {
927 alert(__("No articles are selected."));
931 // var ok = confirm(__("Remove selected articles from label?"));
935 var query
= "backend.php?op=rpc&subop=removeFromLabel&ids=" +
936 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
938 // notify_progress("Loading, please wait...");
940 cache_invalidate("F:" + (-11 - id
));
942 new Ajax
.Request(query
, {
943 onComplete: function(transport
) {
944 show_labels_in_headlines(transport
);
945 all_counters_callback2(transport
);
951 exception_error("selectionAssignLabel", e
);
956 function selectionAssignLabel(id
) {
959 var ids
= getSelectedArticleIds2();
961 if (ids
.length
== 0) {
962 alert(__("No articles are selected."));
966 // var ok = confirm(__("Assign selected articles to label?"));
970 cache_invalidate("F:" + (-11 - id
));
972 var query
= "backend.php?op=rpc&subop=assignToLabel&ids=" +
973 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
975 // notify_progress("Loading, please wait...");
977 new Ajax
.Request(query
, {
978 onComplete: function(transport
) {
979 show_labels_in_headlines(transport
);
980 all_counters_callback2(transport
);
986 exception_error("selectionAssignLabel", e
);
991 function selectionToggleUnread(cdm_mode
, set_state
, callback_func
, no_error
) {
996 rows
= cdmGetSelectedArticles();
998 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1001 if (rows
.length
== 0 && !no_error
) {
1002 alert(__("No articles are selected."));
1006 for (i
= 0; i
< rows
.length
; i
++) {
1007 var row
= $("RROW-" + rows
[i
]);
1009 var nc
= row
.className
;
1010 nc
= nc
.replace("Unread", "");
1011 nc
= nc
.replace("Selected", "");
1013 if (set_state
== undefined) {
1014 if (row
.className
.match("Unread")) {
1015 row
.className
= nc
+ "Selected";
1017 row
.className
= nc
+ "UnreadSelected";
1020 db
.execute("UPDATE articles SET unread = NOT unread WHERE id = ?",
1025 if (set_state
== false) {
1026 row
.className
= nc
+ "Selected";
1028 db
.execute("UPDATE articles SET unread = 0 WHERE id = ?",
1033 if (set_state
== true) {
1034 row
.className
= nc
+ "UnreadSelected";
1036 db
.execute("UPDATE articles SET unread = 1 WHERE id = ?",
1043 if (rows
.length
> 0) {
1045 update_local_feedlist_counters();
1049 if (set_state
== undefined) {
1051 } else if (set_state
== true) {
1053 } else if (set_state
== false) {
1057 var query
= "backend.php?op=rpc&subop=catchupSelected" +
1060 var ids
= "?ids=" + param_escape(rows
.toString());
1062 notify_progress("Loading, please wait...");
1064 new Ajax
.Request(query
, {
1066 onComplete: function(transport
) {
1067 catchup_callback2(transport
, callback_func
);
1073 exception_error("selectionToggleUnread", e
);
1077 function selectionToggleMarked(cdm_mode
) {
1083 rows
= cdmGetSelectedArticles();
1085 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1088 if (rows
.length
== 0) {
1089 alert(__("No articles are selected."));
1093 for (i
= 0; i
< rows
.length
; i
++) {
1094 toggleMark(rows
[i
], true, true);
1097 update_local_feedlist_counters();
1099 if (rows
.length
> 0) {
1101 var query
= "backend.php?op=rpc&subop=markSelected&ids=" +
1102 param_escape(rows
.toString()) + "&cmode=2";
1104 query
= query
+ "&afid=" + getActiveFeedId();
1106 /* if (tagsAreDisplayed()) {
1107 query = query + "&omode=tl";
1109 query = query + "&omode=flc";
1112 query
= query
+ "&omode=lc";
1114 new Ajax
.Request(query
, {
1115 onComplete: function(transport
) {
1116 all_counters_callback2(transport
);
1122 exception_error("selectionToggleMarked", e
);
1126 function selectionTogglePublished(cdm_mode
) {
1132 rows
= cdmGetSelectedArticles();
1134 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1137 if (rows
.length
== 0) {
1138 alert(__("No articles are selected."));
1142 for (i
= 0; i
< rows
.length
; i
++) {
1143 togglePub(rows
[i
], true, true);
1146 if (rows
.length
> 0) {
1148 var query
= "backend.php?op=rpc&subop=publishSelected&ids=" +
1149 param_escape(rows
.toString()) + "&cmode=2";
1151 query
= query
+ "&afid=" + getActiveFeedId();
1153 /* if (tagsAreDisplayed()) {
1154 query = query + "&omode=tl";
1156 query = query + "&omode=flc";
1159 query
= query
+ "&omode=lc";
1161 new Ajax
.Request(query
, {
1162 onComplete: function(transport
) {
1163 all_counters_callback2(transport
);
1169 exception_error("selectionToggleMarked", e
);
1173 function cdmGetSelectedArticles() {
1174 var sel_articles
= new Array();
1175 var container
= $("headlinesInnerContainer");
1177 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1178 var child
= container
.childNodes
[i
];
1180 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Selected")) {
1181 var c_id
= child
.id
.replace("RROW-", "");
1182 sel_articles
.push(c_id
);
1186 return sel_articles
;
1189 function cdmGetVisibleArticles() {
1190 var sel_articles
= new Array();
1191 var container
= $("headlinesInnerContainer");
1193 if (!container
) return sel_articles
;
1195 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1196 var child
= container
.childNodes
[i
];
1198 if (child
.id
&& child
.id
.match("RROW-")) {
1199 var c_id
= child
.id
.replace("RROW-", "");
1200 sel_articles
.push(c_id
);
1204 return sel_articles
;
1207 function cdmGetUnreadArticles() {
1208 var sel_articles
= new Array();
1209 var container
= $("headlinesInnerContainer");
1211 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1212 var child
= container
.childNodes
[i
];
1214 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Unread")) {
1215 var c_id
= child
.id
.replace("RROW-", "");
1216 sel_articles
.push(c_id
);
1220 return sel_articles
;
1224 // mode = all,none,unread
1225 function cdmSelectArticles(mode
) {
1226 var container
= $("headlinesInnerContainer");
1228 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1229 var child
= container
.childNodes
[i
];
1231 if (child
.id
&& child
.id
.match("RROW-")) {
1232 var aid
= child
.id
.replace("RROW-", "");
1234 var cb
= $("RCHK-" + aid
);
1236 if (mode
== "all") {
1237 if (!child
.className
.match("Selected")) {
1238 child
.className
= child
.className
+ "Selected";
1241 } else if (mode
== "unread") {
1242 if (child
.className
.match("Unread") && !child
.className
.match("Selected")) {
1243 child
.className
= child
.className
+ "Selected";
1247 child
.className
= child
.className
.replace("Selected", "");
1254 function catchupPage() {
1256 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1258 var str
= __("Mark all visible articles in %s as read?");
1260 str
= str
.replace("%s", fn
);
1262 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1266 if ($("headlinesList")) {
1267 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true);
1268 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1269 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1271 cdmSelectArticles('all');
1272 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1273 cdmSelectArticles('none');
1277 function catchupSelection() {
1283 if ($("headlinesList")) {
1284 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1286 rows
= cdmGetSelectedArticles();
1289 if (rows
.length
== 0) {
1290 alert(__("No articles are selected."));
1295 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1297 var str
= __("Mark %d selected articles in %s as read?");
1299 str
= str
.replace("%d", rows
.length
);
1300 str
= str
.replace("%s", fn
);
1302 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1306 if ($("headlinesList")) {
1307 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1308 // selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1310 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1311 // cdmSelectArticles('none');
1315 exception_error("catchupSelection", e
);
1319 function editArticleTags(id
, feed_id
, cdm_enabled
) {
1320 displayDlg('editArticleTags', id
);
1324 function tag_saved_callback(transport
) {
1326 debug("in tag_saved_callback");
1331 if (tagsAreDisplayed()) {
1332 _reload_feedlist_after_view
= true;
1336 if (transport
.responseXML
) {
1337 var tags_str
= transport
.responseXML
.getElementsByTagName("tags-str")[0];
1340 var id
= tags_str
.getAttribute("id");
1343 var tags
= $("ATSTR-" + id
);
1345 tags
.innerHTML
= tags_str
.firstChild
.nodeValue
;
1352 exception_error("tag_saved_callback", e
);
1356 function editTagsSave() {
1358 notify_progress("Saving article tags...");
1360 var form
= document
.forms
["tag_edit_form"];
1362 var query
= Form
.serialize("tag_edit_form");
1364 query
= "backend.php?op=rpc&subop=setArticleTags&" + query
;
1368 new Ajax
.Request(query
, {
1369 onComplete: function(transport
) {
1370 tag_saved_callback(transport
);
1375 function editTagsInsert() {
1378 var form
= document
.forms
["tag_edit_form"];
1380 var found_tags
= form
.found_tags
;
1381 var tags_str
= form
.tags_str
;
1383 var tag
= found_tags
[found_tags
.selectedIndex
].value
;
1385 if (tags_str
.value
.length
> 0 &&
1386 tags_str
.value
.lastIndexOf(", ") != tags_str
.value
.length
- 2) {
1388 tags_str
.value
= tags_str
.value
+ ", ";
1391 tags_str
.value
= tags_str
.value
+ tag
+ ", ";
1393 found_tags
.selectedIndex
= 0;
1396 exception_error("editTagsInsert", e
);
1400 function cdmScrollViewport(where
) {
1401 debug("cdmScrollViewport: " + where
);
1403 var ctr
= $("headlinesInnerContainer");
1407 if (where
== "bottom") {
1408 ctr
.scrollTop
= ctr
.scrollHeight
;
1410 ctr
.scrollTop
= where
;
1414 function cdmArticleIsBelowViewport(id
) {
1416 var ctr
= $("headlinesInnerContainer");
1417 var e
= $("RROW-" + id
);
1419 if (!e
|| !ctr
) return;
1421 // article starts below viewport
1423 if (ctr
.scrollTop
< e
.offsetTop
) {
1430 exception_error("cdmArticleIsVisible", e
);
1434 function cdmArticleIsAboveViewport(id
) {
1436 var ctr
= $("headlinesInnerContainer");
1437 var e
= $("RROW-" + id
);
1439 if (!e
|| !ctr
) return;
1441 // article starts above viewport
1443 if (ctr
.scrollTop
> e
.offsetTop
+ e
.offsetHeight
) {
1450 exception_error("cdmArticleIsVisible", e
);
1454 function cdmScrollToArticleId(id
) {
1456 var ctr
= $("headlinesInnerContainer");
1457 var e
= $("RROW-" + id
);
1459 if (!e
|| !ctr
) return;
1461 ctr
.scrollTop
= e
.offsetTop
;
1464 exception_error("cdmScrollToArticleId", e
);
1468 function cdmArticleIsActuallyVisible(id
) {
1470 var ctr
= $("headlinesInnerContainer");
1471 var e
= $("RROW-" + id
);
1473 if (!e
|| !ctr
) return;
1475 // article fits in viewport OR article is longer than viewport and
1476 // its bottom is visible
1478 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1479 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1483 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1484 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1485 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1494 exception_error("cdmArticleIsVisible", e
);
1498 function cdmWatchdog() {
1502 var ctr
= $("headlinesInnerContainer");
1506 var ids
= new Array();
1508 var e
= ctr
.firstChild
;
1511 if (e
.className
&& e
.className
== "cdmArticleUnread" && e
.id
&&
1512 e
.id
.match("RROW-")) {
1514 // article fits in viewport OR article is longer than viewport and
1515 // its bottom is visible
1517 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1518 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1520 // debug(e.id + " is visible " + e.offsetTop + "." +
1521 // (e.offsetTop + e.offsetHeight) + " vs " + ctr.scrollTop + "." +
1522 // (ctr.scrollTop + ctr.offsetHeight));
1524 ids
.push(e
.id
.replace("RROW-", ""));
1526 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1527 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1528 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1530 ids
.push(e
.id
.replace("RROW-", ""));
1534 // method 2: article bottom is visible and is in upper 1/2 of the viewport
1536 /* if (e.offsetTop + e.offsetHeight >= ctr.scrollTop &&
1537 e.offsetTop + e.offsetHeight <= ctr.scrollTop + ctr.offsetHeight/2) {
1539 ids.push(e.id.replace("RROW-", ""));
1548 debug("cdmWatchdog, ids= " + ids
.toString());
1550 if (ids
.length
> 0) {
1552 for (var i
= 0; i
< ids
.length
; i
++) {
1553 var e
= $("RROW-" + ids
[i
]);
1555 e
.className
= e
.className
.replace("Unread", "");
1559 var query
= "backend.php?op=rpc&subop=catchupSelected" +
1562 var ids
= "?ids=" + param_escape(ids
.toString());
1564 new Ajax
.Request(query
, {
1566 onComplete: function(transport
) {
1567 all_counters_callback2(transport
);
1572 _cdm_wd_timeout
= window
.setTimeout("cdmWatchdog()", 4000);
1575 exception_error("cdmWatchdog", e
);
1581 function cache_inject(id
, article
, param
) {
1583 if (!cache_check_param(id
, param
)) {
1584 debug("cache_article: miss: " + id
+ " [p=" + param
+ "]");
1589 var date
= new Date();
1590 var ts
= Math
.round(date
.getTime() / 1000);
1592 db
.execute("INSERT INTO cache (id, article, param, added) VALUES (?, ?, ?, ?)",
1593 [id
, article
, param
, ts
]);
1596 var cache_obj
= new Array();
1598 cache_obj
["id"] = id
;
1599 cache_obj
["data"] = article
;
1600 cache_obj
["param"] = param
;
1602 article_cache
.push(cache_obj
);
1606 debug("cache_article: hit: " + id
+ " [p=" + param
+ "]");
1609 exception_error("cache_inject", e
);
1613 function cache_find(id
) {
1616 var rs
= db
.execute("SELECT article FROM cache WHERE id = ?", [id
]);
1619 if (rs
.isValidRow()) {
1620 var a
= rs
.field(0);
1628 for (var i
= 0; i
< article_cache
.length
; i
++) {
1629 if (article_cache
[i
]["id"] == id
) {
1630 return article_cache
[i
]["data"];
1637 function cache_find_param(id
, param
) {
1640 var rs
= db
.execute("SELECT article FROM cache WHERE id = ? AND param = ?",
1644 if (rs
.isValidRow()) {
1653 for (var i
= 0; i
< article_cache
.length
; i
++) {
1654 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1655 return article_cache
[i
]["data"];
1662 function cache_check(id
) {
1665 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ?",
1669 if (rs
.isValidRow()) {
1670 a
= rs
.field(0) != "0";
1678 for (var i
= 0; i
< article_cache
.length
; i
++) {
1679 if (article_cache
[i
]["id"] == id
) {
1687 function cache_check_param(id
, param
) {
1690 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ? AND param = ?",
1694 if (rs
.isValidRow()) {
1695 a
= rs
.field(0) != "0";
1703 for (var i
= 0; i
< article_cache
.length
; i
++) {
1704 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1712 function cache_expire() {
1714 var date
= new Date();
1715 var ts
= Math
.round(date
.getTime() / 1000);
1717 db
.execute("DELETE FROM cache WHERE added < ? - 1800 AND id LIKE 'FEEDLIST'", [ts
]);
1718 db
.execute("DELETE FROM cache WHERE added < ? - 600 AND (id LIKE 'F:%' OR id LIKE 'C:%')", [ts
]);
1719 db
.execute("DELETE FROM cache WHERE added < ? - 86400", [ts
]);
1723 while (article_cache
.length
> 25) {
1724 article_cache
.shift();
1729 function cache_empty() {
1730 article_cache
= new Array();
1733 function cache_invalidate(id
) {
1737 rs
= db
.execute("DELETE FROM cache WHERE id = ?", [id
]);
1738 return rs
.rowsAffected
!= 0;
1743 while (i
< article_cache
.length
) {
1744 if (article_cache
[i
]["id"] == id
) {
1745 debug("cache_invalidate: removed id " + id
);
1746 article_cache
.splice(i
, 1);
1753 debug("cache_invalidate: id not found: " + id
);
1756 exception_error("cache_invalidate", e
);
1760 function getActiveArticleId() {
1761 return active_post_id
;
1764 function cdmClicked(id
) {
1766 var elem
= $("RROW-" + id
);
1769 var id
= elem
.id
.replace("RROW-", "");
1770 active_post_id
= id
;
1772 // cdmSelectArticles("none");
1773 toggleUnread(id
, 0, true);
1774 // toggleSelected(id);
1778 exception_error("cdmClicked", e
);
1782 function preload_article_callback(transport
) {
1784 if (transport
.responseXML
) {
1785 var articles
= transport
.responseXML
.getElementsByTagName("article");
1787 for (var i
= 0; i
< articles
.length
; i
++) {
1788 var id
= articles
[i
].getAttribute("id");
1789 if (!cache_check(id
)) {
1790 cache_inject(id
, articles
[i
].firstChild
.nodeValue
);
1791 debug("preloaded article: " + id
);
1796 exception_error("preload_article_callback", e
);
1800 function preloadArticleUnderPointer(id
) {
1802 if (getInitParam("bw_limit") == "1") return;
1804 if (post_under_pointer
== id
&& !cache_check(id
)) {
1806 debug("trying to preload article " + id
);
1808 var neighbor_ids
= getRelativePostIds(id
, 1);
1810 /* only request uncached articles */
1812 var cids_to_request
= Array();
1814 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
1815 if (!cache_check(neighbor_ids
[i
])) {
1816 cids_to_request
.push(neighbor_ids
[i
]);
1819 debug("additional ids: " + cids_to_request
.toString());
1821 cids_to_request
.push(id
);
1823 var query
= "backend.php?op=rpc&subop=getArticles&ids=" +
1824 cids_to_request
.toString();
1825 new Ajax
.Request(query
, {
1826 onComplete: function(transport
) {
1827 preload_article_callback(transport
);
1831 exception_error("preloadArticleUnderPointer", e
);
1835 function postMouseIn(id
) {
1837 if (post_under_pointer
!= id
) {
1838 post_under_pointer
= id
;
1840 window
.setTimeout("preloadArticleUnderPointer(" + id
+ ")", 250);
1845 exception_error("postMouseIn", e
);
1849 function postMouseOut(id
) {
1851 post_under_pointer
= false;
1853 exception_error("postMouseOut", e
);
1857 function headlines_scroll_handler() {
1860 var e
= $("headlinesInnerContainer");
1862 // don't do infinite scrolling when Limit == All
1864 var toolbar_form
= document
.forms
["main_toolbar_form"];
1866 var limit
= toolbar_form
.limit
[toolbar_form
.limit
.selectedIndex
];
1867 if (limit
.value
!= 0) {
1869 debug((e
.scrollTop
+ e
.offsetHeight
) + " vs " + e
.scrollHeight
+ " dis? " +
1870 _infscroll_disable
);
1872 if (e
.scrollTop
+ e
.offsetHeight
> e
.scrollHeight
- 100) {
1873 if (!_infscroll_disable
) {
1874 debug("more cowbell!");
1881 exception_error("headlines_scroll_handler", e
);
1885 function catchupRelativeToArticle(below
) {
1890 if (!getActiveArticleId()) {
1891 alert(__("No article is selected."));
1897 if ($("headlinesList")) {
1898 visible_ids
= getVisibleHeadlineIds();
1900 visible_ids
= cdmGetVisibleArticles();
1903 var ids_to_mark
= new Array();
1906 for (var i
= 0; i
< visible_ids
.length
; i
++) {
1907 if (visible_ids
[i
] != getActiveArticleId()) {
1908 var e
= $("RROW-" + visible_ids
[i
]);
1910 if (e
&& e
.className
.match("Unread")) {
1911 ids_to_mark
.push(visible_ids
[i
]);
1918 for (var i
= visible_ids
.length
-1; i
>= 0; i
--) {
1919 if (visible_ids
[i
] != getActiveArticleId()) {
1920 var e
= $("RROW-" + visible_ids
[i
]);
1922 if (e
&& e
.className
.match("Unread")) {
1923 ids_to_mark
.push(visible_ids
[i
]);
1931 if (ids_to_mark
.length
== 0) {
1932 alert(__("No articles found to mark"));
1934 var msg
= __("Mark %d article(s) as read?").replace("%d", ids_to_mark
.length
);
1938 for (var i
= 0; i
< ids_to_mark
.length
; i
++) {
1939 var e
= $("RROW-" + ids_to_mark
[i
]);
1940 e
.className
= e
.className
.replace("Unread", "");
1943 var query
= "backend.php?op=rpc&subop=catchupSelected" +
1946 var ids
= "?ids=" + param_escape(ids_to_mark
.toString());
1948 new Ajax
.Request(query
, {
1950 onComplete: function(transport
) {
1951 catchup_callback2(transport
);
1958 exception_error("catchupRelativeToArticle", e
);
1962 function cdmExpandArticle(a_id
) {
1964 var id
= 'CICD-' + a_id
;
1967 Element
.hide("CEXC-" + a_id
);
1970 Effect
.Appear(id
, {duration
: 0.5,
1971 beforeStart: function(effect
) {
1972 var h_id
= 'CICH-' + a_id
;
1973 var h_elem
= $(h_id
);
1974 if (h_elem
) { h_elem
.style
.display
= "none"; }
1976 toggleUnread(a_id
, 0);
1981 exception_error("appearBlockElementF", e
);
1986 function fixHeadlinesOrder(ids
) {
1988 for (var i
= 0; i
< ids
.length
; i
++) {
1989 var e
= $("RROW-" + ids
[i
]);
1993 e
.className
= e
.className
.replace("even", "odd");
1995 e
.className
= e
.className
.replace("odd", "even");
2000 exception_error("fixHeadlinesOrder", e
);
2004 function hideReadHeadlines() {
2008 var vis_ids
= new Array();
2010 if ($("headlinesList")) {
2011 ids
= getVisibleHeadlineIds();
2013 ids
= cdmGetVisibleArticles();
2016 var read_headlines_visible
= true;
2018 for (var i
= 0; i
< ids
.length
; i
++) {
2019 var row
= $("RROW-" + ids
[i
]);
2021 if (row
&& row
.className
) {
2022 if (read_headlines_visible
) {
2023 if (row
.className
.match("Unread") || row
.className
.match("Selected")) {
2025 vis_ids
.push(ids
[i
]);
2027 //Effect.Fade(row, {duration : 0.3});
2032 vis_ids
.push(ids
[i
]);
2037 fixHeadlinesOrder(vis_ids
);
2039 read_headlines_visible
= !read_headlines_visible
;
2042 exception_error("hideReadHeadlines", e
);
2046 function invertHeadlineSelection() {
2048 var rows
= new Array();
2052 r
= document
.getElementsByTagName("TR");
2054 r
= document
.getElementsByTagName("DIV");
2057 for (var i
= 0; i
< r
.length
; i
++) {
2058 if (r
[i
].id
&& r
[i
].id
.match("RROW-")) {
2063 for (var i
= 0; i
< rows
.length
; i
++) {
2064 var nc
= rows
[i
].className
;
2065 var id
= rows
[i
].id
.replace("RROW-", "");
2066 var cb
= $("RCHK-" + id
);
2068 if (!rows
[i
].className
.match("Selected")) {
2069 nc
= nc
+ "Selected";
2072 nc
= nc
.replace("Selected", "");
2076 rows
[i
].className
= nc
;
2081 exception_error("invertHeadlineSelection", e
);
2085 function getArticleUnderPointer() {
2086 return post_under_pointer
;
2089 function zoomToArticle(id
) {
2091 var w
= window
.open("backend.php?op=view&mode=zoom&id=" + param_escape(id
),
2093 "status=0,toolbar=0,location=0,width=450,height=300,scrollbars=1,menubar=0");
2096 exception_error("zoomToArticle", e
);
2100 function showOriginalArticleInline(id
) {
2103 var query
= "backend.php?op=rpc&subop=getArticleLink&id=" + id
;
2105 notify_progress("Loading, please wait...", true);
2107 new Ajax
.Request(query
, {
2108 onComplete: function(transport
) {
2110 if (transport
.responseXML
) {
2112 var link
= transport
.responseXML
.getElementsByTagName("link")[0];
2113 var id
= transport
.responseXML
.getElementsByTagName("id")[0];
2118 link
= link
.firstChild
.nodeValue
;
2120 var ci
= $("content-insert");
2122 var tmp
= "<iframe id=\"inline_orig_article\" width=\""+ci
.offsetWidth
+"\" height=\""+ci
.offsetHeight
+"\" style=\"border-width : 0px;\" src=\""+link
+"\"></iframe>";
2124 render_article(tmp
);
2131 exception_error("showOriginalArticleInline", e
);
2136 function scrollArticle(offset
) {
2139 var ci
= $("content-insert");
2141 ci
.scrollTop
+= offset
;
2144 var hi
= $("headlinesInnerContainer");
2146 hi
.scrollTop
+= offset
;
2151 exception_error("scrollArticle", e
);
2155 function show_labels_in_headlines(transport
) {
2157 if (transport
.responseXML
) {
2158 var info
= transport
.responseXML
.getElementsByTagName("info-for-headlines")[0];
2160 var elems
= info
.getElementsByTagName("entry");
2162 for (var l
= 0; l
< elems
.length
; l
++) {
2163 var e_id
= elems
[l
].getAttribute("id");
2167 var ctr
= $("HLLCTR-" + e_id
);
2170 ctr
.innerHTML
= elems
[l
].firstChild
.nodeValue
;
2178 exception_error("show_labels_in_headlines", e
);
2183 function toggleHeadlineActions() {
2185 var e
= $("headlineActionsBody");
2186 var p
= $("headlineActionsDrop");
2188 if (!Element
.visible(e
)) {
2195 e
.style
.left
= (p
.offsetLeft
+ 1) + "px";
2196 e
.style
.top
= (p
.offsetTop
+ p
.offsetHeight
+ 2) + "px";
2199 exception_error("toggleHeadlineActions", e
);
2203 function publishWithNote(id
, def_note
) {
2205 if (!def_note
) def_note
= '';
2207 var note
= prompt(__("Please enter a note for this article:"), def_note
);
2209 if (note
!= undefined) {
2210 togglePub(id
, false, false, note
);
2214 exception_error("publishWithNote", e
);