mirror of
https://github.com/YunoHost/doc.git
synced 2024-09-03 20:06:26 +02:00
[enh] add first version of news.md
This commit is contained in:
parent
d69511cbf5
commit
7f50fb3641
1 changed files with 49 additions and 0 deletions
49
news.md
Normal file
49
news.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
# YunoHost News
|
||||
|
||||
<div id="news">
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.emoji {
|
||||
height: 21px;
|
||||
}
|
||||
|
||||
blockquote p {
|
||||
font-size: medium;
|
||||
}
|
||||
blockquote > p {
|
||||
margin-top: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/template" id="news-template">
|
||||
<article class="news">
|
||||
<h2><a target="_blank" href="{link}">{title}</a></h2>
|
||||
|
||||
<div>{body}</div>
|
||||
</article>
|
||||
|
||||
<hr>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// FIXME, we need to enable CORS on forum.yunohost.org
|
||||
// $.get("https://forum.yunohost.org/c/announcement.rss").success(function(data) {
|
||||
$.get("/_pages/announcement.rss").success(function(data) {
|
||||
$(data).find("item").each(function(_, item) {
|
||||
var description = $(item).find("description");
|
||||
// yes this is a NIGHTMARE
|
||||
var blockquote_content = $("<div>" + description[0].textContent + "</div>").find("blockquote")[0].innerHTML
|
||||
// blockquote_content = blockquote_content.replace("<h1", "<h4");
|
||||
|
||||
html = $('#news-template').html()
|
||||
.replace(/{title}/g, $(item).find("title").text())
|
||||
.replace(/{link}/g, $(item).find("link").text())
|
||||
.replace(/{body}/g, blockquote_content)
|
||||
|
||||
$("#news").append(html);
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
Loading…
Reference in a new issue