Advertisement
Guest User

Untitled

a guest
Aug 30th, 2014
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. var n = 360; // 6 min of waiting after blocked
  2. function countDown(){
  3. n--;
  4. if(n > 0){
  5. setTimeout(countDown,1000);
  6. }
  7. $( "span#waitcount" ).html( document.createTextNode(n) );
  8. }
  9.  
  10. var count = 50; // Count of tokens when reached 0 block the page
  11. var counter = document.getElementById('counter');
  12.  
  13. var clickDisabled = false;
  14. $('.slotMachineButton').click(function(){
  15. if (clickDisabled)
  16. return;
  17.  
  18. setTimeout(function(){
  19. count--;
  20. counter.innerHTML = count;
  21.  
  22. if (count === 0) {
  23.  
  24. $.blockUI({ message: '<h1>Thank you for Playing!!!<br>Please wait for 6 munites to be able to play again.</h1>' });
  25. setTimeout(function() {
  26. $.unblockUI({
  27. onUnblock: function(){ alert('Game has been resumed!!!'); }
  28. });
  29. }, 10000);
  30. setTimeout(countDown,1000);
  31. }
  32. });
  33. clickDisabled = true;
  34. setTimeout(function(){
  35. clickDisabled = false;
  36. }, 3000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement