This repository was archived by the owner on Aug 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 297
Expand file tree
/
Copy pathindex.html
More file actions
223 lines (183 loc) · 6.99 KB
/
index.html
File metadata and controls
223 lines (183 loc) · 6.99 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Drawingboard.js: a simple canvas based drawing app that you can integrate easily on your website.</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="bower_components/drawingboard.js/example/prism.css">
<link rel="stylesheet" href="bower_components/drawingboard.js/example/website.css">
<!-- in a production environment, just include the minified css. It contains the css of the board and the default controls (size, nav, colors): -->
<link rel="stylesheet" href="bower_components/drawingboard.js/dist/drawingboard.min.css">
<style>
/*
* drawingboards styles: set the board dimensions you want with CSS
*/
.board {
margin: 0 auto;
width: 300px;
height: 300px;
}
#default-board {
width: 700px;
height: 400px;
}
#custom-board-2 {
width: 550px;
height: 300px;
}
#title-board {
width: 600px;
height: 270px;
}
/* custom board styles for the title? no problem*/
#title-board .drawing-board-canvas-wrapper {
border: none;
margin: 0;
}
</style>
</head>
<body>
<span id="forkongithub"><a href="https://github.com/Leimi/drawingboard.js">Fork me on GitHub!</a></span>
<noscript>JavaScript is required :(</noscript>
<div class="header">
<div class="board" id="title-board"></div>
</div>
<div id="container">
<div data-example="5">
</div>
<p><a href="https://github.com/Leimi/drawingboard.js#drawingboardjs">Detailed information is available in the <strong>readme</strong> on Github.</a></p>
<div class="example" data-example="1">
<h1>The default DrawingBoard</h1>
<div class="board" id="default-board"></div>
</div>
<div class="example" data-example="2">
<h1>A custom one</h1>
<div class="board" id="custom-board"></div>
</div>
<div class="example" data-example="3">
<h1>Another custom one</h1>
<div class="board" id="custom-board-2"></div>
</div>
<div class="example" data-example="4">
<h1>The simplest one</h1>
<div class="board" id="simple-board"></div>
</div>
<div>
<h1>Real world usage</h1>
<p>The drawingboard was originally made for a French website with a dubious humor (that you'll definitely understand even if you're not French): <a href="http://jaiunegrosseteu.be" target="_blank">jaiunegrosseteu.be</a></p>
<p>Other websites using it:</p>
<ul>
<li><a href="http://www.peinto.org/" target="_blank">peinto.org</a></li>
</ul>
</div>
<div>
<p>Made by <a href="http://twitter.com/Leimina">@Leimina</a>.</p>
</div>
</div>
<!-- jquery is required - zepto might do the trick too -->
<script src="https://code.jquery.com/jquery-1.10.1.min.js"></script>
<!-- in a production environment, just include the minified script. It contains the board and the default controls (size, nav, colors, download): -->
<script src="bower_components/drawingboard.js/dist/drawingboard.min.js"></script>
<script data-example="1">
//create the drawingboard by passing it the #id of the wanted container
var defaultBoard = new DrawingBoard.Board('default-board');
</script>
<!-- an input[type=range] poyfill is more than recommanded if you want to use the default "size" control with the "range" type *on every browser*
the polyfill is loaded only if necessary via yepnope http://yepnopejs.com/
note this is totally not required if the size control is set to "auto" or "dropdown" - the control will work with every browser with an alternate view -->
<script src="bower_components/drawingboard.js/example/yepnope.js"></script>
<script>
var iHasRangeInput = function() {
var inputElem = document.createElement('input'),
smile = ':)',
docElement = document.documentElement,
inputElemType = 'range',
available;
inputElem.setAttribute('type', inputElemType);
available = inputElem.type !== 'text';
inputElem.value = smile;
inputElem.style.cssText = 'position:absolute;visibility:hidden;';
if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
docElement.appendChild(inputElem);
defaultView = document.defaultView;
available = defaultView.getComputedStyle &&
defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
(inputElem.offsetHeight !== 0);
docElement.removeChild(inputElem);
}
return !!available;
};
yepnope({
test : iHasRangeInput(),
nope : ['bower_components/drawingboard.js/example/fd-slider.min.css', 'bower_components/drawingboard.js/example/fd-slider.min.js'],
callback: function(id, testResult) {
if("fdSlider" in window && typeof (fdSlider.onDomReady) != "undefined") {
try { fdSlider.onDomReady(); } catch(err) {}
}
}
});
</script>
<script data-example="2">
//pass options and add custom controls to a board
var customBoard = new DrawingBoard.Board('custom-board', {
background: "#ff7ffe",
color: "#ff0",
size: 30,
controls: [
{ Size: { type: "range" } },
{ Navigation: { back: false, forward: false } },
'DrawingMode'
],
webStorage: 'local'
});
//There are multiple ways to add a control to a board after its initialization:
customBoard.addControl('Download'); //if the DrawingBoard.Control.Download class exists
//or...
//var downloadControl = new DrawingBoard.Control.Download(customBoard).addToBoard();
//or...
//var downloadControl = new DrawingBoard.Control.Download(customBoard);
//customBoard.addControl(downloadControl);
</script>
<script data-example="3">
var customBoard2 = new DrawingBoard.Board('custom-board-2', {
controls: [
'Color',
{ Size: { type: 'dropdown' } },
{ DrawingMode: { filler: false } },
'Navigation',
'Download'
],
size: 1,
webStorage: 'session',
enlargeYourContainer: true
});
</script>
<script data-example="4">
var simpleBoard = new DrawingBoard.Board('simple-board', {
controls: false,
webStorage: false
});
</script>
<script data-example="5">
var imageBoard = new DrawingBoard.Board('title-board', {
controls: false,
background: 'bower_components/drawingboard.js/example/drawingboardjs.png',
color: '#ff0',
webStorage: false
});
</script>
<!-- totally not drawingboard-related code -->
<script src="bower_components/drawingboard.js/example/prism.js"></script>
<script src="bower_components/drawingboard.js/example/script.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-13184829-7', 'leimi.github.io');
ga('send', 'pageview');
</script>
</body>
</html>