-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
97 lines (83 loc) · 2.71 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Backbone Demo: Todos</title>
<link href="/assets/css/todos.css" media="all" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="todoapp">
<div class="title">
<h1>Todos</h1>
</div>
<div class="content">
<div id="error"></div>
<div id="create-todo">
<input id="new-todo" placeholder="What needs to be done?" type="text" />
<span class="ui-tooltip-top" style="display:none;">Press Enter to save this task</span>
</div>
<div id="todos">
<ul id="todo-list"></ul>
</div>
<div id="todo-stats"></div>
</div>
</div>
<ul id="instructions">
<li>Double-click to edit a todo.</li>
<li><a href="../../docs/todos.html">View the annotated source.</a></li>
</ul>
<div id="credits">
Created by
<br />
<a href="http://jgn.me/">Jérôme Gravel-Niquet</a>
</div>
<!-- Templates -->
<script type="text/template" id="item-template">
<div class="todo <%= done ? 'done' : '' %>">
<div class="display">
<input class="check" type="checkbox" <%= done ? 'checked="checked"' : '' %> />
<div class="todo-text"></div>
<span class="todo-destroy"></span>
</div>
<div class="edit">
<input class="todo-input" type="text" value="" />
</div>
</div>
</script>
<script type="text/template" id="stats-template">
<% if (total) { %>
<span class="todo-count">
<span class="number"><%= remaining %></span>
<span class="word"><%= remaining == 1 ? 'item' : 'items' %></span> left.
</span>
<% } %>
<% if (done) { %>
<span class="todo-clear">
<a href="#">
Clear <span class="number-done"><%= done %></span>
completed <span class="word-done"><%= done == 1 ? 'item' : 'items' %></span>
</a>
</span>
<% } %>
</script>
<script src="/assets/js/libs/jquery.js"></script>
<script src="/assets/js/libs/underscore.js"></script>
<script src="/assets/js/libs/backbone.js"></script>
<script src="/assets/js/libs/backbone-mongodb.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script src="/app/todoapp.js"></script>
<script src="/app/modules/todos.js"></script>
<script src="/app/index.js"></script>
<script>
var socket = io.connect('http://localhost:8000');
socket.on('new', function (data) {
todoapp.Todos.add(JSON.parse(data));
console.log(data);
});
socket.on('reset', function (data) {
todoapp.Todos.reset(JSON.parse(data));
console.log(data);
});
</script>
</body>
</html>