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
);
109 var ll
= $('FLL-' + feed_id
);
112 var feedr
= $("FEEDR-" + feed_id
);
113 if (feedr
&& !feedr
.className
.match("Selected")) {
114 feedr
.className
= feedr
.className
+ "Selected";
116 if (feedr
&& ll
) feedr
.removeChild(ll
);
118 var feedr
= $("FCAT-" + feed_id
);
119 if (feedr
&& !feedr
.className
.match("Selected")) {
120 feedr
.className
= feedr
.className
+ "Selected";
122 if (feedr
&& ll
) feedr
.removeChild(ll
);
126 var f
= $("headlines-frame");
128 if (feed_cur_page
== 0) {
129 debug("resetting headlines scrollTop");
134 if (transport
.responseXML
) {
135 var headlines
= transport
.responseXML
.getElementsByTagName("headlines")[0];
136 var headlines_count_obj
= transport
.responseXML
.getElementsByTagName("headlines-count")[0];
137 var headlines_unread_obj
= transport
.responseXML
.getElementsByTagName("headlines-unread")[0];
138 var disable_cache_obj
= transport
.responseXML
.getElementsByTagName("disable-cache")[0];
140 var vgroup_last_feed_obj
= transport
.responseXML
.getElementsByTagName("vgroup-last-feed")[0];
142 var headlines_count
= headlines_count_obj
.getAttribute("value");
143 var headlines_unread
= headlines_unread_obj
.getAttribute("value");
144 var disable_cache
= disable_cache_obj
.getAttribute("value") != "0";
146 vgroup_last_feed
= vgroup_last_feed_obj
.getAttribute("value");
148 if (headlines_count
== 0) {
149 _infscroll_disable
= 1;
151 _infscroll_disable
= 0;
154 var counters
= transport
.responseXML
.getElementsByTagName("counters")[0];
155 var articles
= transport
.responseXML
.getElementsByTagName("article");
156 var runtime_info
= transport
.responseXML
.getElementsByTagName("runtime-info");
158 if (feed_cur_page
== 0) {
160 f
.innerHTML
= headlines
.firstChild
.nodeValue
;
162 var cache_prefix
= "";
170 cache_invalidate(cache_prefix
+ feed_id
);
172 if (!disable_cache
) {
173 cache_inject(cache_prefix
+ feed_id
,
174 headlines
.firstChild
.nodeValue
, headlines_unread
);
178 debug("headlines_callback: returned no data");
179 f
.innerHTML
= "<div class='whiteBox'>" + __('Could not update headlines (missing XML data)') + "</div>";
184 if (headlines_count
> 0) {
185 debug("adding some more headlines...");
187 var c
= $("headlinesList");
190 c
= $("headlinesInnerContainer");
193 var ids
= getSelectedArticleIds2();
195 c
.innerHTML
= c
.innerHTML
+ headlines
.firstChild
.nodeValue
;
197 debug("restore selected ids: " + ids
);
199 for (var i
= 0; i
< ids
.length
; i
++) {
200 markHeadline(ids
[i
]);
204 debug("no new headlines received");
207 debug("headlines_callback: returned no data");
208 notify_error("Error while trying to load more headlines");
214 for (var i
= 0; i
< articles
.length
; i
++) {
215 var a_id
= articles
[i
].getAttribute("id");
216 debug("found id: " + a_id
);
217 cache_inject(a_id
, articles
[i
].firstChild
.nodeValue
);
220 debug("no cached articles received");
224 debug("parsing piggybacked counters: " + counters
);
225 parse_counters(counters
, false);
227 debug("counters container not found in reply, requesting...");
232 debug("parsing runtime info: " + runtime_info
[0]);
233 parse_runtime_info(runtime_info
[0]);
235 debug("counters container not found in reply");
239 debug("headlines_callback: returned no XML object");
240 f
.innerHTML
= "<div class='whiteBox'>" + __('Could not update headlines (missing XML object)') + "</div>";
243 if (typeof correctPNG
!= 'undefined') {
247 if (_cdm_wd_timeout
) window
.clearTimeout(_cdm_wd_timeout
);
249 if (!$("headlinesList") &&
250 getActiveFeedId() != -3 &&
251 getInitParam("cdm_auto_catchup") == 1) {
252 debug("starting CDM watchdog");
253 _cdm_wd_timeout
= window
.setTimeout("cdmWatchdog()", 5000);
254 _cdm_wd_vishist
= new Array();
256 debug("not in CDM mode or watchdog disabled");
259 _feed_cur_page
= feed_cur_page
;
260 _infscroll_request_sent
= 0;
267 exception_error("headlines_callback2", e
, transport
);
271 function render_article(article
) {
273 var f
= $("content-frame");
278 var fi
= $("content-insert");
284 fi
.innerHTML
= article
;
286 // article.evalScripts();
289 exception_error("render_article", e
);
293 function showArticleInHeadlines(id
) {
297 cleanSelected("headlinesList");
299 var crow
= $("RROW-" + id
);
303 var article_is_unread
= crow
.className
.match("Unread");
305 crow
.className
= crow
.className
.replace("Unread", "");
307 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
309 var upd_img_pic
= $("FUPDPIC-" + id
);
311 var cache_prefix
= "";
313 if (activeFeedIsCat()) {
319 var view_mode
= false;
322 view_mode
= document
.forms
['main_toolbar_form'].view_mode
;
323 view_mode
= view_mode
[view_mode
.selectedIndex
].value
;
328 if (upd_img_pic
&& (upd_img_pic
.src
.match("updated.png") ||
329 upd_img_pic
.src
.match("fresh_sign.png"))) {
331 upd_img_pic
.src
= "images/blank_icon.gif";
333 cache_invalidate(cache_prefix
+ getActiveFeedId());
335 cache_inject(cache_prefix
+ getActiveFeedId(),
336 $("headlines-frame").innerHTML
,
337 get_feed_unread(getActiveFeedId()));
339 } else if (article_is_unread
&& view_mode
== "all_articles") {
341 cache_invalidate(cache_prefix
+ getActiveFeedId());
343 cache_inject(cache_prefix
+ getActiveFeedId(),
344 $("headlines-frame").innerHTML
,
345 get_feed_unread(getActiveFeedId())-1);
347 } else if (article_is_unread
) {
348 cache_invalidate(cache_prefix
+ getActiveFeedId());
354 exception_error("showArticleInHeadlines", e
);
358 function article_callback2(transport
, id
, feed_id
) {
360 debug("article_callback2 " + id
);
362 if (!transport
.responseText
&& db
) {
363 offlineConfirmModeChange();
367 if (transport
.responseXML
) {
369 if (!transport_error_check(transport
)) return;
371 var ll
= $('LL-' + id
);
372 var content
= $('HLC-' + id
);
374 if (ll
&& content
) content
.removeChild(ll
);
376 if (id
!= last_requested_article
) {
377 debug("requested article id is out of sequence, aborting");
381 active_real_feed_id
= feed_id
;
384 debug("looking for articles to cache...");
386 var articles
= transport
.responseXML
.getElementsByTagName("article");
388 for (var i
= 0; i
< articles
.length
; i
++) {
389 var a_id
= articles
[i
].getAttribute("id");
391 debug("found id: " + a_id
);
393 if (a_id
== active_post_id
) {
394 debug("active article, rendering...");
395 render_article(articles
[i
].firstChild
.nodeValue
);
398 cache_inject(a_id
, articles
[i
].firstChild
.nodeValue
);
402 showArticleInHeadlines(id
);
405 db
.execute("UPDATE articles SET unread = 0 WHERE id = ?", [id
]);
408 var reply
= transport
.responseXML
.firstChild
.firstChild
;
411 debug("article_callback: returned no XML object");
412 //var f = $("content-frame");
413 //f.innerHTML = "<div class='whiteBox'>" + __('Could not display article (missing XML object)') + "</div>";
416 var date
= new Date();
417 last_article_view
= date
.getTime() / 1000;
419 if (typeof correctPNG
!= 'undefined') {
423 if (_reload_feedlist_after_view
) {
424 setTimeout('updateFeedList(false, false)', 50);
425 _reload_feedlist_after_view
= false;
427 if (transport
.responseXML
) {
428 var counters
= transport
.responseXML
.getElementsByTagName("counters")[0];
431 debug("parsing piggybacked counters: " + counters
);
432 parse_counters(counters
, false);
434 debug("counters container not found in reply, requesting...");
442 exception_error("article_callback2", e
, transport
);
446 function view(id
, feed_id
, skip_history
) {
449 debug("loading article: " + id
+ "/" + feed_id
);
451 if (offline_mode
) return view_offline(id
, feed_id
);
453 var cached_article
= cache_find(id
);
455 debug("cache check result: " + (cached_article
!= false));
459 //setActiveFeedId(feed_id);
461 var query
= "backend.php?op=view&id=" + param_escape(id
) +
462 "&feed=" + param_escape(feed_id
);
464 var date
= new Date();
466 var neighbor_ids
= getRelativePostIds(active_post_id
);
468 /* only request uncached articles */
470 var cids_to_request
= Array();
472 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
473 if (!cache_check(neighbor_ids
[i
])) {
474 cids_to_request
.push(neighbor_ids
[i
]);
478 debug("additional ids: " + cids_to_request
.toString());
480 /* additional info for piggyback counters */
482 if (tagsAreDisplayed()) {
483 query
= query
+ "&omode=lt";
485 query
= query
+ "&omode=flc";
488 var date
= new Date();
489 var timestamp
= Math
.round(date
.getTime() / 1000);
490 query
= query
+ "&ts=" + timestamp
;
492 query
= query
+ "&cids=" + cids_to_request
.toString();
494 var crow
= $("RROW-" + id
);
495 var article_is_unread
= crow
.className
.match("Unread");
497 if (!async_counters_work
) {
498 query
= query
+ "&csync=true";
501 showArticleInHeadlines(id
);
503 if (!cached_article
) {
505 // notify_progress("Loading, please wait...", true);
507 var content
= $('HLC-' + id
);
509 if (content
&& !$('LL-' + id
)) {
510 var ll
= document
.createElement('img');
512 ll
.src
= 'images/indicator_tiny.gif';
513 ll
.className
= 'hlLoading';
516 content
.appendChild(ll
);
520 } else if (cached_article
&& article_is_unread
) {
522 query
= query
+ "&mode=prefetch";
524 render_article(cached_article
);
526 } else if (cached_article
) {
528 query
= query
+ "&mode=prefetch_old";
529 render_article(cached_article
);
535 last_requested_article
= id
;
537 new Ajax
.Request(query
, {
538 onComplete: function(transport
) {
539 article_callback2(transport
, id
, feed_id
);
545 exception_error("view", e
);
550 return toggleMark(id
);
554 return togglePub(id
);
557 function tMark_afh_off(effect
) {
559 var elem
= effect
.effects
[0].element
;
561 debug("tMark_afh_off : " + elem
.id
);
564 elem
.src
= elem
.src
.replace("mark_set", "mark_unset");
565 elem
.alt
= __("Star article");
570 exception_error("tMark_afh_off", e
);
574 function tPub_afh_off(effect
) {
576 var elem
= effect
.effects
[0].element
;
578 debug("tPub_afh_off : " + elem
.id
);
581 elem
.src
= elem
.src
.replace("pub_set", "pub_unset");
582 elem
.alt
= __("Publish article");
587 exception_error("tPub_afh_off", e
);
591 function toggleMark(id
, client_only
, no_effects
) {
595 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=mark";
597 query
= query
+ "&afid=" + getActiveFeedId();
599 if (tagsAreDisplayed()) {
600 query
= query
+ "&omode=tl";
602 query
= query
+ "&omode=flc";
605 var mark_img
= $("FMPIC-" + id
);
607 if (!mark_img
) return;
609 var vfeedu
= $("FEEDU--1");
610 var crow
= $("RROW-" + id
);
612 if (mark_img
.src
.match("mark_unset")) {
613 mark_img
.src
= mark_img
.src
.replace("mark_unset", "mark_set");
614 mark_img
.alt
= __("Unstar article");
615 query
= query
+ "&mark=1";
618 db
.execute("UPDATE articles SET marked = 1 WHERE id = ?", [id
]);
622 //mark_img.src = "images/mark_unset.png";
623 mark_img
.alt
= __("Please wait...");
624 query
= query
+ "&mark=0";
626 if ($("headlinesList") && !no_effects
) {
627 Effect
.Puff(mark_img
, {duration
: 0.25, afterFinish
: tMark_afh_off
});
629 mark_img
.src
= mark_img
.src
.replace("mark_set", "mark_unset");
630 mark_img
.alt
= __("Star article");
634 db
.execute("UPDATE articles SET marked = 0 WHERE id = ?", [id
]);
639 if (!no_effects
) update_local_feedlist_counters();
644 new Ajax
.Request(query
, {
645 onComplete: function(transport
) {
646 all_counters_callback2(transport
);
652 exception_error("toggleMark", e
);
656 function togglePub(id
, client_only
, no_effects
, note
) {
660 var query
= "backend.php?op=rpc&id=" + id
+ "&subop=publ";
662 query
= query
+ "&afid=" + getActiveFeedId();
664 if (note
!= undefined) {
665 query
= query
+ "¬e=" + param_escape(note
);
667 query
= query
+ "¬e=undefined";
670 if (tagsAreDisplayed()) {
671 query
= query
+ "&omode=tl";
673 query
= query
+ "&omode=flc";
676 var mark_img
= $("FPPIC-" + id
);
678 if (!mark_img
) return;
680 var vfeedu
= $("FEEDU--2");
681 var crow
= $("RROW-" + id
);
683 if (mark_img
.src
.match("pub_unset") || note
!= undefined) {
684 mark_img
.src
= mark_img
.src
.replace("pub_unset", "pub_set");
685 mark_img
.alt
= __("Unpublish article");
686 query
= query
+ "&pub=1";
689 //mark_img.src = "images/pub_unset.png";
690 mark_img
.alt
= __("Please wait...");
691 query
= query
+ "&pub=0";
693 if ($("headlinesList") && !no_effects
) {
694 Effect
.Puff(mark_img
, {duration
: 0.25, afterFinish
: tPub_afh_off
});
696 mark_img
.src
= mark_img
.src
.replace("pub_set", "pub_unset");
697 mark_img
.alt
= __("Publish article");
702 new Ajax
.Request(query
, {
703 onComplete: function(transport
) {
704 toggle_published_callback(transport
);
710 exception_error("togglePub", e
);
714 function correctHeadlinesOffset(id
) {
718 var hlist
= $("headlinesList");
719 var container
= $("headlinesInnerContainer");
720 var row
= $("RROW-" + id
);
722 var viewport
= container
.offsetHeight
;
724 var rel_offset_top
= row
.offsetTop
- container
.scrollTop
;
725 var rel_offset_bottom
= row
.offsetTop
+ row
.offsetHeight
- container
.scrollTop
;
727 debug("Rtop: " + rel_offset_top
+ " Rbtm: " + rel_offset_bottom
);
728 debug("Vport: " + viewport
);
730 if (rel_offset_top
<= 0 || rel_offset_top
> viewport
) {
731 container
.scrollTop
= row
.offsetTop
;
732 } else if (rel_offset_bottom
> viewport
) {
734 /* doesn't properly work with Opera in some cases because
735 Opera fucks up element scrolling */
737 container
.scrollTop
= row
.offsetTop
+ row
.offsetHeight
- viewport
;
741 exception_error("correctHeadlinesOffset", e
);
746 function moveToPost(mode
) {
753 rows
= cdmGetVisibleArticles();
755 rows
= getVisibleHeadlineIds();
761 if (!$('RROW-' + active_post_id
)) {
762 active_post_id
= false;
765 if (active_post_id
== false) {
766 next_id
= getFirstVisibleHeadlineId();
767 prev_id
= getLastVisibleHeadlineId();
769 for (var i
= 0; i
< rows
.length
; i
++) {
770 if (rows
[i
] == active_post_id
) {
777 if (mode
== "next") {
781 if (!cdmArticleIsActuallyVisible(next_id
)) {
782 cdmScrollToArticleId(next_id
);
784 cdmSelectArticles("none");
785 toggleUnread(next_id
, 0, true);
786 toggleSelected(next_id
);
789 correctHeadlinesOffset(next_id
);
790 view(next_id
, getActiveFeedId());
795 if (mode
== "prev") {
798 cdmScrollToArticleId(prev_id
);
799 cdmSelectArticles("none");
800 toggleUnread(prev_id
, 0, true);
801 toggleSelected(prev_id
);
803 correctHeadlinesOffset(prev_id
);
804 view(prev_id
, getActiveFeedId());
810 exception_error("moveToPost", e
);
814 function toggleSelected(id
) {
817 var cb
= $("RCHK-" + id
);
819 var row
= $("RROW-" + id
);
821 var nc
= row
.className
;
823 if (!nc
.match("Selected")) {
824 nc
= nc
+ "Selected";
829 // In CDM basically last selected article == active article
830 if (isCdmMode()) active_post_id
= id
;
832 nc
= nc
.replace("Selected", "");
842 exception_error("toggleSelected", e
);
846 function toggleUnread_afh(effect
) {
849 var elem
= effect
.element
;
850 elem
.style
.backgroundColor
= "";
853 exception_error("toggleUnread_afh", e
);
857 function toggleUnread(id
, cmode
, effect
) {
860 var row
= $("RROW-" + id
);
862 var nc
= row
.className
;
863 var is_selected
= row
.className
.match("Selected");
864 nc
= nc
.replace("Unread", "");
865 nc
= nc
.replace("Selected", "");
867 // since we are removing selection from the object, uncheck
868 // corresponding checkbox
870 var cb
= $("RCHK-" + id
);
875 // NOTE: I'm not sure that resetting selection here is a feature -fox
877 if (cmode
== undefined || cmode
== 2) {
878 if (row
.className
.match("Unread")) {
882 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
883 afterFinish
: toggleUnread_afh
,
884 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
888 row
.className
= nc
+ "Unread";
892 db
.execute("UPDATE articles SET unread = not unread "+
893 "WHERE id = ?", [id
]);
896 } else if (cmode
== 0) {
900 new Effect
.Highlight(row
, {duration
: 1, startcolor
: "#fff7d5",
901 afterFinish
: toggleUnread_afh
,
902 queue
: { position
:'end', scope
: 'TMRQ-' + id
, limit
: 1 } } );
906 db
.execute("UPDATE articles SET unread = 0 "+
907 "WHERE id = ?", [id
]);
910 } else if (cmode
== 1) {
911 row
.className
= nc
+ "Unread";
914 db
.execute("UPDATE articles SET unread = 1 "+
915 "WHERE id = ?", [id
]);
920 update_local_feedlist_counters();
922 // Disable unmarking as selected for the time being (16.05.08) -fox
923 if (is_selected
) row
.className
= row
.className
+ "Selected";
925 if (cmode
== undefined) cmode
= 2;
927 var query
= "backend.php?op=rpc&subop=catchupSelected" +
928 "&cmode=" + param_escape(cmode
);
930 var ids
= "?ids=" + param_escape(id
);
932 // notify_progress("Loading, please wait...");
934 new Ajax
.Request(query
, {
936 onComplete: function(transport
) {
937 all_counters_callback2(transport
);
943 exception_error("toggleUnread", e
);
947 function selectionRemoveLabel(id
) {
950 var ids
= getSelectedArticleIds2();
952 if (ids
.length
== 0) {
953 alert(__("No articles are selected."));
957 // var ok = confirm(__("Remove selected articles from label?"));
961 var query
= "backend.php?op=rpc&subop=removeFromLabel&ids=" +
962 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
964 // notify_progress("Loading, please wait...");
966 cache_invalidate("F:" + (-11 - id
));
968 new Ajax
.Request(query
, {
969 onComplete: function(transport
) {
970 show_labels_in_headlines(transport
);
971 all_counters_callback2(transport
);
977 exception_error("selectionAssignLabel", e
);
982 function selectionAssignLabel(id
) {
985 var ids
= getSelectedArticleIds2();
987 if (ids
.length
== 0) {
988 alert(__("No articles are selected."));
992 // var ok = confirm(__("Assign selected articles to label?"));
996 cache_invalidate("F:" + (-11 - id
));
998 var query
= "backend.php?op=rpc&subop=assignToLabel&ids=" +
999 param_escape(ids
.toString()) + "&lid=" + param_escape(id
);
1001 // notify_progress("Loading, please wait...");
1003 new Ajax
.Request(query
, {
1004 onComplete: function(transport
) {
1005 show_labels_in_headlines(transport
);
1006 all_counters_callback2(transport
);
1012 exception_error("selectionAssignLabel", e
);
1017 function selectionToggleUnread(cdm_mode
, set_state
, callback_func
, no_error
) {
1022 rows
= cdmGetSelectedArticles();
1024 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1027 if (rows
.length
== 0 && !no_error
) {
1028 alert(__("No articles are selected."));
1032 for (i
= 0; i
< rows
.length
; i
++) {
1033 var row
= $("RROW-" + rows
[i
]);
1035 var nc
= row
.className
;
1036 nc
= nc
.replace("Unread", "");
1037 nc
= nc
.replace("Selected", "");
1039 if (set_state
== undefined) {
1040 if (row
.className
.match("Unread")) {
1041 row
.className
= nc
+ "Selected";
1043 row
.className
= nc
+ "UnreadSelected";
1046 db
.execute("UPDATE articles SET unread = NOT unread WHERE id = ?",
1051 if (set_state
== false) {
1052 row
.className
= nc
+ "Selected";
1054 db
.execute("UPDATE articles SET unread = 0 WHERE id = ?",
1059 if (set_state
== true) {
1060 row
.className
= nc
+ "UnreadSelected";
1062 db
.execute("UPDATE articles SET unread = 1 WHERE id = ?",
1069 if (rows
.length
> 0) {
1071 update_local_feedlist_counters();
1075 if (set_state
== undefined) {
1077 } else if (set_state
== true) {
1079 } else if (set_state
== false) {
1083 var query
= "backend.php?op=rpc&subop=catchupSelected" +
1086 var ids
= "?ids=" + param_escape(rows
.toString());
1088 notify_progress("Loading, please wait...");
1090 new Ajax
.Request(query
, {
1092 onComplete: function(transport
) {
1093 catchup_callback2(transport
, callback_func
);
1099 exception_error("selectionToggleUnread", e
);
1103 function selectionToggleMarked(cdm_mode
) {
1109 rows
= cdmGetSelectedArticles();
1111 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1114 if (rows
.length
== 0) {
1115 alert(__("No articles are selected."));
1119 for (i
= 0; i
< rows
.length
; i
++) {
1120 toggleMark(rows
[i
], true, true);
1123 update_local_feedlist_counters();
1125 if (rows
.length
> 0) {
1127 var query
= "backend.php?op=rpc&subop=markSelected&ids=" +
1128 param_escape(rows
.toString()) + "&cmode=2";
1130 query
= query
+ "&afid=" + getActiveFeedId();
1132 /* if (tagsAreDisplayed()) {
1133 query = query + "&omode=tl";
1135 query = query + "&omode=flc";
1138 query
= query
+ "&omode=lc";
1140 new Ajax
.Request(query
, {
1141 onComplete: function(transport
) {
1142 all_counters_callback2(transport
);
1148 exception_error("selectionToggleMarked", e
);
1152 function selectionTogglePublished(cdm_mode
) {
1158 rows
= cdmGetSelectedArticles();
1160 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1163 if (rows
.length
== 0) {
1164 alert(__("No articles are selected."));
1168 for (i
= 0; i
< rows
.length
; i
++) {
1169 togglePub(rows
[i
], true, true);
1172 if (rows
.length
> 0) {
1174 var query
= "backend.php?op=rpc&subop=publishSelected&ids=" +
1175 param_escape(rows
.toString()) + "&cmode=2";
1177 query
= query
+ "&afid=" + getActiveFeedId();
1179 /* if (tagsAreDisplayed()) {
1180 query = query + "&omode=tl";
1182 query = query + "&omode=flc";
1185 query
= query
+ "&omode=lc";
1187 new Ajax
.Request(query
, {
1188 onComplete: function(transport
) {
1189 all_counters_callback2(transport
);
1195 exception_error("selectionToggleMarked", e
);
1199 function cdmGetSelectedArticles() {
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("Selected")) {
1207 var c_id
= child
.id
.replace("RROW-", "");
1208 sel_articles
.push(c_id
);
1212 return sel_articles
;
1215 function cdmGetVisibleArticles() {
1216 var sel_articles
= new Array();
1217 var container
= $("headlinesInnerContainer");
1219 if (!container
) return sel_articles
;
1221 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1222 var child
= container
.childNodes
[i
];
1224 if (child
.id
&& child
.id
.match("RROW-")) {
1225 var c_id
= child
.id
.replace("RROW-", "");
1226 sel_articles
.push(c_id
);
1230 return sel_articles
;
1233 function cdmGetUnreadArticles() {
1234 var sel_articles
= new Array();
1235 var container
= $("headlinesInnerContainer");
1237 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1238 var child
= container
.childNodes
[i
];
1240 if (child
.id
&& child
.id
.match("RROW-") && child
.className
.match("Unread")) {
1241 var c_id
= child
.id
.replace("RROW-", "");
1242 sel_articles
.push(c_id
);
1246 return sel_articles
;
1250 // mode = all,none,unread
1251 function cdmSelectArticles(mode
) {
1252 var container
= $("headlinesInnerContainer");
1254 for (i
= 0; i
< container
.childNodes
.length
; i
++) {
1255 var child
= container
.childNodes
[i
];
1257 if (child
.id
&& child
.id
.match("RROW-")) {
1258 var aid
= child
.id
.replace("RROW-", "");
1260 var cb
= $("RCHK-" + aid
);
1262 if (mode
== "all") {
1263 if (!child
.className
.match("Selected")) {
1264 child
.className
= child
.className
+ "Selected";
1267 } else if (mode
== "unread") {
1268 if (child
.className
.match("Unread") && !child
.className
.match("Selected")) {
1269 child
.className
= child
.className
+ "Selected";
1273 child
.className
= child
.className
.replace("Selected", "");
1280 function catchupPage() {
1282 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1284 var str
= __("Mark all visible articles in %s as read?");
1286 str
= str
.replace("%s", fn
);
1288 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1292 if ($("headlinesList")) {
1293 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true);
1294 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1295 selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1297 cdmSelectArticles('all');
1298 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1299 cdmSelectArticles('none');
1303 function catchupSelection() {
1309 if ($("headlinesList")) {
1310 rows
= getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
1312 rows
= cdmGetSelectedArticles();
1315 if (rows
.length
== 0) {
1316 alert(__("No articles are selected."));
1321 var fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
1323 var str
= __("Mark %d selected articles in %s as read?");
1325 str
= str
.replace("%d", rows
.length
);
1326 str
= str
.replace("%s", fn
);
1328 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
1332 if ($("headlinesList")) {
1333 selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
1334 // selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
1336 selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
1337 // cdmSelectArticles('none');
1341 exception_error("catchupSelection", e
);
1345 function editArticleTags(id
, feed_id
, cdm_enabled
) {
1346 displayDlg('editArticleTags', id
);
1350 function tag_saved_callback(transport
) {
1352 debug("in tag_saved_callback");
1357 if (tagsAreDisplayed()) {
1358 _reload_feedlist_after_view
= true;
1362 if (transport
.responseXML
) {
1363 var tags_str
= transport
.responseXML
.getElementsByTagName("tags-str")[0];
1366 var id
= tags_str
.getAttribute("id");
1369 var tags
= $("ATSTR-" + id
);
1371 tags
.innerHTML
= tags_str
.firstChild
.nodeValue
;
1378 exception_error("tag_saved_callback", e
);
1382 function editTagsSave() {
1384 notify_progress("Saving article tags...");
1386 var form
= document
.forms
["tag_edit_form"];
1388 var query
= Form
.serialize("tag_edit_form");
1390 query
= "backend.php?op=rpc&subop=setArticleTags&" + query
;
1394 new Ajax
.Request(query
, {
1395 onComplete: function(transport
) {
1396 tag_saved_callback(transport
);
1401 function editTagsInsert() {
1404 var form
= document
.forms
["tag_edit_form"];
1406 var found_tags
= form
.found_tags
;
1407 var tags_str
= form
.tags_str
;
1409 var tag
= found_tags
[found_tags
.selectedIndex
].value
;
1411 if (tags_str
.value
.length
> 0 &&
1412 tags_str
.value
.lastIndexOf(", ") != tags_str
.value
.length
- 2) {
1414 tags_str
.value
= tags_str
.value
+ ", ";
1417 tags_str
.value
= tags_str
.value
+ tag
+ ", ";
1419 found_tags
.selectedIndex
= 0;
1422 exception_error("editTagsInsert", e
);
1426 function cdmScrollViewport(where
) {
1427 debug("cdmScrollViewport: " + where
);
1429 var ctr
= $("headlinesInnerContainer");
1433 if (where
== "bottom") {
1434 ctr
.scrollTop
= ctr
.scrollHeight
;
1436 ctr
.scrollTop
= where
;
1440 function cdmArticleIsBelowViewport(id
) {
1442 var ctr
= $("headlinesInnerContainer");
1443 var e
= $("RROW-" + id
);
1445 if (!e
|| !ctr
) return;
1447 // article starts below viewport
1449 if (ctr
.scrollTop
< e
.offsetTop
) {
1456 exception_error("cdmArticleIsVisible", e
);
1460 function cdmArticleIsAboveViewport(id
) {
1462 var ctr
= $("headlinesInnerContainer");
1463 var e
= $("RROW-" + id
);
1465 if (!e
|| !ctr
) return;
1467 // article starts above viewport
1469 if (ctr
.scrollTop
> e
.offsetTop
+ e
.offsetHeight
) {
1476 exception_error("cdmArticleIsVisible", e
);
1480 function cdmScrollToArticleId(id
) {
1482 var ctr
= $("headlinesInnerContainer");
1483 var e
= $("RROW-" + id
);
1485 if (!e
|| !ctr
) return;
1487 ctr
.scrollTop
= e
.offsetTop
;
1490 exception_error("cdmScrollToArticleId", e
);
1494 function cdmArticleIsActuallyVisible(id
) {
1496 var ctr
= $("headlinesInnerContainer");
1497 var e
= $("RROW-" + id
);
1499 if (!e
|| !ctr
) return;
1501 // article fits in viewport OR article is longer than viewport and
1502 // its bottom is visible
1504 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1505 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1509 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1510 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1511 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1520 exception_error("cdmArticleIsVisible", e
);
1524 function cdmWatchdog() {
1528 var ctr
= $("headlinesInnerContainer");
1532 var ids
= new Array();
1534 var e
= ctr
.firstChild
;
1537 if (e
.className
&& e
.className
== "cdmArticleUnread" && e
.id
&&
1538 e
.id
.match("RROW-")) {
1540 // article fits in viewport OR article is longer than viewport and
1541 // its bottom is visible
1543 if (ctr
.scrollTop
<= e
.offsetTop
&& e
.offsetTop
+ e
.offsetHeight
<=
1544 ctr
.scrollTop
+ ctr
.offsetHeight
) {
1546 // debug(e.id + " is visible " + e.offsetTop + "." +
1547 // (e.offsetTop + e.offsetHeight) + " vs " + ctr.scrollTop + "." +
1548 // (ctr.scrollTop + ctr.offsetHeight));
1550 ids
.push(e
.id
.replace("RROW-", ""));
1552 } else if (e
.offsetHeight
> ctr
.offsetHeight
&&
1553 e
.offsetTop
+ e
.offsetHeight
>= ctr
.scrollTop
&&
1554 e
.offsetTop
+ e
.offsetHeight
<= ctr
.scrollTop
+ ctr
.offsetHeight
) {
1556 ids
.push(e
.id
.replace("RROW-", ""));
1560 // method 2: article bottom is visible and is in upper 1/2 of the viewport
1562 /* if (e.offsetTop + e.offsetHeight >= ctr.scrollTop &&
1563 e.offsetTop + e.offsetHeight <= ctr.scrollTop + ctr.offsetHeight/2) {
1565 ids.push(e.id.replace("RROW-", ""));
1574 debug("cdmWatchdog, ids= " + ids
.toString());
1576 if (ids
.length
> 0) {
1578 for (var i
= 0; i
< ids
.length
; i
++) {
1579 var e
= $("RROW-" + ids
[i
]);
1581 e
.className
= e
.className
.replace("Unread", "");
1585 var query
= "backend.php?op=rpc&subop=catchupSelected" +
1588 var ids
= "?ids=" + param_escape(ids
.toString());
1590 new Ajax
.Request(query
, {
1592 onComplete: function(transport
) {
1593 all_counters_callback2(transport
);
1598 _cdm_wd_timeout
= window
.setTimeout("cdmWatchdog()", 4000);
1601 exception_error("cdmWatchdog", e
);
1607 function cache_inject(id
, article
, param
) {
1609 if (!cache_check_param(id
, param
)) {
1610 debug("cache_article: miss: " + id
+ " [p=" + param
+ "]");
1615 var date
= new Date();
1616 var ts
= Math
.round(date
.getTime() / 1000);
1618 db
.execute("INSERT INTO cache (id, article, param, added) VALUES (?, ?, ?, ?)",
1619 [id
, article
, param
, ts
]);
1622 var cache_obj
= new Array();
1624 cache_obj
["id"] = id
;
1625 cache_obj
["data"] = article
;
1626 cache_obj
["param"] = param
;
1628 article_cache
.push(cache_obj
);
1632 debug("cache_article: hit: " + id
+ " [p=" + param
+ "]");
1635 exception_error("cache_inject", e
);
1639 function cache_find(id
) {
1642 var rs
= db
.execute("SELECT article FROM cache WHERE id = ?", [id
]);
1645 if (rs
.isValidRow()) {
1646 var a
= rs
.field(0);
1654 for (var i
= 0; i
< article_cache
.length
; i
++) {
1655 if (article_cache
[i
]["id"] == id
) {
1656 return article_cache
[i
]["data"];
1663 function cache_find_param(id
, param
) {
1666 var rs
= db
.execute("SELECT article FROM cache WHERE id = ? AND param = ?",
1670 if (rs
.isValidRow()) {
1679 for (var i
= 0; i
< article_cache
.length
; i
++) {
1680 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1681 return article_cache
[i
]["data"];
1688 function cache_check(id
) {
1691 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ?",
1695 if (rs
.isValidRow()) {
1696 a
= rs
.field(0) != "0";
1704 for (var i
= 0; i
< article_cache
.length
; i
++) {
1705 if (article_cache
[i
]["id"] == id
) {
1713 function cache_check_param(id
, param
) {
1716 var rs
= db
.execute("SELECT COUNT(*) AS c FROM cache WHERE id = ? AND param = ?",
1720 if (rs
.isValidRow()) {
1721 a
= rs
.field(0) != "0";
1729 for (var i
= 0; i
< article_cache
.length
; i
++) {
1730 if (article_cache
[i
]["id"] == id
&& article_cache
[i
]["param"] == param
) {
1738 function cache_expire() {
1740 var date
= new Date();
1741 var ts
= Math
.round(date
.getTime() / 1000);
1743 db
.execute("DELETE FROM cache WHERE added < ? - 1800 AND id LIKE 'FEEDLIST'", [ts
]);
1744 db
.execute("DELETE FROM cache WHERE added < ? - 600 AND (id LIKE 'F:%' OR id LIKE 'C:%')", [ts
]);
1745 db
.execute("DELETE FROM cache WHERE added < ? - 86400", [ts
]);
1749 while (article_cache
.length
> 25) {
1750 article_cache
.shift();
1755 function cache_empty() {
1756 article_cache
= new Array();
1759 function cache_invalidate(id
) {
1763 rs
= db
.execute("DELETE FROM cache WHERE id = ?", [id
]);
1764 return rs
.rowsAffected
!= 0;
1769 while (i
< article_cache
.length
) {
1770 if (article_cache
[i
]["id"] == id
) {
1771 debug("cache_invalidate: removed id " + id
);
1772 article_cache
.splice(i
, 1);
1779 debug("cache_invalidate: id not found: " + id
);
1782 exception_error("cache_invalidate", e
);
1786 function getActiveArticleId() {
1787 return active_post_id
;
1790 function cdmClicked(id
) {
1792 var elem
= $("RROW-" + id
);
1795 var id
= elem
.id
.replace("RROW-", "");
1796 active_post_id
= id
;
1798 // cdmSelectArticles("none");
1799 toggleUnread(id
, 0, true);
1800 // toggleSelected(id);
1804 exception_error("cdmClicked", e
);
1808 function preload_article_callback(transport
) {
1810 if (transport
.responseXML
) {
1811 var articles
= transport
.responseXML
.getElementsByTagName("article");
1813 for (var i
= 0; i
< articles
.length
; i
++) {
1814 var id
= articles
[i
].getAttribute("id");
1815 if (!cache_check(id
)) {
1816 cache_inject(id
, articles
[i
].firstChild
.nodeValue
);
1817 debug("preloaded article: " + id
);
1822 exception_error("preload_article_callback", e
);
1826 function preloadArticleUnderPointer(id
) {
1828 if (getInitParam("bw_limit") == "1") return;
1830 if (post_under_pointer
== id
&& !cache_check(id
)) {
1832 debug("trying to preload article " + id
);
1834 var neighbor_ids
= getRelativePostIds(id
, 1);
1836 /* only request uncached articles */
1838 var cids_to_request
= Array();
1840 for (var i
= 0; i
< neighbor_ids
.length
; i
++) {
1841 if (!cache_check(neighbor_ids
[i
])) {
1842 cids_to_request
.push(neighbor_ids
[i
]);
1845 debug("additional ids: " + cids_to_request
.toString());
1847 cids_to_request
.push(id
);
1849 var query
= "backend.php?op=rpc&subop=getArticles&ids=" +
1850 cids_to_request
.toString();
1851 new Ajax
.Request(query
, {
1852 onComplete: function(transport
) {
1853 preload_article_callback(transport
);
1857 exception_error("preloadArticleUnderPointer", e
);
1861 function postMouseIn(id
) {
1863 if (post_under_pointer
!= id
) {
1864 post_under_pointer
= id
;
1866 window
.setTimeout("preloadArticleUnderPointer(" + id
+ ")", 250);
1871 exception_error("postMouseIn", e
);
1875 function postMouseOut(id
) {
1877 post_under_pointer
= false;
1879 exception_error("postMouseOut", e
);
1883 function headlines_scroll_handler() {
1886 var e
= $("headlinesInnerContainer");
1888 // don't do infinite scrolling when Limit == All
1890 var toolbar_form
= document
.forms
["main_toolbar_form"];
1892 var limit
= toolbar_form
.limit
[toolbar_form
.limit
.selectedIndex
];
1893 if (limit
.value
!= 0) {
1895 debug((e
.scrollTop
+ e
.offsetHeight
) + " vs " + e
.scrollHeight
+ " dis? " +
1896 _infscroll_disable
);
1898 if (e
.scrollTop
+ e
.offsetHeight
> e
.scrollHeight
- 100) {
1899 if (!_infscroll_disable
) {
1900 debug("more cowbell!");
1907 exception_error("headlines_scroll_handler", e
);
1911 function catchupRelativeToArticle(below
) {
1916 if (!getActiveArticleId()) {
1917 alert(__("No article is selected."));
1923 if ($("headlinesList")) {
1924 visible_ids
= getVisibleHeadlineIds();
1926 visible_ids
= cdmGetVisibleArticles();
1929 var ids_to_mark
= new Array();
1932 for (var i
= 0; i
< visible_ids
.length
; i
++) {
1933 if (visible_ids
[i
] != getActiveArticleId()) {
1934 var e
= $("RROW-" + visible_ids
[i
]);
1936 if (e
&& e
.className
.match("Unread")) {
1937 ids_to_mark
.push(visible_ids
[i
]);
1944 for (var i
= visible_ids
.length
-1; i
>= 0; i
--) {
1945 if (visible_ids
[i
] != getActiveArticleId()) {
1946 var e
= $("RROW-" + visible_ids
[i
]);
1948 if (e
&& e
.className
.match("Unread")) {
1949 ids_to_mark
.push(visible_ids
[i
]);
1957 if (ids_to_mark
.length
== 0) {
1958 alert(__("No articles found to mark"));
1960 var msg
= __("Mark %d article(s) as read?").replace("%d", ids_to_mark
.length
);
1964 for (var i
= 0; i
< ids_to_mark
.length
; i
++) {
1965 var e
= $("RROW-" + ids_to_mark
[i
]);
1966 e
.className
= e
.className
.replace("Unread", "");
1969 var query
= "backend.php?op=rpc&subop=catchupSelected" +
1972 var ids
= "?ids=" + param_escape(ids_to_mark
.toString());
1974 new Ajax
.Request(query
, {
1976 onComplete: function(transport
) {
1977 catchup_callback2(transport
);
1984 exception_error("catchupRelativeToArticle", e
);
1988 function cdmExpandArticle(a_id
) {
1990 var id
= 'CICD-' + a_id
;
1993 Element
.hide("CEXC-" + a_id
);
1996 Effect
.Appear(id
, {duration
: 0.5,
1997 beforeStart: function(effect
) {
1998 var h_id
= 'CICH-' + a_id
;
1999 var h_elem
= $(h_id
);
2000 if (h_elem
) { h_elem
.style
.display
= "none"; }
2002 toggleUnread(a_id
, 0);
2007 exception_error("appearBlockElementF", e
);
2012 function fixHeadlinesOrder(ids
) {
2014 for (var i
= 0; i
< ids
.length
; i
++) {
2015 var e
= $("RROW-" + ids
[i
]);
2019 e
.className
= e
.className
.replace("even", "odd");
2021 e
.className
= e
.className
.replace("odd", "even");
2026 exception_error("fixHeadlinesOrder", e
);
2030 function hideReadHeadlines() {
2034 var vis_ids
= new Array();
2036 if ($("headlinesList")) {
2037 ids
= getVisibleHeadlineIds();
2039 ids
= cdmGetVisibleArticles();
2042 var read_headlines_visible
= true;
2044 for (var i
= 0; i
< ids
.length
; i
++) {
2045 var row
= $("RROW-" + ids
[i
]);
2047 if (row
&& row
.className
) {
2048 if (read_headlines_visible
) {
2049 if (row
.className
.match("Unread") || row
.className
.match("Selected")) {
2051 vis_ids
.push(ids
[i
]);
2053 //Effect.Fade(row, {duration : 0.3});
2058 vis_ids
.push(ids
[i
]);
2063 fixHeadlinesOrder(vis_ids
);
2065 read_headlines_visible
= !read_headlines_visible
;
2068 exception_error("hideReadHeadlines", e
);
2072 function invertHeadlineSelection() {
2074 var rows
= new Array();
2078 r
= document
.getElementsByTagName("TR");
2080 r
= document
.getElementsByTagName("DIV");
2083 for (var i
= 0; i
< r
.length
; i
++) {
2084 if (r
[i
].id
&& r
[i
].id
.match("RROW-")) {
2089 for (var i
= 0; i
< rows
.length
; i
++) {
2090 var nc
= rows
[i
].className
;
2091 var id
= rows
[i
].id
.replace("RROW-", "");
2092 var cb
= $("RCHK-" + id
);
2094 if (!rows
[i
].className
.match("Selected")) {
2095 nc
= nc
+ "Selected";
2098 nc
= nc
.replace("Selected", "");
2102 rows
[i
].className
= nc
;
2107 exception_error("invertHeadlineSelection", e
);
2111 function getArticleUnderPointer() {
2112 return post_under_pointer
;
2115 function zoomToArticle(id
) {
2117 var w
= window
.open("backend.php?op=view&mode=zoom&id=" + param_escape(id
),
2119 "status=0,toolbar=0,location=0,width=450,height=300,scrollbars=1,menubar=0");
2122 exception_error("zoomToArticle", e
);
2126 function showOriginalArticleInline(id
) {
2129 var query
= "backend.php?op=rpc&subop=getArticleLink&id=" + id
;
2131 notify_progress("Loading, please wait...", true);
2133 new Ajax
.Request(query
, {
2134 onComplete: function(transport
) {
2136 if (transport
.responseXML
) {
2138 var link
= transport
.responseXML
.getElementsByTagName("link")[0];
2139 var id
= transport
.responseXML
.getElementsByTagName("id")[0];
2144 link
= link
.firstChild
.nodeValue
;
2146 var ci
= $("content-insert");
2148 var tmp
= "<iframe id=\"inline_orig_article\" width=\""+ci
.offsetWidth
+"\" height=\""+ci
.offsetHeight
+"\" style=\"border-width : 0px;\" src=\""+link
+"\"></iframe>";
2150 render_article(tmp
);
2157 exception_error("showOriginalArticleInline", e
);
2162 function scrollArticle(offset
) {
2165 var ci
= $("content-insert");
2167 ci
.scrollTop
+= offset
;
2170 var hi
= $("headlinesInnerContainer");
2172 hi
.scrollTop
+= offset
;
2177 exception_error("scrollArticle", e
);
2181 function show_labels_in_headlines(transport
) {
2183 if (transport
.responseXML
) {
2184 var info
= transport
.responseXML
.getElementsByTagName("info-for-headlines")[0];
2186 var elems
= info
.getElementsByTagName("entry");
2188 for (var l
= 0; l
< elems
.length
; l
++) {
2189 var e_id
= elems
[l
].getAttribute("id");
2193 var ctr
= $("HLLCTR-" + e_id
);
2196 ctr
.innerHTML
= elems
[l
].firstChild
.nodeValue
;
2204 exception_error("show_labels_in_headlines", e
);
2209 function toggleHeadlineActions() {
2211 var e
= $("headlineActionsBody");
2212 var p
= $("headlineActionsDrop");
2214 if (!Element
.visible(e
)) {
2221 e
.style
.left
= (p
.offsetLeft
+ 1) + "px";
2222 e
.style
.top
= (p
.offsetTop
+ p
.offsetHeight
+ 2) + "px";
2225 exception_error("toggleHeadlineActions", e
);
2229 function publishWithNote(id
, def_note
) {
2231 if (!def_note
) def_note
= '';
2233 var note
= prompt(__("Please enter a note for this article:"), def_note
);
2235 if (note
!= undefined) {
2236 togglePub(id
, false, false, note
);
2240 exception_error("publishWithNote", e
);