From abb2759ef3deb6ef549beb52ac3aae667f44df2a Mon Sep 17 00:00:00 2001 From: X-88 <126267638+MyBooty165@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:58:33 -0500 Subject: [PATCH] Update search.html --- search.html | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/search.html b/search.html index 4e4d02c7..eb2eae44 100644 --- a/search.html +++ b/search.html @@ -25,6 +25,15 @@
+
+ +
+

ALT+M to hide/show this

+ + + +
+
@@ -103,6 +112,66 @@ showresults(query); } }); + + gamebtn.addEventListener('click', () => { + const gameframe = document.getElementById('gframe'); + const gcontrols = document.getElementById('gcontrols'); + const garea = document.getElementById("garea"); + + document.getElementById('main-area').style.display = 'none'; + document.querySelector('header').style.display = 'none'; + document.querySelector('footer').style.display = 'none'; + + garea.style.display = 'block'; + + gameframe.style.display = 'block'; + gcontrols.style.display = 'flex'; + document.body.style.overflow = 'none'; + + gameframe.src = game.source; + gameframe.setAttribute('allow', 'autoplay; fullscreen; gamepad; keyboard; clipboard-write; allow-same-origin'); + gameframe.contentWindow.focus(); + + gameframe.onload = () => { + ifrev(gameframe); + }; + }); + }); + + globalev(); + + function shortcut() { + const gcontrols = document.getElementById('gcontrols'); + if (gcontrols.style.display === 'none' || gcontrols.style.display === '') { + gcontrols.style.display = 'flex'; + } else { + gcontrols.style.display = 'none'; + } + } + + function globalev() { + document.addEventListener('keydown', (e) => { + if ((e.altKey || e.metaKey) && e.key.toLowerCase() === 'm') { + e.preventDefault(); + shortcut(); + } + }); + } + + function ifrev(iframe) { + const ifrdoc = iframe.contentDocument || iframe.contentWindow.document; + + ifrdoc.addEventListener('keydown', (e) => { + if (e.altKey && e.key.toLowerCase() === 'm') { + e.preventDefault(); + shortcut(); + } + }); + } + } catch (error) { + console.error('Err:', error); + } +}