Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
chikchok1 committed Oct 23, 2024
2 parents f59fdd4 + 2c28176 commit b507b95
Show file tree
Hide file tree
Showing 19 changed files with 211 additions and 22 deletions.
7 changes: 5 additions & 2 deletions minkyong/JavaScript Study/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ <h1 id="greeting" class="hidden"></h1>

<h2 id="clock">00:00:00</h2>

<script src="app.js"></script>
<script src="clock.js"></script>
<script src="js/app.js"></script>
<script src="js/greetings.js"></script>
<script src="js/clock.js"></script>
<script src="js/background.js"></script>
<script src="js/todo.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const loginForm = document.querySelector("#login-form");
const loginInput = document.querySelector("#login-form input");
const greeting = document.querySelector("#greeting");

const HIDDEN_CLASSNAME = "hidden";


function onLoginSubmit(event){
event.preventDefalut();
Expand Down
7 changes: 7 additions & 0 deletions minkyong/JavaScript Study/js/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const images = ["0.jpeg", "1.jpeg", "2.jpeg"];
const chosenImage = images[Math.floor(Math.random() * images.length)];


const bgImage = document.createElement("img");
bgImage.src = `img/${chosenImage}`;
document.body.appendChild(bgImage);
File renamed without changes.
31 changes: 31 additions & 0 deletions minkyong/JavaScript Study/js/greetings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const loginForm = document.querySelector("#login-form");
const loginInput = document.querySelector("#login-form input");
const greeting = document.querySelector("#greeting");

const HIDDEN_CLASSNAME = "hidden";
const USERNAME_KEY = "username";

function onLoginSubmit(event) {
event.preventDefault();
loginForm.classList.add(HIDDEN_CLASSNAME);
const username = loginInput.value;
localStorage.setItem(USERNAME_KEY, username);
paintingGreetings(username);
}


function paintingGreetings(username) {
greeting.innerText = "Hello " + username;
greeting.classList.remove(HIDDEN_CLASSNAME);
}


const savedUsername = localStorage.getItem(USERNAME_KEY);


if (savedUsername === null) {
loginForm.classList.remove(HIDDEN_CLASSNAME);
loginForm.addEventListener("submit", onLoginSubmit);
} else {
paintingGreetings(savedUsername);
}
11 changes: 11 additions & 0 deletions minkyong/JavaScript Study/js/todo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const toDoFrom = document.getElementById("todo-form");
const toDoInput = toDoFrom.querySelector("input");
const toDoList = document.getElementById("todo-list");

function handleToDoSubmit(event) {
event.preventDefault();
const newTodo = toDoInput.value;
toDoInput.value = "";
}

toDoFrom.addEventListener("submit", handleToDoSubmit);
12 changes: 0 additions & 12 deletions yoojin/노마드/app.js

This file was deleted.

3 changes: 3 additions & 0 deletions yoojin/노마드/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.hidden {
display: none;
}
Binary file added yoojin/노마드/img/0.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added yoojin/노마드/img/1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added yoojin/노마드/img/2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 25 additions & 7 deletions yoojin/노마드/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="css/style.css" />
<title>Momentum App</title>
</head>
<body>
<div id="login-form">
<input type="text" placeholder="What is your name?" />
<button>Log In</button>
<form id="login-form">
<input
required
maxlength="15"
type="text"
placeholder="What is your name?"
/>
<input type="submit" value="Log In" />
</form>
<h2 id="clock">00:00:00</h2>
<h1 class="hidden" id="greeting"></h1>
<form id="todo-form">
<input type="text" placeholder="Write a To Do and Press Enter" required />
</form>
<ul id="todo-list"></ul>
<div id="quote">
<span></span>
<span></span>
</div>
<script src="app.js"></script>
<script src="js/app.js"></script>
<script src="js/greetings.js"></script>
<script src="js/clock.js"></script>
<script src="js/quotes.js"></script>
<script src="js/background.js"></script>
<script src="js/todo.js"></script>
</body>
</html>
14 changes: 14 additions & 0 deletions yoojin/노마드/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const loginForm = document.querySelector("#login-form");
const loginInput = document.querySelector("#login-form input");
const greeting = document.querySelector("#greeting");

function onLoginSubmit(event) {
event.preventDefault();
loginForm.classList.add("hidden");
const username = loginInput.value;
console.log(username);
greeting.innerText = "Hello " + username;
greeting.classList.remove("hidden");
}

loginForm.addEventListener("submit", onLoginSubmit);
6 changes: 6 additions & 0 deletions yoojin/노마드/js/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const images = ["0.jpeg", "1.jpeg", "2.jpeg"];
const chosenImage = images[Math.floor(Math.random() * images.length)];

const bgImage = document.createElement("img");
bgImage.src = `img/${chosenImage}`;
document.body.appendChild(bgImage);
11 changes: 11 additions & 0 deletions yoojin/노마드/js/clock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const clock = document.querySelector("h2#clock");

function getClock() {
const date = new Date();
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
clock.innerText = `${hours}:${minutes}:${seconds}`;
}
getClock();
setInterval(getClock, 1000);
28 changes: 28 additions & 0 deletions yoojin/노마드/js/greetings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const loginForm = document.querySelector("#login-form");
const loginInput = document.querySelector("#login-form input");
const greeting = document.querySelector("#greeting");

const HIDDEN_CLASSNAME = "hidden";
const USERNAME_KEY = "username";

function onLoginSubmit(event) {
event.preventDefault();
loginForm.classList.add(HIDDEN_CLASSNAME);
const username = loginInput.value;
localStorage.setItem(USERNAME_KEY, username);
paintingGreetings(username);
}

function paintingGreetings(username) {
greeting.innerText = "Hello " + username;
greeting.classList.remove(HIDDEN_CLASSNAME);
}

const savedUsername = localStorage.getItem(USERNAME_KEY);

if (savedUsername === null) {
loginForm.classList.remove(HIDDEN_CLASSNAME);
loginForm.addEventListener("submit", onLoginSubmit);
} else {
paintingGreetings(savedUsername);
}
58 changes: 58 additions & 0 deletions yoojin/노마드/js/quotes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const quotes = [
{
quote:
"Without continuous personal development, you are now all that you will ever become and hell starts when the person you are meets the person you could have been.",
author: "Eli Cohen",
},
{
quote:
"Working hard for something we don't care about is called stressed, working hard for something we love is called passion.",
author: "Simon Sinek",
},
{
quote:
"Move out of your comfort zone. You can only grow if you are willing to feel awkward and uncomfortable when you try something new.",
author: "Brian Tracy",
},
{
quote:
"Don't let the fear of losing be greater than the excitement of winning.",
author: "Robert Kiyosaki",
},
{
quote:
"Develop success from failures. Discouragement and failure are two of the surest stepping stones to success.",
author: "Dale Carnegie",
},
{
quote: "Action is the foundational key to all success.",
author: "Pablo Picasso",
},
{
quote:
"The difference between a successful person and others is not a lack of strength, not a lack of knowledge, but rather a lack of will.",
author: "Vince Lombardi",
},
{
quote:
"It is your determination and persistence that will make you a successful person.",
author: "Kenneth J Hutchins",
},
{
quote:
"You can waste your life drawing lines. Or you can live your life crossing them.",
author: "Shonda Rhimes",
},
{
quote: "Be poor, humble and driven. Don't be afraid to shift or pivot.",
author: "Alex Rodriguez",
},
];

const quoteText = document.querySelector("#quote span:first-child");
const authorText = document.querySelector("#quote span:last-child");

const todaysQuote = quotes[Math.floor(Math.random() * quotes.length)];

quoteText.innerText = todaysQuote.quote;
authorText.innerText = todaysQuote.author;
11 changes: 11 additions & 0 deletions yoojin/노마드/js/todo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const toDoFrom = document.getElementById("todo-form");
const toDoInput = toDoFrom.querySelector("input");
const toDoList = document.getElementById("todo-list");

function handleToDoSubmit(event) {
event.preventDefault();
const newTodo = toDoInput.value;
toDoInput.value = "";
}

toDoFrom.addEventListener("submit", handleToDoSubmit);
Empty file removed yoojin/노마드/style.css
Empty file.

0 comments on commit b507b95

Please sign in to comment.