Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function() {
- if(getRandomInt(1, 1) >= 1) {
- setTimeout(function() {
- var offset = $(window).height() + Math.floor($(window).scrollTop()) - 300;
- var offset_top = (getRandomInt(Math.floor($(window).scrollTop()), offset));
- var left = -400;
- 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">');
- var timer = setInterval(function() {
- left += parseInt($("#witch_1").data("speed"));
- $("#witch_1").css("left", left + "px");
- if(left > $(window).height() + 2500) {
- clearInterval(timer);
- $("#witch_1").remove();
- }
- }, 20);
- }, getRandomInt(1, 1));
- }
- if(getRandomInt(1, 1) >= 1) {
- setTimeout(function() {
- var offset = $(window).height() - 210;
- var right = -400;
- 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">');
- var timer = setInterval(function() {
- right += parseInt($("#witch_2").data("speed"));
- $("#witch_2").css("right", right + "px");
- if(right > $(window).height() + 2500) {
- clearInterval(timer);
- $("#witch_2").remove();
- }
- }, 20);
- }, getRandomInt(1, 1));
- }
- });
- function clickWitch(event) {
- "эй, хакеры, не надо просто так отправлять сюда запрос, тыкните по честному на ведьму! =("
- $(event).data("speed", $(event).data("speed") * 4);
- new Audio("/assets/sound/events/halloween/witch_cry_" + getRandomInt(1, 3) + ".mp3").play();
- if(session == null) return;
- $.ajax({
- url: "/ajax/events/halloween/click.witch.php",
- type: "POST",
- json: true,
- data: {
- hash: session.cid,
- },
- success: function(data) {
- if(data.status) {
- _notify.success(data.msg);
- }
- }
- });
- }
Add Comment
Please, Sign In to add comment