This repository has been archived by the owner on Oct 30, 2018. It is now read-only.
forked from aroc/side-comments
-
Notifications
You must be signed in to change notification settings - Fork 3
/
demo.html
45 lines (45 loc) · 2.09 KB
/
demo.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
<html>
<head>
<meta charset="utf-8">
<title>SideComments.js Demo</title>
<link rel="stylesheet" href="release/side-comments.css" />
<link rel="stylesheet" href="release/themes/default-theme.css" />
<link rel="stylesheet" href="support/css/basics.css" />
<meta name = "viewport" content = "user-scalable=no, initial-scale=1.0, maximum-scale=1.0, width=device-width">
</head>
<body>
<div id="commentable-container" class="container commentable-container">
<h1 class="title">
SideComments.js In Action
</h1>
<p data-section-id="1" class="commentable-section">
Each paragraph tag has the "commentable-section" class, making it a section which can be commented on after you've initialized a new SideComments object and pointed it at the parent element, which is "#commentable-container" for this demo.
</p>
<p data-section-id="2" class="commentable-section">
Clicking on the markers on the right will show the SideComments. Sections without any comments only show their marker on hover.
</p>
<p data-section-id="3" class="commentable-section">
This is the default theme that comes with SideComments.js. You can easily theme SideComments to your liking by not including "default-theme.css" and just styling it all yourself.
</p>
</div>
<script src="support/js/jquery.js"></script>
<script src="release/side-comments.js"></script>
<script src="support/test_data.js"></script>
<script>
$(document).ready(function(){
var SideComments = require('side-comments');
window.sideComments = new SideComments('#commentable-container', currentUser, existingComments);
window.sideComments.on('commentPosted', function( comment ) {
comment.id = parseInt(Math.random() * (100000 - 1) + 1);
sideComments.insertComment(comment);
});
window.sideComments.on('commentUpdated', function( comment ) {
sideComments.replaceComment(comment);
});
window.sideComments.on('commentDeleted', function( comment ) {
sideComments.removeComment(comment.sectionId, comment.id);
});
});
</script>
</body>
</html>