Compare commits
No commits in common. "aee24b18d173c2263fd135107cec0401d29eaf60" and "2977478b0c5d5af3f3532d9d4e57e921ee1e482b" have entirely different histories.
aee24b18d1
...
2977478b0c
Binary file not shown.
Before Width: | Height: | Size: 175 KiB After Width: | Height: | Size: 134 KiB |
@ -94,11 +94,13 @@ input {
|
||||
.image-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.image-grid>* {
|
||||
max-width: 100%;
|
||||
max-width: 50%;
|
||||
max-height: 50%;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,8 @@
|
||||
<h1>welcome to my website</h1>
|
||||
<h2 id="switch_theme">switch theme</h2>
|
||||
|
||||
<p>type <span id="help">'help'</span> to list all commands</p>
|
||||
<p>press <kbd>Enter</kbd> to run command</p>
|
||||
<p>use <span id="help">'help'</span> to list all commands</p>
|
||||
<span>[guest@website ~]$ </span>
|
||||
<input type="text" id="command">
|
||||
</div>
|
||||
|
31
js/data.js
31
js/data.js
@ -16,12 +16,21 @@ const MUSIC_METADATA = [
|
||||
'Metallica'
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'gothic metal',
|
||||
aliases: ['gm', 'goth', 'gothic'],
|
||||
artists: [
|
||||
'Draconian',
|
||||
'Beseech',
|
||||
'To/Die/For',
|
||||
'For My Pain...',
|
||||
'Entwine'
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'depressive suicidal black metal',
|
||||
aliases: ['dsbm'],
|
||||
artists: [
|
||||
'Totalselfhatred',
|
||||
'Lifelover',
|
||||
'минута агонии',
|
||||
'Decalius'
|
||||
]
|
||||
@ -36,8 +45,22 @@ const MUSIC_METADATA = [
|
||||
'Watain',
|
||||
'Bathory',
|
||||
'Carpathian Forest',
|
||||
'Darkthrone',
|
||||
'Rotting Christ'
|
||||
'Darkthrone'
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'nu metal',
|
||||
aliases: ['nm', 'nu'],
|
||||
artists: [
|
||||
'Slipknot',
|
||||
'Evanescence'
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'other genres',
|
||||
aliases: [],
|
||||
artists: [
|
||||
'Rammstein'
|
||||
]
|
||||
}
|
||||
]
|
20
js/script.js
20
js/script.js
@ -5,13 +5,13 @@ function updateAge() {
|
||||
}
|
||||
|
||||
// process command function
|
||||
function processCommand(input) {
|
||||
const [commandName, ...args] = input.split(' ') || [input]
|
||||
function processCommand() {
|
||||
const [commandName, ...args] = command.value.split(' ') || [command.value]
|
||||
const suppliedCommand = COMMANDS.find(c => c.name === commandName)
|
||||
|
||||
if (!suppliedCommand) {
|
||||
result.textContent = '';
|
||||
return;
|
||||
result.textContent = 'invalid command';
|
||||
return
|
||||
}
|
||||
|
||||
const { arguments, output } = suppliedCommand;
|
||||
@ -66,7 +66,9 @@ command?.addEventListener('focusout', () => {
|
||||
setTimeout(() => command.focus(), 0);
|
||||
})
|
||||
|
||||
command?.addEventListener('input', () => processCommand(command.value))
|
||||
command?.addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter') processCommand()
|
||||
})
|
||||
|
||||
// run all tasks
|
||||
if (typeof age !== 'undefined') runEvery(updateAge, 10 * 1000)
|
||||
@ -80,11 +82,5 @@ if (theme === 'dark')
|
||||
// listen to help tooltip
|
||||
help.addEventListener('click', () => {
|
||||
command.value = 'help';
|
||||
processCommand('help');
|
||||
processCommand();
|
||||
})
|
||||
|
||||
// ignore context menu
|
||||
document.addEventListener('contextmenu', e => e.preventDefault());
|
||||
|
||||
// check for command in input
|
||||
if (command?.value) processCommand(command.value);
|
Reference in New Issue
Block a user