anxiety/scripts/game/About.js

98 lines
1.7 KiB
JavaScript
Raw Normal View History

2019-04-30 15:20:45 +00:00
window.About = {};
2019-05-03 16:13:22 +00:00
Loader.addSounds([
{ id:"yelp", src:"sounds/sfx/yelp.mp3" }
]);
2019-04-29 19:19:44 +00:00
(function(){
2019-04-30 15:20:45 +00:00
// Newsletter stuff
var gdpr = $("#gdpr");
var submit = $("#submit");
gdpr.oninput = function(){
var isChecked = gdpr.checked;
submit.disabled = !isChecked;
submit.value = isChecked ? "Subscribe! →" : "← plz consent";
};
gdpr.oninput();
$("#the_newsletter").setAttribute("action", "https://sendy.ncase.me/subscribe");
// The About Button
var aboutDOM = $("#end_demo");
$("#about").onclick = function(){
aboutDOM.setAttribute("about","yes");
aboutDOM.style.top = "40px";
// Hi
About.showing = true;
Game.pause();
};
$("#close_about").onclick = function(){
2019-05-03 16:13:22 +00:00
sfx("ui_click");
2019-04-30 15:20:45 +00:00
aboutDOM.style.top = "";
//aboutDOM.setAttribute("about","yes");
// Bye
About.showing = false;
};
2019-05-05 19:56:00 +00:00
// SHOW TBC
var tbc = $("#end_demo_tbc");
subscribe("TO_BE_CONTINUED", function(){
tbc.style.display = "block";
});
2019-04-30 15:20:45 +00:00
// SHOW END
subscribe("END_OF_DEMO", function(){
// Hi
About.showing = true;
Game.pause();
// Cut in
aboutDOM.removeAttribute("about");
aboutDOM.style.display = "none";
2019-05-05 19:56:00 +00:00
aboutDOM.style.display = "block";
2019-04-30 15:20:45 +00:00
setTimeout(function(){
2019-05-05 19:56:00 +00:00
aboutDOM.style.top = "0px"; // slide in
2019-04-30 15:20:45 +00:00
},10);
2019-05-05 19:56:00 +00:00
// Sound
Howler.mute(false);
sfx("rustle");
music('campus', {volume:0.5, fade:1});
2019-04-30 15:20:45 +00:00
});
// Replay
$("#replay").onclick = function(){
2019-05-03 16:13:22 +00:00
// UI/SCREAM SOUNDS
2019-05-05 19:56:00 +00:00
stopAllSounds();
2019-05-03 16:13:22 +00:00
sfx("yelp");
2019-04-30 15:20:45 +00:00
// Cut out
aboutDOM.style.top = "";
aboutDOM.style.display = "none";
setTimeout(function(){
aboutDOM.style.display = "block";
},100);
2019-05-05 19:56:00 +00:00
tbc.style.display = "none";
2019-04-30 15:20:45 +00:00
// Bye
About.showing = false;
// Back to the beginning! (after a second)
setTimeout(function(){
publish("START_GAME");
}, 1000);
};
2019-04-29 19:19:44 +00:00
})();