Skip to content

Commit 5504a64

Browse files
committed
feat: clean initial display with banner and welcome message
1 parent b492521 commit 5504a64

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

script.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ async function loadConfig() {
2525
const text = await response.text();
2626
try {
2727
config = JSON.parse(text);
28-
displayOutput("Successfully loaded configuration from Gist");
2928
return;
3029
} catch (parseError) {
3130
console.error('Failed to parse config JSON:', parseError);
@@ -53,10 +52,18 @@ async function loadConfig() {
5352
// Initialize terminal
5453
async function initializeTerminal() {
5554
await loadConfig();
55+
// Clear any previous content
56+
clearTerminal();
57+
5658
if (config.ascii_art) {
57-
displayOutput(config.ascii_art);
59+
// Display ASCII art banner without timestamp
60+
const lines = config.ascii_art.replace(/\\n/g, '\n').split('\n');
61+
lines.forEach(line => {
62+
outputElement.innerHTML += `<div>${line}</div>`;
63+
});
5864
}
59-
displayOutput(`Welcome to ${config.about.name}'s terminal portfolio! Type 'help' for available commands.`);
65+
// Add welcome message without timestamp
66+
outputElement.innerHTML += `<div>Welcome to ${config.about.name}'s terminal portfolio! Type 'help' for available commands.</div>`;
6067
}
6168

6269
// Initialize when DOM is ready
@@ -182,11 +189,19 @@ function displayOutput(text, success = true) {
182189
const formattedText = text.replace(/\\n/g, '\n').split('\n').map(line => line.trim()).join('\n');
183190
const lines = formattedText.split('\n');
184191

192+
// Check if this is ASCII art (contains box drawing characters)
193+
const isAsciiArt = lines.some(line => line.match(/[]/));
194+
185195
lines.forEach((line, index) => {
186-
// Only add timestamp to first line
187-
// Calculate padding based on timestamp format [HH:MM:SS PM]
188-
const prefix = index === 0 ? `[${timestamp}] ` : ' '.repeat('[00:00:00 PM] '.length);
189-
outputElement.innerHTML += `<div class="${success ? '' : 'error'}">${prefix}${line}</div>`;
196+
if (isAsciiArt) {
197+
// For ASCII art, only add timestamp to first line, no padding for others
198+
const prefix = index === 0 ? `[${timestamp}] ` : '';
199+
outputElement.innerHTML += `<div class="${success ? '' : 'error'}">${prefix}${line}</div>`;
200+
} else {
201+
// For normal text, add timestamp or padding
202+
const prefix = index === 0 ? `[${timestamp}] ` : ' '.repeat('[00:00:00 PM] '.length);
203+
outputElement.innerHTML += `<div class="${success ? '' : 'error'}">${prefix}${line}</div>`;
204+
}
190205
});
191206

192207
scrollToBottom();

0 commit comments

Comments
 (0)