rlm@29
|
1
|
rlm@42
|
2 function defaults()
|
rlm@42
|
3 {
|
rlm@42
|
4 alias = "Robert Mac";
|
rlm@42
|
5 email = "rlm@mit.edu";
|
rlm@42
|
6 occupation = "";
|
rlm@42
|
7 company = "";
|
rlm@42
|
8 phone = "";
|
rlm@42
|
9 website = "";
|
rlm@42
|
10 lineArt = "";
|
rlm@42
|
11 }
|
rlm@29
|
12
|
rlm@29
|
13
|
rlm@44
|
14
|
rlm@44
|
15 function stabForm(ID)
|
rlm@42
|
16 {
|
rlm@44
|
17 var JSONtext = document.getElementById('formValues').innerHTML;
|
rlm@44
|
18 var hash = new Object();
|
rlm@44
|
19 hash = eval('(' + JSONtext + ')');
|
rlm@44
|
20
|
rlm@44
|
21 propertyValue = document.getElementById(ID).value;
|
rlm@44
|
22 propertyName = ID;
|
rlm@44
|
23 propertyValue = escape(propertyValue);
|
rlm@44
|
24
|
rlm@44
|
25 eval("hash."+propertyName+"='"+propertyValue+"'");
|
rlm@42
|
26
|
rlm@44
|
27 var JSONtext = document.getElementById('formValues').innerHTML = JSON.stringify(hash);
|
rlm@44
|
28 }
|
rlm@44
|
29
|
rlm@44
|
30
|
rlm@44
|
31
|
rlm@44
|
32 function getPosition(style, field)
|
rlm@44
|
33 {
|
rlm@44
|
34
|
rlm@44
|
35 var cardType = eval ("laserkard." + style);
|
rlm@44
|
36
|
rlm@44
|
37
|
rlm@44
|
38 if ( eval("typeof cardType." + field + " != 'undefined'")) //shouldn't ever really matter
|
rlm@44
|
39 {
|
rlm@44
|
40 values = eval("cardType." + field);
|
rlm@44
|
41
|
rlm@44
|
42 if (typeof values.posx != 'undefined'){posx = values.posx;}
|
rlm@44
|
43 if (typeof values.posy != 'undefined'){posy = values.posy;}
|
rlm@44
|
44 if (typeof values.center != 'undefined'){center = values.center;}
|
rlm@44
|
45 if (typeof values.font != 'undefined'){font = values.font;}
|
rlm@44
|
46 if (typeof values.weirdFlip != 'undefined'){weirdFlip = values.weirdFlip;}
|
rlm@44
|
47 }
|
rlm@44
|
48
|
rlm@44
|
49
|
rlm@44
|
50 }
|
rlm@44
|
51
|
rlm@44
|
52
|
rlm@44
|
53
|
rlm@44
|
54
|
rlm@44
|
55 function smallRedraw(style,field)
|
rlm@44
|
56 {
|
rlm@44
|
57
|
rlm@44
|
58 var JSONtext = document.getElementById('formValues').innerHTML;
|
rlm@44
|
59 var hash = new Object();
|
rlm@44
|
60 hash = eval('(' + JSONtext + ')');
|
rlm@44
|
61
|
rlm@44
|
62 var content = eval("hash."+field);
|
rlm@44
|
63
|
rlm@44
|
64 content = unescape(content);
|
rlm@44
|
65
|
rlm@44
|
66 posx = 10;
|
rlm@44
|
67 posy = 10;
|
rlm@44
|
68 center = 0;
|
rlm@44
|
69 font = 10;
|
rlm@44
|
70 face = 700;
|
rlm@44
|
71 weirdFlip = 0;
|
rlm@44
|
72
|
rlm@44
|
73 getPosition(style, field);
|
rlm@44
|
74
|
rlm@44
|
75 target = "d_" + field;
|
rlm@44
|
76
|
rlm@44
|
77
|
rlm@44
|
78 var whatev = eval("typeof " + target + " != 'undefined'")
|
rlm@44
|
79
|
rlm@44
|
80 if (whatev){eval ("{" + target + ".remove();}");}
|
rlm@44
|
81
|
rlm@44
|
82 eval ( target + " = raphe.print(posx, posy, content , raphe.getFont('HelveticaNeue', face), font);" );
|
rlm@44
|
83
|
rlm@44
|
84
|
rlm@44
|
85 eval ( target +".attr('stroke', '#6a6a6a');");
|
rlm@44
|
86 eval ( target +".attr('fill', 'none');");
|
rlm@44
|
87
|
rlm@44
|
88
|
rlm@44
|
89 if (center == 1)
|
rlm@44
|
90 {
|
rlm@44
|
91 eval ("var c = " + target+".getBBox().width; " + target + ".translate((485 - c)/2,0);");
|
rlm@44
|
92 }
|
rlm@44
|
93
|
rlm@44
|
94
|
rlm@44
|
95 if (weirdFlip == 1)
|
rlm@44
|
96 {
|
rlm@44
|
97 eval("var c = "+target+".getBBox().width;");
|
rlm@44
|
98 eval(target+ ".translate((317 - c)/2,0);");
|
rlm@44
|
99 eval(target+".translate(0, -490);");
|
rlm@44
|
100 eval(target+".rotate(90,0,0);");
|
rlm@44
|
101 }
|
rlm@44
|
102
|
rlm@44
|
103
|
rlm@44
|
104
|
rlm@44
|
105
|
rlm@44
|
106
|
rlm@44
|
107 }
|
rlm@44
|
108
|
rlm@44
|
109 function clearAll()
|
rlm@44
|
110 {
|
rlm@44
|
111 if(typeof d_Name != 'undefined' ){d_Name.remove();}
|
rlm@44
|
112 if(typeof d_Company != 'undefined' ){d_Company.remove();}
|
rlm@44
|
113 if(typeof d_Email != 'undefined' ){d_Email.remove();}
|
rlm@44
|
114 if(typeof d_Occupation != 'undefined' ){d_Occupation.remove();}
|
rlm@44
|
115 if(typeof d_Phone != 'undefined' ){d_Phone.remove();}
|
rlm@44
|
116 if(typeof d_Website != 'undefined' ){d_Website.remove();}
|
rlm@44
|
117
|
rlm@44
|
118 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
|
rlm@42
|
119 }
|
rlm@42
|
120
|
rlm@42
|
121 function redraw(style)
|
rlm@42
|
122 {
|
rlm@42
|
123
|
rlm@43
|
124
|
rlm@43
|
125
|
rlm@43
|
126
|
rlm@42
|
127 if (style == "bold")
|
rlm@42
|
128 {
|
rlm@42
|
129
|
rlm@44
|
130 clearAll();
|
rlm@44
|
131 smallRedraw("bold","Name");
|
rlm@44
|
132 smallRedraw("bold","Email");
|
rlm@42
|
133
|
rlm@42
|
134
|
rlm@42
|
135
|
rlm@42
|
136 }
|
rlm@42
|
137
|
rlm@42
|
138
|
rlm@42
|
139 if (style == "arrow")
|
rlm@42
|
140 {
|
rlm@42
|
141
|
rlm@44
|
142 clearAll();
|
rlm@42
|
143
|
rlm@44
|
144 smallRedraw("arrow","Name");
|
rlm@44
|
145 smallRedraw("arrow","Email");
|
rlm@44
|
146 smallRedraw("arrow","Occupation");
|
rlm@44
|
147 smallRedraw("arrow","Company");
|
rlm@42
|
148
|
rlm@43
|
149
|
rlm@42
|
150 d_lineArt = raphe.path("M 2 272 L 258 272");
|
rlm@42
|
151 d_lineArt.attr('stroke', '#6a6a6a');
|
rlm@42
|
152
|
rlm@42
|
153 }
|
rlm@42
|
154
|
rlm@42
|
155
|
rlm@42
|
156 if (style == "classic")
|
rlm@42
|
157 {
|
rlm@42
|
158
|
rlm@44
|
159 clearAll();
|
rlm@42
|
160
|
rlm@44
|
161 smallRedraw("classic","Name");
|
rlm@44
|
162 smallRedraw("classic","Email");
|
rlm@44
|
163 smallRedraw("classic","Occupation");
|
rlm@44
|
164 smallRedraw("classic","Company");
|
rlm@44
|
165 smallRedraw("classic","Phone");
|
rlm@44
|
166 smallRedraw("classic","Website");
|
rlm@42
|
167 }
|
rlm@42
|
168
|
rlm@42
|
169
|
rlm@42
|
170 if (style == "direct")
|
rlm@42
|
171 {
|
rlm@42
|
172
|
rlm@44
|
173 clearAll();
|
rlm@42
|
174
|
rlm@44
|
175 smallRedraw("direct","Name");
|
rlm@44
|
176 smallRedraw("direct","Email");
|
rlm@44
|
177 smallRedraw("direct","Occupation");
|
rlm@44
|
178 smallRedraw("direct","Company");
|
rlm@44
|
179 smallRedraw("direct","Phone");
|
rlm@44
|
180 smallRedraw("direct","Website");
|
rlm@42
|
181
|
rlm@42
|
182 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");
|
rlm@42
|
183 d_lineArt.attr('stroke', '#6a6a6a');
|
rlm@42
|
184
|
rlm@42
|
185
|
rlm@42
|
186
|
rlm@42
|
187 }
|
rlm@42
|
188
|
rlm@42
|
189
|
rlm@42
|
190
|
rlm@42
|
191
|
rlm@42
|
192
|
rlm@42
|
193 }
|
rlm@42
|
194
|
rlm@42
|
195
|