From d3253f49aa90a481c97f137987025e401d0b6b01 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 10 Aug 2012 15:02:18 +0400 Subject: [PATCH] Revert "add experimental clientside headline clamping (refs #479)" This reverts commit 26e4b12466208b433fef35946cb61ef9b3e52e45. --- classes/feeds.php | 5 +++-- js/functions.js | 9 --------- js/viewfeed.js | 17 +---------------- 3 files changed, 4 insertions(+), 27 deletions(-) diff --git a/classes/feeds.php b/classes/feeds.php index 23c9e783..0c981247 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -378,7 +378,8 @@ class Feeds extends Protected_Handler { $updated_fmt = make_local_datetime($this->link, $line["updated_noms"], false); if (get_pref($this->link, 'SHOW_CONTENT_PREVIEW')) { - $content_preview = strip_tags($line["content_preview"]); + $content_preview = truncate_string(strip_tags($line["content_preview"]), + 100); } $score = $line["score"]; @@ -457,7 +458,7 @@ class Feeds extends Protected_Handler { $reply['content'] .= "" . - $line["title"]; + truncate_string($line["title"], 200); if (get_pref($this->link, 'SHOW_CONTENT_PREVIEW')) { if ($content_preview) { diff --git a/js/functions.js b/js/functions.js index 997d55a5..b2d79dc5 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1718,12 +1718,3 @@ function get_radio_checked(radioObj) { } return(""); } - -function clamp_element(elem, height) { - if (elem && elem.offsetHeight > height) { - while (elem.offsetHeight > height) - elem.innerHTML = cp.innerHTML.substring(0, elem.innerHTML.length - 50); - - elem.innerHTML += "…"; - } -} diff --git a/js/viewfeed.js b/js/viewfeed.js index 2e830164..92a610f8 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -81,10 +81,6 @@ function headlines_callback2(transport, offset, background, infscroll_req) { reply['headlines']['toolbar']); $$("#headlines-frame > div[id*=RROW]").each(function(row) { - cp = row.getElementsByClassName("contentPreview")[0]; - - clamp_element(cp, 50); - if ($$("#headlines-frame DIV[id="+row.id+"]").length > 1) { row.parentNode.removeChild(row); } @@ -140,13 +136,8 @@ function headlines_callback2(transport, offset, background, infscroll_req) { $$("#headlines-frame > div[id*=RROW]").each( function(child) { - if (!Element.visible(child)) { + if (!Element.visible(child)) new Effect.Appear(child, { duration : 0.5 }); - - cp = child.getElementsByClassName("contentPreview")[0]; - - clamp_element(cp, 50); - } }); } else { @@ -2056,12 +2047,6 @@ function render_local_headlines(feed, is_cat, obj) { setActiveFeedId(feed, is_cat); initHeadlinesMenu(); - - $$("#headlines-frame > div[id*=RROW]").each(function(row) { - cp = row.getElementsByClassName("contentPreview")[0]; - clamp_element(cp, 50); - }); - precache_headlines(); } catch (e) { -- 2.39.5