Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Vanila.js/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "openHtml",
"type": "shell",
"command": "index.html",
"problemMatcher": []
}
]
}
Comment on lines +1 to +13
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 파일의 역할은 무엇인가욥??

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visual Studio Code 기능 중 하나인 Task에 관련된 파일입니다. 자주 사용하는 명령어를 포맷에 맞게 등록해두면 [Tasks>Task 이름]으로 바로 실행하게 해줍니다.

56 changes: 56 additions & 0 deletions Vanila.js/CSS/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

첫 줄을 비워두시는 이유가 있을까요?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아무도 보지 않은 것이라고 생각해서 엉망진창으로 코딩했네요..

html{
text-align: center;
font-style:italic;
}

input{
width : 400px;
height : 50px;
font-size : x-large;
}

main{
display:inline-block;
width : 400px;
}

input::placeholder{
font-style:italic;
font-size: x-large;
font-weight : bold;
}
#createToDo{
border: none;
margin : 0px;
box-shadow: 0 5px 10px rgba(0,0,0,0.5);
}

#contents{
padding :0px;
text-align: center;
margin : 0px;
}

.content{
box-shadow: 1px 1px 5px rgba(0,0,0,0.5);
text-align:left;
display: inline-block;
position: relative;
width : 400px;
height : 50px;

}

.content h1{

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

가독성과 무관한 빈 줄은 제거해주세요.

margin : 0px
}

.destory{
position : absolute;
top : 13px;
right :10px;
font-weight: inherit;
color: #cc9a9a;
}
Comment on lines +2 to +56
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ CSS property 표기의 일관성이 떨어지는 것 같습니다.

property: value
property : value
property:value

위 세 가지 중 하나만 사용하시는 것을 권장합니다.
직접 맞추기 힘드시다면 Prettier 확장 프로그램을 추천해드립니다.
code style을 맞춰주는 툴은 항상 편합니다! 👍

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋은 정보감사합니다 ㅎㅎ

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier 저도 알아갑니다 총총...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seki님 말씀 메모메모

56 changes: 56 additions & 0 deletions Vanila.js/JS/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

function enterkey(){
let input = document.getElementById("createToDo");

if(window.event.keyCode == 13){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KeyboardEvent.keyCode는 deprecated된 기능입니다.

console.log(input.value);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

디버깅을 위한 console.log는 PR전에 제거해 주세요!

if(localStorage.getItem(input.value) == null && input.value != "")
{
localStorage.setItem(input.value,JSON.stringify(input.value));
draw(makecontent(input.value));
}
Comment on lines +7 to +11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분 이해가 잘 가지 않는데 설명 부탁드립니다!


input.value = "";
}
}

function makecontent(val){
let content = document.createElement("div");
let h = document.createElement("h1");
let txtNode = document.createTextNode(val);
let button = document.createElement("button");

button.setAttribute("class","destory");
button.setAttribute("onclick", "remove(" +"\""+val+"\""+")")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event object를 사용하는 것이 더 좋을 것 같습니다.

Suggested change
button.setAttribute("onclick", "remove(" +"\""+val+"\""+")")
button.setAttribute("onclick", remove)

🔧할 일 이름에 쌍따옴표(")가 들어가면 동작하지 않는 문제가 있습니다.

content.setAttribute("class", "content");
content.setAttribute("id", val);

h.appendChild(txtNode);
button.appendChild(document.createTextNode("X"));

content.appendChild(h);
content.appendChild(button);

return content;
}

function draw(content){
let contents = document.getElementById("contents");
contents.appendChild(content);
}

function remove(item_id){
let content = document.getElementById(item_id);
let contents = document.getElementById("contents");

localStorage.removeItem(item_id);
contents.removeChild(content);
}


(function load(){

for(var i = 0; i < localStorage.length; i++){
draw(makecontent(localStorage.key(i)));
}
})()
32 changes: 32 additions & 0 deletions Vanila.js/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>

<html>
<head>
<meta charset="utf-8">
<link rel = "stylesheet" href = "CSS/index.css">
<title>vanilaToDoList</title>

</head>
<body>
<header>
<div>
<h1>
Seongho's vanilaToDoList
</h1>
</div>
</header>
<main>
<div>
<input onkeyup = "enterkey()" id = "createToDo" placeholder="Enter to save your task" autofocus>
</div>
<ul id = "contents">
</ul>
</main>
<footer>
<div>

</div>
</footer>
<script src = "JS/index.js"></script>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index.js를 html 시작 부분이 아니라 뒷 부분에 사용하신 이유가 있으신가요?

</body>
</html>
Comment on lines +3 to +32
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

원래 HTML 작성하실 때 탭을 사용하시나요?
아니라면 위랑 동일하게 Prettier 사용을 권장합니다.

51 changes: 51 additions & 0 deletions Vanila.js/vanillajs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!doctype html>
<html lang="en" data-framework="javascript">
<head>
<meta charset="utf-8">
<title>VanillaJS • TodoMVC</title>
<link rel="stylesheet" href="node_modules/todomvc-common/base.css">
<link rel="stylesheet" href="node_modules/todomvc-app-css/index.css">
</head>
<body>
<section class="todoapp">
<header class="header">
<h1>todos</h1>
<input class="new-todo" placeholder="What needs to be done?" autofocus>
</header>
<section class="main">
<input id="toggle-all" class="toggle-all" type="checkbox">
<label for="toggle-all">Mark all as complete</label>
<ul class="todo-list"></ul>
</section>
<footer class="footer">
<span class="todo-count"></span>
<ul class="filters">
<li>
<a href="#/" class="selected">All</a>
</li>
<li>
<a href="#/active">Active</a>
</li>
<li>
<a href="#/completed">Completed</a>
</li>
</ul>
<button class="clear-completed">Clear completed</button>
</footer>
</section>
<footer class="info">
<p>Double-click to edit a todo</p>
<p>Created by <a href="http://twitter.com/oscargodson">Oscar Godson</a></p>
<p>Refactored by <a href="https://github.com/cburgmer">Christoph Burgmer</a></p>
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer>
<script src="node_modules/todomvc-common/base.js"></script>
<script src="js/helpers.js"></script>
<script src="js/store.js"></script>
<script src="js/model.js"></script>
<script src="js/template.js"></script>
<script src="js/view.js"></script>
<script src="js/controller.js"></script>
<script src="js/app.js"></script>
</body>
</html>
25 changes: 25 additions & 0 deletions Vanila.js/vanillajs/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*global app, $on */
(function () {
'use strict';

/**
* Sets up a brand new Todo list.
*
* @param {string} name The name of your new to do list.
*/
function Todo(name) {
this.storage = new app.Store(name);
this.model = new app.Model(this.storage);
this.template = new app.Template();
this.view = new app.View(this.template);
this.controller = new app.Controller(this.model, this.view);
}

var todo = new Todo('todos-vanillajs');

function setView() {
todo.controller.setView(document.location.hash);
}
$on(window, 'load', setView);
$on(window, 'hashchange', setView);
})();
Loading