view awesome_js/robert.js @ 43:329638a361cc laserkard

[svn r44] implemented redraw memory.
author rlm
date Thu, 28 Jan 2010 00:32:54 -0500
parents ef8615de8a9c
children 1045db9799e3
line wrap: on
line source



4 function defaults()
5 {
6 alias = "Robert Mac";
7 email = "rlm@mit.edu";
8 occupation = "";
9 company = "";
10 phone = "";
11 website = "";
12 lineArt = "";
13 }
16 function drawElement(obj)
17 {
19 }
21 function redraw(style)
22 {
25 var JSONtext = document.getElementById('formValues').innerHTML;
26 var hash = new Object();
27 hash = eval('(' + JSONtext + ')');
29 if(hash.Name){alias = hash.Name;}
30 if(hash.Email){email = hash.Email;}
31 if(hash.Occupation){occupation = hash.Occupation;}
32 if(hash.Company){company = hash.Company;}
33 if(hash.Phone){phone = hash.Phone;}
34 if(hash.website){website = Website;}
36 if (style == "bold")
37 {
41 if(typeof d_alias != 'undefined' ){d_alias.remove();}
42 if(typeof d_email != 'undefined' ){d_email.remove();}
43 if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
44 if(typeof d_company != 'undefined' ){d_company.remove();}
45 if(typeof d_phone != 'undefined' ){d_phone.remove();}
46 if(typeof d_website != 'undefined' ){d_website.remove();}
47 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
52 d_alias = raphe.print(10, 160, alias, raphe.getFont('HelveticaNeue', 700), 60);
53 d_alias.attr('stroke', '#6a6a6a');
54 d_alias.attr('fill', 'none')
55 var c = d_alias.getBBox().width;
56 d_alias.translate((485 - c)/2,0);
61 d_email = raphe.print(280, 270, email, raphe.getFont("HelveticaNeue", 700), 25);
62 d_email.attr('stroke', '#6a6a6a');
63 d_email.attr('fill', 'TRANSPARENT');
68 }
71 if (style == "arrow")
72 {
74 if(typeof d_alias != 'undefined' ){d_alias.remove();}
75 if(typeof d_email != 'undefined' ){d_email.remove();}
76 if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
77 if(typeof d_company != 'undefined' ){d_company.remove();}
78 if(typeof d_phone != 'undefined' ){d_phone.remove();}
79 if(typeof d_website != 'undefined' ){d_website.remove();}
80 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
84 d_alias = raphe.print(40, 110, alias, raphe.getFont('HelveticaNeue', 700), 55);
85 d_alias.attr('stroke', '#6a6a6a');
86 d_alias.attr('fill', 'none')
88 d_company = raphe.print(40, 155, company, raphe.getFont("HelveticaNeue", 700), 27);
89 d_company.attr('stroke', '#6a6a6a');
90 d_company.attr('fill', 'TRANSPARENT');
92 d_occupation = raphe.print(40, 190, occupation, raphe.getFont("HelveticaNeue", 700), 27);
93 d_occupation.attr('stroke', '#6a6a6a');
94 d_occupation.attr('fill', 'TRANSPARENT');
96 d_email = raphe.print(280, 270, email, raphe.getFont("HelveticaNeue", 700), 25);
97 d_email.attr('stroke', '#6a6a6a');
98 d_email.attr('fill', 'TRANSPARENT');
100 d_lineArt = raphe.path("M 2 272 L 258 272");
101 d_lineArt.attr('stroke', '#6a6a6a');
103 }
106 if (style == "classic")
107 {
109 if(typeof d_alias != 'undefined' ){d_alias.remove();}
110 if(typeof d_email != 'undefined' ){d_email.remove();}
111 if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
112 if(typeof d_company != 'undefined' ){d_company.remove();}
113 if(typeof d_phone != 'undefined' ){d_phone.remove();}
114 if(typeof d_website != 'undefined' ){d_website.remove();}
115 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
118 d_email = raphe.print(0, 42, email, raphe.getFont("HelveticaNeue", 700), 29);
119 d_email.attr('stroke', '#6a6a6a');
120 d_email.attr('fill', 'TRANSPARENT');
121 var c = d_email.getBBox().width;
122 d_email.translate((510 - c)/2,0);
126 d_phone = raphe.print(0, 75, phone, raphe.getFont("HelveticaNeue", 700), 27);
127 d_phone.attr('stroke', '#6a6a6a');
128 d_phone.attr('fill', 'TRANSPARENT');
129 var c = d_phone.getBBox().width;
130 d_phone.translate((510 - c)/2,0);
133 d_alias = raphe.print(0, 164, alias, raphe.getFont('HelveticaNeue', 800), 47);
134 d_alias.attr('stroke', '#6a6a6a');
135 d_alias.attr('fill', 'none')
136 var c = d_alias.getBBox().width;
137 d_alias.translate((510 - c)/2,0);
140 d_company = raphe.print(0, 247, company, raphe.getFont("HelveticaNeue", 700), 27);
141 d_company.attr('stroke', '#6a6a6a');
142 d_company.attr('fill', 'TRANSPARENT');
143 var c = d_company.getBBox().width;
144 d_company.translate((510 - c)/2,0);
148 d_occupation = raphe.print(0, 278, occupation, raphe.getFont("HelveticaNeue", 700), 27);
149 d_occupation.attr('stroke', '#6a6a6a');
150 d_occupation.attr('fill', 'TRANSPARENT');
151 var c = d_occupation.getBBox().width;
152 d_occupation.translate((510 - c)/2,0);
155 d_website = raphe.print(0, 0, website, raphe.getFont("HelveticaNeue", 700), 21);
156 d_website.attr('stroke', '#6a6a6a');
157 d_website.attr('fill', 'TRANSPARENT');
159 var c = d_website.getBBox().width;
160 d_website.translate((317 - c)/2,0);
162 d_website.translate(0, -490);
163 d_website.rotate(90,0,0);
164 }
167 if (style == "direct")
168 {
170 if(typeof d_alias != 'undefined' ){d_alias.remove();}
171 if(typeof d_email != 'undefined' ){d_email.remove();}
172 if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
173 if(typeof d_company != 'undefined' ){d_company.remove();}
174 if(typeof d_phone != 'undefined' ){d_phone.remove();}
175 if(typeof d_website != 'undefined' ){d_website.remove();}
176 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
181 d_alias = raphe.print(37, 70, alias, raphe.getFont('HelveticaNeue', 700), 55);
182 d_alias.attr('stroke', '#6a6a6a');
183 d_alias.attr('fill', 'none')
187 d_occupation = raphe.print(37, 120, occupation, raphe.getFont("HelveticaNeue", 700), 27);
188 d_occupation.attr('stroke', '#6a6a6a');
189 d_occupation.attr('fill', 'TRANSPARENT');
193 d_company = raphe.print(37, 178, company, raphe.getFont("HelveticaNeue", 700), 27);
194 d_company.attr('stroke', '#6a6a6a');
195 d_company.attr('fill', 'TRANSPARENT');
199 d_phone = raphe.print(37, 210, phone, raphe.getFont("HelveticaNeue", 700), 27);
200 d_phone.attr('stroke', '#6a6a6a');
201 d_phone.attr('fill', 'TRANSPARENT');
205 d_email = raphe.print(37, 240, email, raphe.getFont("HelveticaNeue", 700), 27);
206 d_email.attr('stroke', '#6a6a6a');
207 d_email.attr('fill', 'TRANSPARENT');
212 d_website = raphe.print(37, 270, website, raphe.getFont("HelveticaNeue", 700), 27);
213 d_website.attr('stroke', '#6a6a6a');
214 d_website.attr('fill', 'TRANSPARENT');
216 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");
217 d_lineArt.attr('stroke', '#6a6a6a');
221 }
227 }