experimental: limit initialized html content for expanded cdm

This commit is contained in:
Andrew Dolgov 2013-03-21 10:34:36 +04:00
parent 24c215e2bb
commit b74c513428
2 changed files with 26 additions and 6 deletions

View File

@ -624,14 +624,14 @@ class Feeds extends Handler_Protected {
$reply['content'] .= "<span id=\"CWRAP-$id\">"; $reply['content'] .= "<span id=\"CWRAP-$id\">";
if (!$expand_cdm) { // if (!$expand_cdm) {
$reply['content'] .= "<span id=\"CENCW-$id\">"; $reply['content'] .= "<span id=\"CENCW-$id\" style=\"display : none\">";
$reply['content'] .= htmlspecialchars($line["content"]); $reply['content'] .= htmlspecialchars($line["content"]);
$reply['content'] .= "</span."; $reply['content'] .= "</span.";
} else { // } else {
$reply['content'] .= $line["content"]; // $reply['content'] .= $line["content"];
} // }
$reply['content'] .= "</span>"; $reply['content'] .= "</span>";

View File

@ -205,6 +205,8 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
_infscroll_request_sent = 0; _infscroll_request_sent = 0;
headlines_scroll_handler($("headlines-frame"));
notify(""); notify("");
} catch (e) { } catch (e) {
@ -1176,6 +1178,23 @@ function headlines_scroll_handler(e) {
try { try {
var hsp = $("headlines-spacer"); var hsp = $("headlines-spacer");
$$("#headlines-frame > div[id*=RROW]").each(
function(child) {
if (child.offsetTop <= $("headlines-frame").scrollTop +
$("headlines-frame").offsetHeight) {
var cencw = $("CENCW-" + child.id.replace("RROW-", ""));
if (cencw) {
cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML);
cencw.setAttribute('id', '');
Element.show(cencw);
}
}
}
);
if (!_infscroll_disable) { if (!_infscroll_disable) {
if ((hsp && e.scrollTop + e.offsetHeight >= hsp.offsetTop - hsp.offsetHeight) || if ((hsp && e.scrollTop + e.offsetHeight >= hsp.offsetTop - hsp.offsetHeight) ||
(e.scrollHeight != 0 && (e.scrollHeight != 0 &&
@ -1197,7 +1216,7 @@ function headlines_scroll_handler(e) {
$$("#headlines-frame > div[id*=RROW][class*=Unread]").each( $$("#headlines-frame > div[id*=RROW][class*=Unread]").each(
function(child) { function(child) {
if ($("headlines-frame").scrollTop > if (child.hasClassName("Unread") && $("headlines-frame").scrollTop >
(child.offsetTop + child.offsetHeight/2)) { (child.offsetTop + child.offsetHeight/2)) {
var id = child.id.replace("RROW-", ""); var id = child.id.replace("RROW-", "");
@ -1388,6 +1407,7 @@ function cdmExpandArticle(id) {
if (cencw) { if (cencw) {
cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML); cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML);
cencw.setAttribute('id', ''); cencw.setAttribute('id', '');
Element.show(cencw);
} }
Element.show(elem); Element.show(elem);