From b7d92d285d0eacab10ddd34988aeae477054a895 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Sat, 1 Jul 2023 14:06:16 -0500 Subject: [PATCH] Ad timer --- index.html | 17 +++++++++++++++++ src/emulator.js | 5 +++++ src/loader.js | 2 ++ 3 files changed, 24 insertions(+) diff --git a/index.html b/index.html index b560853..3ffe2a4 100644 --- a/index.html +++ b/index.html @@ -8,5 +8,22 @@ EJS_gameUrl = 'mega_mountain.nes'; EJS_DEBUG_XX = true; EJS_AdUrl = "https://www.google.com/search?igu=1"; + EJS_Buttons = { + playPause: false, + restart: false, + mute: false, + settings: false, + fullscreen: true, + saveState: false, + loadState: false, + screenRecord: false, + gamepad: false, + cheat: false, + volume: true, + quickSave: false, + quickLoad: false, + screenshot: false, + cacheManager: false + } diff --git a/src/emulator.js b/src/emulator.js index 6a7b89f..a67e2a0 100644 --- a/src/emulator.js +++ b/src/emulator.js @@ -225,6 +225,11 @@ class EmulatorJS { this.on("start", () => { closeParent.removeAttribute("hidden"); + const time = (typeof this.config.adTimer === "number" && this.config.adTimer > 0) ? this.config.adTimer : 10000; + if (this.config.adTimer === 0) return; + setTimeout(() => { + div.remove(); + }, time); }) } diff --git a/src/loader.js b/src/loader.js index a2759e0..9036163 100644 --- a/src/loader.js +++ b/src/loader.js @@ -50,6 +50,8 @@ config.gameName = window.EJS_gameName; config.color = window.EJS_color; config.adUrl = window.EJS_AdUrl; + config.adTimer = window.EJS_AdTimer + config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings; new EmulatorJS(EJS_player, config);