rlm@79: rlm@81: var Buy = //main LaserKard function. Deals with updating the order. rlm@80: (function (){ rlm@80: rlm@80: var order = rlm@80: {color: "black", rlm@80: style: "bold", rlm@81: quantity: 30, rlm@81: content: undefined}; rlm@81: rlm@80: var raphe = undefined; rlm@80: rlm@80: var init = (function () { rlm@81: rlm@81: raphe = Raphael("card-display", 337 ,212); rlm@81: $(".select-green").click(function() {order.color="green";update();}); rlm@81: $(".select-red").click(function() {order.color="red";update();}); rlm@81: $(".select-blue").click(function() {order.color="blue";update();}); rlm@81: $(".select-black").click(function() {order.color="black";update();}); rlm@81: rlm@81: rlm@81: }); rlm@80: rlm@80: var drawRect = (function (){ rlm@81: raphe.rect(0,0,337,212);}); rlm@80: rlm@80: var materials = rlm@81: {green: "buy-images/select-green.png", rlm@81: red: "buy-images/select-red.png", rlm@81: blue: "buy-images/select-blue.png", rlm@81: black: "buy-images/select-black.png"}; rlm@81: rlm@81: var update_color = (function (){ rlm@81: var color = undefined; rlm@81: return (function () { rlm@81: if (order.color === color){} rlm@81: else {color = order.color;}});})(); rlm@80: rlm@81: var update_display = (function (){}); rlm@81: var update_info = (function (){}); rlm@81: rlm@81: rlm@81: var update = (function (){ rlm@81: update_color(); rlm@81: $("#whatev").html(order.color); rlm@81: update_display(); rlm@81: update_info();}); rlm@81: rlm@81: rlm@81: rlm@80: return {init : init, rlm@81: draw : drawRect, rlm@81: update : update rlm@81: }; rlm@80: })(); rlm@80: rlm@80: rlm@80: rlm@80: $(document).ready(function() { rlm@81: // $("#color-select").html("Hello World"); rlm@80: Buy.init(); rlm@80: Buy.draw(); rlm@81: $("#radio1").buttonset(); rlm@80: rlm@80: rlm@80: }); rlm@80: