Show 3 Lines of text instead of 1

This commit is contained in:
ohrensessel 2015-01-14 20:51:13 +01:00
parent 8757f276d0
commit c1498835f6
2 changed files with 12 additions and 4 deletions

View file

@ -30,10 +30,10 @@ body {
.css-truncate { .css-truncate {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; # text-overflow: ellipsis;
width: 100%; width: 100%;
display: inline-block; display: inline-block;
white-space: nowrap; white-space: wrap;
} }
/* Layout Styles */ /* Layout Styles */

View file

@ -1,7 +1,15 @@
var rss = [ var rss = [
'hamburg.freifunk.net', '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() { $(document).ready(function() {
var addItem = function(title, link, date, text) { var addItem = function(title, link, date, text) {
@ -53,7 +61,7 @@ $(document).ready(function() {
var i = 0; var i = 0;
items.forEach(function(item) { items.forEach(function(item) {
if(i++ >= MAX_RSS) return; 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));
}); });
}; };