-
Notifications
You must be signed in to change notification settings - Fork 117
/
Copy pathindex.html
100 lines (92 loc) · 3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name=description content="">
<meta name=viewport content="width=device-width, initial-scale=1">
<title>Jquery Comments Plugin</title>
<!-- Styles -->
<link rel="stylesheet" type="text/css" href="css/jquery-comments.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<!-- Data -->
<script type="text/javascript" src="data/comments-data.js"></script>
<!-- Libraries -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.textcomplete/1.8.0/jquery.textcomplete.js"></script>
<script type="text/javascript" src="js/jquery-comments.js"></script>
<style type="text/css">
body {
padding: 20px;
margin: 0px;
font-size: 14px;
font-family: "Arial", Georgia, Serif;
}
</style>
<!-- Init jquery-comments -->
<script type="text/javascript">
$(function() {
var saveComment = function(data) {
// Convert pings to human readable format
$(Object.keys(data.pings)).each(function(index, userId) {
var fullname = data.pings[userId];
var pingText = '@' + fullname;
data.content = data.content.replace(new RegExp('@' + userId, 'g'), pingText);
});
return data;
}
$('#comments-container').comments({
profilePictureURL: 'https://viima-app.s3.amazonaws.com/media/public/defaults/user-icon.png',
currentUserId: 1,
roundProfilePictures: true,
textareaRows: 1,
enableAttachments: true,
enableHashtags: true,
enablePinging: true,
scrollContainer: $(window),
searchUsers: function(term, success, error) {
setTimeout(function() {
success(usersArray.filter(function(user) {
var containsSearchTerm = user.fullname.toLowerCase().indexOf(term.toLowerCase()) != -1;
var isNotSelf = user.id != 1;
return containsSearchTerm && isNotSelf;
}));
}, 500);
},
getComments: function(success, error) {
setTimeout(function() {
success(commentsArray);
}, 500);
},
postComment: function(data, success, error) {
setTimeout(function() {
success(saveComment(data));
}, 500);
},
putComment: function(data, success, error) {
setTimeout(function() {
success(saveComment(data));
}, 500);
},
deleteComment: function(data, success, error) {
setTimeout(function() {
success();
}, 500);
},
upvoteComment: function(data, success, error) {
setTimeout(function() {
success(data);
}, 500);
},
validateAttachments: function(attachments, callback) {
setTimeout(function() {
callback(attachments);
}, 500);
},
});
});
</script>
</head>
<body>
<div id="comments-container"></div>
</body>
</html>