diff --git a/index.html b/index.html index d4e68ba..5b3eef9 100644 --- a/index.html +++ b/index.html @@ -87,6 +87,18 @@ height: 100%; border: none; } + + #cyberchef-container { + flex: 1; + width: 100%; + height: 100%; + } + + #cyberchef-container iframe { + width: 100%; + height: 100%; + border: none; + } @@ -204,7 +216,7 @@ // creates the workstation function addCryptoWorkstation() { - console.log('CyberChef: Adding crypto workstation...'); + // console.log('CyberChef: Adding crypto workstation...'); const workstationData = { type: "workstation", name: "Crypto Analysis Station", @@ -220,11 +232,11 @@ // Override the default handleObjectInteraction for this specific item workstationSprite.customInteraction = function() { - console.log('CyberChef: Workstation custom interaction triggered'); + // console.log('CyberChef: Workstation custom interaction triggered'); // Create popup let popup = document.getElementById('laptop-popup'); if (!popup) { - console.log('CyberChef: Creating new popup...'); + // console.log('CyberChef: Creating new popup...'); popup = document.createElement('div'); popup.id = 'laptop-popup'; popup.innerHTML = ` @@ -234,13 +246,33 @@ CryptoWorkstation - +
`; document.body.appendChild(popup); - // Add close button handler + // Find the CyberChef file + fetch('assets/cyberchef/') + .then(response => response.text()) + .then(html => { + // Use regex to find the CyberChef filename + const match = html.match(/CyberChef_v[0-9.]+\.html/); + if (match) { + const cyberchefPath = `assets/cyberchef/${match[0]}`; + // Create and append the iframe with the found path + const iframe = document.createElement('iframe'); + iframe.src = cyberchefPath; + iframe.frameBorder = "0"; + document.getElementById('cyberchef-container').appendChild(iframe); + } else { + console.error('Could not find CyberChef file'); + } + }) + .catch(error => { + console.error('Error loading CyberChef:', error); + }); + popup.querySelector('.close-btn').addEventListener('click', () => { popup.style.display = 'none'; }); @@ -251,7 +283,7 @@ // Add to inventory directly addToInventory(workstationSprite); - console.log('CyberChef: Workstation added to inventory'); + // console.log('CyberChef: Workstation added to inventory'); } // creates the game