view awesome_js/robert.js @ 47:4431dc7d4bb5 laserkard

[svn r48] almost fixed "hover over" bug
author rlm
date Sun, 31 Jan 2010 14:21:14 -0500
parents 26c2b3ad21c7
children b2a11435a89b
line wrap: on
line source

2 descHash = new Object();
7 descHash.classic_acrylic_clear =
8 "<h1>The Classic LaserKard.</h1>Balanced and Complete. The original LaserKard. For those that wish to leave no stone unturned. It's all there.";
10 descHash.big_acrylic_clear =
11 "<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.";
13 descHash.basic_acrylic_clear =
14 "<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.";
16 descHash.lines_acrylic_clear =
17 "<h1>The Direct Kard.</h1>Thorough and Distinct. For those that aim to demonstrate their professionalism with style. Push the envelope. Be Direct.";
24 function pokedex(target)
25 {
28 var description = eval ("descHash." + target);
30 document.getElementById('pokedex').innerHTML = description;
32 }
36 function stabForm(ID)
37 {
38 var JSONtext = document.getElementById('formValues').innerHTML;
39 var hash = new Object();
40 hash = eval('(' + JSONtext + ')');
42 propertyValue = document.getElementById(ID).value;
43 propertyName = ID;
44 propertyValue = escape(propertyValue);
46 eval("hash."+propertyName+"='"+propertyValue+"'");
48 var JSONtext = document.getElementById('formValues').innerHTML = JSON.stringify(hash);
49 }
53 function getPosition(style, field)
54 {
56 var cardType = eval ("laserkard." + style);
59 if ( eval("typeof cardType." + field + " != 'undefined'")) //shouldn't ever really matter
60 {
61 values = eval("cardType." + field);
63 if (typeof values.posx != 'undefined'){posx = values.posx;}
64 if (typeof values.posy != 'undefined'){posy = values.posy;}
65 if (typeof values.center != 'undefined'){center = values.center;}
66 if (typeof values.font != 'undefined'){font = values.font;}
67 if (typeof values.weirdFlip != 'undefined'){weirdFlip = values.weirdFlip;}
68 }
71 }
76 function smallRedraw(style,field)
77 {
79 var JSONtext = document.getElementById('formValues').innerHTML;
80 var hash = new Object();
81 hash = eval('(' + JSONtext + ')');
83 var content = eval("hash."+field);
85 content = unescape(content);
87 posx = 10;
88 posy = 10;
89 center = 0;
90 font = 10;
91 face = 700;
92 weirdFlip = 0;
94 getPosition(style, field);
96 target = "d_" + field;
99 var whatev = eval("typeof " + target + " != 'undefined'")
101 if (whatev){eval ("{" + target + ".remove();}");}
103 eval ( target + " = raphe.print(posx, posy, content , raphe.getFont('HelveticaNeue', face), font);" );
106 eval ( target +".attr('stroke', '#6a6a6a');");
107 eval ( target +".attr('fill', 'none');");
110 if (center == 1)
111 {
112 eval ("var c = " + target+".getBBox().width; " + target + ".translate((485 - c)/2,0);");
113 }
116 if (weirdFlip == 1)
117 {
118 eval("var c = "+target+".getBBox().width;");
119 eval(target+ ".translate((317 - c)/2,0);");
120 eval(target+".translate(0, -490);");
121 eval(target+".rotate(90,0,0);");
122 }
128 }
130 function clearAll()
131 {
132 if(typeof d_Name != 'undefined' ){d_Name.remove();}
133 if(typeof d_Company != 'undefined' ){d_Company.remove();}
134 if(typeof d_Email != 'undefined' ){d_Email.remove();}
135 if(typeof d_Occupation != 'undefined' ){d_Occupation.remove();}
136 if(typeof d_Phone != 'undefined' ){d_Phone.remove();}
137 if(typeof d_Website != 'undefined' ){d_Website.remove();}
139 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
140 }
142 function redraw(style)
143 {
148 if (style == "bold")
149 {
151 clearAll();
152 smallRedraw("bold","Name");
153 smallRedraw("bold","Email");
157 }
160 if (style == "arrow")
161 {
163 clearAll();
165 smallRedraw("arrow","Name");
166 smallRedraw("arrow","Email");
167 smallRedraw("arrow","Occupation");
168 smallRedraw("arrow","Company");
171 d_lineArt = raphe.path("M 2 272 L 258 272");
172 d_lineArt.attr('stroke', '#6a6a6a');
174 }
177 if (style == "classic")
178 {
180 clearAll();
182 smallRedraw("classic","Name");
183 smallRedraw("classic","Email");
184 smallRedraw("classic","Occupation");
185 smallRedraw("classic","Company");
186 smallRedraw("classic","Phone");
187 smallRedraw("classic","Website");
188 }
191 if (style == "direct")
192 {
194 clearAll();
196 smallRedraw("direct","Name");
197 smallRedraw("direct","Email");
198 smallRedraw("direct","Occupation");
199 smallRedraw("direct","Company");
200 smallRedraw("direct","Phone");
201 smallRedraw("direct","Website");
203 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");
204 d_lineArt.attr('stroke', '#6a6a6a');
208 }
214 }