Guest User

Untitled

a guest
Apr 5th, 2022
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. $("#dice").click(function(){
  2. $(this).unbind('click');
  3. $("#result").hide();
  4. $(this).attr("class","dice");//After clearing the last points animation
  5. $(this).css('cursor','default');
  6. var num = Math.floor(Math.random()*6+1);//random num 1-6
  7. $(this).animate({left: '+2px'}, 100,function(){
  8. $(this).addClass("dice_t");
  9. }).delay(200).animate({top:'-2px'},100,function(){
  10. $(this).removeClass("dice_t").addClass("dice_s");
  11. }).delay(200).animate({opacity: 'show'},600,function(){
  12. $(this).removeClass("dice_s").addClass("dice_e");
  13. }).delay(100).animate({left:'-2px',top:'2px'},100,function(){
  14. $(this).removeClass("dice_e").addClass("dice_"+num);
  15.  
  16. $.ajax({
  17. type: "POST",
  18. url: "/ajax/ext/pok4/magic_rows",
  19. data: {"add_to_db":"1"},
  20. success: function(data) {}
  21. });
  22.  
  23. $("#result").show();
  24. $("#result").html("{{ext_magic_row_set}}<span>"+num+"</span> ({{ext_magic_row_no_win}})");
  25. if(num == 6) {
  26. $("#result").html("{{ext_magic_row_you_win}}");
  27.  
  28. $.ajax({
  29. type: "POST",
  30. url: "/ajax/ext/pok4/magic_rows",
  31. data: {"update_db":"1"},
  32. success: function(data) {}
  33. });
  34.  
  35. } else {
  36. $.ajax({
  37. type: "POST",
  38. url: "/ajax/ext/pok4/magic_rows",
  39. data: {"update_db":"2"},
  40. success: function(data) {}
  41. });
  42. }
  43. $(this).css('cursor','pointer');
  44. $("#dice_mask").remove();//remove mask
  45. });
  46. });
Advertisement
Add Comment
Please, Sign In to add comment