This repository was archived by the owner on Dec 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
242 lines (217 loc) · 7 KB
/
index.html
File metadata and controls
242 lines (217 loc) · 7 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<!doctype html>
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Examples and documentation on coDesign.js</title>
<meta name="description" content="Examples and documentation on coDesign.js">
<meta name="author" content="James Cryer">
<link href="libs/farbtastic/farbtastic.css" rel="stylesheet" type="text/css" />
<link href="libs/tipsy/src/stylesheets/tipsy.css" rel="stylesheet" type="text/css" />
<!-- link href="src/css/coDesign.css" rel="stylesheet" type="text/css" /-->
<link href="libs/coDesign/css/coDesign.min.css" rel="stylesheet" type="text/css" />
<style>
body {
font-size: 16px;
line-height: 24px;
background: #fff;
color: #330;
font-family: "Georgia", FreeSerif, serif;
padding-left: 30px;
}
div.container {
width: 690px;
margin: 50px 0 50px 50px;
}
p, li {
margin: 16px 0 16px 0;
width: 550px;
}
p.break {
margin-top: 35px;
}
a, a:visited {
padding: 0 2px;
text-decoration: none;
background: #f7f7bb;
color: #330;
}
a:active, a:hover {
color: #000;
background: #ff8;
}
.contact {
background: transparent;
color: #441;
}
.contact:active, .contact:hover {
background: transparent;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 40px;
display:inline-block;
}
b.header {
font-size: 18px;
}
span.alias {
font-size: 14px;
font-style: italic;
margin-left: 20px;
}
table {
margin: 16px 0; padding: 0;
}
tr, td {
margin: 0; padding: 0;
}
td {
padding: 9px 15px 9px 0;
}
td.definition {
line-height: 18px;
font-size: 14px;
}
code, pre, tt {
font-family: Consolas, "Lucida Console", monospace;
font-size: 12px;
line-height: 18px;
color: #444;
}
code {
margin-left: 20px;
}
pre {
font-size: 12px;
padding: 2px 0 2px 12px;
border-left: 6px solid hotpink;
margin: 0px 0 10px;
}
li pre {
padding: 0;
border-left: 0;
margin: 6px 0 6px 0;
}
#diagram {
margin: 20px 0 0 0;
}
</style>
<style>
.ex {
display:inline-block;
width: 150px;
padding-left:3px;
height:20px;
border:1px solid #ddd;
font-size: 12px;
font-family: Consolas, "Lucida Console", monospace;
}
.grumble-button {
font-size:11px;
}
</style>
</head>
<body>
<div id="container">
<header>
<h1>coDesign.js</h1>
</header>
<div id="main" role="main">
<br/>
<p>
coDesign.js is a simple tool for creative fun collaboration. Originally an experiment with HTML5 canvas,
coDesign.js is built for the co-creation of low-fidelity designs in <a href="http://jamescryer.no.de/codesign" target="_blank">realtime</a> with others across the Web.
It's open source on <a href="https://github.com/jamescryer/coDesign.js" target="_blank">Github</a>.
</p>
<div id="codesign" style="position: relative; border:1px solid #ccc; width: 400px; height: 300px;"></div>
<p>
<a href="fullscreen-example.html" target="_blank">Full screen mode</a> is also supported. Click here to see the <a href="http://jamescryer.no.de/codesign" target="_blank">realtime example</a>
</p>
<h2>Examples</h2>
<pre>
$('#codesign').coDesign();</pre>
<p>
No controls.
</p>
<pre>
$('#codesign').coDesign({
enableControls: false
});</pre>
<p>
Fullscreen
</p>
<pre>
$('#codesign').coDesign({
fullScreen: true
});</pre>
</div>
<p>
Can I haz callbacks? Sure.
</p>
<pre>
$('#codesign').coDesign({
onDraw: function( obj ){
console.log(obj.action); // Current state of action. Just started or incomplete?
console.log(obj.brush); // The brush to be used (this is an object)
console.log(obj.color); // The color to be drawn
console.log(obj.left); // Position of cursor from left of canvas
console.log(obj.top); // Position of cursor from top of canvas
},
onWrite: function( obj ){
{
console.log(obj.action); // Was it a backspace or return ?
console.log(obj.value); // The character that was just inserted
console.log(obj.color); // The color of the last character
console.log(obj.size); // And the size
console.log(obj.left); // Position of cursor from left of canvas
console.log(obj.top); // Position of cursor from top of canvas
}
});</pre>
<p>
Events can be triggered. Where an object is specified, that object should contain all the neccessary information to perform an action. Object properties are detailed above.
</p>
<pre>
$('#codesign').coDesign('draw', obj ); // trigger draw event
$('#codesign').coDesign('write', obj ); // trigger write event
$('#codesign').coDesign('update', config ); // Update properties or replace callbacks
$('#codesign').coDesign('clear'); // Clear the canvas
$('#codesign').coDesign('destroy'); // Destroy the canvas and unbind events</pre>
<p>
The realtime example uses this <a href="https://github.com/jamescryer/nodejs-homepage/blob/master/public/js/realtimecodesign.js" target="_blacnk">client-side code</a>. Take a look at this for a working example.
</p>
<h2>Credit due</h2>
<p>
Although I've mosty worked on this in my own time I'd like to thank the awesome <a href="http://www.huddle.com" target="_blank">Huddle.com</a> for 'Tuesday Time', the day when developers at Huddle get the chance to contribute back to the Open Source community.
</p>
<footer>
<br/>
<br/>
<p>Written by <a href="https://github.com/jamescryer">James Cryer</a></p>
<p><a href="http://twitter.com/jamescryer" class="contact">@jamescryer</a></p>
</footer>
</div> <!-- eo #container -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="libs/farbtastic/farbtastic.js"></script>
<script type="text/javascript" src="libs/tipsy/src/javascripts/jquery.tipsy.js"></script>
<!-- script type="text/javascript" src="src/js/brushes.js"></script>
<script type="text/javascript" src="src/js/colors.js"></script>
<script type="text/javascript" src="src/js/ColorArray.js"></script>
<script type="text/javascript" src="src/js/CanvasDraw.js"></script>
<script type="text/javascript" src="src/js/CanvasWrite.js"></script>
<script type="text/javascript" src="src/js/CanvasControl.js"></script>
<script type="text/javascript" src="src/js/jquery.coDesign.js"></script -->
<script type="text/javascript" src="libs/coDesign/js/jquery.coDesign.min.js"></script>
<script>
$('#codesign').coDesign();
</script>
<script>
var _gaq=[["_setAccount","UA-27156183-1"],["_trackPageview"]];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
s.parentNode.insertBefore(g,s)}(document,"script"));
</script>
</body>
</html>