annotate awesome_js/robert.js @ 58:9d156039944e laserkard

[svn r59] final modifacatios wqith kevin
author rlm
date Sun, 14 Mar 2010 01:51:23 -0500
parents 2ca94aa58033
children 14271eedf004
rev   line source
rlm@29 1
rlm@47 2 descHash = new Object();
rlm@47 3
rlm@48 4 prevVal = "";
rlm@47 5
rlm@47 6
rlm@47 7
rlm@47 8 descHash.classic_acrylic_clear =
rlm@47 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.";
rlm@47 10
rlm@47 11 descHash.big_acrylic_clear =
rlm@47 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.";
rlm@47 13
rlm@47 14 descHash.basic_acrylic_clear =
rlm@47 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.";
rlm@47 16
rlm@47 17 descHash.lines_acrylic_clear =
rlm@47 18 "<h1>The Direct Kard.</h1>Thorough and Distinct. For those that aim to demonstrate their professionalism with style. Push the envelope. Be Direct.";
rlm@47 19
rlm@51 20 color = 'fefefe';
rlm@47 21
rlm@47 22
rlm@47 23
rlm@47 24
rlm@47 25 function pokedex(target)
rlm@47 26 {
rlm@47 27
rlm@47 28
rlm@47 29 var description = eval ("descHash." + target);
rlm@47 30
rlm@47 31 document.getElementById('pokedex').innerHTML = description;
rlm@47 32
rlm@47 33 }
rlm@29 34
rlm@29 35
rlm@44 36
rlm@44 37 function stabForm(ID)
rlm@42 38 {
rlm@44 39 var JSONtext = document.getElementById('formValues').innerHTML;
rlm@44 40 var hash = new Object();
rlm@44 41 hash = eval('(' + JSONtext + ')');
rlm@44 42
rlm@44 43 propertyValue = document.getElementById(ID).value;
rlm@44 44 propertyName = ID;
rlm@44 45 propertyValue = escape(propertyValue);
rlm@44 46
rlm@44 47 eval("hash."+propertyName+"='"+propertyValue+"'");
rlm@42 48
rlm@44 49 var JSONtext = document.getElementById('formValues').innerHTML = JSON.stringify(hash);
rlm@44 50 }
rlm@44 51
rlm@44 52
rlm@44 53
rlm@44 54 function getPosition(style, field)
rlm@44 55 {
rlm@44 56
rlm@44 57 var cardType = eval ("laserkard." + style);
rlm@44 58
rlm@44 59
rlm@44 60 if ( eval("typeof cardType." + field + " != 'undefined'")) //shouldn't ever really matter
rlm@44 61 {
rlm@44 62 values = eval("cardType." + field);
rlm@44 63
rlm@44 64 if (typeof values.posx != 'undefined'){posx = values.posx;}
rlm@44 65 if (typeof values.posy != 'undefined'){posy = values.posy;}
rlm@44 66 if (typeof values.center != 'undefined'){center = values.center;}
rlm@44 67 if (typeof values.font != 'undefined'){font = values.font;}
rlm@48 68 if (typeof values.face != 'undefined'){face = values.face;}
rlm@48 69 if (typeof values.width != 'undefined'){width = values.width;}
rlm@44 70 if (typeof values.weirdFlip != 'undefined'){weirdFlip = values.weirdFlip;}
rlm@48 71 if (typeof values.resize != 'undefined'){resize = values.resize;}
rlm@44 72 }
rlm@44 73
rlm@44 74
rlm@44 75 }
rlm@44 76
rlm@51 77 //~ function smallRedraw(style,field)
rlm@51 78 //~ {
rlm@51 79 //~ //smallRedraw(style,field,"fefefe");
rlm@51 80 //~ sRedraw(style,field,'fefefe');
rlm@51 81 //~ }
rlm@44 82
rlm@44 83
rlm@44 84 function smallRedraw(style,field)
rlm@44 85 {
rlm@51 86
rlm@44 87 var JSONtext = document.getElementById('formValues').innerHTML;
rlm@44 88 var hash = new Object();
rlm@44 89 hash = eval('(' + JSONtext + ')');
rlm@44 90
rlm@44 91 var content = eval("hash."+field);
rlm@44 92
rlm@44 93 content = unescape(content);
rlm@44 94
rlm@51 95 //if (prevVal == content){return;}
rlm@51 96
rlm@51 97 contentRedraw(style,field, content);
rlm@51 98
rlm@51 99
rlm@51 100 }
rlm@51 101
rlm@51 102
rlm@51 103
rlm@51 104 function contentRedraw(style,field, content)
rlm@51 105 {
rlm@51 106
rlm@51 107 //var color = color;
rlm@51 108
rlm@51 109
rlm@51 110
rlm@48 111
rlm@44 112 posx = 10;
rlm@44 113 posy = 10;
rlm@44 114 center = 0;
rlm@44 115 font = 10;
rlm@44 116 face = 700;
rlm@44 117 weirdFlip = 0;
rlm@48 118 resize = 1;
rlm@48 119 width = 450;
rlm@44 120
rlm@44 121 getPosition(style, field);
rlm@44 122
rlm@48 123
rlm@48 124
rlm@48 125
rlm@44 126 target = "d_" + field;
rlm@44 127
rlm@44 128
rlm@44 129 var whatev = eval("typeof " + target + " != 'undefined'")
rlm@44 130
rlm@44 131 if (whatev){eval ("{" + target + ".remove();}");}
rlm@44 132
rlm@44 133 eval ( target + " = raphe.print(posx, posy, content , raphe.getFont('HelveticaNeue', face), font);" );
rlm@44 134
rlm@48 135
rlm@48 136 var sizzle = eval(target+".getBBox().width;");
rlm@48 137
rlm@48 138 document.getElementById('output').innerHTML = sizzle;
rlm@48 139
rlm@48 140
rlm@48 141 if (resize == 1)
rlm@48 142
rlm@48 143 {
rlm@48 144
rlm@48 145
rlm@48 146
rlm@48 147
rlm@48 148 //base case
rlm@48 149 if ((sizzle) > width)
rlm@48 150 {
rlm@48 151
rlm@48 152 mul = .9;
rlm@48 153
rlm@48 154
rlm@48 155 mul = (width/sizzle);
rlm@48 156
rlm@48 157
rlm@48 158 font = font * mul;
rlm@48 159
rlm@48 160 //eval( target + ".scale(mul,mul)" );
rlm@48 161
rlm@48 162 eval ( target + ".remove();");
rlm@56 163 eval ( target + " = raphe.print(posx, posy, content , raphe.getFont('HelveticaNeue', face), font);" );
rlm@48 164
rlm@48 165
rlm@48 166 }
rlm@48 167
rlm@48 168
rlm@48 169
rlm@48 170 }
rlm@56 171 eval ( target +".attr('stroke-width', 2.3 *font/385.16 + 2.3*0.311);");
rlm@56 172 //eval ( target +".attr('stroke-width', font/385.16 + 0.311);");
rlm@48 173
rlm@48 174 var sizzle = eval(target+".getBBox().width;");
rlm@48 175
rlm@48 176 document.getElementById('output').innerHTML = sizzle;
rlm@48 177
rlm@51 178 eval ( target +".attr('stroke', '#" + color + "');");
rlm@48 179 //eval ( target +".attr('stroke', '#fbafcd');");
rlm@48 180
rlm@44 181 eval ( target +".attr('fill', 'none');");
rlm@44 182
rlm@44 183
rlm@48 184
rlm@48 185
rlm@44 186 if (center == 1)
rlm@44 187 {
rlm@44 188 eval ("var c = " + target+".getBBox().width; " + target + ".translate((485 - c)/2,0);");
rlm@44 189 }
rlm@44 190
rlm@44 191
rlm@44 192 if (weirdFlip == 1)
rlm@44 193 {
rlm@44 194 eval("var c = "+target+".getBBox().width;");
rlm@44 195 eval(target+ ".translate((317 - c)/2,0);");
rlm@44 196 eval(target+".translate(0, -490);");
rlm@44 197 eval(target+".rotate(90,0,0);");
rlm@44 198 }
rlm@44 199
rlm@44 200
rlm@44 201
rlm@48 202 prevVal = content;
rlm@48 203
rlm@44 204
rlm@44 205
rlm@44 206 }
rlm@44 207
rlm@44 208 function clearAll()
rlm@44 209 {
rlm@44 210 if(typeof d_Name != 'undefined' ){d_Name.remove();}
rlm@44 211 if(typeof d_Company != 'undefined' ){d_Company.remove();}
rlm@44 212 if(typeof d_Email != 'undefined' ){d_Email.remove();}
rlm@44 213 if(typeof d_Occupation != 'undefined' ){d_Occupation.remove();}
rlm@44 214 if(typeof d_Phone != 'undefined' ){d_Phone.remove();}
rlm@44 215 if(typeof d_Website != 'undefined' ){d_Website.remove();}
rlm@44 216
rlm@44 217 if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
rlm@42 218 }
rlm@42 219
rlm@51 220
rlm@51 221 function lineDraw(style, color)
rlm@51 222 {
rlm@51 223
rlm@51 224
rlm@51 225
rlm@51 226
rlm@51 227
rlm@51 228 if (style == "bold")
rlm@51 229 {return;}
rlm@51 230
rlm@51 231
rlm@51 232
rlm@51 233 if (style == "arrow")
rlm@51 234 {
rlm@51 235 d_lineArt = raphe.path("M 4 272 L 258 272");
rlm@51 236 d_lineArt.attr('stroke', "#" + color);
rlm@51 237 return;
rlm@51 238 }
rlm@51 239
rlm@51 240
rlm@51 241 if (style == "classic")
rlm@51 242 {return;}
rlm@51 243
rlm@51 244
rlm@51 245 if (style == "direct")
rlm@51 246 {
rlm@51 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");
rlm@51 248 d_lineArt.attr('stroke', "#" + color);
rlm@51 249 return;
rlm@51 250 }
rlm@51 251
rlm@51 252 }
rlm@51 253
rlm@51 254
rlm@51 255
rlm@42 256 function redraw(style)
rlm@42 257 {
rlm@42 258
rlm@43 259
rlm@43 260
rlm@43 261
rlm@42 262 if (style == "bold")
rlm@42 263 {
rlm@42 264
rlm@44 265 clearAll();
rlm@44 266 smallRedraw("bold","Name");
rlm@44 267 smallRedraw("bold","Email");
rlm@42 268
rlm@42 269
rlm@42 270
rlm@42 271 }
rlm@42 272
rlm@42 273
rlm@42 274 if (style == "arrow")
rlm@42 275 {
rlm@42 276
rlm@44 277 clearAll();
rlm@42 278
rlm@44 279 smallRedraw("arrow","Name");
rlm@44 280 smallRedraw("arrow","Email");
rlm@44 281 smallRedraw("arrow","Occupation");
rlm@44 282 smallRedraw("arrow","Company");
rlm@42 283
rlm@43 284
rlm@42 285 }
rlm@42 286
rlm@42 287
rlm@42 288 if (style == "classic")
rlm@42 289 {
rlm@42 290
rlm@44 291 clearAll();
rlm@42 292
rlm@44 293 smallRedraw("classic","Name");
rlm@44 294 smallRedraw("classic","Email");
rlm@44 295 smallRedraw("classic","Occupation");
rlm@44 296 smallRedraw("classic","Company");
rlm@44 297 smallRedraw("classic","Phone");
rlm@44 298 smallRedraw("classic","Website");
rlm@42 299 }
rlm@42 300
rlm@42 301
rlm@42 302 if (style == "direct")
rlm@42 303 {
rlm@42 304
rlm@44 305 clearAll();
rlm@42 306
rlm@44 307 smallRedraw("direct","Name");
rlm@44 308 smallRedraw("direct","Email");
rlm@44 309 smallRedraw("direct","Occupation");
rlm@44 310 smallRedraw("direct","Company");
rlm@44 311 smallRedraw("direct","Phone");
rlm@44 312 smallRedraw("direct","Website");
rlm@42 313
rlm@42 314
rlm@42 315 }
rlm@42 316
rlm@51 317 lineDraw(style, "fefefe");
rlm@42 318
rlm@42 319
rlm@42 320
rlm@42 321 }
rlm@42 322
rlm@42 323