mirror of
https://github.com/chylex/Nextcloud-News.git
synced 2024-11-24 22:42:46 +01:00
Compare commits
3 Commits
3fdd21b9fd
...
cc861ca186
Author | SHA1 | Date | |
---|---|---|---|
cc861ca186 | |||
29b643168b | |||
cde02ce5e2 |
@ -465,11 +465,6 @@
|
|||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#app-content .feed-view .utils .title {
|
|
||||||
background: none !important;
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#app-content .utils .title h1 a {
|
#app-content .utils .title h1 a {
|
||||||
/*text-overflow: ellipsis;*/
|
/*text-overflow: ellipsis;*/
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
1326
css/custom.css
1326
css/custom.css
File diff suppressed because it is too large
Load Diff
@ -360,6 +360,10 @@ class Item extends Entity implements IAPI, \JsonSerializable
|
|||||||
return json_decode($this->getCategoriesJson());
|
return json_decode($this->getCategoriesJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getWordCount(): int {
|
||||||
|
return self::countWords(strip_tags($this->getBody()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns entity attributes into an array
|
* Turns entity attributes into an array
|
||||||
*/
|
*/
|
||||||
@ -384,11 +388,12 @@ class Item extends Entity implements IAPI, \JsonSerializable
|
|||||||
'starred' => $this->isStarred(),
|
'starred' => $this->isStarred(),
|
||||||
'lastModified' => $this->getLastModified(),
|
'lastModified' => $this->getLastModified(),
|
||||||
'rtl' => $this->getRtl(),
|
'rtl' => $this->getRtl(),
|
||||||
'intro' => $this->getIntro(),
|
'intro' => mb_substr($this->getIntro(), 0, 500),
|
||||||
'fingerprint' => $this->getFingerprint(),
|
'fingerprint' => $this->getFingerprint(),
|
||||||
'categories' => $this->getCategories(),
|
'categories' => $this->getCategories(),
|
||||||
'sharedBy' => $this->getSharedBy(),
|
'sharedBy' => $this->getSharedBy(),
|
||||||
'sharedByDisplayName' => $this->getSharedByDisplayName()
|
'sharedByDisplayName' => $this->getSharedByDisplayName(),
|
||||||
|
'wordCount' => $this->getWordCount(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,4 +760,11 @@ class Item extends Entity implements IAPI, \JsonSerializable
|
|||||||
stripos($mime, 'image/') !== false ||
|
stripos($mime, 'image/') !== false ||
|
||||||
stripos($mime, 'video/') !== false));
|
stripos($mime, 'video/') !== false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function countWords(string $text): int
|
||||||
|
{
|
||||||
|
$text = preg_replace('/[\pP\pM]/u', '', $text); // strip punctuation (P) and combination marks (M)
|
||||||
|
$text = preg_replace('/[^\pL\pN]+/u', ' ', $text); // convert every sequence of non-letters (L) and non-numbers (N) to a space
|
||||||
|
return 1 + substr_count($text, ' ');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,9 @@
|
|||||||
{{ item.pubDate*1000 | relativeTimestamp }}
|
{{ item.pubDate*1000 | relativeTimestamp }}
|
||||||
</time>
|
</time>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="only-in-compact">
|
||||||
|
<span class="date">{{ item.wordCount }} words</span>
|
||||||
|
</li>
|
||||||
<li ng-click="Content.toggleStar(item.id)"
|
<li ng-click="Content.toggleStar(item.id)"
|
||||||
class="util"
|
class="util"
|
||||||
news-stop-propagation>
|
news-stop-propagation>
|
||||||
|
Loading…
Reference in New Issue
Block a user