0% found this document useful (0 votes)
18 views4 pages

Javascript (Function (

This document contains a JavaScript code snippet that creates a hacker-style terminal UI on a webpage. The terminal allows users to input commands such as launching a proxy game, blanking the screen, activating troll mode, and exiting the console. Each command triggers specific functions that modify the webpage's appearance and behavior accordingly.

Uploaded by

jakerossi2012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

Javascript (Function (

This document contains a JavaScript code snippet that creates a hacker-style terminal UI on a webpage. The terminal allows users to input commands such as launching a proxy game, blanking the screen, activating troll mode, and exiting the console. Each command triggers specific functions that modify the webpage's appearance and behavior accordingly.

Uploaded by

jakerossi2012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

javascript:(function() {

let gameMode = false;


let screenBlankerMode = false;
let trollMode = false;

// Create hacker-style terminal UI


function createHackerUI() {
let terminal = document.createElement('div');
terminal.style.position = 'fixed';
terminal.style.top = '0';
terminal.style.left = '0';
terminal.style.width = '100vw';
terminal.style.height = '100vh';
terminal.style.zIndex = '9999999999'; // Ensure it’s above everything else
terminal.style.backgroundColor = '#000';
terminal.style.color = '#00FF00';
terminal.style.fontFamily = 'monospace';
terminal.style.fontSize = '1.2rem';
terminal.style.padding = '1rem';
terminal.style.overflowY = 'auto';
terminal.style.whiteSpace = 'pre-wrap';
terminal.id = 'hacker-terminal';
document.body.appendChild(terminal);

// Display welcome message


terminal.innerHTML = `Loading Hacker Console...
-------------------------------
Type 'help' for commands.
-------------------------------
> Type 'help' to see available commands.
`;
}

// Process terminal commands


function processCommand(command) {
let terminal = document.getElementById('hacker-terminal');
let output = terminal.innerHTML;

if (command === 'help') {


output += `
Available commands:
- game: Launch a proxy game
- blank: Blank the screen
- troll: Activate troll mode
- exit: Exit the console
-------------------------------
`;
} else if (command === 'game') {
proxyGame();
output += 'Launching Proxy Game...\n';
} else if (command === 'blank') {
screenBlanker();
output += 'Blanking Screen...\n';
} else if (command === 'troll') {
trollModeFunction();
output += 'Activating Troll Mode...\n';
} else if (command === 'exit') {
document.getElementById('hacker-terminal').remove();
return;
} else {
output += 'Invalid command. Type "help" for a list of commands.\n';
}

terminal.innerHTML = output;
terminal.scrollTop = terminal.scrollHeight;
}

// Proxy Game
function proxyGame() {
if (!gameMode) {
let iframe = document.createElement('iframe');
iframe.src = "https://flappybird.io/"; // You can replace this with any
game URL
iframe.style.position = 'fixed';
iframe.style.top = 0;
iframe.style.left = 0;
iframe.style.width = '100vw';
iframe.style.height = '100vh';
iframe.style.zIndex = 999999;
iframe.style.border = 'none';
document.body.appendChild(iframe);
gameMode = true;
} else {
document.querySelector('iframe').remove();
gameMode = false;
}
}

// Screen Blanker
function screenBlanker() {
if (!screenBlankerMode) {
let overlay = document.createElement('div');
overlay.style.position = 'fixed';
overlay.style.top = 0;
overlay.style.left = 0;
overlay.style.width = '100vw';
overlay.style.height = '100vh';
overlay.style.zIndex = 99999999;
overlay.style.backgroundColor = 'black';
overlay.style.display = 'block';
overlay.id = 'screen-blanker';
document.body.appendChild(overlay);

let message = document.createElement('div');


message.style.position = 'absolute';
message.style.top = '50%';
message.style.left = '50%';
message.style.transform = 'translate(-50%, -50%)';
message.style.fontSize = '30px';
message.style.color = 'white';
message.style.fontFamily = 'sans-serif';
message.innerHTML = 'Screen Blank: Press ESC to return';
document.body.appendChild(message);

let escPressed = 0;
window.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
escPressed++;
if (escPressed >= 2) {
document.body.removeChild(overlay);
document.body.removeChild(message);
escPressed = 0;
}
} else {
escPressed = 0;
}
});

screenBlankerMode = true;
} else {
document.getElementById('screen-blanker').remove();
screenBlankerMode = false;
}
}

// Troll Mode
function trollModeFunction() {
if (!trollMode) {
let crashOverlay = document.createElement('div');
crashOverlay.id = 'fake-crash';
crashOverlay.style.position = 'fixed';
crashOverlay.style.top = 0;
crashOverlay.style.left = 0;
crashOverlay.style.width = '100vw';
crashOverlay.style.height = '100vh';
crashOverlay.style.zIndex = 9999999;
crashOverlay.style.background = '#000';
crashOverlay.style.color = '#fff';
crashOverlay.style.fontFamily = 'monospace';
crashOverlay.style.fontSize = '2rem';
crashOverlay.style.display = 'flex';
crashOverlay.style.flexDirection = 'column';
crashOverlay.style.justifyContent = 'center';
crashOverlay.style.alignItems = 'center';
crashOverlay.style.textAlign = 'center';
crashOverlay.style.padding = '2rem';
crashOverlay.innerHTML = `
:(<br>
System Crash: Kernel Panic<br>
Press and hold the power button to force shutdown.
`;
document.body.appendChild(crashOverlay);
trollMode = true;
} else {
document.getElementById('fake-crash').remove();
trollMode = false;
}
}

// Create the hacker-style terminal UI


createHackerUI();

// Capture user input (simulating typing in the terminal)


let terminal = document.getElementById('hacker-terminal');
let userInput = '';
window.addEventListener('keydown', function(event) {
if (event.key === 'Enter') {
if (userInput.trim() !== '') {
processCommand(userInput.trim());
}
userInput = '';
} else if (event.key.length === 1) {
userInput += event.key;
terminal.innerHTML = terminal.innerHTML.replace(/>.*$/, '> ' +
userInput);
}
});
})();

You might also like