Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(function ($) {
- // -------------------------
- // Sounds
- // -------------------------
- const sounds = {
- key: new Audio("https://cdn.shopify.com/s/files/1/0655/3541/0376/files/keyclick.wav?v=1726250442"),
- error: new Audio("https://cdn.shopify.com/s/files/1/0655/3541/0376/files/errorsound.wav?v=1726251333")
- };
- const credentials = [
- { password: "LEERAM", url: "https://indigopark.shop/cdn/shop/files/beginnings.png" },
- { password: "YEILM", url: "https://indigopark.shop/cdn/shop/files/caged.png" },
- { password: "MORAMOO", url: "https://indigopark.shop/cdn/shop/files/closeddoor.png" },
- { password: "RILLRY", url: "https://indigopark.shop/cdn/shop/files/stage.png" }
- ];
- function playSound(type) {
- const sound = sounds[type];
- if (!sound) return;
- sound.currentTime = 0;
- sound.play().catch(() => {});
- }
- function onKeyPress(e) {
- e.preventDefault();
- if ($(this).hasClass("active")) return;
- const screen = $(".screen");
- if (screen.text().length >= 7) return playSound("key");
- screen.append($(this).text());
- window.tries++;
- updateFlasher();
- playSound("key");
- $(this).addClass("active");
- }
- function onKeyRelease() {
- $(this).removeClass("active");
- }
- function onSubmitPress(e) {
- e.preventDefault();
- if (!$(this).hasClass("active")) {
- validateEntry();
- $(this).addClass("active");
- }
- }
- function onSubmitRelease() {
- $(this).removeClass("active");
- }
- function updateFlasher() {
- $(".flasher").css(
- window.tries <= 1
- ? { left: window.tries * 55 + "px" }
- : { left: "20px", display: "block" }
- );
- }
- function validateEntry() {
- if (window.tries < 1) return;
- checkPassword();
- $(".screen").text("");
- window.tries = 0;
- $(".flasher").hide();
- $(".submit-button").removeClass("active");
- }
- function checkPassword() {
- const input = $(".screen").text();
- for (const entry of credentials) {
- if (input === entry.password) {
- $(".success").show().delay(5000).fadeOut(0);
- window.location.href = entry.url;
- return;
- }
- }
- $(".error-notification").show().delay(1000).fadeOut(0);
- playSound("error");
- }
- // Init
- window.tries = 0;
- $(".key").on("mousedown touchstart", onKeyPress);
- $(".key").on("mouseup touchend", onKeyRelease);
- $(".submit-button").on("mousedown touchstart", onSubmitPress);
- $(".submit-button").on("mouseup touchend", onSubmitRelease);
- });
Advertisement
Add Comment
Please, Sign In to add comment