lolimoska

Untitled

Oct 30th, 2020
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. $(function() {
  2. if(getRandomInt(1, 1) >= 1) {
  3. setTimeout(function() {
  4. var offset = $(window).height() + Math.floor($(window).scrollTop()) - 300;
  5. var offset_top = (getRandomInt(Math.floor($(window).scrollTop()), offset));
  6.  
  7. var left = -400;
  8.  
  9. var block = $("#containter-user-zone").append('<img id="witch_1" data-speed="8" onclick="clickWitch(this)" src="/assets/img/events/halloween/witch_1.gif" class="img-fluid" style="position:absolute; z-index: 99999; top: ' + offset_top + 'px; left: ' + left + 'px">');
  10.  
  11. var timer = setInterval(function() {
  12. left += parseInt($("#witch_1").data("speed"));
  13. $("#witch_1").css("left", left + "px");
  14.  
  15. if(left > $(window).height() + 2500) {
  16. clearInterval(timer);
  17. $("#witch_1").remove();
  18. }
  19. }, 20);
  20.  
  21. }, getRandomInt(1, 1));
  22. }
  23.  
  24. if(getRandomInt(1, 1) >= 1) {
  25. setTimeout(function() {
  26. var offset = $(window).height() - 210;
  27. var right = -400;
  28.  
  29. var block = $("#containter-user-zone").append('<img id="witch_2" data-speed="8" onclick="clickWitch(this)" src="/assets/img/events/halloween/witch_2.gif" class="img-fluid" style="position:absolute; z-index: 99999; top: ' + offset + 'px; right: ' + right + 'px">');
  30.  
  31. var timer = setInterval(function() {
  32. right += parseInt($("#witch_2").data("speed"));
  33. $("#witch_2").css("right", right + "px");
  34.  
  35. if(right > $(window).height() + 2500) {
  36. clearInterval(timer);
  37. $("#witch_2").remove();
  38. }
  39. }, 20);
  40.  
  41. }, getRandomInt(1, 1));
  42. }
  43. });
  44.  
  45. function clickWitch(event) {
  46. "эй, хакеры, не надо просто так отправлять сюда запрос, тыкните по честному на ведьму! =("
  47.  
  48. $(event).data("speed", $(event).data("speed") * 4);
  49.  
  50. new Audio("/assets/sound/events/halloween/witch_cry_" + getRandomInt(1, 3) + ".mp3").play();
  51.  
  52. if(session == null) return;
  53.  
  54. $.ajax({
  55. url: "/ajax/events/halloween/click.witch.php",
  56. type: "POST",
  57. json: true,
  58. data: {
  59. hash: session.cid,
  60. },
  61. success: function(data) {
  62. if(data.status) {
  63. _notify.success(data.msg);
  64. }
  65. }
  66. });
  67. }
Add Comment
Please, Sign In to add comment