diff js-lib/buy3.js @ 94:0f19af92260e laserkard

saving progress.
author Robert McIntyre <rlm@mit.edu>
date Mon, 26 Jul 2010 20:33:17 -0400
parents 69b4defd835d
children 5fb202915c11
line wrap: on
line diff
     1.1 --- a/js-lib/buy3.js	Mon Jul 26 18:19:34 2010 -0400
     1.2 +++ b/js-lib/buy3.js	Mon Jul 26 20:33:17 2010 -0400
     1.3 @@ -16,10 +16,30 @@
     1.4  
     1.5  
     1.6  
     1.7 +    
     1.8 +
     1.9 +
    1.10  
    1.11  Buy = (function (){ 
    1.12 +
    1.13 +    //Cards drawing functions:
    1.14 +
    1.15 +    var Cards = 
    1.16 +	{"bold" : {
    1.17 +	    "name" :(function (text, display){
    1.18 +		return display.print(10,10,text,helvetica, 25).attr(
    1.19 +		    {"fill" : "#FFFFFF"});
    1.20 +	    })}};
    1.21 +
    1.22 +    
    1.23 +
    1.24 +
    1.25      // Utility Functinos
    1.26  
    1.27 +
    1.28 +
    1.29 +
    1.30 +
    1.31      var switchText = (function (){
    1.32  	if ($(this).val() == $(this).attr('title'))
    1.33  	    $(this).val('').removeClass('exampleText');
    1.34 @@ -48,6 +68,8 @@
    1.35      var display;
    1.36      var color;
    1.37      var style;
    1.38 +    var helvetica;
    1.39 +    var helvetica_I;
    1.40  
    1.41      var state_map = {
    1.42      	green : {ref : null, 
    1.43 @@ -107,12 +129,15 @@
    1.44  	display = Raphael("card-display", 340 ,215);
    1.45  	color = Raphael("color-select", 300, 100);
    1.46  	style = Raphael("style-select", 200, 70);
    1.47 +	helvetica = display.getFont('HelveticaNeue', 700);
    1.48 +	helvetica_I = display.getFont('HelveticaNeue', 800);
    1.49 +
    1.50  	color_select_init();
    1.51  	display_init();
    1.52  	card_init();	
    1.53  	text_entry_init();
    1.54  	key_handling();
    1.55 -
    1.56 +	update();
    1.57      });
    1.58  
    1.59  	
    1.60 @@ -180,28 +205,19 @@
    1.61  	assoc('#user-company', card.company);
    1.62  	assoc('#user-occupation', card.occupation);
    1.63  	assoc('#user-website', card.website);
    1.64 +    });
    1.65  
    1.66  
    1.67 -});
    1.68 -
    1.69 -
    1.70 -    
    1.71      var display_text_update = (function (){
    1.72  	var name = null;
    1.73  
    1.74 -	return (function () {                         
    1.75 -
    1.76 +	var check_text = (function () {                         
    1.77  	    if (name !== card.name.text){
    1.78 -
    1.79  		card.name.ref.remove();
    1.80 -		card.name.ref = 
    1.81 -		    display.print(10,10,card.name.text,
    1.82 -				  display.getFont('HelveticaNeue',700), 25).attr(
    1.83 -				      {"fill" : "#FFFFFF"});
    1.84 -
    1.85 -		//card.name.ref.animate({"fill" : Raphael.getColor()} ,1000);
    1.86 +		card.name.ref = Cards[order.style].name(card.name.text, display);
    1.87  		name = card.name.text;
    1.88  	    }});
    1.89 +	return check_text;
    1.90  	    
    1.91  
    1.92      })();