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