forked from jimdoescode/jqScribble
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
88 lines (85 loc) · 2.81 KB
/
example.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>jqScribble example</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width;initial-scale=1.0;maximum-scale=1.0;user-scalable=0;"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<script src="http://code.jquery.com/jquery-1.5.2.min.js" type="text/javascript" ></script>
<script src="jquery.jqscribble.js" type="text/javascript"></script>
<script src="jqscribble.extrabrushes.js" type="text/javascript"></script>
<style>
.links a {
padding-left: 10px;
margin-left: 10px;
border-left: 1px solid #000;
text-decoration: none;
color: #999;
}
.links a:first-child {
padding-left: 0;
margin-left: 0;
border-left: none;
}
.links a:hover {text-decoration: underline;}
.column-left {
display: inline;
float: left;
}
.column-right {
display: inline;
float: right;
}
</style>
</head>
<body>
<div style="overflow: hidden; margin-bottom: 5px;">
<div class="column-left links">
<strong>BRUSHES:</strong>
<a href="#" onclick='$("#test").jqScribble.update({brush: BasicBrush});'>Basic</a>
<a href="#" onclick='$("#test").jqScribble.update({brush: LineBrush});'>Line</a>
<a href="#" onclick='$("#test").jqScribble.update({brush: CrossBrush});'>Cross</a>
</div>
<div class="column-right links">
<strong>COLORS:</strong>
<a href="#" onclick='$("#test").jqScribble.update({brushColor: "rgb(0,0,0)"});'>Black</a>
<a href="#" onclick='$("#test").jqScribble.update({brushColor: "rgb(255,0,0)"});'>Red</a>
<a href="#" onclick='$("#test").jqScribble.update({brushColor: "rgb(0,255,0)"});'>Green</a>
<a href="#" onclick='$("#test").jqScribble.update({brushColor: "rgb(0,0,255)"});'>Blue</a>
</div>
</div>
<canvas id="test" style="border: 1px solid red;"></canvas>
<div class="links" style="margin-top: 5px;">
<strong>OPTIONS:</strong>
<a href="#" onclick='addImage();'>Add Image</a>
<a href="#" onclick='$("#test").jqScribble.clear();'>Clear</a>
<a href="#" onclick='$("#test").jqScribble.save();'>Save</a>
<a href="#" onclick='save();'>Custom Save</a>
</div>
<script type="text/javascript">
function save()
{
$("#test").jqScribble.save(function(imageData)
{
if(confirm("This will write a file using the example image_save.php. Is that cool with you?"))
{
$.post('image_save.php', {imagedata: imageData}, function(response)
{
$('body').append(response);
});
}
});
}
function addImage()
{
var img = prompt("Enter the URL of the image.");
if(img !== '')$("#test").jqScribble.update({backgroundImage: img});
}
$(document).ready(function()
{
$("#test").jqScribble();
});
</script>
</body>
</html>