view awesome_js/robert.js @ 56:2ca94aa58033 laserkard

[svn r57] commiting before corrections with Kevin
author rlm
date Sat, 13 Mar 2010 22:30:59 -0500
parents 95fa4bcc5d67
children 14271eedf004
line wrap: on
line source

2 descHash = new Object();
4 prevVal = "";
8 descHash.classic_acrylic_clear =
9 "<h1>The Classic LaserKard.</h1>Balanced and Complete. The original LaserKard. For those that wish to leave no stone unturned. It's all there.";
11 descHash.big_acrylic_clear =
12 "<h1>The Bold Kard.</h1>Austere and Iconic. For those that wish to leave an impression with the power of their name accompanied only by their main method of contact. Bold, period.";
14 descHash.basic_acrylic_clear =
15 "<h1>The Arrow Kard.</h1>Precise and Straightforward. For those that seek to make a statement while being clear and concise. Straight as an arrow.";
17 descHash.lines_acrylic_clear =
18 "<h1>The Direct Kard.</h1>Thorough and Distinct. For those that aim to demonstrate their professionalism with style. Push the envelope. Be Direct.";
20 color = 'fefefe';
25 function pokedex(target)
26 {
29 var description = eval ("descHash." + target);
31 document.getElementById('pokedex').innerHTML = description;
33 }
37 function stabForm(ID)
38 {
39 var JSONtext = document.getElementById('formValues').innerHTML;
40 var hash = new Object();
41 hash = eval('(' + JSONtext + ')');
43 propertyValue = document.getElementById(ID).value;
44 propertyName = ID;
45 propertyValue = escape(propertyValue);
47 eval("hash."+propertyName+"='"+propertyValue+"'");
49 var JSONtext = document.getElementById('formValues').innerHTML = JSON.stringify(hash);
50 }
54 function getPosition(style, field)
55 {
57 var cardType = eval ("laserkard." + style);
60 if ( eval("typeof cardType." + field + " != 'undefined'")) //shouldn't ever really matter
61 {
62 values = eval("cardType." + field);
64 if (typeof values.posx != 'undefined'){posx = values.posx;}
65 if (typeof values.posy != 'undefined'){posy = values.posy;}
66 if (typeof values.center != 'undefined'){center = values.center;}
67 if (typeof values.font != 'undefined'){font = values.font;}
68 if (typeof values.face != 'undefined'){face = values.face;}
69 if (typeof values.width != 'undefined'){width = values.width;}
70 if (typeof values.weirdFlip != 'undefined'){weirdFlip = values.weirdFlip;}
71 if (typeof values.resize != 'undefined'){resize = values.resize;}
72 }
75 }
77 //~ function smallRedraw(style,field)
78 //~ {
79 //~ //smallRedraw(style,field,"fefefe");
80 //~ sRedraw(style,field,'fefefe');
81 //~ }
84 function smallRedraw(style,field)
85 {
87 var JSONtext = document.getElementById('formValues').innerHTML;
88 var hash = new Object();
89 hash = eval('(' + JSONtext + ')');
91 var content = eval("hash."+field);
93 content = unescape(content);
95 //if (prevVal == content){return;}
97 contentRedraw(style,field, content);
100 }
104 function contentRedraw(style,field, content)
105 {
107 //var color = color;
112 posx = 10;
113 posy = 10;
114 center = 0;
115 font = 10;
116 face = 700;
117 weirdFlip = 0;
118 resize = 1;
119 width = 450;
121 getPosition(style, field);
126 target = "d_" + field;
129 var whatev = eval("typeof " + target + " != 'undefined'")
131 if (whatev){eval ("{" + target + ".remove();}");}
133 eval ( target + " = raphe.print(posx, posy, content , raphe.getFont('HelveticaNeue', face), font);" );
136 var sizzle = eval(target+".getBBox().width;");
138 document.getElementById('output').innerHTML = sizzle;
141 if (resize == 1)
143 {
148 //base case
149 if ((sizzle) > width)
150 {
152 mul = .9;
155 mul = (width/sizzle);
158 font = font * mul;
160 //eval( target + ".scale(mul,mul)" );
162 eval ( target + ".remove();");
163 eval ( target + " = raphe.print(posx, posy, content , raphe.getFont('HelveticaNeue', face), font);" );
166 }
170 }
171 eval ( target +".attr('stroke-width', 2.3 *font/385.16 + 2.3*0.311);");
172 //eval ( target +".attr('stroke-width', font/385.16 + 0.311);");
174 var sizzle = eval(target+".getBBox().width;");
176 document.getElementById('output').innerHTML = sizzle;
178 eval ( target +".attr('stroke', '#" + color + "');");
179 //eval ( target +".attr('stroke', '#fbafcd');");
181 eval ( target +".attr('fill', 'none');");
186 if (center == 1)
187 {
188 eval ("var c = " + target+".getBBox().width; " + target + ".translate((485 - c)/2,0);");
189 }
192 if (weirdFlip == 1)
193 {
194 eval("var c = "+target+".getBBox().width;");
195 eval(target+ ".translate((317 - c)/2,0);");
196 eval(target+".translate(0, -490);");
197 eval(target+".rotate(90,0,0);");
198 }
202 prevVal = content;
206 }
208 function clearAll()
209 {
210 if(typeof d_Name != 'undefined' ){d_Name.remove();}
211 if(typeof d_Company != 'undefined' ){d_Company.remove();}
212 if(typeof d_Email != 'undefined' ){d_Email.remove();}
213 if(typeof d_Occupation != 'undefined' ){d_Occupation.remove();}
214 if(typeof d_Phone != 'undefined' ){d_Phone.remove();}
215 if(typeof d_Website != 'undefined' ){d_Website.remove();}
217 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
218 }
221 function lineDraw(style, color)
222 {
228 if (style == "bold")
229 {return;}
233 if (style == "arrow")
234 {
235 d_lineArt = raphe.path("M 4 272 L 258 272");
236 d_lineArt.attr('stroke', "#" + color);
237 return;
238 }
241 if (style == "classic")
242 {return;}
245 if (style == "direct")
246 {
247 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");
248 d_lineArt.attr('stroke', "#" + color);
249 return;
250 }
252 }
256 function redraw(style)
257 {
262 if (style == "bold")
263 {
265 clearAll();
266 smallRedraw("bold","Name");
267 smallRedraw("bold","Email");
271 }
274 if (style == "arrow")
275 {
277 clearAll();
279 smallRedraw("arrow","Name");
280 smallRedraw("arrow","Email");
281 smallRedraw("arrow","Occupation");
282 smallRedraw("arrow","Company");
285 }
288 if (style == "classic")
289 {
291 clearAll();
293 smallRedraw("classic","Name");
294 smallRedraw("classic","Email");
295 smallRedraw("classic","Occupation");
296 smallRedraw("classic","Company");
297 smallRedraw("classic","Phone");
298 smallRedraw("classic","Website");
299 }
302 if (style == "direct")
303 {
305 clearAll();
307 smallRedraw("direct","Name");
308 smallRedraw("direct","Email");
309 smallRedraw("direct","Occupation");
310 smallRedraw("direct","Company");
311 smallRedraw("direct","Phone");
312 smallRedraw("direct","Website");
315 }
317 lineDraw(style, "fefefe");
321 }