sync shitcode xD

This commit is contained in:
doesnm 2024-04-16 22:19:14 +03:00
parent 2e5e0b4b26
commit 9c677c6fd2
2 changed files with 11 additions and 1 deletions

View file

@ -22,9 +22,12 @@ function getReactions(posts,p){
});
}
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);
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){

View file

@ -10,5 +10,12 @@
<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="blog.js"></script>
<style>
tr {
white-space: normal;
overflow-wrap: break-word;
text-wrap: break-word;
}
</style>
</body>
</html>