# HG changeset patch # User rlm # Date 1264669844 18000 # Node ID 1045db9799e30dd8c0fe8e1dae8546ec03aa683e # Parent 329638a361ccd2f39d86b4db890bdf75e05a9e35 [svn r45] Greatly Enhanced Responsiveness of the website. diff -r 329638a361cc -r 1045db9799e3 awesome_js/robert.js --- a/awesome_js/robert.js Thu Jan 28 00:32:54 2010 -0500 +++ b/awesome_js/robert.js Thu Jan 28 04:10:44 2010 -0500 @@ -1,5 +1,3 @@ - - function defaults() { @@ -13,55 +11,125 @@ } -function drawElement(obj) + +function stabForm(ID) { +var JSONtext = document.getElementById('formValues').innerHTML; +var hash = new Object(); +hash = eval('(' + JSONtext + ')'); + +propertyValue = document.getElementById(ID).value; +propertyName = ID; +propertyValue = escape(propertyValue); + +eval("hash."+propertyName+"='"+propertyValue+"'"); +var JSONtext = document.getElementById('formValues').innerHTML = JSON.stringify(hash); +} + + + +function getPosition(style, field) +{ + +var cardType = eval ("laserkard." + style); + + +if ( eval("typeof cardType." + field + " != 'undefined'")) //shouldn't ever really matter +{ +values = eval("cardType." + field); + +if (typeof values.posx != 'undefined'){posx = values.posx;} +if (typeof values.posy != 'undefined'){posy = values.posy;} +if (typeof values.center != 'undefined'){center = values.center;} +if (typeof values.font != 'undefined'){font = values.font;} +if (typeof values.weirdFlip != 'undefined'){weirdFlip = values.weirdFlip;} +} + + +} + + + + +function smallRedraw(style,field) +{ + +var JSONtext = document.getElementById('formValues').innerHTML; +var hash = new Object(); +hash = eval('(' + JSONtext + ')'); + +var content = eval("hash."+field); + + content = unescape(content); + +posx = 10; +posy = 10; +center = 0; +font = 10; +face = 700; +weirdFlip = 0; + +getPosition(style, field); + +target = "d_" + field; + + +var whatev = eval("typeof " + target + " != 'undefined'") + +if (whatev){eval ("{" + target + ".remove();}");} + +eval ( target + " = raphe.print(posx, posy, content , raphe.getFont('HelveticaNeue', face), font);" ); + + +eval ( target +".attr('stroke', '#6a6a6a');"); +eval ( target +".attr('fill', 'none');"); + + +if (center == 1) +{ +eval ("var c = " + target+".getBBox().width; " + target + ".translate((485 - c)/2,0);"); +} + + +if (weirdFlip == 1) +{ +eval("var c = "+target+".getBBox().width;"); +eval(target+ ".translate((317 - c)/2,0);"); +eval(target+".translate(0, -490);"); +eval(target+".rotate(90,0,0);"); +} + + + + + +} + +function clearAll() +{ +if(typeof d_Name != 'undefined' ){d_Name.remove();} +if(typeof d_Company != 'undefined' ){d_Company.remove();} +if(typeof d_Email != 'undefined' ){d_Email.remove();} +if(typeof d_Occupation != 'undefined' ){d_Occupation.remove();} +if(typeof d_Phone != 'undefined' ){d_Phone.remove();} +if(typeof d_Website != 'undefined' ){d_Website.remove();} + +if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();} } function redraw(style) { -var JSONtext = document.getElementById('formValues').innerHTML; -var hash = new Object(); -hash = eval('(' + JSONtext + ')'); -if(hash.Name){alias = hash.Name;} -if(hash.Email){email = hash.Email;} -if(hash.Occupation){occupation = hash.Occupation;} -if(hash.Company){company = hash.Company;} -if(hash.Phone){phone = hash.Phone;} -if(hash.website){website = Website;} if (style == "bold") { - - -if(typeof d_alias != 'undefined' ){d_alias.remove();} -if(typeof d_email != 'undefined' ){d_email.remove();} -if(typeof d_occupation != 'undefined' ){d_occupation.remove();} -if(typeof d_company != 'undefined' ){d_company.remove();} -if(typeof d_phone != 'undefined' ){d_phone.remove();} -if(typeof d_website != 'undefined' ){d_website.remove();} -if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();} - - - - -d_alias = raphe.print(10, 160, alias, raphe.getFont('HelveticaNeue', 700), 60); -d_alias.attr('stroke', '#6a6a6a'); -d_alias.attr('fill', 'none') -var c = d_alias.getBBox().width; -d_alias.translate((485 - c)/2,0); - - - - -d_email = raphe.print(280, 270, email, raphe.getFont("HelveticaNeue", 700), 25); -d_email.attr('stroke', '#6a6a6a'); -d_email.attr('fill', 'TRANSPARENT'); - +clearAll(); +smallRedraw("bold","Name"); +smallRedraw("bold","Email"); @@ -71,32 +139,14 @@ if (style == "arrow") { -if(typeof d_alias != 'undefined' ){d_alias.remove();} -if(typeof d_email != 'undefined' ){d_email.remove();} -if(typeof d_occupation != 'undefined' ){d_occupation.remove();} -if(typeof d_company != 'undefined' ){d_company.remove();} -if(typeof d_phone != 'undefined' ){d_phone.remove();} -if(typeof d_website != 'undefined' ){d_website.remove();} -if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();} +clearAll(); +smallRedraw("arrow","Name"); +smallRedraw("arrow","Email"); +smallRedraw("arrow","Occupation"); +smallRedraw("arrow","Company"); -d_alias = raphe.print(40, 110, alias, raphe.getFont('HelveticaNeue', 700), 55); -d_alias.attr('stroke', '#6a6a6a'); -d_alias.attr('fill', 'none') - -d_company = raphe.print(40, 155, company, raphe.getFont("HelveticaNeue", 700), 27); -d_company.attr('stroke', '#6a6a6a'); -d_company.attr('fill', 'TRANSPARENT'); - -d_occupation = raphe.print(40, 190, occupation, raphe.getFont("HelveticaNeue", 700), 27); -d_occupation.attr('stroke', '#6a6a6a'); -d_occupation.attr('fill', 'TRANSPARENT'); - -d_email = raphe.print(280, 270, email, raphe.getFont("HelveticaNeue", 700), 25); -d_email.attr('stroke', '#6a6a6a'); -d_email.attr('fill', 'TRANSPARENT'); - d_lineArt = raphe.path("M 2 272 L 258 272"); d_lineArt.attr('stroke', '#6a6a6a'); @@ -105,113 +155,29 @@ if (style == "classic") { - -if(typeof d_alias != 'undefined' ){d_alias.remove();} -if(typeof d_email != 'undefined' ){d_email.remove();} -if(typeof d_occupation != 'undefined' ){d_occupation.remove();} -if(typeof d_company != 'undefined' ){d_company.remove();} -if(typeof d_phone != 'undefined' ){d_phone.remove();} -if(typeof d_website != 'undefined' ){d_website.remove();} -if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();} +clearAll(); -d_email = raphe.print(0, 42, email, raphe.getFont("HelveticaNeue", 700), 29); -d_email.attr('stroke', '#6a6a6a'); -d_email.attr('fill', 'TRANSPARENT'); -var c = d_email.getBBox().width; -d_email.translate((510 - c)/2,0); - - - -d_phone = raphe.print(0, 75, phone, raphe.getFont("HelveticaNeue", 700), 27); -d_phone.attr('stroke', '#6a6a6a'); -d_phone.attr('fill', 'TRANSPARENT'); -var c = d_phone.getBBox().width; -d_phone.translate((510 - c)/2,0); - - -d_alias = raphe.print(0, 164, alias, raphe.getFont('HelveticaNeue', 800), 47); -d_alias.attr('stroke', '#6a6a6a'); -d_alias.attr('fill', 'none') -var c = d_alias.getBBox().width; -d_alias.translate((510 - c)/2,0); - - -d_company = raphe.print(0, 247, company, raphe.getFont("HelveticaNeue", 700), 27); -d_company.attr('stroke', '#6a6a6a'); -d_company.attr('fill', 'TRANSPARENT'); -var c = d_company.getBBox().width; -d_company.translate((510 - c)/2,0); - - - -d_occupation = raphe.print(0, 278, occupation, raphe.getFont("HelveticaNeue", 700), 27); -d_occupation.attr('stroke', '#6a6a6a'); -d_occupation.attr('fill', 'TRANSPARENT'); -var c = d_occupation.getBBox().width; -d_occupation.translate((510 - c)/2,0); - - -d_website = raphe.print(0, 0, website, raphe.getFont("HelveticaNeue", 700), 21); -d_website.attr('stroke', '#6a6a6a'); -d_website.attr('fill', 'TRANSPARENT'); - -var c = d_website.getBBox().width; -d_website.translate((317 - c)/2,0); - -d_website.translate(0, -490); -d_website.rotate(90,0,0); +smallRedraw("classic","Name"); +smallRedraw("classic","Email"); +smallRedraw("classic","Occupation"); +smallRedraw("classic","Company"); +smallRedraw("classic","Phone"); +smallRedraw("classic","Website"); } if (style == "direct") { -if(typeof d_alias != 'undefined' ){d_alias.remove();} -if(typeof d_email != 'undefined' ){d_email.remove();} -if(typeof d_occupation != 'undefined' ){d_occupation.remove();} -if(typeof d_company != 'undefined' ){d_company.remove();} -if(typeof d_phone != 'undefined' ){d_phone.remove();} -if(typeof d_website != 'undefined' ){d_website.remove();} -if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();} +clearAll(); - - - -d_alias = raphe.print(37, 70, alias, raphe.getFont('HelveticaNeue', 700), 55); -d_alias.attr('stroke', '#6a6a6a'); -d_alias.attr('fill', 'none') - - - -d_occupation = raphe.print(37, 120, occupation, raphe.getFont("HelveticaNeue", 700), 27); -d_occupation.attr('stroke', '#6a6a6a'); -d_occupation.attr('fill', 'TRANSPARENT'); - - - -d_company = raphe.print(37, 178, company, raphe.getFont("HelveticaNeue", 700), 27); -d_company.attr('stroke', '#6a6a6a'); -d_company.attr('fill', 'TRANSPARENT'); - - - -d_phone = raphe.print(37, 210, phone, raphe.getFont("HelveticaNeue", 700), 27); -d_phone.attr('stroke', '#6a6a6a'); -d_phone.attr('fill', 'TRANSPARENT'); - - - -d_email = raphe.print(37, 240, email, raphe.getFont("HelveticaNeue", 700), 27); -d_email.attr('stroke', '#6a6a6a'); -d_email.attr('fill', 'TRANSPARENT'); - - - - -d_website = raphe.print(37, 270, website, raphe.getFont("HelveticaNeue", 700), 27); -d_website.attr('stroke', '#6a6a6a'); -d_website.attr('fill', 'TRANSPARENT'); +smallRedraw("direct","Name"); +smallRedraw("direct","Email"); +smallRedraw("direct","Occupation"); +smallRedraw("direct","Company"); +smallRedraw("direct","Phone"); +smallRedraw("direct","Website"); 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"); d_lineArt.attr('stroke', '#6a6a6a'); diff -r 329638a361cc -r 1045db9799e3 buy.html --- a/buy.html Thu Jan 28 00:32:54 2010 -0500 +++ b/buy.html Thu Jan 28 04:10:44 2010 -0500 @@ -87,11 +87,24 @@ +