comparison awesome_js/robert.js @ 42:ef8615de8a9c laserkard

[svn r43] implemented form memory
author rlm
date Wed, 27 Jan 2010 22:04:43 -0500
parents 1ac1409ea68c
children 329638a361cc
comparison
equal deleted inserted replaced
41:c4747d955ac8 42:ef8615de8a9c
1 1
2 2
3 window.Robert = (function () { 3
4 4 function defaults()
5 5 {
6 var separator = /[, ]+/, 6 alias = "Robert Mac";
7 elements = /^(circle|rect|path|ellipse|text|image)$/, 7 email = "rlm@mit.edu";
8 8 occupation = "";
9 Paper = function () {}, 9 company = "";
10 phone = "";
11 website = "";
12 lineArt = "";
13 }
14
15
16 function drawElement(obj)
17 {
18
19 }
20
21 function redraw(style)
22 {
23
24 if (style == "bold")
25 {
26
27
28
29 if(typeof d_alias != 'undefined' ){d_alias.remove();}
30 if(typeof d_email != 'undefined' ){d_email.remove();}
31 if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
32 if(typeof d_company != 'undefined' ){d_company.remove();}
33 if(typeof d_phone != 'undefined' ){d_phone.remove();}
34 if(typeof d_website != 'undefined' ){d_website.remove();}
35 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
36
37
38
39 var oText = document.getElementById('Name');
40 var text_val = oText.value;
41 d_alias = raphe.print(10, 160, text_val, raphe.getFont('HelveticaNeue', 700), 60);
42 d_alias.attr('stroke', '#6a6a6a');
43 d_alias.attr('fill', 'none')
44 var c = d_alias.getBBox().width;
45 d_alias.translate((485 - c)/2,0);
46
47
48 var oText = document.getElementById('Email');
49 var text_val = oText.value;
50
51 d_email = raphe.print(280, 270, text_val, raphe.getFont("HelveticaNeue", 700), 25);
52 d_email.attr('stroke', '#6a6a6a');
53 d_email.attr('fill', 'TRANSPARENT');
54
55
56
57
58 }
59
60
61 if (style == "arrow")
62 {
63
64 if(typeof d_alias != 'undefined' ){d_alias.remove();}
65 if(typeof d_email != 'undefined' ){d_email.remove();}
66 if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
67 if(typeof d_company != 'undefined' ){d_company.remove();}
68 if(typeof d_phone != 'undefined' ){d_phone.remove();}
69 if(typeof d_website != 'undefined' ){d_website.remove();}
70 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
71
72
73 var oText = document.getElementById('Name');
74 var text_val = oText.value;
75 d_alias = raphe.print(40, 110, text_val, raphe.getFont('HelveticaNeue', 700), 55);
76 d_alias.attr('stroke', '#6a6a6a');
77 d_alias.attr('fill', 'none')
78
79
80
81 var oText = document.getElementById('Company');
82 var text_val = oText.value;
83
84 d_company = raphe.print(40, 155, text_val, raphe.getFont("HelveticaNeue", 700), 27);
85 d_company.attr('stroke', '#6a6a6a');
86 d_company.attr('fill', 'TRANSPARENT');
87
88
89 var oText = document.getElementById('Occupation');
90 var text_val = oText.value;
91
92 d_occupation = raphe.print(40, 190, text_val, raphe.getFont("HelveticaNeue", 700), 27);
93 d_occupation.attr('stroke', '#6a6a6a');
94 d_occupation.attr('fill', 'TRANSPARENT');
95
96
97 var oText = document.getElementById('Email');
98 var text_val = oText.value;
99
100 d_email = raphe.print(280, 270, text_val, raphe.getFont("HelveticaNeue", 700), 25);
101 d_email.attr('stroke', '#6a6a6a');
102 d_email.attr('fill', 'TRANSPARENT');
103
104
105 d_lineArt = raphe.path("M 2 272 L 258 272");
106 d_lineArt.attr('stroke', '#6a6a6a');
107
108 }
109
110
111 if (style == "classic")
112 {
113
114 if(typeof d_alias != 'undefined' ){d_alias.remove();}
115 if(typeof d_email != 'undefined' ){d_email.remove();}
116 if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
117 if(typeof d_company != 'undefined' ){d_company.remove();}
118 if(typeof d_phone != 'undefined' ){d_phone.remove();}
119 if(typeof d_website != 'undefined' ){d_website.remove();}
120 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
121
122
123 var oText = document.getElementById('Email');
124 var text_val = oText.value;
125
126 d_email = raphe.print(0, 42, text_val, raphe.getFont("HelveticaNeue", 700), 29);
127 d_email.attr('stroke', '#6a6a6a');
128 d_email.attr('fill', 'TRANSPARENT');
129 var c = d_email.getBBox().width;
130 d_email.translate((510 - c)/2,0);
131
132
133 var oText = document.getElementById('Phone');
134 var text_val = oText.value;
135
136 d_phone = raphe.print(0, 75, text_val, raphe.getFont("HelveticaNeue", 700), 27);
137 d_phone.attr('stroke', '#6a6a6a');
138 d_phone.attr('fill', 'TRANSPARENT');
139 var c = d_phone.getBBox().width;
140 d_phone.translate((510 - c)/2,0);
141
142
143
144
145 var oText = document.getElementById('Name');
146 var text_val = oText.value;
147 d_alias = raphe.print(0, 164, text_val, raphe.getFont('HelveticaNeue', 800), 47);
148 d_alias.attr('stroke', '#6a6a6a');
149 d_alias.attr('fill', 'none')
150 var c = d_alias.getBBox().width;
151 d_alias.translate((510 - c)/2,0);
152
153
154 var oText = document.getElementById('Company');
155 var text_val = oText.value;
156 d_company = raphe.print(0, 247, text_val, raphe.getFont("HelveticaNeue", 700), 27);
157 d_company.attr('stroke', '#6a6a6a');
158 d_company.attr('fill', 'TRANSPARENT');
159 var c = d_company.getBBox().width;
160 d_company.translate((510 - c)/2,0);
161
162
163 var oText = document.getElementById('Occupation');
164 var text_val = oText.value;
165
166 d_occupation = raphe.print(0, 278, text_val, raphe.getFont("HelveticaNeue", 700), 27);
167 d_occupation.attr('stroke', '#6a6a6a');
168 d_occupation.attr('fill', 'TRANSPARENT');
169 var c = d_occupation.getBBox().width;
170 d_occupation.translate((510 - c)/2,0);
171
172
173
174
175 var oText = document.getElementById('Website');
176 var text_val = oText.value;
177
178 d_website = raphe.print(0, 0, text_val, raphe.getFont("HelveticaNeue", 700), 21);
179 d_website.attr('stroke', '#6a6a6a');
180 d_website.attr('fill', 'TRANSPARENT');
181
182 var c = d_website.getBBox().width;
183 d_website.translate((317 - c)/2,0);
184
185 d_website.translate(0, -490);
186 d_website.rotate(90,0,0);
187 }
188
189
190 if (style == "direct")
191 {
192
193 if(typeof d_alias != 'undefined' ){d_alias.remove();}
194 if(typeof d_email != 'undefined' ){d_email.remove();}
195 if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
196 if(typeof d_company != 'undefined' ){d_company.remove();}
197 if(typeof d_phone != 'undefined' ){d_phone.remove();}
198 if(typeof d_website != 'undefined' ){d_website.remove();}
199 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
200
201
202
203 var oText = document.getElementById('Name');
204 var text_val = oText.value;
205 d_alias = raphe.print(37, 70, text_val, raphe.getFont('HelveticaNeue', 700), 55);
206 d_alias.attr('stroke', '#6a6a6a');
207 d_alias.attr('fill', 'none')
208
209
210 var oText = document.getElementById('Occupation');
211 var text_val = oText.value;
212 d_occupation = raphe.print(37, 120, text_val, raphe.getFont("HelveticaNeue", 700), 27);
213 d_occupation.attr('stroke', '#6a6a6a');
214 d_occupation.attr('fill', 'TRANSPARENT');
215
216
217 var oText = document.getElementById('Company');
218 var text_val = oText.value;
219 d_company = raphe.print(37, 178, text_val, raphe.getFont("HelveticaNeue", 700), 27);
220 d_company.attr('stroke', '#6a6a6a');
221 d_company.attr('fill', 'TRANSPARENT');
222
223
224
225 var oText = document.getElementById('Phone');
226 var text_val = oText.value;
227 d_phone = raphe.print(37, 210, text_val, raphe.getFont("HelveticaNeue", 700), 27);
228 d_phone.attr('stroke', '#6a6a6a');
229 d_phone.attr('fill', 'TRANSPARENT');
230
231
232 var oText = document.getElementById('Email');
233 var text_val = oText.value;
234 d_email = raphe.print(37, 240, text_val, raphe.getFont("HelveticaNeue", 700), 27);
235 d_email.attr('stroke', '#6a6a6a');
236 d_email.attr('fill', 'TRANSPARENT');
237
238
239 var oText = document.getElementById('Website');
240 var text_val = oText.value;
241 d_website = raphe.print(37, 270, text_val, raphe.getFont("HelveticaNeue", 700), 27);
242 d_website.attr('stroke', '#6a6a6a');
243 d_website.attr('fill', 'TRANSPARENT');
244
245 d_lineArt = raphe.path("M 350 165 L 512 165 M 350 173 L 512 173 M 350 181 L 512 181 M 350 189 L 512 189 M 350 197 L 512 197 M 350 213 L 512 213 M 350 205 L 512 205 M 350 221 L 512 221");
246 d_lineArt.attr('stroke', '#6a6a6a');
247
248
249
250 }
251
252
253
254
255
256 }
257
258