Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#dice").click(function(){
- $(this).unbind('click');
- $("#result").hide();
- $(this).attr("class","dice");//After clearing the last points animation
- $(this).css('cursor','default');
- var num = Math.floor(Math.random()*6+1);//random num 1-6
- $(this).animate({left: '+2px'}, 100,function(){
- $(this).addClass("dice_t");
- }).delay(200).animate({top:'-2px'},100,function(){
- $(this).removeClass("dice_t").addClass("dice_s");
- }).delay(200).animate({opacity: 'show'},600,function(){
- $(this).removeClass("dice_s").addClass("dice_e");
- }).delay(100).animate({left:'-2px',top:'2px'},100,function(){
- $(this).removeClass("dice_e").addClass("dice_"+num);
- $.ajax({
- type: "POST",
- url: "/ajax/ext/pok4/magic_rows",
- data: {"add_to_db":"1"},
- success: function(data) {}
- });
- $("#result").show();
- $("#result").html("{{ext_magic_row_set}}<span>"+num+"</span> ({{ext_magic_row_no_win}})");
- if(num == 6) {
- $("#result").html("{{ext_magic_row_you_win}}");
- $.ajax({
- type: "POST",
- url: "/ajax/ext/pok4/magic_rows",
- data: {"update_db":"1"},
- success: function(data) {}
- });
- } else {
- $.ajax({
- type: "POST",
- url: "/ajax/ext/pok4/magic_rows",
- data: {"update_db":"2"},
- success: function(data) {}
- });
- }
- $(this).css('cursor','pointer');
- $("#dice_mask").remove();//remove mask
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment