view awesome_js/robert.js @ 46:26c2b3ad21c7 laserkard

[svn r47] saving progresswww.cinemassacre.com/new/?page_id=30
author rlm
date Sun, 31 Jan 2010 12:33:33 -0500
parents 1045db9799e3
children 4431dc7d4bb5
line wrap: on
line source




5 function stabForm(ID)
6 {
7 var JSONtext = document.getElementById('formValues').innerHTML;
8 var hash = new Object();
9 hash = eval('(' + JSONtext + ')');
11 propertyValue = document.getElementById(ID).value;
12 propertyName = ID;
13 propertyValue = escape(propertyValue);
15 eval("hash."+propertyName+"='"+propertyValue+"'");
17 var JSONtext = document.getElementById('formValues').innerHTML = JSON.stringify(hash);
18 }
22 function getPosition(style, field)
23 {
25 var cardType = eval ("laserkard." + style);
28 if ( eval("typeof cardType." + field + " != 'undefined'")) //shouldn't ever really matter
29 {
30 values = eval("cardType." + field);
32 if (typeof values.posx != 'undefined'){posx = values.posx;}
33 if (typeof values.posy != 'undefined'){posy = values.posy;}
34 if (typeof values.center != 'undefined'){center = values.center;}
35 if (typeof values.font != 'undefined'){font = values.font;}
36 if (typeof values.weirdFlip != 'undefined'){weirdFlip = values.weirdFlip;}
37 }
40 }
45 function smallRedraw(style,field)
46 {
48 var JSONtext = document.getElementById('formValues').innerHTML;
49 var hash = new Object();
50 hash = eval('(' + JSONtext + ')');
52 var content = eval("hash."+field);
54 content = unescape(content);
56 posx = 10;
57 posy = 10;
58 center = 0;
59 font = 10;
60 face = 700;
61 weirdFlip = 0;
63 getPosition(style, field);
65 target = "d_" + field;
68 var whatev = eval("typeof " + target + " != 'undefined'")
70 if (whatev){eval ("{" + target + ".remove();}");}
72 eval ( target + " = raphe.print(posx, posy, content , raphe.getFont('HelveticaNeue', face), font);" );
75 eval ( target +".attr('stroke', '#6a6a6a');");
76 eval ( target +".attr('fill', 'none');");
79 if (center == 1)
80 {
81 eval ("var c = " + target+".getBBox().width; " + target + ".translate((485 - c)/2,0);");
82 }
85 if (weirdFlip == 1)
86 {
87 eval("var c = "+target+".getBBox().width;");
88 eval(target+ ".translate((317 - c)/2,0);");
89 eval(target+".translate(0, -490);");
90 eval(target+".rotate(90,0,0);");
91 }
97 }
99 function clearAll()
100 {
101 if(typeof d_Name != 'undefined' ){d_Name.remove();}
102 if(typeof d_Company != 'undefined' ){d_Company.remove();}
103 if(typeof d_Email != 'undefined' ){d_Email.remove();}
104 if(typeof d_Occupation != 'undefined' ){d_Occupation.remove();}
105 if(typeof d_Phone != 'undefined' ){d_Phone.remove();}
106 if(typeof d_Website != 'undefined' ){d_Website.remove();}
108 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
109 }
111 function redraw(style)
112 {
117 if (style == "bold")
118 {
120 clearAll();
121 smallRedraw("bold","Name");
122 smallRedraw("bold","Email");
126 }
129 if (style == "arrow")
130 {
132 clearAll();
134 smallRedraw("arrow","Name");
135 smallRedraw("arrow","Email");
136 smallRedraw("arrow","Occupation");
137 smallRedraw("arrow","Company");
140 d_lineArt = raphe.path("M 2 272 L 258 272");
141 d_lineArt.attr('stroke', '#6a6a6a');
143 }
146 if (style == "classic")
147 {
149 clearAll();
151 smallRedraw("classic","Name");
152 smallRedraw("classic","Email");
153 smallRedraw("classic","Occupation");
154 smallRedraw("classic","Company");
155 smallRedraw("classic","Phone");
156 smallRedraw("classic","Website");
157 }
160 if (style == "direct")
161 {
163 clearAll();
165 smallRedraw("direct","Name");
166 smallRedraw("direct","Email");
167 smallRedraw("direct","Occupation");
168 smallRedraw("direct","Company");
169 smallRedraw("direct","Phone");
170 smallRedraw("direct","Website");
172 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");
173 d_lineArt.attr('stroke', '#6a6a6a');
177 }
183 }