6
6
< script src ="http://code.jquery.com/jquery-latest.js "> </ script >
7
7
< script src ='src/sketch.js '> </ script >
8
8
< style type ='text/css '>
9
- body { font-family : "Open Sans" , sans-serif; }
9
+ body { font-family : "Open Sans" , sans-serif; color : # 444 ; }
10
10
h1 , h2 , h3 , h4 { font-family : Yellowtail; font-weight : normal; color : # 06a ; }
11
11
12
12
# wrapper { width : 800px ; margin : 0 auto; }
21
21
height : 300px ;
22
22
border : 1px solid # ccc ;
23
23
}
24
+
25
+ pre .source {
26
+ background : # e5eeee ;
27
+ padding : 10px 20px ;
28
+ width : 760px ;
29
+ overflow-x : auto;
30
+ border : 1px solid # acc ;
31
+ }
32
+
33
+ # colors_tools a {
34
+ border : 1px solid black; width : 30px ; height : 30px ; line-height : 30px ; vertical-align : middle; text-align : center; text-decoration : none; display : inline-block; color : black; font-weight : bold;
35
+ }
24
36
</ style >
25
37
</ head >
26
38
< body >
@@ -37,17 +49,17 @@ <h1>Simple Example</h1>
37
49
< p > Click and drag in the box below to draw a simple black line.</ p >
38
50
39
51
< div class ='demo '>
40
- < canvas id ='simple_sketch ' width ='800 ' height ='300 '> </ canvas >
41
- < script type ='text/javascript '>
42
- $ ( function ( ) {
43
- $ ( '#simple_sketch' ) . sketch ( ) ;
44
- } ) ;
45
- </ script >
52
+ < canvas id ='simple_sketch ' width ='800 ' height ='300 '> </ canvas >
53
+ < script type ='text/javascript '>
54
+ $ ( function ( ) {
55
+ $ ( '#simple_sketch' ) . sketch ( ) ;
56
+ } ) ;
57
+ </ script >
46
58
</ div >
47
59
</ article >
48
60
49
61
< article class ='example '>
50
- < h1 > Color Change </ h1 >
62
+ < h1 > Changing Color/Size </ h1 >
51
63
52
64
< p > </ p >
53
65
@@ -56,8 +68,11 @@ <h1>Color Change</h1>
56
68
< canvas id ='colors_sketch ' width ='800 ' height ='300 '> </ canvas >
57
69
< script type ='text/javascript '>
58
70
$ ( function ( ) {
59
- $ . each ( [ '#f00' , '#ff0' , '#0f0' , '#0ff' , '#00f' , '#000' , '#fff' ] , function ( ) {
60
- $ ( '#colors_tools' ) . append ( "<a href='#colors_sketch' data-color='" + this + "' style='border: 1px solid black; width: 30px; height: 30px; background: " + this + "; display: inline-block;'></a> " ) ;
71
+ $ . each ( [ '#f00' , '#ff0' , '#0f0' , '#0ff' , '#00f' , '#000' , '#fff' ] , function ( ) {
72
+ $ ( '#colors_tools' ) . append ( "<a href='#colors_sketch' data-color='" + this + "' style='background: " + this + ";'></a> " ) ;
73
+ } ) ;
74
+ $ . each ( [ 3 , 5 , 10 , 15 ] , function ( ) {
75
+ $ ( '#colors_tools' ) . append ( "<a href='#colors_sketch' data-size='" + this + "' style='background: #ccc'>" + this + "</a> " ) ;
61
76
} ) ;
62
77
$ ( '#colors_sketch' ) . sketch ( ) ;
63
78
} ) ;
@@ -75,7 +90,8 @@ <h1>Color Change</h1>
75
90
76
91
$ ( 'article.example' ) . each ( function ( ) {
77
92
$ ( this ) . append ( "<pre class='source'></pre>" ) ;
78
- $ ( this ) . find ( "pre.source" ) . html ( escapeHTML ( $ ( this ) . find ( "div.demo" ) . html ( ) ) ) ;
93
+ var html = $ ( this ) . find ( "div.demo" ) . html ( ) . replace ( / / g, "" ) ;
94
+ $ ( this ) . find ( "pre.source" ) . html ( escapeHTML ( html ) ) ;
79
95
} ) ;
80
96
</ script >
81
97
</ body >
0 commit comments