Lottery
var lottery; if (lottery) {$("#container").empty();} $we.require("component/lottery", function(f) { lottery = f(document.getElementById("container"), { width: 516, height: 432, x: 3, y: 3, itemBorder: 0, itemMargin: 0, itemPadding: 6, bgColor: "#fff" }); var path = $we.conf.ENV.__STATIC + '/img/src/lottery'; lottery.setPicMatch({ "ipad": [path + '/pic1.jpg', path + '/pic5.jpg'], "iphone": [path + '/pic2.jpg', path + '/pic6.jpg', path + '/pic8.jpg'], "mac": [path + '/pic4.jpg', path + '/pic7.jpg'], "EMPTY": [path + '/empty.jpg'] }); var p = { 2: "ipad", 3: "iphone", 6: "mac" }; //lottery.setPrizeFromServer({ lottery.setPrize({ prize: p, url: 'http://dev.g.sdo.com/ajaxLottery/draw', beforeStart: function() {return true}, endCallback: function(w) {alert("win "+w + "!")}, errorCallback: function(data) {alert(data.msg)} }); });
if (typeof lottery != "undefined") { var pos = $we.array.rand([0,1,2,3,4,5,6,7], 3); var p = {}; p[pos[0]] = "ipad"; p[pos[1]] = "iphone"; p[pos[2]] = "mac"; lottery.setPrize(p); }
if (typeof lottery != "undefined") { lottery.setEnd("ipad"); }