Mercurial > laserkard
comparison 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 |
comparison
equal
deleted
inserted
replaced
93:69b4defd835d | 94:0f19af92260e |
---|---|
14 | 14 |
15 // }); | 15 // }); |
16 | 16 |
17 | 17 |
18 | 18 |
19 | |
20 | |
21 | |
19 | 22 |
20 Buy = (function (){ | 23 Buy = (function (){ |
24 | |
25 //Cards drawing functions: | |
26 | |
27 var Cards = | |
28 {"bold" : { | |
29 "name" :(function (text, display){ | |
30 return display.print(10,10,text,helvetica, 25).attr( | |
31 {"fill" : "#FFFFFF"}); | |
32 })}}; | |
33 | |
34 | |
35 | |
36 | |
21 // Utility Functinos | 37 // Utility Functinos |
38 | |
39 | |
40 | |
41 | |
22 | 42 |
23 var switchText = (function (){ | 43 var switchText = (function (){ |
24 if ($(this).val() == $(this).attr('title')) | 44 if ($(this).val() == $(this).attr('title')) |
25 $(this).val('').removeClass('exampleText'); | 45 $(this).val('').removeClass('exampleText'); |
26 else if ($.trim($(this).val()) == '') | 46 else if ($.trim($(this).val()) == '') |
46 }; | 66 }; |
47 | 67 |
48 var display; | 68 var display; |
49 var color; | 69 var color; |
50 var style; | 70 var style; |
71 var helvetica; | |
72 var helvetica_I; | |
51 | 73 |
52 var state_map = { | 74 var state_map = { |
53 green : {ref : null, | 75 green : {ref : null, |
54 offState : {"fill" : "#030", "scale": 1} , | 76 offState : {"fill" : "#030", "scale": 1} , |
55 onState : {"fill" : "#0F0", "scale": 1}}, | 77 onState : {"fill" : "#0F0", "scale": 1}}, |
105 | 127 |
106 var init = (function () { | 128 var init = (function () { |
107 display = Raphael("card-display", 340 ,215); | 129 display = Raphael("card-display", 340 ,215); |
108 color = Raphael("color-select", 300, 100); | 130 color = Raphael("color-select", 300, 100); |
109 style = Raphael("style-select", 200, 70); | 131 style = Raphael("style-select", 200, 70); |
132 helvetica = display.getFont('HelveticaNeue', 700); | |
133 helvetica_I = display.getFont('HelveticaNeue', 800); | |
134 | |
110 color_select_init(); | 135 color_select_init(); |
111 display_init(); | 136 display_init(); |
112 card_init(); | 137 card_init(); |
113 text_entry_init(); | 138 text_entry_init(); |
114 key_handling(); | 139 key_handling(); |
115 | 140 update(); |
116 }); | 141 }); |
117 | 142 |
118 | 143 |
119 //Update Functions | 144 //Update Functions |
120 | 145 |
178 assoc('#user-phone', card.phone); | 203 assoc('#user-phone', card.phone); |
179 assoc('#user-email', card.email); | 204 assoc('#user-email', card.email); |
180 assoc('#user-company', card.company); | 205 assoc('#user-company', card.company); |
181 assoc('#user-occupation', card.occupation); | 206 assoc('#user-occupation', card.occupation); |
182 assoc('#user-website', card.website); | 207 assoc('#user-website', card.website); |
183 | 208 }); |
184 | 209 |
185 }); | 210 |
186 | |
187 | |
188 | |
189 var display_text_update = (function (){ | 211 var display_text_update = (function (){ |
190 var name = null; | 212 var name = null; |
191 | 213 |
192 return (function () { | 214 var check_text = (function () { |
193 | |
194 if (name !== card.name.text){ | 215 if (name !== card.name.text){ |
195 | |
196 card.name.ref.remove(); | 216 card.name.ref.remove(); |
197 card.name.ref = | 217 card.name.ref = Cards[order.style].name(card.name.text, display); |
198 display.print(10,10,card.name.text, | |
199 display.getFont('HelveticaNeue',700), 25).attr( | |
200 {"fill" : "#FFFFFF"}); | |
201 | |
202 //card.name.ref.animate({"fill" : Raphael.getColor()} ,1000); | |
203 name = card.name.text; | 218 name = card.name.text; |
204 }}); | 219 }}); |
220 return check_text; | |
205 | 221 |
206 | 222 |
207 })(); | 223 })(); |
208 | 224 |
209 | 225 |