forked from websanova/wScratchPad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
131 lines (110 loc) · 3.28 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
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
<!DOCTYPE html>
<html>
<head>
<meta CHARSET="UTF-8">
<title>Websanova Scratch Pad</title>
<!-- jQuery -->
<script type="text/javascript" src="./inc/jquery.1.8.2.min.js"></script>
<!-- wScratchPad -->
<script type="text/javascript" src="./wScratchPad.js"></script>
</head>
<body>
<div id="wScratchPad" style="display:inline-block; position:relative; border:solid black 1px;"></div>
<div>
<a id="reset" href="javascript:reset_to_defaults();">reset to defaults</a> |
<a id="reset" href="javascript:reset();">reset</a> |
<a href="javascript:clear();">clear</a> |
<a id="reset" href="javascript:reset_with_new_color();">reset with new color</a> |
<a href="javascript:get_color();">get color</a> |
<a href="javascript:set_image_bg();">set image background</a> |
<a href="javascript:set_image_overlay();">set overlay image</a> |
<a href="javascript:set_to_winner();">set to winner</a> |
<a href="javascript:change_size();">change size</a> |
<a href="javascript:enabled(false);">disable</a> |
<a href="javascript:enabled(true);">enable</a> |
</div>
<div>
percent scratched: <span id="percent_scratched"></span>
</div>
<script type="text/javascript">
var sp = $("#wScratchPad").wScratchPad({
scratchDown: function(e, percent){$("#percent_scratched").html(percent)},
scratchMove: function(e, percent){$("#percent_scratched").html(percent)},
scratchUp: function(e, percent){$("#percent_scratched").html(percent)}
});
function set_to_winner()
{
sp.wScratchPad('width', '200');
sp.wScratchPad('image', './images/winner.png');
sp.wScratchPad('image2', './images/scratch-to-win.png');
sp.wScratchPad('cursor', './cursors/coin.png');
sp.wScratchPad('reset');
}
function change_size()
{
sp.wScratchPad('size', '5');
}
function reset_to_defaults()
{
sp.wScratchPad('image', './images/slide1.jpg');
sp.wScratchPad('image2', null);
sp.wScratchPad('color', '#336699');
sp.wScratchPad('overlay', 'none');
sp.wScratchPad('size', '10');
sp.wScratchPad('reset');
}
function reset()
{
sp.wScratchPad('reset');
}
function clear()
{
sp.wScratchPad('clear');
}
function reset_with_new_color()
{
sp.wScratchPad('color', '#FF0000');
sp.wScratchPad('image2', null);
sp.wScratchPad('reset');
}
function get_color()
{
alert(sp.wScratchPad('color'));
}
function set_image_bg()
{
sp.wScratchPad('image', './images/slide2.jpg');
sp.wScratchPad('reset');
}
function set_image_overlay()
{
sp.wScratchPad('image2', './images/slide3.jpg');
sp.wScratchPad('reset');
}
function enabled(toggle)
{
sp.wScratchPad('enabled', toggle);
}
</script>
<!-- testing multiple scratch pads -->
<div id="wScratchPad2" style="display:inline-block; position:relative; border:solid black 1px;"></div>
<script type="text/javascript">
$("#wScratchPad2").wScratchPad({
cursor:'./cursors/mario.png'
});
</script>
<!-- clear after 70% -->
<h3>Clear after 70 percent</h3>
<div id="wScratchPad3" style="display:inline-block; position:relative; border:solid black 1px;"></div>
<script type="text/javascript">
$("#wScratchPad3").wScratchPad({
cursor:'./cursors/mario.png',
scratchMove: function(e, percent)
{
if(percent > 70)
this.clear();
},
});
</script>
</body>
</html>