diff awesome_js/robert.js @ 42:ef8615de8a9c laserkard

[svn r43] implemented form memory
author rlm
date Wed, 27 Jan 2010 22:04:43 -0500
parents 1ac1409ea68c
children 329638a361cc
line wrap: on
line diff
     1.1 --- a/awesome_js/robert.js	Mon Jan 25 13:38:05 2010 -0500
     1.2 +++ b/awesome_js/robert.js	Wed Jan 27 22:04:43 2010 -0500
     1.3 @@ -1,9 +1,258 @@
     1.4  
     1.5  
     1.6 -window.Robert = (function () {
     1.7  
     1.8 +function defaults()
     1.9 +{
    1.10 +alias = "Robert Mac";
    1.11 +email = "rlm@mit.edu";
    1.12 +occupation = "";
    1.13 +company = "";
    1.14 +phone = "";
    1.15 +website = "";
    1.16 +lineArt = "";
    1.17 +}
    1.18  
    1.19 -var separator = /[, ]+/,
    1.20 -        elements = /^(circle|rect|path|ellipse|text|image)$/,
    1.21  
    1.22 -Paper = function () {},
    1.23 +function drawElement(obj)
    1.24 +{
    1.25 +	
    1.26 +}
    1.27 +
    1.28 +function redraw(style)
    1.29 +{
    1.30 +
    1.31 +if (style == "bold")
    1.32 +{
    1.33 +	
    1.34 +
    1.35 +
    1.36 +if(typeof d_alias != 'undefined' ){d_alias.remove();}
    1.37 +if(typeof d_email != 'undefined' ){d_email.remove();}
    1.38 +if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
    1.39 +if(typeof d_company != 'undefined' ){d_company.remove();}
    1.40 +if(typeof d_phone != 'undefined' ){d_phone.remove();}
    1.41 +if(typeof d_website != 'undefined' ){d_website.remove();}
    1.42 +if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
    1.43 +
    1.44 +
    1.45 +
    1.46 +var oText = document.getElementById('Name');
    1.47 +var text_val = oText.value; 
    1.48 +d_alias = raphe.print(10, 160, text_val, raphe.getFont('HelveticaNeue', 700), 60);
    1.49 +d_alias.attr('stroke', '#6a6a6a');
    1.50 +d_alias.attr('fill', 'none')
    1.51 +var c = d_alias.getBBox().width;
    1.52 +d_alias.translate((485 - c)/2,0);
    1.53 +
    1.54 +	
    1.55 +var oText = document.getElementById('Email');
    1.56 +var text_val = oText.value; 
    1.57 +
    1.58 +d_email = raphe.print(280, 270, text_val, raphe.getFont("HelveticaNeue", 700), 25);
    1.59 +d_email.attr('stroke', '#6a6a6a');
    1.60 +d_email.attr('fill', 'TRANSPARENT');
    1.61 +
    1.62 +
    1.63 +
    1.64 +	
    1.65 +}
    1.66 +
    1.67 +
    1.68 +if (style == "arrow")
    1.69 +{
    1.70 +	
    1.71 +if(typeof d_alias != 'undefined' ){d_alias.remove();}
    1.72 +if(typeof d_email != 'undefined' ){d_email.remove();}
    1.73 +if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
    1.74 +if(typeof d_company != 'undefined' ){d_company.remove();}
    1.75 +if(typeof d_phone != 'undefined' ){d_phone.remove();}
    1.76 +if(typeof d_website != 'undefined' ){d_website.remove();}
    1.77 +if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
    1.78 +
    1.79 +
    1.80 +var oText = document.getElementById('Name');
    1.81 +var text_val = oText.value; 
    1.82 +d_alias = raphe.print(40, 110, text_val, raphe.getFont('HelveticaNeue', 700), 55);
    1.83 +d_alias.attr('stroke', '#6a6a6a');
    1.84 +d_alias.attr('fill', 'none')
    1.85 +
    1.86 +
    1.87 +
    1.88 +var oText = document.getElementById('Company');
    1.89 +var text_val = oText.value; 
    1.90 +
    1.91 +d_company = raphe.print(40, 155, text_val, raphe.getFont("HelveticaNeue", 700), 27);
    1.92 +d_company.attr('stroke', '#6a6a6a');
    1.93 +d_company.attr('fill', 'TRANSPARENT');
    1.94 +
    1.95 +
    1.96 +var oText = document.getElementById('Occupation');
    1.97 +var text_val = oText.value; 
    1.98 +
    1.99 +d_occupation = raphe.print(40, 190, text_val, raphe.getFont("HelveticaNeue", 700), 27);
   1.100 +d_occupation.attr('stroke', '#6a6a6a');
   1.101 +d_occupation.attr('fill', 'TRANSPARENT');
   1.102 +
   1.103 +
   1.104 +var oText = document.getElementById('Email');
   1.105 +var text_val = oText.value; 
   1.106 +
   1.107 +d_email = raphe.print(280, 270, text_val, raphe.getFont("HelveticaNeue", 700), 25);
   1.108 +d_email.attr('stroke', '#6a6a6a');
   1.109 +d_email.attr('fill', 'TRANSPARENT');
   1.110 +
   1.111 +
   1.112 +d_lineArt = raphe.path("M 2 272 L 258 272");
   1.113 +d_lineArt.attr('stroke', '#6a6a6a');
   1.114 +	
   1.115 +}
   1.116 +
   1.117 +
   1.118 +if (style == "classic")
   1.119 +{
   1.120 +	
   1.121 +if(typeof d_alias != 'undefined' ){d_alias.remove();}
   1.122 +if(typeof d_email != 'undefined' ){d_email.remove();}
   1.123 +if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
   1.124 +if(typeof d_company != 'undefined' ){d_company.remove();}
   1.125 +if(typeof d_phone != 'undefined' ){d_phone.remove();}
   1.126 +if(typeof d_website != 'undefined' ){d_website.remove();}
   1.127 +if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
   1.128 +
   1.129 +
   1.130 +var oText = document.getElementById('Email');
   1.131 +var text_val = oText.value; 
   1.132 +
   1.133 +d_email = raphe.print(0, 42, text_val, raphe.getFont("HelveticaNeue", 700), 29);
   1.134 +d_email.attr('stroke', '#6a6a6a');
   1.135 +d_email.attr('fill', 'TRANSPARENT');
   1.136 +var c = d_email.getBBox().width;
   1.137 +d_email.translate((510 - c)/2,0);
   1.138 +
   1.139 +
   1.140 +var oText = document.getElementById('Phone');
   1.141 +var text_val = oText.value; 
   1.142 +
   1.143 +d_phone = raphe.print(0, 75, text_val, raphe.getFont("HelveticaNeue", 700), 27);
   1.144 +d_phone.attr('stroke', '#6a6a6a');
   1.145 +d_phone.attr('fill', 'TRANSPARENT');
   1.146 +var c = d_phone.getBBox().width;
   1.147 +d_phone.translate((510 - c)/2,0);
   1.148 +
   1.149 +
   1.150 +
   1.151 +
   1.152 +var oText = document.getElementById('Name');
   1.153 +var text_val = oText.value; 
   1.154 +d_alias = raphe.print(0, 164, text_val, raphe.getFont('HelveticaNeue', 800), 47);
   1.155 +d_alias.attr('stroke', '#6a6a6a');
   1.156 +d_alias.attr('fill', 'none')
   1.157 +var c = d_alias.getBBox().width;
   1.158 +d_alias.translate((510 - c)/2,0);
   1.159 +
   1.160 +
   1.161 +var oText = document.getElementById('Company');
   1.162 +var text_val = oText.value; 
   1.163 +d_company = raphe.print(0, 247, text_val, raphe.getFont("HelveticaNeue", 700), 27);
   1.164 +d_company.attr('stroke', '#6a6a6a');
   1.165 +d_company.attr('fill', 'TRANSPARENT');
   1.166 +var c = d_company.getBBox().width;
   1.167 +d_company.translate((510 - c)/2,0);
   1.168 +
   1.169 +
   1.170 +var oText = document.getElementById('Occupation');
   1.171 +var text_val = oText.value; 
   1.172 +
   1.173 +d_occupation = raphe.print(0, 278, text_val, raphe.getFont("HelveticaNeue", 700), 27);
   1.174 +d_occupation.attr('stroke', '#6a6a6a');
   1.175 +d_occupation.attr('fill', 'TRANSPARENT');
   1.176 +var c = d_occupation.getBBox().width;
   1.177 +d_occupation.translate((510 - c)/2,0);
   1.178 +
   1.179 +
   1.180 +
   1.181 +
   1.182 +var oText = document.getElementById('Website');
   1.183 +var text_val = oText.value; 
   1.184 +
   1.185 +d_website = raphe.print(0, 0, text_val, raphe.getFont("HelveticaNeue", 700), 21);
   1.186 +d_website.attr('stroke', '#6a6a6a');
   1.187 +d_website.attr('fill', 'TRANSPARENT');
   1.188 +
   1.189 +var c = d_website.getBBox().width;
   1.190 +d_website.translate((317 - c)/2,0);
   1.191 +
   1.192 +d_website.translate(0, -490);
   1.193 +d_website.rotate(90,0,0);
   1.194 +}
   1.195 +
   1.196 +
   1.197 +if (style == "direct")
   1.198 +{
   1.199 +	
   1.200 +if(typeof d_alias != 'undefined' ){d_alias.remove();}
   1.201 +if(typeof d_email != 'undefined' ){d_email.remove();}
   1.202 +if(typeof d_occupation != 'undefined' ){d_occupation.remove();}
   1.203 +if(typeof d_company != 'undefined' ){d_company.remove();}
   1.204 +if(typeof d_phone != 'undefined' ){d_phone.remove();}
   1.205 +if(typeof d_website != 'undefined' ){d_website.remove();}
   1.206 +if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();}
   1.207 +
   1.208 +
   1.209 +
   1.210 +var oText = document.getElementById('Name');
   1.211 +var text_val = oText.value; 
   1.212 +d_alias = raphe.print(37, 70, text_val, raphe.getFont('HelveticaNeue', 700), 55);
   1.213 +d_alias.attr('stroke', '#6a6a6a');
   1.214 +d_alias.attr('fill', 'none')
   1.215 +
   1.216 +
   1.217 +var oText = document.getElementById('Occupation');
   1.218 +var text_val = oText.value; 
   1.219 +d_occupation = raphe.print(37, 120, text_val, raphe.getFont("HelveticaNeue", 700), 27);
   1.220 +d_occupation.attr('stroke', '#6a6a6a');
   1.221 +d_occupation.attr('fill', 'TRANSPARENT');
   1.222 +
   1.223 +
   1.224 +var oText = document.getElementById('Company');
   1.225 +var text_val = oText.value; 
   1.226 +d_company = raphe.print(37, 178, text_val, raphe.getFont("HelveticaNeue", 700), 27);
   1.227 +d_company.attr('stroke', '#6a6a6a');
   1.228 +d_company.attr('fill', 'TRANSPARENT');
   1.229 +
   1.230 +
   1.231 +
   1.232 +var oText = document.getElementById('Phone');
   1.233 +var text_val = oText.value; 
   1.234 +d_phone = raphe.print(37, 210, text_val, raphe.getFont("HelveticaNeue", 700), 27);
   1.235 +d_phone.attr('stroke', '#6a6a6a');
   1.236 +d_phone.attr('fill', 'TRANSPARENT');
   1.237 +
   1.238 +
   1.239 +var oText = document.getElementById('Email');
   1.240 +var text_val = oText.value; 
   1.241 +d_email = raphe.print(37, 240, text_val, raphe.getFont("HelveticaNeue", 700), 27);
   1.242 +d_email.attr('stroke', '#6a6a6a');
   1.243 +d_email.attr('fill', 'TRANSPARENT');
   1.244 +
   1.245 +
   1.246 +var oText = document.getElementById('Website');
   1.247 +var text_val = oText.value; 
   1.248 +d_website = raphe.print(37, 270, text_val, raphe.getFont("HelveticaNeue", 700), 27);
   1.249 +d_website.attr('stroke', '#6a6a6a');
   1.250 +d_website.attr('fill', 'TRANSPARENT');
   1.251 +
   1.252 +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");
   1.253 +d_lineArt.attr('stroke', '#6a6a6a');
   1.254 +
   1.255 +
   1.256 +
   1.257 +}
   1.258 +
   1.259 +
   1.260 +
   1.261 +
   1.262 +
   1.263 +}
   1.264 +
   1.265 +