anxiety/scripts/game/About.js

91 lines
1.6 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");
2019-05-06 00:50:18 +00:00
gdpr.onchange = function(){
2019-04-30 15:20:45 +00:00
var isChecked = gdpr.checked;
submit.disabled = !isChecked;
submit.value = isChecked ? "Subscribe! →" : "← plz consent";
};
2019-05-06 00:50:18 +00:00
gdpr.onchange();
2019-04-30 15:20:45 +00:00
$("#the_newsletter").setAttribute("action", "https://sendy.ncase.me/subscribe");
// The About Button
2019-09-06 20:25:14 +00:00
var aboutDOM = $("#about");
2019-04-30 15:20:45 +00:00
$("#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;
};
// 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);
// 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
})();