Mercurial > laserkard
view buy2.js @ 81:6adb5da55d18 laserkard
getting color select working
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 25 Jul 2010 05:45:56 -0400 |
parents | d913ee48d935 |
children | da3028a52ac1 |
line wrap: on
line source
2 var Buy = //main LaserKard function. Deals with updating the order.3 (function (){5 var order =6 {color: "black",7 style: "bold",8 quantity: 30,9 content: undefined};11 var raphe = undefined;13 var init = (function () {15 raphe = Raphael("card-display", 337 ,212);16 $(".select-green").click(function() {order.color="green";update();});17 $(".select-red").click(function() {order.color="red";update();});18 $(".select-blue").click(function() {order.color="blue";update();});19 $(".select-black").click(function() {order.color="black";update();});22 });24 var drawRect = (function (){25 raphe.rect(0,0,337,212);});27 var materials =28 {green: "buy-images/select-green.png",29 red: "buy-images/select-red.png",30 blue: "buy-images/select-blue.png",31 black: "buy-images/select-black.png"};33 var update_color = (function (){34 var color = undefined;35 return (function () {36 if (order.color === color){}37 else {color = order.color;}});})();39 var update_display = (function (){});40 var update_info = (function (){});43 var update = (function (){44 update_color();45 $("#whatev").html(order.color);46 update_display();47 update_info();});51 return {init : init,52 draw : drawRect,53 update : update54 };55 })();59 $(document).ready(function() {60 // $("#color-select").html("Hello World");61 Buy.init();62 Buy.draw();63 $("#radio1").buttonset();66 });