mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Display user likes
This commit is contained in:
		@@ -122,8 +122,27 @@
 | 
			
		||||
			</table>
 | 
			
		||||
		</div>
 | 
			
		||||
		
 | 
			
		||||
		<!-- All user likes -->
 | 
			
		||||
		<div id="likes" class="category container">
 | 
			
		||||
			Loading likes
 | 
			
		||||
			<h1>All your likes</h1>
 | 
			
		||||
 | 
			
		||||
			<table id="all-likes-table">
 | 
			
		||||
 | 
			
		||||
				<thead>
 | 
			
		||||
					<tr>
 | 
			
		||||
						<th>Number</th>
 | 
			
		||||
						<th>Date</th>
 | 
			
		||||
						<th>Element type</th>
 | 
			
		||||
						<th>Element ID</th>
 | 
			
		||||
					</tr>
 | 
			
		||||
				</thead>
 | 
			
		||||
 | 
			
		||||
				<tbody>
 | 
			
		||||
					<!-- Likes will go here-->
 | 
			
		||||
				</tbody>
 | 
			
		||||
 | 
			
		||||
			</table>
 | 
			
		||||
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		<div id="survey-responses" class="category container">
 | 
			
		||||
@@ -152,6 +171,7 @@
 | 
			
		||||
	<script src="assets/js/categories/friends.js"></script>
 | 
			
		||||
	<script src="assets/js/categories/posts.js"></script>
 | 
			
		||||
	<script src="assets/js/categories/comments.js"></script>
 | 
			
		||||
	<script src="assets/js/categories/likes.js"></script>
 | 
			
		||||
	<script src="assets/js/main.js"></script>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,28 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Likes category
 | 
			
		||||
 * 
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Apply all user likes
 | 
			
		||||
 */
 | 
			
		||||
function ApplyUserLikes() {
 | 
			
		||||
 | 
			
		||||
    let target = document.querySelector("#all-likes-table tbody");
 | 
			
		||||
 | 
			
		||||
    data.likes.forEach(like => {
 | 
			
		||||
 | 
			
		||||
        createElem2({
 | 
			
		||||
            appendTo: target,
 | 
			
		||||
            type: "tr",
 | 
			
		||||
            innerHTML:
 | 
			
		||||
                "<td>" + like.id + "</td>" +
 | 
			
		||||
                "<td>" + timeToStr(like.time_sent) + "</td>" +
 | 
			
		||||
                "<td>" + like.elem_type + "</td>" +
 | 
			
		||||
                "<td>" + like.elem_id + "</td>"
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -77,6 +77,7 @@ xhr.onload = function(){
 | 
			
		||||
	ApplyFriendsList();
 | 
			
		||||
	ApplyPosts();
 | 
			
		||||
	ApplyCommentsList();
 | 
			
		||||
	ApplyUserLikes();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
xhr.send(null);
 | 
			
		||||
		Reference in New Issue
	
	Block a user