日记列表超过100字显示省略号并保留完整正文
This commit is contained in:
@@ -4,7 +4,9 @@ function diaryEntry(item) {
|
||||
if (typeof images === 'string') { try { images = JSON.parse(images); } catch (e) { images = []; } }
|
||||
if (!Array.isArray(images)) images = [];
|
||||
var date = String(item.created_at || '').slice(0, 10);
|
||||
return Object.assign({}, item, { title: item.title || '日常的一页', summary: String(item.content || '').replace(/\s+/g, ' ').slice(0, 100), date: date, dateLabel: date.replace(/-/g, '.'), cover: getImageUrl(images[0]), imageCount: images.length, author: item.creator_name || item.created_by_name || '' });
|
||||
var characters = Array.from(String(item.content || '').replace(/\s+/g, ' '));
|
||||
var summary = characters.slice(0, 100).join('') + (characters.length > 100 ? '…' : '');
|
||||
return Object.assign({}, item, { title: item.title || '日常的一页', summary: summary, date: date, dateLabel: date.replace(/-/g, '.'), cover: getImageUrl(images[0]), imageCount: images.length, author: item.creator_name || item.created_by_name || '' });
|
||||
}
|
||||
function albumEntry(item) { return Object.assign({}, item, { cover: getImageUrl(item.cover), title: item.title || '我们的相册' }); }
|
||||
function memoryEntry(item) {
|
||||
|
||||
Reference in New Issue
Block a user