Ivers Innovations

Ivers Innovations Hi, I do Amateur Computer Repairs

06/28/2026

Also developing HTML 5, C # games

06/17/2026

Turned my Android tablet into an Ubuntu Server

06/13/2026






Mobile JS Chatbot

/* CSS: Making it look like a mobile app */
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; background-color: ; display: flex; flex-direction: column; height: 100vh; }
{ background: ; color: white; padding: 15px; text-align: center; font-size: 1.2rem; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
-box { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }

/* Message Bubbles */
.message { padding: 10px 15px; border-radius: 10px; max-width: 80%; font-size: 16px; word-wrap: break-word; }
.bot-msg { align-self: flex-start; background: white; border-bottom-left-radius: 2px; }
.user-msg { align-self: flex-end; background: ; border-bottom-right-radius: 2px; }

/* Input Area */
-container { display: flex; padding: 10px; background: ; border-top: 1px solid ; }
input { flex: 1; padding: 12px; border: none; border-radius: 25px; outline: none; font-size: 16px; }
button { background: ; color: white; border: none; border-radius: 50%; width: 45px; height: 45px; margin-left: 10px; cursor: pointer; font-size: 1.2rem; }




JS Chatbot Instance

Chatbot: Hi there! I'm your chatbot. Type 'quit' to exit.




➤



const chatBox = document.getElementById('chat-box');
const userInput = document.getElementById('user-input');
const sendBtn = document.getElementById('send-btn');

function processInput() {
const rawText = userInput.value.trim();
if (rawText === "") return;

// Display User Message
appendMessage(rawText, 'user-msg');
userInput.value = "";

// Process Logic (Translated from your Java code [cite: 3, 4, 5, 6, 7])
const cleanInput = rawText.toLowerCase();
let response = "";

if (cleanInput === "quit") {
response = "Chatbot: Goodbye! Have a great day!"; [cite: 3]
} else {
switch (cleanInput) {
case "hello":
case "hi":
case "hey":
response = "Chatbot: Hello! How can I assist you today?"; [cite: 4]
break;
case "how are you":
response = "Chatbot: I'm just a program, but I'm doing great! How about you?"; [cite: 5]
break;
case "what is your name":
response = "Chatbot: I'm your friendly chatbot. What's your name?"; [cite: 6]
break;
default:
response = "Chatbot: I'm not sure I understand. Can you rephrase?"; [cite: 7]
break;
}
}

// Delay response slightly for a "human" feel
setTimeout(() => {
appendMessage(response, 'bot-msg');
}, 600);
}

function appendMessage(text, className) {
const msgDiv = document.createElement('div');
msgDiv.classList.add('message', className);
msgDiv.innerText = text;
chatBox.appendChild(msgDiv);
chatBox.scrollTop = chatBox.scrollHeight; // Auto-scroll to bottom
}

// Listeners for Send click and Enter key
sendBtn.addEventListener('click', processInput);
userInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') processInput();
});



06/13/2026

Here’s the Java chatbot you provided, converted to JavaScript for Node.js:

JavaScript Code

const readline = require('readline');

// Create an interface for reading user input
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

console.log("Chatbot: Hi there! I'm your chatbot. Type 'quit' to exit.");

function startChat() {
rl.question("You: ", (userInput) => {
userInput = userInput.toLowerCase(); // Convert input to lowercase

// Exit condition
if (userInput === "quit") {
console.log("Chatbot: Goodbye! Have a great day!");
rl.close(); // Close the input stream
return;
}

// Respond based on user input
switch (userInput) {
case "hello":
case "hi":
case "hey":
console.log("Chatbot: Hello! How can I assist you today?");
break;

case "how are you":
console.log("Chatbot: I'm just a program, but I'm doing great! How about you?");
break;

case "what is your name":
console.log("Chatbot: I'm your friendly chatbot. What's your name?");
break;

default:
console.log("Chatbot: I'm not sure I understand. Can you rephrase?");
break;
}

// Continue the conversation
startChat();
});
}

// Start the chatbot
startChat();

How to Run This Code
1. Save the code to a file, e.g., chatbot.js.
2. Run the file in Node.js:

node chatbot.js

Key Changes
1. Input/Output:
• In Java: Scanner is used for input, and System.out.println for output.
• In JavaScript: readline module handles input/output in the terminal.
2. Loop Replacement:
• Java uses a while(true) loop.
• JavaScript recursively calls the startChat function for continuous input.
3. Case Handling:
• Both languages use switch-case for basic responses.

This Node.js chatbot behaves similarly to the original Java version! Would you like to extend its functionality further?

Later I may fix my Alcatel 4051s the hardware the hinge and screen.
06/13/2026

Later I may fix my Alcatel 4051s the hardware the hinge and screen.

05/31/2026

More of my past IT class media

I also sell premade bootable Linux drives for those who don’t want want to create their own.
05/19/2026

I also sell premade bootable Linux drives for those who don’t want want to create their own.

I am selling a an HP intel mini PC. It runs Windows 10 and has Microsoft Office 2010 pre-installed $40 OBO
05/19/2026

I am selling a an HP intel mini PC. It runs Windows 10 and has Microsoft Office 2010 pre-installed $40 OBO

Installing Pop! OS on Intel MacBook Pro
05/05/2026

Installing Pop! OS on Intel MacBook Pro

Quantum Computing
05/03/2026

Quantum Computing

Address

1203 Cedar Ridge Court
Grand Island, NE
68803

Alerts

Be the first to know and let us send you an email when Ivers Innovations posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Shortcuts

Share