sync shitcode xD
This commit is contained in:
parent
2e5e0b4b26
commit
9c677c6fd2
2 changed files with 11 additions and 1 deletions
5
blog.js
5
blog.js
|
@ -22,9 +22,12 @@ function getReactions(posts,p){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function printPost(post,roomId,noButton){
|
function printPost(post,roomId,noButton){
|
||||||
|
if(post.type != "m.room.message") return false;
|
||||||
|
//console.log(post)
|
||||||
|
|
||||||
let body = DOMPurify.sanitize(post.content.formatted_body ?? post.content.body);
|
let body = DOMPurify.sanitize(post.content.formatted_body ?? post.content.body);
|
||||||
body = body.split("\n").join("<br>");
|
body = body.split("\n").join("<br>");
|
||||||
table.innerHTML += `<tr><td><b>${post.sender}</b><br>${body}${post.content.msgtype == "m.image" ? `<br><img src="https://matrix.org/_matrix/media/v3/download/${post.content.url.slice(6)}">` : ''}${!noButton ? `<br><a href="#${roomId}/${post.event_id}">Открыть</a>` : ''}</td></tr>`;
|
table.innerHTML += `<tr><td><b>${post.sender}</b><br>${body}${post.content.msgtype == "m.image" ? `<br><img src="https://matrix.org/_matrix/media/v3/download/${post.content.url.slice(6)}">` : ''}${getReactions(posts,post)}${!noButton ? `<br><a href="#${roomId}/${post.event_id}">Открыть</a>` : ''}</td></tr>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPosts(roomId,start){
|
function loadPosts(roomId,start){
|
||||||
|
|
|
@ -10,5 +10,12 @@
|
||||||
<table class="table is-bordered is-fullwidth"></table>
|
<table class="table is-bordered is-fullwidth"></table>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.0.6/purify.min.js" integrity="sha512-H+rglffZ6f5gF7UJgvH4Naa+fGCgjrHKMgoFOGmcPTRwR6oILo5R+gtzNrpDp7iMV3udbymBVjkeZGNz1Em4rQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.0.6/purify.min.js" integrity="sha512-H+rglffZ6f5gF7UJgvH4Naa+fGCgjrHKMgoFOGmcPTRwR6oILo5R+gtzNrpDp7iMV3udbymBVjkeZGNz1Em4rQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
<script src="blog.js"></script>
|
<script src="blog.js"></script>
|
||||||
|
<style>
|
||||||
|
tr {
|
||||||
|
white-space: normal;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
text-wrap: break-word;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue