Ghost Messenger
Instead of a messaging app, build a tool where you type a secret message, and it turns into "Unreadable Ghost Text"
Html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ghost Messenger</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Ghost Messenger 👻</h1>
<textarea id="userInput" placeholder="Type or paste your message here..."></textarea>
<div class="btn-group">
<button onclick="ghostify()">Ghostify (Encode)</button>
<button onclick="reveal()">Reveal (Decode)</button>
</div>
<div class="result-box">
<h3>Result:</h3>
<p id="outputText">Waiting for secrets...</p>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
CSS
body {
background-color: #121212;
color: #00ff41;
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
background: #1e1e1e;
padding: 25px;
border-radius: 10px;
width: 350px;
text-align: center;
box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
textarea {
width: 100%;
height: 80px;
margin-bottom: 15px;
background: #2b2b2b;
color: #fff;
border: 1px solid #444;
padding: 10px;
border-radius: 5px;
box-sizing: border-box;
}
.btn-group {
display: flex;
gap: 10px;
}
button {
flex: 1;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
font-weight: bold;
background: #00ff41;
color: #000;
}
button:hover {
background: #00cc33;
}
.result-box {
margin-top: 20px;
padding: 10px;
background: #000;
border-radius: 5px;
word-wrap: break-word;
}
JS
// Function to turn text into Ghost Code
function ghostify() {
let input = document.getElementById("userInput").value;
if (input === "") return alert("Please type a message!");
// Encode message to Base64
let encoded = btoa(input);
document.getElementById("outputText").innerText = "GHOST-" + encoded;
// Clear input box
document.getElementById("userInput").value = "";
}
// Function to turn Ghost Code back into text
function reveal() {
let input = document.getElementById("userInput").value;
if (input === "") return alert("Paste the GHOST- code to reveal it!");
try {
// Remove the 'GHOST-' prefix and decode
let cleanCode = input.replace("GHOST-", "");
let decoded = atob(cleanCode);
document.getElementById("outputText").innerText = decoded;
} catch (e) {
document.getElementById("outputText").innerText = "Invalid Ghost Code!";
}
}
Hope you Enjoy ..

Comments
Post a Comment