Skip to content

Commit d1d1ab9

Browse files
authored
Merge pull request #2 from mertssmnoglu/dynamic_u-h_names
Dynamically updating username and hostname
2 parents 828783d + 3ec6c56 commit d1d1ab9

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

css/style.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ body{
1212
color: whitesmoke;
1313
overflow: hidden;
1414
font-size: 25px;
15-
1615
}
1716

1817
#shellinput{
@@ -25,4 +24,9 @@ body{
2524

2625
#shellinput:focus{
2726
outline: none;
27+
}
28+
29+
#uname-hname{
30+
color: whitesmoke;
31+
font-size: 25px;
2832
}

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</head>
1212
<body>
1313
<div id="terminal">
14-
<span>username@hostname: </span><input type="text" name="shell" id="shellinput" onKeyPress="detectEnter(event, this)" >
14+
<span id="uname-hname"></span><input type="text" name="shell" id="shellinput" onKeyPress="detectEnter(event, this)" >
1515
</div>
1616
</body>
1717
</html>

js/script.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
console.log("Welcome to the shell!")
22
window.onload = function () {
3+
this.username = "username"
4+
this.hostname = "hostname"
35
document.getElementById("shellinput").value = "";
6+
document.getElementById("uname-hname").innerText = `${username}@${hostname}`
47
}
58

69
const commands = [

0 commit comments

Comments
 (0)