/
script.js
76 lines (70 loc) · 1.96 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
$whiteArtifact = $('.white-artifact');
$hButton = $('.hidden-toggle');
$rButton = $('.hidden-reload');
$bottom = $('.bottom');
bouncecheck = null;
window.addEventListener("load", function() { window. scrollTo(0, 0); });
document.addEventListener("touchmove", function(e) { e.preventDefault() });
window.scrollTo(0,1);
$whiteArtifact.pep();
var path = window.location.pathname;
var page = path.split("/").pop();
console.log(page);
$(document).ready(function(){
if(page == "shop.html" || page == "checkin.html"){
bouncecheck = setInterval(function(){
position = $whiteArtifact.css("top");
position = position.substr(0,position.length-2);
if(position < -100){
bounceback();
console.log('bouncing');
position = 0;
clearInterval(bouncecheck);
}
},500)
};
$hButton.on('tap',function(){
$bottom.text("");
$whiteArtifact.animate({top:'-300'},0)
if(bouncecheck){
clearInterval(bouncecheck);
};
setTimeout(function(){
bounceback();
},1000);
});
$rButton.on('tap',function(){
console.log('reload');
location.reload();
});
});
function bounceback(){
// $whiteArtifact.data('plugin_pep').revert();
$whiteArtifact.removeAttr('style');
$whiteArtifact.animate({top:'-300'},0)
setTimeout(function(){
if(page == "shop.html"){
console.log("coupontime");
$whiteArtifact.removeClass('art-shop');
$whiteArtifact.addClass('art-coupon');
$bottom.text("GOT COUPON!");
}
else if(page == "checkin.html"){
$whiteArtifact.removeClass('art-checkin');
$whiteArtifact.addClass('art-checkin-done');
$bottom.text("CHECKED IN!");
}
else if(page == "lecture.html"){
$bottom.text("RECEIVED LECTURE");
}
else if(page == "pay.html"){
$bottom.text("RECEIVED MONEY");
}
else if (page == "lnkd.html"){
$whiteArtifact.removeClass('art-linked');
$whiteArtifact.addClass('art-linked-add');
$('.linked-text').text("NEW REQUEST");
}
$whiteArtifact.animate({top:'+=500'},1000,"easeOutExpo");
},500);
}