3 let _active_article_id
= 0;
5 let vgroup_last_feed
= false;
6 let post_under_pointer
= false;
8 let last_requested_article
= 0;
10 let catchup_id_batch
= [];
11 let catchup_timeout_id
= false;
13 let cids_requested
= [];
14 let loaded_article_ids
= [];
15 let _last_headlines_update
= 0;
16 let _headlines_scroll_offset
= 0;
17 let current_first_id
= 0;
18 let last_search_query
;
20 let _catchup_request_sent
= false;
22 let has_storage
= 'sessionStorage' in window
&& window
['sessionStorage'] !== null;
24 function headlines_callback2(transport
, offset
, background
, infscroll_req
) {
25 const reply
= handle_rpc_json(transport
);
27 console
.log("headlines_callback2 [offset=" + offset
+ "] B:" + background
+ " I:" + infscroll_req
);
37 is_cat
= reply
['headlines']['is_cat'];
38 feed_id
= reply
['headlines']['id'];
39 last_search_query
= reply
['headlines']['search_query'];
41 if (feed_id
!= -7 && (feed_id
!= getActiveFeedId() || is_cat
!= activeFeedIsCat()))
45 if (infscroll_req
== false) {
46 $("headlines-frame").scrollTop
= 0;
48 $("floatingTitle").style
.visibility
= "hidden";
49 $("floatingTitle").setAttribute("data-article-id", 0);
50 $("floatingTitle").innerHTML
= "";
54 $("headlines-frame").removeClassName("cdm");
55 $("headlines-frame").removeClassName("normal");
57 $("headlines-frame").addClassName(isCdmMode() ? "cdm" : "normal");
59 const headlines_count
= reply
['headlines-info']['count'];
61 vgroup_last_feed
= reply
['headlines-info']['vgroup_last_feed'];
63 if (parseInt(headlines_count
) < 30) {
64 _infscroll_disable
= 1;
66 _infscroll_disable
= 0;
69 current_first_id
= reply
['headlines']['first_id'];
70 const counters
= reply
['counters'];
71 const articles
= reply
['articles'];
73 if (infscroll_req
== false) {
74 loaded_article_ids
= [];
76 dojo
.html
.set($("headlines-toolbar"),
77 reply
['headlines']['toolbar'],
78 {parseContent
: true});
80 $("headlines-frame").innerHTML
= '';
82 let tmp
= document
.createElement("div");
83 tmp
.innerHTML
= reply
['headlines']['content'];
84 dojo
.parser
.parse(tmp
);
86 while (tmp
.hasChildNodes()) {
87 var row
= tmp
.removeChild(tmp
.firstChild
);
89 if (loaded_article_ids
.indexOf(row
.id
) == -1 || row
.hasClassName("cdmFeedTitle")) {
90 dijit
.byId("headlines-frame").domNode
.appendChild(row
);
92 loaded_article_ids
.push(row
.id
);
96 let hsp
= $("headlines-spacer");
97 if (!hsp
) hsp
= new Element("DIV", {"id": "headlines-spacer"});
98 dijit
.byId('headlines-frame').domNode
.appendChild(hsp
);
102 if (_infscroll_disable
)
103 hsp
.innerHTML
= "<a href='#' onclick='openNextUnreadFeed()'>" +
104 __("Click to open next unread feed.") + "</a>";
107 $("feed_title").innerHTML
+= "<span id='cancel_search'>" +
108 " (<a href='#' onclick='cancelSearch()'>" + __("Cancel search") + "</a>)" +
112 } else if (headlines_count
> 0 && feed_id
== getActiveFeedId() && is_cat
== activeFeedIsCat()) {
113 console
.log("adding some more headlines: " + headlines_count
);
115 const c
= dijit
.byId("headlines-frame");
116 const ids
= getSelectedArticleIds2();
118 let hsp
= $("headlines-spacer");
121 c
.domNode
.removeChild(hsp
);
123 let tmp
= document
.createElement("div");
124 tmp
.innerHTML
= reply
['headlines']['content'];
125 dojo
.parser
.parse(tmp
);
127 while (tmp
.hasChildNodes()) {
128 let row
= tmp
.removeChild(tmp
.firstChild
);
130 if (loaded_article_ids
.indexOf(row
.id
) == -1 || row
.hasClassName("cdmFeedTitle")) {
131 dijit
.byId("headlines-frame").domNode
.appendChild(row
);
133 loaded_article_ids
.push(row
.id
);
137 if (!hsp
) hsp
= new Element("DIV", {"id": "headlines-spacer"});
138 c
.domNode
.appendChild(hsp
);
140 if (headlines_count
< 30) _infscroll_disable
= true;
142 console
.log("restore selected ids: " + ids
);
144 for (let i
= 0; i
< ids
.length
; i
++) {
145 markHeadline(ids
[i
]);
150 if (_infscroll_disable
) {
151 hsp
.innerHTML
= "<a href='#' onclick='openNextUnreadFeed()'>" +
152 __("Click to open next unread feed.") + "</a>";
156 console
.log("no new headlines received");
158 const first_id_changed
= reply
['headlines']['first_id_changed'];
159 console
.log("first id changed:" + first_id_changed
);
161 let hsp
= $("headlines-spacer");
164 if (first_id_changed
) {
165 hsp
.innerHTML
= "<a href='#' onclick='viewCurrentFeed()'>" +
166 __("New articles found, reload feed to continue.") + "</a>";
168 hsp
.innerHTML
= "<a href='#' onclick='openNextUnreadFeed()'>" +
169 __("Click to open next unread feed.") + "</a>";
177 for (let i
= 0; i
< articles
.length
; i
++) {
178 const a_id
= articles
[i
]['id'];
179 cache_set("article:" + a_id
, articles
[i
]['content']);
182 console
.log("no cached articles received");
186 parse_counters(counters
);
191 console
.error("Invalid object received: " + transport
.responseText
);
192 dijit
.byId("headlines-frame").attr('content', "<div class='whiteBox'>" +
193 __('Could not update headlines (invalid object received - see error console for details)') +
197 _infscroll_request_sent
= 0;
198 _last_headlines_update
= new Date().getTime();
200 unpackVisibleHeadlines();
202 // if we have some more space in the buffer, why not try to fill it
204 if (!_infscroll_disable
&& $("headlines-spacer") &&
205 $("headlines-spacer").offsetTop
< $("headlines-frame").offsetHeight
) {
207 window
.setTimeout(function() {
215 function render_article(article
) {
216 cleanup_memory("content-insert");
218 dijit
.byId("headlines-wrap-inner").addChild(
219 dijit
.byId("content-insert"));
221 const c
= dijit
.byId("content-insert");
224 c
.domNode
.scrollTop
= 0;
227 c
.attr('content', article
);
228 PluginHost
.run(PluginHost
.HOOK_ARTICLE_RENDERED
, c
.domNode
);
230 correctHeadlinesOffset(getActiveArticleId());
237 function showArticleInHeadlines(id
, noexpand
) {
238 const row
= $("RROW-" + id
);
242 row
.removeClassName("Unread");
244 row
.addClassName("active");
246 selectArticles('none');
251 function article_callback2(transport
, id
) {
252 console
.log("article_callback2 " + id
);
254 const reply
= handle_rpc_json(transport
);
258 reply
.each(function(article
) {
259 if (getActiveArticleId() == article
['id']) {
260 render_article(article
['content']);
262 cids_requested
.remove(article
['id']);
264 cache_set("article:" + article
['id'], article
['content']);
268 console
.error("Invalid object received: " + transport
.responseText
);
270 render_article("<div class='whiteBox'>" +
271 __('Could not display article (invalid object received - see error console for details)') + "</div>");
274 const unread_in_buffer
= $$("#headlines-frame > div[id*=RROW][class*=Unread]").length
;
275 request_counters(unread_in_buffer
== 0);
280 function view(id
, activefeed
, noexpand
) {
281 const oldrow
= $("RROW-" + getActiveArticleId());
282 if (oldrow
) oldrow
.removeClassName("active");
284 const crow
= $("RROW-" + id
);
288 setActiveArticleId(id
);
289 showArticleInHeadlines(id
, noexpand
);
293 console
.log("loading article: " + id
);
295 const cached_article
= cache_get("article:" + id
);
297 console
.log("cache check result: " + (cached_article
!= false));
299 const query
= {op
: "article", method
: "view", id
: id
};
301 const neighbor_ids
= getRelativePostIds(id
);
303 /* only request uncached articles */
305 const cids_to_request
= [];
307 for (let i
= 0; i
< neighbor_ids
.length
; i
++) {
308 if (cids_requested
.indexOf(neighbor_ids
[i
]) == -1)
309 if (!cache_get("article:" + neighbor_ids
[i
])) {
310 cids_to_request
.push(neighbor_ids
[i
]);
311 cids_requested
.push(neighbor_ids
[i
]);
315 console
.log("additional ids: " + cids_to_request
.toString());
317 query
.cids
= cids_to_request
.toString();
319 const article_is_unread
= crow
.hasClassName("Unread");
321 setActiveArticleId(id
);
322 showArticleInHeadlines(id
);
324 if (cached_article
&& article_is_unread
) {
325 query
.mode
= "prefetch";
326 render_article(cached_article
);
327 } else if (cached_article
) {
328 query
.mode
= "prefetch_old";
329 render_article(cached_article
);
331 // if we don't need to request any relative ids, we might as well skip
332 // the server roundtrip altogether
333 if (cids_to_request
.length
== 0) {
338 last_requested_article
= id
;
342 if (article_is_unread
) {
343 decrementFeedCounter(getActiveFeedId(), activeFeedIsCat());
346 xhrPost("backend.php", query
, (transport
) => {
347 article_callback2(transport
, id
);
354 function toggleMark(id
, client_only
) {
355 const query
= { op
: "rpc", id
: id
, method
: "mark" };
357 const row
= $("RROW-" + id
);
362 const row_imgs
= row
.getElementsByClassName("markedPic");
364 for (let i
= 0; i
< row_imgs
.length
; i
++)
365 imgs
.push(row_imgs
[i
]);
367 const ft
= $("floatingTitle");
369 if (ft
&& ft
.getAttribute("data-article-id") == id
) {
370 const fte
= ft
.getElementsByClassName("markedPic");
372 for (var i
= 0; i
< fte
.length
; i
++)
376 for (i
= 0; i
< imgs
.length
; i
++) {
379 if (!row
.hasClassName("marked")) {
380 img
.src
= img
.src
.replace("mark_unset", "mark_set");
383 img
.src
= img
.src
.replace("mark_set", "mark_unset");
388 row
.toggleClassName("marked");
391 xhrPost("backend.php", query
, (transport
) => {
392 handle_rpc_json(transport
);
396 function togglePub(id
, client_only
, no_effects
, note
) {
397 const query
= { op
: "rpc", id
: id
, method
: "publ" };
399 if (note
!= undefined) {
402 query
.note
= "undefined";
405 const row
= $("RROW-" + id
);
410 const row_imgs
= row
.getElementsByClassName("pubPic");
412 for (let i
= 0; i
< row_imgs
.length
; i
++)
413 imgs
.push(row_imgs
[i
]);
415 const ft
= $("floatingTitle");
417 if (ft
&& ft
.getAttribute("data-article-id") == id
) {
418 const fte
= ft
.getElementsByClassName("pubPic");
420 for (let i
= 0; i
< fte
.length
; i
++)
424 for (let i
= 0; i
< imgs
.length
; i
++) {
427 if (!row
.hasClassName("published") || note
!= undefined) {
428 img
.src
= img
.src
.replace("pub_unset", "pub_set");
431 img
.src
= img
.src
.replace("pub_set", "pub_unset");
436 if (note
!= undefined)
437 row
.addClassName("published");
439 row
.toggleClassName("published");
442 xhrPost("backend.php", query
, (transport
) => {
443 handle_rpc_json(transport
);
447 function moveToPost(mode
, noscroll
, noexpand
) {
448 const rows
= getLoadedArticleIds();
453 if (!$('RROW-' + getActiveArticleId())) {
454 setActiveArticleId(0);
457 if (!getActiveArticleId()) {
459 prev_id
= rows
[rows
.length
-1]
461 for (let i
= 0; i
< rows
.length
; i
++) {
462 if (rows
[i
] == getActiveArticleId()) {
464 // Account for adjacent identical article ids.
465 if (i
> 0) prev_id
= rows
[i
-1];
467 for (let j
= i
+1; j
< rows
.length
; j
++) {
468 if (rows
[j
] != getActiveArticleId()) {
478 console
.log("cur: " + getActiveArticleId() + " next: " + next_id
);
480 if (mode
== "next") {
481 if (next_id
|| getActiveArticleId()) {
484 var article
= $("RROW-" + getActiveArticleId());
485 var ctr
= $("headlines-frame");
487 if (!noscroll
&& article
&& article
.offsetTop
+ article
.offsetHeight
>
488 ctr
.scrollTop
+ ctr
.offsetHeight
) {
490 scrollArticle(ctr
.offsetHeight
/4);
492 } else if (next_id
) {
493 cdmExpandArticle(next_id
, noexpand
);
494 cdmScrollToArticleId(next_id
, true);
497 } else if (next_id
) {
498 correctHeadlinesOffset(next_id
);
499 view(next_id
, getActiveFeedId(), noexpand
);
504 if (mode
== "prev") {
505 if (prev_id
|| getActiveArticleId()) {
508 var article
= $("RROW-" + getActiveArticleId());
509 const prev_article
= $("RROW-" + prev_id
);
510 var ctr
= $("headlines-frame");
512 if (!getInitParam("cdm_expanded")) {
514 if (!noscroll
&& article
&& article
.offsetTop
< ctr
.scrollTop
) {
515 scrollArticle(-ctr
.offsetHeight
/4);
517 cdmExpandArticle(prev_id
, noexpand
);
518 cdmScrollToArticleId(prev_id
, true);
520 } else if (!noscroll
&& article
&& article
.offsetTop
< ctr
.scrollTop
) {
521 scrollArticle(-ctr
.offsetHeight
/3);
522 } else if (!noscroll
&& prev_article
&&
523 prev_article
.offsetTop
< ctr
.scrollTop
) {
524 cdmExpandArticle(prev_id
, noexpand
);
525 scrollArticle(-ctr
.offsetHeight
/4);
526 } else if (prev_id
) {
527 cdmExpandArticle(prev_id
, noexpand
);
528 cdmScrollToArticleId(prev_id
, noscroll
);
531 } else if (prev_id
) {
532 correctHeadlinesOffset(prev_id
);
533 view(prev_id
, getActiveFeedId(), noexpand
);
540 function toggleSelected(id
, force_on
) {
541 const row
= $("RROW-" + id
);
544 const cb
= dijit
.getEnclosingWidget(
545 row
.getElementsByClassName("rchk")[0]);
547 if (row
.hasClassName('Selected') && !force_on
) {
548 row
.removeClassName('Selected');
549 if (cb
) cb
.attr("checked", false);
551 row
.addClassName('Selected');
552 if (cb
) cb
.attr("checked", true);
556 updateSelectedPrompt();
559 function updateSelectedPrompt() {
560 const count
= getSelectedArticleIds2().length
;
561 const elem
= $("selected_prompt");
564 elem
.innerHTML
= ngettext("%d article selected",
565 "%d articles selected", count
).replace("%d", count
);
575 function toggleUnread(id
, cmode
) {
576 const row
= $("RROW-" + id
);
578 const tmpClassName
= row
.className
;
580 if (cmode
== undefined || cmode
== 2) {
581 if (row
.hasClassName("Unread")) {
582 row
.removeClassName("Unread");
585 row
.addClassName("Unread");
588 } else if (cmode
== 0) {
590 row
.removeClassName("Unread");
592 } else if (cmode
== 1) {
593 row
.addClassName("Unread");
596 if (tmpClassName
!= row
.className
) {
597 if (cmode
== undefined) cmode
= 2;
599 const query
= {op
: "rpc", method
: "catchupSelected",
600 cmode
: cmode
, ids
: id
};
602 xhrPost("backend.php", query
, (transport
) => {
603 handle_rpc_json(transport
);
610 function selectionRemoveLabel(id
, ids
) {
611 if (!ids
) ids
= getSelectedArticleIds2();
613 if (ids
.length
== 0) {
614 alert(__("No articles are selected."));
618 const query
= { op
: "article", method
: "removeFromLabel",
619 ids
: ids
.toString(), lid
: id
};
621 xhrPost("backend.php", query
, (transport
) => {
622 handle_rpc_json(transport
);
623 show_labels_in_headlines(transport
);
627 function selectionAssignLabel(id
, ids
) {
628 if (!ids
) ids
= getSelectedArticleIds2();
630 if (ids
.length
== 0) {
631 alert(__("No articles are selected."));
635 const query
= { op
: "article", method
: "assignToLabel",
636 ids
: ids
.toString(), lid
: id
};
638 xhrPost("backend.php", query
, (transport
) => {
639 handle_rpc_json(transport
);
640 show_labels_in_headlines(transport
);
644 function selectionToggleUnread(set_state
, callback
, no_error
, ids
) {
645 const rows
= ids
? ids
: getSelectedArticleIds2();
647 if (rows
.length
== 0 && !no_error
) {
648 alert(__("No articles are selected."));
652 for (let i
= 0; i
< rows
.length
; i
++) {
653 const row
= $("RROW-" + rows
[i
]);
655 if (set_state
== undefined) {
656 if (row
.hasClassName("Unread")) {
657 row
.removeClassName("Unread");
659 row
.addClassName("Unread");
663 if (set_state
== false) {
664 row
.removeClassName("Unread");
667 if (set_state
== true) {
668 row
.addClassName("Unread");
673 updateFloatingTitle(true);
675 if (rows
.length
> 0) {
679 if (set_state
== undefined) {
681 } else if (set_state
== true) {
683 } else if (set_state
== false) {
687 const query
= {op
: "rpc", method
: "catchupSelected",
688 cmode
: cmode
, ids
: rows
.toString() };
690 notify_progress("Loading, please wait...");
692 xhrPost("backend.php", query
, (transport
) => {
693 handle_rpc_json(transport
);
694 if (callback
) callback(transport
);
701 function selectionToggleMarked(sel_state
, callback
, no_error
, ids
) {
702 const rows
= ids
? ids
: getSelectedArticleIds2();
704 if (rows
.length
== 0 && !no_error
) {
705 alert(__("No articles are selected."));
709 for (let i
= 0; i
< rows
.length
; i
++) {
710 toggleMark(rows
[i
], true, true);
713 if (rows
.length
> 0) {
714 const query
= { op
: "rpc", method
: "markSelected",
715 ids
: rows
.toString(), cmode
: 2 };
717 xhrPost("backend.php", query
, (transport
) => {
718 handle_rpc_json(transport
);
719 if (callback
) callback(transport
);
725 function selectionTogglePublished(sel_state
, callback
, no_error
, ids
) {
726 const rows
= ids
? ids
: getSelectedArticleIds2();
728 if (rows
.length
== 0 && !no_error
) {
729 alert(__("No articles are selected."));
733 for (let i
= 0; i
< rows
.length
; i
++) {
734 togglePub(rows
[i
], true, true);
737 if (rows
.length
> 0) {
738 const query
= { op
: "rpc", method
: "publishSelected",
739 ids
: rows
.toString(), cmode
: 2 };
741 xhrPost("backend.php", query
, (transport
) => {
742 handle_rpc_json(transport
);
743 if (callback
) callback(transport
);
748 function getSelectedArticleIds2() {
752 $$("#headlines-frame > div[id*=RROW][class*=Selected]").each(
754 rv
.push(child
.getAttribute("data-article-id"));
760 function getLoadedArticleIds() {
763 const children
= $$("#headlines-frame > div[id*=RROW-]");
765 children
.each(function(child
) {
766 if (Element
.visible(child
)) {
767 rv
.push(child
.getAttribute("data-article-id"));
775 // mode = all,none,unread,invert,marked,published
776 function selectArticles(mode
, query
) {
777 if (!query
) query
= "#headlines-frame > div[id*=RROW]";
779 const children
= $$(query
);
781 children
.each(function(child
) {
782 //const id = child.getAttribute("data-article-id");
784 const cb
= dijit
.getEnclosingWidget(
785 child
.getElementsByClassName("rchk")[0]);
788 child
.addClassName("Selected");
789 if (cb
) cb
.attr("checked", true);
790 } else if (mode
== "unread") {
791 if (child
.hasClassName("Unread")) {
792 child
.addClassName("Selected");
793 if (cb
) cb
.attr("checked", true);
795 child
.removeClassName("Selected");
796 if (cb
) cb
.attr("checked", false);
798 } else if (mode
== "marked") {
799 if (child
.hasClassName("marked")) {
800 child
.addClassName("Selected");
801 if (cb
) cb
.attr("checked", true);
803 child
.removeClassName("Selected");
804 if (cb
) cb
.attr("checked", false);
806 } else if (mode
== "published") {
807 if (child
.hasClassName("published")) {
808 child
.addClassName("Selected");
809 if (cb
) cb
.attr("checked", true);
811 child
.removeClassName("Selected");
812 if (cb
) cb
.attr("checked", false);
815 } else if (mode
== "invert") {
816 if (child
.hasClassName("Selected")) {
817 child
.removeClassName("Selected");
818 if (cb
) cb
.attr("checked", false);
820 child
.addClassName("Selected");
821 if (cb
) cb
.attr("checked", true);
825 child
.removeClassName("Selected");
826 if (cb
) cb
.attr("checked", false);
830 updateSelectedPrompt();
833 function deleteSelection() {
835 const rows
= getSelectedArticleIds2();
837 if (rows
.length
== 0) {
838 alert(__("No articles are selected."));
842 const fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
845 if (getActiveFeedId() != 0) {
846 str
= ngettext("Delete %d selected article in %s?", "Delete %d selected articles in %s?", rows
.length
);
848 str
= ngettext("Delete %d selected article?", "Delete %d selected articles?", rows
.length
);
851 str
= str
.replace("%d", rows
.length
);
852 str
= str
.replace("%s", fn
);
854 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
858 const query
= { op
: "rpc", method
: "delete", ids
: rows
.toString() };
860 xhrPost("backend.php", query
, (transport
) => {
861 handle_rpc_json(transport
);
866 function archiveSelection() {
868 const rows
= getSelectedArticleIds2();
870 if (rows
.length
== 0) {
871 alert(__("No articles are selected."));
875 const fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
879 if (getActiveFeedId() != 0) {
880 str
= ngettext("Archive %d selected article in %s?", "Archive %d selected articles in %s?", rows
.length
);
883 str
= ngettext("Move %d archived article back?", "Move %d archived articles back?", rows
.length
);
885 str
+= " " + __("Please note that unstarred articles might get purged on next feed update.");
890 str
= str
.replace("%d", rows
.length
);
891 str
= str
.replace("%s", fn
);
893 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
897 for (let i
= 0; i
< rows
.length
; i
++) {
898 cache_delete("article:" + rows
[i
]);
901 const query
= {op
: "rpc", method
: op
, ids
: rows
.toString()};
903 xhrPost("backend.php", query
, (transport
) => {
904 handle_rpc_json(transport
);
909 function catchupSelection() {
911 const rows
= getSelectedArticleIds2();
913 if (rows
.length
== 0) {
914 alert(__("No articles are selected."));
918 const fn
= getFeedName(getActiveFeedId(), activeFeedIsCat());
920 let str
= ngettext("Mark %d selected article in %s as read?", "Mark %d selected articles in %s as read?", rows
.length
);
922 str
= str
.replace("%d", rows
.length
);
923 str
= str
.replace("%s", fn
);
925 if (getInitParam("confirm_feed_catchup") == 1 && !confirm(str
)) {
929 selectionToggleUnread(false, 'viewCurrentFeed()', true);
932 function editArticleTags(id
) {
933 const query
= "backend.php?op=article&method=editArticleTags¶m=" + param_escape(id
);
935 if (dijit
.byId("editTagsDlg"))
936 dijit
.byId("editTagsDlg").destroyRecursive();
938 const dialog
= new dijit
.Dialog({
940 title
: __("Edit article Tags"),
941 style
: "width: 600px",
942 execute: function() {
943 if (this.validate()) {
944 const query
= dojo
.objectToQuery(this.attr('value'));
946 notify_progress("Saving article tags...", true);
948 xhrPost("backend.php", this.attr('value'), (transport
) => {
953 const data
= JSON
.parse(transport
.responseText
);
958 const tags
= $("ATSTR-" + id
);
959 const tooltip
= dijit
.byId("ATSTRTIP-" + id
);
961 if (tags
) tags
.innerHTML
= data
.content
;
962 if (tooltip
) tooltip
.attr('label', data
.content_full
);
973 var tmph
= dojo
.connect(dialog
, 'onLoad', function() {
974 dojo
.disconnect(tmph
);
976 new Ajax
.Autocompleter('tags_str', 'tags_choices',
977 "backend.php?op=article&method=completeTags",
978 { tokens
: ',', paramName
: "search" });
985 function cdmScrollToArticleId(id
, force
) {
986 const ctr
= $("headlines-frame");
987 const e
= $("RROW-" + id
);
989 if (!e
|| !ctr
) return;
991 if (force
|| e
.offsetTop
+e
.offsetHeight
> (ctr
.scrollTop
+ctr
.offsetHeight
) ||
992 e
.offsetTop
< ctr
.scrollTop
) {
994 // expanded cdm has a 4px margin now
995 ctr
.scrollTop
= parseInt(e
.offsetTop
) - 4;
999 function setActiveArticleId(id
) {
1000 console
.log("setActiveArticleId:" + id
);
1002 _active_article_id
= id
;
1003 PluginHost
.run(PluginHost
.HOOK_ARTICLE_SET_ACTIVE
, _active_article_id
);
1006 function getActiveArticleId() {
1007 return _active_article_id
;
1010 function postMouseIn(e
, id
) {
1011 post_under_pointer
= id
;
1014 function postMouseOut(id
) {
1015 post_under_pointer
= false;
1018 function unpackVisibleHeadlines() {
1019 if (!isCdmMode() || !getInitParam("cdm_expanded")) return;
1021 $$("#headlines-frame div[id*=RROW][data-content]").each((row
) => {
1022 //console.log('checking', row.id);
1024 if (row
.offsetTop
<= $("headlines-frame").scrollTop
+ $("headlines-frame").offsetHeight
) {
1025 console
.log("unpacking: " + row
.id
);
1030 content
= JSON
.parse(row
.getAttribute("data-content"));
1032 content
= "Error decoding content: " + row
.getAttribute("data-content");
1035 row
.select(".cdmContentInner")[0].innerHTML
= content
;
1036 row
.removeAttribute("data-content");
1038 PluginHost
.run(PluginHost
.HOOK_ARTICLE_RENDERED_CDM
, row
);
1045 function headlines_scroll_handler(e
) {
1048 // rate-limit in case of smooth scrolling and similar abominations
1049 if (Math
.max(e
.scrollTop
, _headlines_scroll_offset
) - Math
.min(e
.scrollTop
, _headlines_scroll_offset
) < 25) {
1053 _headlines_scroll_offset
= e
.scrollTop
;
1055 const hsp
= $("headlines-spacer");
1057 unpackVisibleHeadlines();
1059 // set topmost child in the buffer as active
1060 if (isCdmMode() && getInitParam("cdm_auto_catchup") == 1 &&
1061 getSelectedArticleIds2().length
<= 1 &&
1062 getInitParam("cdm_expanded")) {
1064 const rows
= $$("#headlines-frame > div[id*=RROW]");
1066 for (let i
= 0; i
< rows
.length
; i
++) {
1067 const child
= rows
[i
];
1069 if ($("headlines-frame").scrollTop
<= child
.offsetTop
&&
1070 child
.offsetTop
- $("headlines-frame").scrollTop
< 100 &&
1071 child
.getAttribute("data-article-id") != _active_article_id
) {
1073 if (_active_article_id
) {
1074 const row
= $("RROW-" + _active_article_id
);
1075 if (row
) row
.removeClassName("active");
1078 _active_article_id
= child
.getAttribute("data-article-id");
1079 showArticleInHeadlines(_active_article_id
, true);
1080 updateSelectedPrompt();
1086 if (!_infscroll_disable
) {
1087 if (hsp
&& hsp
.offsetTop
- 250 <= e
.scrollTop
+ e
.offsetHeight
) {
1089 hsp
.innerHTML
= "<span class='loading'><img src='images/indicator_tiny.gif'> " +
1090 __("Loading, please wait...") + "</span>";
1092 loadMoreHeadlines();
1099 updateFloatingTitle();
1102 catchupCurrentBatchIfNeeded();
1104 if (getInitParam("cdm_auto_catchup") == 1) {
1106 // let's get DOM some time to settle down
1107 const ts
= new Date().getTime();
1108 if (ts
- _last_headlines_update
< 100) return;
1110 $$("#headlines-frame > div[id*=RROW][class*=Unread]").each(
1112 if ($("headlines-frame").scrollTop
> (child
.offsetTop
+ child
.offsetHeight
/2)) {
1114 const id
= child
.getAttribute("data-article-id")
1116 if (catchup_id_batch
.indexOf(id
) == -1)
1117 catchup_id_batch
.push(id
);
1119 //console.log("auto_catchup_batch: " + catchup_id_batch.toString());
1124 if (_infscroll_disable
) {
1125 const child
= $$("#headlines-frame div[id*=RROW]").last();
1127 if (child
&& $("headlines-frame").scrollTop
>
1128 (child
.offsetTop
+ child
.offsetHeight
- 50)) {
1130 console
.log("we seem to be at an end");
1132 if (getInitParam("on_catchup_show_next_feed") == "1") {
1133 openNextUnreadFeed();
1140 console
.warn("headlines_scroll_handler: " + e
);
1144 function openNextUnreadFeed() {
1145 const is_cat
= activeFeedIsCat();
1146 const nuf
= getNextUnreadFeed(getActiveFeedId(), is_cat
);
1147 if (nuf
) viewfeed({feed
: nuf
, is_cat
: is_cat
});
1150 function catchupBatchedArticles() {
1151 if (catchup_id_batch
.length
> 0 && !_infscroll_request_sent
&& !_catchup_request_sent
) {
1153 console
.log("catchupBatchedArticles: working");
1155 // make a copy of the array
1156 const batch
= catchup_id_batch
.slice();
1157 const query
= { op
: "rpc", method
: "catchupSelected",
1158 cmode
: 0, ids
: batch
.toString() };
1160 _catchup_request_sent
= true;
1162 xhrPost("backend.php", query
, (transport
) => {
1163 const reply
= handle_rpc_json(transport
);
1165 _catchup_request_sent
= false;
1168 const batch
= reply
.ids
;
1170 batch
.each(function (id
) {
1172 const elem
= $("RROW-" + id
);
1173 if (elem
) elem
.removeClassName("Unread");
1174 catchup_id_batch
.remove(id
);
1178 updateFloatingTitle(true);
1183 function catchupRelativeToArticle(below
, id
) {
1185 if (!id
) id
= getActiveArticleId();
1188 alert(__("No article is selected."));
1192 const visible_ids
= getLoadedArticleIds();
1194 const ids_to_mark
= [];
1197 for (var i
= 0; i
< visible_ids
.length
; i
++) {
1198 if (visible_ids
[i
] != id
) {
1199 var e
= $("RROW-" + visible_ids
[i
]);
1201 if (e
&& e
.hasClassName("Unread")) {
1202 ids_to_mark
.push(visible_ids
[i
]);
1209 for (var i
= visible_ids
.length
- 1; i
>= 0; i
--) {
1210 if (visible_ids
[i
] != id
) {
1211 var e
= $("RROW-" + visible_ids
[i
]);
1213 if (e
&& e
.hasClassName("Unread")) {
1214 ids_to_mark
.push(visible_ids
[i
]);
1222 if (ids_to_mark
.length
== 0) {
1223 alert(__("No articles found to mark"));
1225 const msg
= ngettext("Mark %d article as read?", "Mark %d articles as read?", ids_to_mark
.length
).replace("%d", ids_to_mark
.length
);
1227 if (getInitParam("confirm_feed_catchup") != 1 || confirm(msg
)) {
1229 for (var i
= 0; i
< ids_to_mark
.length
; i
++) {
1230 var e
= $("RROW-" + ids_to_mark
[i
]);
1231 e
.removeClassName("Unread");
1234 const query
= { op
: "rpc", method
: "catchupSelected",
1235 cmode
: 0, ids
: ids_to_mark
.toString() };
1237 xhrPost("backend.php", query
, (transport
) => {
1238 handle_rpc_json(transport
);
1244 function cdmCollapseArticle(event
, id
, unmark
) {
1245 if (unmark
== undefined) unmark
= true;
1247 const row
= $("RROW-" + id
);
1248 const elem
= $("CICD-" + id
);
1251 const collapse
= row
.select("span[class='collapseBtn']")[0];
1254 Element
.show("CEXC-" + id
);
1255 Element
.hide(collapse
);
1258 row
.removeClassName("active");
1260 markHeadline(id
, false);
1262 if (id
== getActiveArticleId()) {
1263 setActiveArticleId(0);
1266 updateSelectedPrompt();
1269 if (event
) Event
.stop(event
);
1271 PluginHost
.run(PluginHost
.HOOK_ARTICLE_COLLAPSED
, id
);
1273 if (row
.offsetTop
< $("headlines-frame").scrollTop
)
1274 scrollToRowId(row
.id
);
1276 $("floatingTitle").style
.visibility
= "hidden";
1277 $("floatingTitle").setAttribute("data-article-id", 0);
1281 function cdmExpandArticle(id
, noexpand
) {
1282 console
.log("cdmExpandArticle " + id
);
1284 const row
= $("RROW-" + id
);
1286 if (!row
) return false;
1288 const oldrow
= $("RROW-" + getActiveArticleId());
1290 let elem
= $("CICD-" + getActiveArticleId());
1292 if (id
== getActiveArticleId() && Element
.visible(elem
))
1295 selectArticles("none");
1297 const old_offset
= row
.offsetTop
;
1299 if (getActiveArticleId() && elem
&& !getInitParam("cdm_expanded")) {
1300 let collapse
= oldrow
.select("span[class='collapseBtn']")[0];
1303 Element
.show("CEXC-" + getActiveArticleId());
1304 Element
.hide(collapse
);
1307 if (oldrow
) oldrow
.removeClassName("active");
1309 setActiveArticleId(id
);
1311 elem
= $("CICD-" + id
);
1313 let collapse
= row
.select("span[class='collapseBtn']")[0];
1315 const cencw
= $("CENCW-" + id
);
1317 if (!Element
.visible(elem
) && !noexpand
) {
1319 cencw
.innerHTML
= htmlspecialchars_decode(cencw
.innerHTML
);
1320 cencw
.setAttribute('id', '');
1321 Element
.show(cencw
);
1325 Element
.hide("CEXC-" + id
);
1326 Element
.show(collapse
);
1329 const new_offset
= row
.offsetTop
;
1331 if (old_offset
> new_offset
)
1332 $("headlines-frame").scrollTop
-= (old_offset
- new_offset
);
1335 if (catchup_id_batch
.indexOf(id
) == -1)
1336 catchup_id_batch
.push(id
);
1338 catchupCurrentBatchIfNeeded();
1342 row
.addClassName("active");
1344 PluginHost
.run(PluginHost
.HOOK_ARTICLE_EXPANDED
, id
);
1349 function getArticleUnderPointer() {
1350 return post_under_pointer
;
1353 function scrollArticle(offset
) {
1355 const ci
= $("content-insert");
1357 ci
.scrollTop
+= offset
;
1360 const hi
= $("headlines-frame");
1362 hi
.scrollTop
+= offset
;
1368 function show_labels_in_headlines(transport
) {
1369 const data
= JSON
.parse(transport
.responseText
);
1372 data
['info-for-headlines'].each(function (elem
) {
1373 $$(".HLLCTR-" + elem
.id
).each(function (ctr
) {
1374 ctr
.innerHTML
= elem
.labels
;
1380 function cdmClicked(event
, id
, in_body
) {
1381 //var shift_key = event.shiftKey;
1383 if (!event
.ctrlKey
&& !event
.metaKey
) {
1385 if (!getInitParam("cdm_expanded")) {
1386 return cdmExpandArticle(id
);
1389 let elem
= $("RROW-" + getActiveArticleId());
1391 if (elem
) elem
.removeClassName("active");
1393 selectArticles("none");
1396 elem
= $("RROW-" + id
);
1397 const article_is_unread
= elem
.hasClassName("Unread");
1399 elem
.removeClassName("Unread");
1400 elem
.addClassName("active");
1402 setActiveArticleId(id
);
1404 if (article_is_unread
) {
1405 decrementFeedCounter(getActiveFeedId(), activeFeedIsCat());
1406 updateFloatingTitle(true);
1409 op
: "rpc", method
: "catchupSelected",
1413 xhrPost("backend.php", query
, (transport
) => {
1414 handle_rpc_json(transport
);
1418 return !event
.shiftKey
;
1421 } else if (!in_body
) {
1423 toggleSelected(id
, true);
1425 let elem
= $("RROW-" + id
);
1426 const article_is_unread
= elem
.hasClassName("Unread");
1428 if (article_is_unread
) {
1429 decrementFeedCounter(getActiveFeedId(), activeFeedIsCat());
1432 toggleUnread(id
, 0, false);
1434 openArticleInNewWindow(id
);
1439 const unread_in_buffer
= $$("#headlines-frame > div[id*=RROW][class*=Unread]").length
1440 request_counters(unread_in_buffer
== 0);
1445 function hlClicked(event
, id
) {
1446 if (event
.which
== 2) {
1449 } else if (event
.ctrlKey
|| event
.metaKey
) {
1450 openArticleInNewWindow(id
);
1458 function openArticleInNewWindow(id
) {
1459 toggleUnread(id
, 0, false);
1461 const w
= window
.open("");
1463 w
.location
= "backend.php?op=article&method=redirect&id=" + id
;
1466 function isCdmMode() {
1467 return getInitParam("combined_display_mode");
1470 function markHeadline(id
, marked
) {
1471 if (marked
== undefined) marked
= true;
1473 const row
= $("RROW-" + id
);
1475 const check
= dijit
.getEnclosingWidget(
1476 row
.getElementsByClassName("rchk")[0]);
1479 check
.attr("checked", marked
);
1483 row
.addClassName("Selected");
1485 row
.removeClassName("Selected");
1489 function getRelativePostIds(id
, limit
) {
1493 if (!limit
) limit
= 6; //3
1495 const ids
= getLoadedArticleIds();
1497 for (let i
= 0; i
< ids
.length
; i
++) {
1499 for (let k
= 1; k
<= limit
; k
++) {
1500 //if (i > k-1) tmp.push(ids[i-k]);
1501 if (i
< ids
.length
- k
) tmp
.push(ids
[i
+ k
]);
1510 function correctHeadlinesOffset(id
) {
1512 const container
= $("headlines-frame");
1513 const row
= $("RROW-" + id
);
1515 if (!container
|| !row
) return;
1517 const viewport
= container
.offsetHeight
;
1519 const rel_offset_top
= row
.offsetTop
- container
.scrollTop
;
1520 const rel_offset_bottom
= row
.offsetTop
+ row
.offsetHeight
- container
.scrollTop
;
1522 //console.log("Rtop: " + rel_offset_top + " Rbtm: " + rel_offset_bottom);
1523 //console.log("Vport: " + viewport);
1525 if (rel_offset_top
<= 0 || rel_offset_top
> viewport
) {
1526 container
.scrollTop
= row
.offsetTop
;
1527 } else if (rel_offset_bottom
> viewport
) {
1529 /* doesn't properly work with Opera in some cases because
1530 Opera fucks up element scrolling */
1532 container
.scrollTop
= row
.offsetTop
+ row
.offsetHeight
- viewport
;
1536 function headlineActionsChange(elem
) {
1538 elem
.attr('value', 'false');
1541 function closeArticlePanel() {
1543 if (dijit
.byId("content-insert"))
1544 dijit
.byId("headlines-wrap-inner").removeChild(
1545 dijit
.byId("content-insert"));
1548 function initFloatingMenu() {
1549 if (!dijit
.byId("floatingMenu")) {
1551 const menu
= new dijit
.Menu({
1553 targetNodeIds
: ["floatingTitle"]
1556 headlinesMenuCommon(menu
);
1562 function headlinesMenuCommon(menu
) {
1564 menu
.addChild(new dijit
.MenuItem({
1565 label
: __("Open original article"),
1566 onClick: function (event
) {
1567 openArticleInNewWindow(this.getParent().currentTarget
.getAttribute("data-article-id"));
1571 menu
.addChild(new dijit
.MenuItem({
1572 label
: __("Display article URL"),
1573 onClick: function (event
) {
1574 displayArticleUrl(this.getParent().currentTarget
.getAttribute("data-article-id"));
1578 menu
.addChild(new dijit
.MenuSeparator());
1580 menu
.addChild(new dijit
.MenuItem({
1581 label
: __("Toggle unread"),
1582 onClick: function () {
1584 let ids
= getSelectedArticleIds2();
1586 const id
= (this.getParent().currentTarget
.getAttribute("data-article-id")) + "";
1587 ids
= ids
.length
!= 0 && ids
.indexOf(id
) != -1 ? ids
: [id
];
1589 selectionToggleUnread(undefined, false, true, ids
);
1593 menu
.addChild(new dijit
.MenuItem({
1594 label
: __("Toggle starred"),
1595 onClick: function () {
1596 let ids
= getSelectedArticleIds2();
1598 const id
= (this.getParent().currentTarget
.getAttribute("data-article-id")) + "";
1599 ids
= ids
.length
!= 0 && ids
.indexOf(id
) != -1 ? ids
: [id
];
1601 selectionToggleMarked(undefined, false, true, ids
);
1605 menu
.addChild(new dijit
.MenuItem({
1606 label
: __("Toggle published"),
1607 onClick: function () {
1608 let ids
= getSelectedArticleIds2();
1610 const id
= (this.getParent().currentTarget
.getAttribute("data-article-id")) + "";
1611 ids
= ids
.length
!= 0 && ids
.indexOf(id
) != -1 ? ids
: [id
];
1613 selectionTogglePublished(undefined, false, true, ids
);
1617 menu
.addChild(new dijit
.MenuSeparator());
1619 menu
.addChild(new dijit
.MenuItem({
1620 label
: __("Mark above as read"),
1621 onClick: function () {
1622 catchupRelativeToArticle(0, this.getParent().currentTarget
.getAttribute("data-article-id"));
1626 menu
.addChild(new dijit
.MenuItem({
1627 label
: __("Mark below as read"),
1628 onClick: function () {
1629 catchupRelativeToArticle(1, this.getParent().currentTarget
.getAttribute("data-article-id"));
1634 const labels
= getInitParam("labels");
1636 if (labels
&& labels
.length
) {
1638 menu
.addChild(new dijit
.MenuSeparator());
1640 const labelAddMenu
= new dijit
.Menu({ownerMenu
: menu
});
1641 const labelDelMenu
= new dijit
.Menu({ownerMenu
: menu
});
1643 labels
.each(function (label
) {
1644 const bare_id
= label
.id
;
1645 const name
= label
.caption
;
1647 labelAddMenu
.addChild(new dijit
.MenuItem({
1650 onClick: function () {
1652 let ids
= getSelectedArticleIds2();
1654 const id
= (this.getParent().ownerMenu
.currentTarget
.getAttribute("data-article-id")) + "";
1656 ids
= ids
.length
!= 0 && ids
.indexOf(id
) != -1 ? ids
: [id
];
1658 selectionAssignLabel(this.labelId
, ids
);
1662 labelDelMenu
.addChild(new dijit
.MenuItem({
1665 onClick: function () {
1666 let ids
= getSelectedArticleIds2();
1668 const id
= (this.getParent().ownerMenu
.currentTarget
.getAttribute("data-article-id")) + "";
1670 ids
= ids
.length
!= 0 && ids
.indexOf(id
) != -1 ? ids
: [id
];
1672 selectionRemoveLabel(this.labelId
, ids
);
1678 menu
.addChild(new dijit
.PopupMenuItem({
1679 label
: __("Assign label"),
1683 menu
.addChild(new dijit
.PopupMenuItem({
1684 label
: __("Remove label"),
1691 function initHeadlinesMenu() {
1692 if (!dijit
.byId("headlinesMenu")) {
1694 const menu
= new dijit
.Menu({
1695 id
: "headlinesMenu",
1696 targetNodeIds
: ["headlines-frame"],
1697 selector
: ".hlMenuAttach"
1700 headlinesMenuCommon(menu
);
1705 /* vgroup feed title menu */
1707 if (!dijit
.byId("headlinesFeedTitleMenu")) {
1709 const menu
= new dijit
.Menu({
1710 id
: "headlinesFeedTitleMenu",
1711 targetNodeIds
: ["headlines-frame"],
1712 selector
: "div.cdmFeedTitle"
1715 menu
.addChild(new dijit
.MenuItem({
1716 label
: __("Select articles in group"),
1717 onClick: function (event
) {
1718 selectArticles("all",
1719 "#headlines-frame > div[id*=RROW]" +
1720 "[data-orig-feed-id='" + this.getParent().currentTarget
.getAttribute("data-feed-id") + "']");
1725 menu
.addChild(new dijit
.MenuItem({
1726 label
: __("Mark group as read"),
1727 onClick: function () {
1728 selectArticles("none");
1729 selectArticles("all",
1730 "#headlines-frame > div[id*=RROW]" +
1731 "[data-orig-feed-id='" + this.getParent().currentTarget
.getAttribute("data-feed-id") + "']");
1737 menu
.addChild(new dijit
.MenuItem({
1738 label
: __("Mark feed as read"),
1739 onClick: function () {
1740 catchupFeedInGroup(this.getParent().currentTarget
.getAttribute("data-feed-id"));
1744 menu
.addChild(new dijit
.MenuItem({
1745 label
: __("Edit feed"),
1746 onClick: function () {
1747 editFeed(this.getParent().currentTarget
.getAttribute("data-feed-id"));
1755 function cache_set(id
, obj
) {
1756 //console.log("cache_set: " + id);
1759 sessionStorage
[id
] = obj
;
1761 sessionStorage
.clear();
1765 function cache_get(id
) {
1767 return sessionStorage
[id
];
1770 function cache_clear() {
1772 sessionStorage
.clear();
1775 function cache_delete(id
) {
1777 sessionStorage
.removeItem(id
);
1780 function cancelSearch() {
1785 function setSelectionScore() {
1786 const ids
= getSelectedArticleIds2();
1788 if (ids
.length
> 0) {
1791 const score
= prompt(__("Please enter new score for selected articles:"));
1793 if (score
!= undefined) {
1794 const query
= { op
: "article", method
: "setScore", id
: ids
.toString(),
1797 xhrJson("backend.php", query
, (reply
) => {
1799 reply
.id
.each((id
) => {
1800 const row
= $("RROW-" + id
);
1803 const pic
= row
.getElementsByClassName("hlScorePic")[0];
1806 pic
.src
= pic
.src
.replace(/score_.*?\.png/,
1807 reply
["score_pic"]);
1808 pic
.setAttribute("score", reply
["score"]);
1817 alert(__("No articles are selected."));
1822 function updateScore(id) {
1823 const pic = $$("#RROW-" + id + " .hlScorePic")[0];
1827 const query = "op=article&method=getScore&id=" + param_escape(id);
1829 new Ajax.Request("backend.php", {
1831 onComplete: function (transport) {
1832 console.log(transport.responseText);
1834 const reply = JSON.parse(transport.responseText);
1837 pic.src = pic.src.replace(/score_.*?\.png/, reply["score_pic"]);
1838 pic.setAttribute("score", reply["score"]);
1839 pic.setAttribute("title", reply["score"]);
1846 function changeScore(id
, pic
) {
1847 const score
= pic
.getAttribute("score");
1849 const new_score
= prompt(__("Please enter new score for this article:"), score
);
1851 if (new_score
!= undefined) {
1852 const query
= { op
: "article", method
: "setScore", id
: id
, score
: new_score
};
1854 xhrJson("backend.php", query
, (reply
) => {
1856 pic
.src
= pic
.src
.replace(/score_.*?\.png/, reply
["score_pic"]);
1857 pic
.setAttribute("score", new_score
);
1858 pic
.setAttribute("title", new_score
);
1864 function displayArticleUrl(id
) {
1865 const query
= { op
: "rpc", method
: "getlinktitlebyid", id
: id
};
1867 xhrJson("backend.php", query
, (reply
) => {
1868 if (reply
&& reply
.link
) {
1869 prompt(__("Article URL:"), reply
.link
);
1875 function scrollToRowId(id
) {
1879 $("headlines-frame").scrollTop
= row
.offsetTop
- 4;
1882 function updateFloatingTitle(unread_only
) {
1883 if (!isCdmMode()) return;
1885 const hf
= $("headlines-frame");
1887 const elems
= $$("#headlines-frame > div[id*=RROW]");
1889 for (let i
= 0; i
< elems
.length
; i
++) {
1891 const child
= elems
[i
];
1893 if (child
&& child
.offsetTop
+ child
.offsetHeight
> hf
.scrollTop
) {
1895 const header
= child
.getElementsByClassName("cdmHeader")[0];
1897 if (unread_only
|| child
.getAttribute("data-article-id") != $("floatingTitle").getAttribute("data-article-id")) {
1898 if (child
.getAttribute("data-article-id") != $("floatingTitle").getAttribute("data-article-id")) {
1900 $("floatingTitle").setAttribute("data-article-id", child
.getAttribute("data-article-id"));
1901 $("floatingTitle").innerHTML
= header
.innerHTML
;
1902 $("floatingTitle").firstChild
.innerHTML
= "<img class='anchor markedPic' src='images/page_white_go.png' onclick=\"scrollToRowId('" + child
.id
+ "')\">" + $("floatingTitle").firstChild
.innerHTML
;
1906 const cb
= $$("#floatingTitle .dijitCheckBox")[0];
1909 cb
.parentNode
.removeChild(cb
);
1912 if (child
.hasClassName("Unread"))
1913 $("floatingTitle").addClassName("Unread");
1915 $("floatingTitle").removeClassName("Unread");
1917 PluginHost
.run(PluginHost
.HOOK_FLOATING_TITLE
, child
);
1920 $("floatingTitle").style
.marginRight
= hf
.offsetWidth
- child
.offsetWidth
+ "px";
1921 if (header
.offsetTop
+ header
.offsetHeight
< hf
.scrollTop
+ $("floatingTitle").offsetHeight
- 5 &&
1922 child
.offsetTop
+ child
.offsetHeight
>= hf
.scrollTop
+ $("floatingTitle").offsetHeight
- 5)
1923 $("floatingTitle").style
.visibility
= "visible";
1925 $("floatingTitle").style
.visibility
= "hidden";
1933 function catchupCurrentBatchIfNeeded() {
1934 if (catchup_id_batch
.length
> 0) {
1935 window
.clearTimeout(catchup_timeout_id
);
1936 catchup_timeout_id
= window
.setTimeout(catchupBatchedArticles
, 1000);
1938 if (catchup_id_batch
.length
>= 10) {
1939 catchupBatchedArticles();