From c1498835f615f1ae5324335e26cebf5f7cde91f1 Mon Sep 17 00:00:00 2001 From: ohrensessel Date: Wed, 14 Jan 2015 20:51:13 +0100 Subject: [PATCH] Show 3 Lines of text instead of 1 --- css/main.css | 4 ++-- js/main.js | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/css/main.css b/css/main.css index f3f4b5c..458d726 100644 --- a/css/main.css +++ b/css/main.css @@ -30,10 +30,10 @@ body { .css-truncate { overflow: hidden; - text-overflow: ellipsis; +# text-overflow: ellipsis; width: 100%; display: inline-block; - white-space: nowrap; + white-space: wrap; } /* Layout Styles */ diff --git a/js/main.js b/js/main.js index e159591..771fe56 100644 --- a/js/main.js +++ b/js/main.js @@ -1,7 +1,15 @@ var rss = [ 'hamburg.freifunk.net', ]; -var MAX_RSS = 5; +var MAX_RSS = 3; + +function shorten(text, maxLength) { + var ret = text; + if (ret.length > maxLength) { + ret = ret.substr(0,maxLength-3) + "..."; + } + return ret; +} $(document).ready(function() { var addItem = function(title, link, date, text) { @@ -53,7 +61,7 @@ $(document).ready(function() { var i = 0; items.forEach(function(item) { if(i++ >= MAX_RSS) return; - addItem(item.title, item.link, item.date, item.text); + addItem(item.title, item.link, item.date, shorten(item.text, 80)); }); };