From 71d5fb32bcdd6c8276501ab1f2c9356bb5d807c4 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:06:05 +0900 Subject: [PATCH 01/32] =?UTF-8?q?=EB=A9=94=EC=9D=B8=20=EB=B2=84=ED=8A=BC?= =?UTF-8?q?=20html=EC=97=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.html b/index.html index fc99deac2..800ab2bdd 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,10 @@

πŸš‡ μ§€ν•˜μ²  노선도 관리

+ + + +

From d9354e3348b652a5707a959a0f51214acbdf5e83 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:07:06 +0900 Subject: [PATCH 02/32] =?UTF-8?q?html=EC=97=90=20=EC=97=AD=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20form=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/index.html b/index.html index 800ab2bdd..5ab2bdec4 100644 --- a/index.html +++ b/index.html @@ -12,6 +12,21 @@

πŸš‡ μ§€ν•˜μ²  노선도 관리



+ From 8b35bd32ce88bdf6384f4cfc7cd89b1d282bb21a Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:07:45 +0900 Subject: [PATCH 03/32] =?UTF-8?q?html=EC=97=90=20=EB=85=B8=EC=84=A0=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20form=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/index.html b/index.html index 5ab2bdec4..f9f5761ed 100644 --- a/index.html +++ b/index.html @@ -27,6 +27,24 @@

πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘

+ + From f38f4fa95d032bccd1c515006331d546de66abfe Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:08:24 +0900 Subject: [PATCH 04/32] =?UTF-8?q?html=EC=97=90=20=EA=B5=AC=EA=B0=84=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20form=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/index.html b/index.html index f9f5761ed..df540c643 100644 --- a/index.html +++ b/index.html @@ -45,6 +45,22 @@

πŸš‰ μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘

+ + From a1e7e84a629400edde2e65d8014d5f7e675dc3cc Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:09:37 +0900 Subject: [PATCH 05/32] =?UTF-8?q?html=EC=97=90=20=EB=85=B8=EC=84=A0?= =?UTF-8?q?=EB=8F=84=20=EC=B6=9C=EB=A0=A5=20form=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.html b/index.html index df540c643..f4d60ca48 100644 --- a/index.html +++ b/index.html @@ -61,6 +61,8 @@

ꡬ간 등둝

+ + From ab7473e69630a6305c9dfa9dc0ec66b5944de6a8 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:11:25 +0900 Subject: [PATCH 06/32] =?UTF-8?q?line=20class=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/line.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/line.js diff --git a/src/line.js b/src/line.js new file mode 100644 index 000000000..76d9600b0 --- /dev/null +++ b/src/line.js @@ -0,0 +1,6 @@ +export class Line { + constructor(name, firstStation, lastStation) { + this.name = name; + this.section = new Section(firstStation, lastStation); + } +} \ No newline at end of file From 25fea13bddfb621beb9248a1cd6161fff04f3750 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:12:20 +0900 Subject: [PATCH 07/32] =?UTF-8?q?section=20class=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/section.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/section.js diff --git a/src/section.js b/src/section.js new file mode 100644 index 000000000..e4de00aac --- /dev/null +++ b/src/section.js @@ -0,0 +1,15 @@ +export class Section { + constructor(firstStation, lastStation) { + this.stations = []; + this.stations.push(firstStation); + this.stations.push(lastStation); + } + + addStation(station, position) { + this.stations.splice(position, 0, station); + } + + deleteStation() { + this.stations.splice(position, 1); + } +} \ No newline at end of file From 44feeac800126d9b39b246b475512917ac2fb52d Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:19:28 +0900 Subject: [PATCH 08/32] =?UTF-8?q?Readme=EC=97=90=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=EB=AA=A9=EB=A1=9D=20=EB=8B=A8=EC=9C=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index e97a1d649..5bbb7263a 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,24 @@ ### μ§€ν•˜μ²  노선도 좜λ ₯ κΈ°λŠ₯ - μ§€ν•˜μ²  노선도 좜λ ₯ λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ `
` νƒœκ·Έλ₯Ό λ§Œλ“€κ³  ν•΄λ‹Ή νƒœκ·Έ 내뢀에 노선도λ₯Ό 좜λ ₯ν•œλ‹€. + +## κΈ°λŠ₯λͺ©λ‘ λ‹¨μœ„ +- μ§€ν•˜μ²  μ—­ 이름을 μž…λ ₯λ°›μ•„ μ—­ λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. + - μ€‘λ³΅λœ μ—­ 이름이 좔가될 수 μ—†λ‹€. +- μ—­ λͺ©λ‘μ—μ„œ μ§€ν•˜μ² μ—­μ„ μ‚­μ œν•  수 μžˆλ‹€. +- μ—­ λͺ©λ‘μ—μ„œ μ§€ν•˜μ² μ—­μ΄ μ‚­μ œλ˜λ©΄ 이후 select elementμ—μ„œλ„ μ‚­μ œλœλ‹€. +- μ§€ν•˜μ²  노선을 μΆ”κ°€ν•  수 μžˆλ‹€. + - 상행 쒅점과 ν•˜ν–‰ 쒅점을 μ„ νƒν•œλ‹€. +- λ…Έμ„  λͺ©λ‘μ—μ„œ 노선을 μ‚­μ œν•  수 μžˆλ‹€. +- 노선을 μ„ νƒν•˜μ—¬ μ›ν•˜λŠ” μœ„μΉ˜μ— ꡬ간을 μΆ”κ°€ν•  수 μžˆλ‹€. + - μΆ”κ°€ν•  μœ„μΉ˜λŠ” μŒμˆ˜κ°€ 될 수 μ—†λ‹€. +- λ…Έμ„ μ—μ„œ μ›ν•˜λŠ” ꡬ간을 μ œκ±°ν•  수 μžˆλ‹€. + - 제거 λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ œκ±°ν•  것인지 ν™•μΈν•˜λŠ” 경고창을 λ„μš΄λ‹€ + - κ²½κ³ μ°½μ—μ„œ 확인을 λˆŒλŸ¬μ•Ό ꡬ간이 μ œκ±°λœλ‹€. +- λ…Έμ„  이름과 노선에 ν¬ν•¨λœ ꡬ간듀을 좜λ ₯ν•œλ‹€. +- μƒˆλ‘œκ³ μΉ¨ 해도 데이터가 μ‚­μ œλ˜μ§€ μ•ŠλŠ”λ‹€. + + ### κΈ°μ‘΄ μš”κ΅¬μ‚¬ν•­ - μ‚¬μš©μžκ°€ 잘λͺ»λœ μž…λ ₯ 값을 μž‘μ„±ν•œ 경우 `alert`을 μ΄μš©ν•΄ λ©”μ‹œμ§€λ₯Ό 보여주고, μž¬μž…λ ₯ν•  수 있게 ν•œλ‹€. From da26adf8df33c178664aebaff2ad3449460bccd4 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:20:25 +0900 Subject: [PATCH 09/32] =?UTF-8?q?=EC=97=AD=EA=B3=BC=20=EB=85=B8=EC=84=A0?= =?UTF-8?q?=EC=9D=84=20=EB=8B=B4=EC=9D=84=20=EB=B0=B0=EC=97=B4=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.js b/src/index.js index e69de29bb..45a16a9aa 100644 --- a/src/index.js +++ b/src/index.js @@ -0,0 +1,3 @@ + +window.arrStations = new Array(); +window.arrLine = new Array(); \ No newline at end of file From 9d08421584b4f7e28d83593dc4650bcd6dbb336c Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:24:29 +0900 Subject: [PATCH 10/32] =?UTF-8?q?local=20strage=EC=97=90=20=EC=9E=88?= =?UTF-8?q?=EB=8A=94=20=EA=B8=B0=EC=A1=B4=EC=9D=98=20=EC=97=AD=EA=B3=BC=20?= =?UTF-8?q?=EB=85=B8=EC=84=A0=EC=9D=B8=EC=A7=80=20=EC=B2=B4=ED=81=AC?= =?UTF-8?q?=ED=95=98=EC=97=AC=20=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90=20?= =?UTF-8?q?=EC=B6=9C=EB=A0=A5=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 45a16a9aa..687eddaab 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,29 @@ window.arrStations = new Array(); -window.arrLine = new Array(); \ No newline at end of file +window.arrLine = new Array(); + + + +function GetStationsArray() { + if(localStorage.getItem("stations") != null) { + arrStations = JSON.parse(localStorage.getItem("stations")); + for(let i = 0; i < arrStations.length; i++) { + createStationHTML(arrStations[i]); + } + } +} + +function GetLinesArray() { + if(localStorage.getItem("lines") != null) { + arrLine = JSON.parse(localStorage.getItem("lines")); + for(let i=0; i < arrLine.length; i++) { + makeTableOfLine(arrLine[i]); + let length = arrLine [i].section.stations.length; + if(length > 0) { + createLineHTML(arrLine[i], arrLine[i].name, + arrLine[i].section.stations[0], arrLine[i].section.stations[length - 1]); + createStationInSectionHTML(arrLine[i]); + } + } + } +} \ No newline at end of file From 7b0830f51ad9dadd0e82965ff5912caecb1df6f7 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:27:28 +0900 Subject: [PATCH 11/32] =?UTF-8?q?=EA=B0=81=20=EB=B2=84=ED=8A=BC=EC=97=90?= =?UTF-8?q?=20event=20listener=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/index.js b/src/index.js index 687eddaab..79ff4768d 100644 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,28 @@ window.arrStations = new Array(); window.arrLine = new Array(); +GetStationsArray(); +GetLinesArray(); +const eachStation = document.getElementById('#station-name-input').value; +const addStationBtn = document.getElementById('#station-add-button'); +addStationBtn.addEventListener('click', addStationToTable); +const addStationToSectionButton = document.getElementById('#section-add-button'); +addStationToSectionButton.addEventListener('click', addStationToSection); + +const addLineBtn = document.getElementById('#line-add-button'); +addLineBtn.addEventListener('click', addLineToTable); + +let manageStations = document.getElementById('#station-manager-button'); +let manageLines = document.getElementById('#line-manager-button'); +let manageSections = document.getElementById('#section-manager-button'); +let printSubwaymap = document.getElementById('#map-print-manager-button'); + +manageStations.addEventListener('click', showManageStations); +manageLines.addEventListener('click', showManageLines); +manageSections.addEventListener('click', showManageSections); +printSubwaymap.addEventListener('click', showSubwaymap); function GetStationsArray() { if(localStorage.getItem("stations") != null) { From e7d86a0976b29c9035faae5746754d0a28017064 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:29:08 +0900 Subject: [PATCH 12/32] =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=EC=97=90=EC=84=9C=20=EC=97=AD=20=EC=9D=B4=EB=A6=84?= =?UTF-8?q?=EC=9D=84=20=EA=B0=80=EC=A0=B8=EC=99=80=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/index.js b/src/index.js index 79ff4768d..e221120b6 100644 --- a/src/index.js +++ b/src/index.js @@ -46,4 +46,18 @@ function GetLinesArray() { } } } +} + +function addStationToTable() { + + let stationName = document.getElementById('#station-name-input').value; + + let index = arrStations.indexOf(stationName); + if(index != -1) { + alert('같은 μ—­ 이름을 μž…λ ₯ν•  수 μ—†μŠ΅λ‹ˆλ‹€.'); + return; + } + + createStationHTML(stationName); + addStationToArray(stationName); } \ No newline at end of file From e0b239ec0d1c5a691dd64426dd54c432a57db945 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:30:23 +0900 Subject: [PATCH 13/32] =?UTF-8?q?=EC=83=88=EB=A1=9C=EC=9A=B4=20=EC=97=AD?= =?UTF-8?q?=EC=9D=84=20=ED=85=8C=EC=9D=B4=EB=B8=94=EC=97=90=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/index.js b/src/index.js index e221120b6..20c74e9a4 100644 --- a/src/index.js +++ b/src/index.js @@ -60,4 +60,17 @@ function addStationToTable() { createStationHTML(stationName); addStationToArray(stationName); +} + +function createStationHTML(stationName) { + let stationTable = document.getElementById('#print-station-list'); + let stationRow = stationTable.insertRow(stationTable.rows.length); + let cell1 = stationRow.insertCell(0); + cell1.innerHTML = stationName; + + let deleteButton = addStationDeleteBtnOnTable(stationRow); + deleteStationFromTable(deleteButton); + addOptionsToSelectBox(stationName); + document.getElementById('#station-name-input').value=''; + addOptionsToSectionSelectBox(stationName); } \ No newline at end of file From e772e1331300e76e3ea22f955c18c7e7ff3b0d2f Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:30:54 +0900 Subject: [PATCH 14/32] =?UTF-8?q?=EC=97=AD=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=EC=97=90=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/index.js b/src/index.js index 20c74e9a4..258fe1ed5 100644 --- a/src/index.js +++ b/src/index.js @@ -73,4 +73,16 @@ function createStationHTML(stationName) { addOptionsToSelectBox(stationName); document.getElementById('#station-name-input').value=''; addOptionsToSectionSelectBox(stationName); +} + +function addStationDeleteBtnOnTable(stationRow) { + let cell2 = stationRow.insertCell(1); + let stationDeleteBtn = document.createElement('button'); + let stationDeleteBtnText = document.createTextNode('μ‚­μ œ'); + stationDeleteBtn.className = '.station-delete-button'; + stationDeleteBtn.appendChild(stationDeleteBtnText); + document.body.appendChild(stationDeleteBtn); + cell2.appendChild(stationDeleteBtn); + + return stationDeleteBtn; } \ No newline at end of file From 1729d049a02f4767098a4b6fb9fbc082b6d77d47 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:32:01 +0900 Subject: [PATCH 15/32] =?UTF-8?q?=EB=85=B8=EC=84=A0=20=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=EC=9D=98=20=EB=91=90=20=EC=85=80=EB=A0=89=ED=8A=B8=EB=B0=95?= =?UTF-8?q?=EC=8A=A4=EC=97=90=20=EC=98=B5=EC=85=98=EC=9D=84=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/index.js b/src/index.js index 258fe1ed5..e7c385441 100644 --- a/src/index.js +++ b/src/index.js @@ -85,4 +85,19 @@ function addStationDeleteBtnOnTable(stationRow) { cell2.appendChild(stationDeleteBtn); return stationDeleteBtn; +} + +function addOptionsToSelectBox(stationName) { + //first station + let selectStationStart = document.getElementById("#line-start-station-selector"); + let elStart = document.createElement("option"); + elStart.textContent = stationName; + elStart.value = stationName; + selectStationStart.appendChild(elStart); + //last station + let selectStationEnd = document.getElementById("#line-end-station-selector"); + let elEnd = document.createElement("option"); + elEnd.textContent = stationName; + elEnd.value = stationName; + selectStationEnd.appendChild(elEnd); } \ No newline at end of file From fded38a38e46ca1059676d50c9f583519c379845 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:33:39 +0900 Subject: [PATCH 16/32] =?UTF-8?q?=EC=97=AD=EC=9D=84=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=EC=97=90=EC=84=9C=20=EC=82=AD=EC=A0=9C=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/index.js b/src/index.js index e7c385441..1115e1d7f 100644 --- a/src/index.js +++ b/src/index.js @@ -100,4 +100,20 @@ function addOptionsToSelectBox(stationName) { elEnd.textContent = stationName; elEnd.value = stationName; selectStationEnd.appendChild(elEnd); +} + +function deleteStationFromTable(deleteButton) { + //connect delete function to the delete button + deleteButton.addEventListener('click', function() { + let arrButton = document.getElementsByClassName('.station-delete-button'); + let stationSelector = document.getElementById('#line-start-station-selector'); + let endStationSelector = document.getElementById('#line-end-station-selector'); + let index = [].slice.call(arrButton).indexOf(deleteButton); + stationSelector.remove(index); + endStationSelector.remove(index); + + deleteStationFromArray(index); + + this.parentElement.parentElement.remove(); + }); } \ No newline at end of file From 06b8746740290911d6a3277ddfb3646ec75b4e39 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:34:28 +0900 Subject: [PATCH 17/32] =?UTF-8?q?=EC=83=88=EB=A1=9C=EC=9A=B4=20=EB=85=B8?= =?UTF-8?q?=EC=84=A0=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/index.js b/src/index.js index 1115e1d7f..64e1104fa 100644 --- a/src/index.js +++ b/src/index.js @@ -116,4 +116,15 @@ function deleteStationFromTable(deleteButton) { this.parentElement.parentElement.remove(); }); +} + +function addLineToTable() { + let lineName = document.getElementById('#line-name-input').value; + let firstStation = document.getElementById('#line-start-station-selector').value; + let lastStation = document.getElementById('#line-end-station-selector').value; + let newLine = new Line(lineName, firstStation, lastStation); + + addLineToArray(newLine); + + createLineHTML(newLine, newLine.name, firstStation, lastStation); } \ No newline at end of file From 50176f1099c3f7c668a6fc3efae9bbe80a5fe9fa Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:35:28 +0900 Subject: [PATCH 18/32] =?UTF-8?q?=EB=85=B8=EC=84=A0=EC=9D=84=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=96=88=EC=9D=84=EB=95=8C=20=EB=85=B8=EC=84=A0=20?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=EC=97=90=20=EC=83=88=EB=A1=9C?= =?UTF-8?q?=EC=9A=B4=20=ED=96=89=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/index.js b/src/index.js index 64e1104fa..3cba7744f 100644 --- a/src/index.js +++ b/src/index.js @@ -127,4 +127,21 @@ function addLineToTable() { addLineToArray(newLine); createLineHTML(newLine, newLine.name, firstStation, lastStation); +} + +function createLineHTML(newLine, lineName, firstStation, lastStation) { + let lineTable = document.getElementById('#print-line-list'); + let lineRow = lineTable.insertRow(lineTable.rows.length); + let cell1 = lineRow.insertCell(0); + let cell2 = lineRow.insertCell(1); + let cell3 = lineRow.insertCell(2); + cell1.innerHTML = lineName; + cell2.innerHTML = firstStation; + cell3.innerHTML = lastStation; + document.getElementById('#line-name-input').value=''; + + let deleteButton = addLineDeleteBtnOnTable(lineRow); + makeLineBtnFromArray(newLine); + deleteLineFromTable(deleteButton, newLine); + makeTableOfLine(newLine); } \ No newline at end of file From acf72368732473a48f3caf5071a261b3d107efe0 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:36:01 +0900 Subject: [PATCH 19/32] =?UTF-8?q?=EB=85=B8=EC=84=A0=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=EC=97=90=20=EC=82=AD=EC=A0=9C=20=EB=B2=84=ED=8A=BC?= =?UTF-8?q?=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=98=EB=8A=94=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/index.js b/src/index.js index 3cba7744f..28fdbce7e 100644 --- a/src/index.js +++ b/src/index.js @@ -144,4 +144,17 @@ function createLineHTML(newLine, lineName, firstStation, lastStation) { makeLineBtnFromArray(newLine); deleteLineFromTable(deleteButton, newLine); makeTableOfLine(newLine); +} + +function addLineDeleteBtnOnTable(lineRow) { + //add delete button on the table + let lineDeleteBtn = document.createElement('button'); + let lineDeleteBtnText = document.createTextNode('μ‚­μ œ'); + let cell4 = lineRow.insertCell(3); + lineDeleteBtn.className = '.line-delete-button'; + lineDeleteBtn.appendChild(lineDeleteBtnText); + document.body.appendChild(lineDeleteBtn); + cell4.appendChild(lineDeleteBtn); + + return lineDeleteBtn; } \ No newline at end of file From eca3d1fc9122794cab20aed143b5d8aa0fcf5f39 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:36:35 +0900 Subject: [PATCH 20/32] =?UTF-8?q?=EB=85=B8=EC=84=A0=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=EC=97=90=EC=84=9C=20=EC=9E=90=EB=A3=8C=EB=A5=BC=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/index.js b/src/index.js index 28fdbce7e..76a5fa2f5 100644 --- a/src/index.js +++ b/src/index.js @@ -157,4 +157,15 @@ function addLineDeleteBtnOnTable(lineRow) { cell4.appendChild(lineDeleteBtn); return lineDeleteBtn; +} + +function deleteLineFromTable(deleteLineButton, newLine) { + //connect delete function to the delete button + deleteLineButton.addEventListener('click', function() { + const index = arrLine.indexOf(newLine); + //arrLine.splice(index,1); + deleteLineFromArray(index); + this.parentElement.parentElement.remove(); + makeSubwayMap(); + }); } \ No newline at end of file From 98c8b60daab57a8797f780ae53817fdbc863a9b9 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:37:21 +0900 Subject: [PATCH 21/32] =?UTF-8?q?=EA=B5=AC=EA=B0=84=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90=20=EB=85=B8=EC=84=A0?= =?UTF-8?q?=EB=B3=84=20=EB=B2=84=ED=8A=BC=EC=9D=84=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/index.js b/src/index.js index 76a5fa2f5..a54d93ab3 100644 --- a/src/index.js +++ b/src/index.js @@ -168,4 +168,14 @@ function deleteLineFromTable(deleteLineButton, newLine) { this.parentElement.parentElement.remove(); makeSubwayMap(); }); +} + +function makeLineBtnFromArray(newLine) { + let lineBtn = document.createElement('button'); + let lineBtnText = document.createTextNode(newLine.name); + lineBtn.appendChild(lineBtnText); + lineBtn.className = '.section-line-menu-button'; + document.getElementById('line-buttons').appendChild(lineBtn); + + lineBtn.addEventListener('click', function() {showAddDeleteSection(newLine)}); } \ No newline at end of file From c0020a74f9d5d9e3c75ae7fb527ef132e7f75a75 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:37:57 +0900 Subject: [PATCH 22/32] =?UTF-8?q?=EA=B5=AC=EA=B0=84=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=EC=8B=9C=20=EC=85=80=EB=A0=89=ED=8A=B8=20=EB=B0=95=EC=8A=A4?= =?UTF-8?q?=EC=97=90=20=EC=98=B5=EC=85=98=EC=9D=84=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/index.js b/src/index.js index a54d93ab3..cdf47a359 100644 --- a/src/index.js +++ b/src/index.js @@ -178,4 +178,12 @@ function makeLineBtnFromArray(newLine) { document.getElementById('line-buttons').appendChild(lineBtn); lineBtn.addEventListener('click', function() {showAddDeleteSection(newLine)}); +} + +function addOptionsToSectionSelectBox(stationName) { + let selectSection = document.getElementById('#section-station-selector'); + let elSection = document.createElement('option'); + elSection.textContent = stationName; + elSection.value = stationName; + selectSection.appendChild(elSection); } \ No newline at end of file From b9256991c03b077f77c96b3f8e46e8158ec5b300 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:38:57 +0900 Subject: [PATCH 23/32] =?UTF-8?q?=EA=B5=AC=EA=B0=84=20=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=EC=97=90=20=EB=85=B8=EC=84=A0=EB=B3=84=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=EC=9D=84=20=EB=A7=8C=EB=93=9C=EB=8A=94=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/index.js b/src/index.js index cdf47a359..436c0eae7 100644 --- a/src/index.js +++ b/src/index.js @@ -186,4 +186,29 @@ function addOptionsToSectionSelectBox(stationName) { elSection.textContent = stationName; elSection.value = stationName; selectSection.appendChild(elSection); +} + +function makeTableOfLine(newLine) { + let container = document.getElementById('section-lists-container'); + let sectionTable = document.createElement('table'); + + let headerRow = sectionTable.insertRow(0); + let headerCell1 = headerRow.insertCell(0); + let headerCell2 = headerRow.insertCell(1); + let headerCell3= headerRow.insertCell(2); + headerCell1.innerHTML = 'μˆœμ„œ'; + headerCell2.innerHTML = '이름'; + headerCell3.innerHTML = 'μ„€μ •'; + + sectionTable.id = '#print-section-list-' + newLine.name; + sectionTable.border = 1; + sectionTable.classList.add('section-table'); + sectionTable.style.width = 'fit-content'; + + let lengthOfStations = newLine.section.stations.length; + for (let i = 0; i < lengthOfStations; i += 1) { + addLineToSectionTable(sectionTable, newLine.section.stations[i], i); + } + makeSubwayMap(); + container.appendChild(sectionTable); } \ No newline at end of file From 0708fe4d66cec76a50403786a5f6d5c0cc1f6ad8 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:39:44 +0900 Subject: [PATCH 24/32] =?UTF-8?q?=EA=B5=AC=EA=B0=84=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=EC=97=90=20=EC=83=88=20=ED=96=89?= =?UTF-8?q?=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=98=EB=8A=94=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/index.js b/src/index.js index 436c0eae7..fe572638d 100644 --- a/src/index.js +++ b/src/index.js @@ -211,4 +211,14 @@ function makeTableOfLine(newLine) { } makeSubwayMap(); container.appendChild(sectionTable); +} + +function addLineToSectionTable(sectionTable, sectionName, sectionOrder) { + let sectionRow = sectionTable.insertRow(sectionOrder + 1); + let sectionCell1 = sectionRow.insertCell(0); + let sectionCell2 = sectionRow.insertCell(1); + let sectionCell3= sectionRow.insertCell(2); + sectionCell1.innerHTML = sectionOrder; + sectionCell2.innerHTML = sectionName; + addSectionDeleteBtn(sectionTable, sectionCell3); } \ No newline at end of file From cedd384bf0d573a2331c0603e6dd8e58c323dfac Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:40:42 +0900 Subject: [PATCH 25/32] =?UTF-8?q?=EA=B5=AC=EA=B0=84=EC=9D=84=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=ED=95=98=EB=8A=94=20=EB=B2=84=ED=8A=BC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/index.js b/src/index.js index fe572638d..724ef5264 100644 --- a/src/index.js +++ b/src/index.js @@ -221,4 +221,35 @@ function addLineToSectionTable(sectionTable, sectionName, sectionOrder) { sectionCell1.innerHTML = sectionOrder; sectionCell2.innerHTML = sectionName; addSectionDeleteBtn(sectionTable, sectionCell3); +} + +function addSectionDeleteBtn(sectionTable, sectionCell3) { + let sectionDeleteBtn = document.createElement('button'); + let sectionDeleteBtnText = document.createTextNode('λ…Έμ„ μ—μ„œ 제거'); + sectionDeleteBtn.className = '.section-delete-button'; + sectionDeleteBtn.appendChild(sectionDeleteBtnText); + document.body.appendChild(sectionDeleteBtn); + sectionCell3.appendChild(sectionDeleteBtn); + + sectionDeleteBtn.addEventListener('click', function() { + if(confirm('μ •λ§λ‘œ λ…Έμ„ μ—μ„œ μ œκ±°ν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?')) { + let index = this.parentElement.parentElement.rowIndex - 1; + let lineName = document.getElementById('selected-line-input').value; + let lineIndex = arrLine.findIndex(l => l.name == lineName); + let line = arrLine[lineIndex]; + + removeStationFromSectionArray(line, index); + + for(let i = sectionTable.rows.length - 1; i > 0; i--){ + sectionTable.deleteRow(i); + } + + for (let i = 0; i < line.section.stations.length; i++) { + addLineToSectionTable(sectionTable, line.section.stations[i], i); + } + makeSubwayMap(); + } else { + + } + }); } \ No newline at end of file From 708a4dd7dcf12831004dc77a03227fe7a3d7953a Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:41:31 +0900 Subject: [PATCH 26/32] =?UTF-8?q?4=EB=B2=88=EC=A7=B8=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EC=97=90=20=EB=85=B8=EC=84=A0=EC=9D=84=20=EC=B6=9C?= =?UTF-8?q?=EB=A0=A5=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/index.js b/src/index.js index 724ef5264..a9a5773e5 100644 --- a/src/index.js +++ b/src/index.js @@ -252,4 +252,29 @@ function addSectionDeleteBtn(sectionTable, sectionCell3) { } }); +} + +function makeSubwayMap() { + document.getElementsByClassName('map')[0].innerHTML = ''; + let tag = ''; + + for(let i = 0; i < arrLine.length; i++) { + tag += getLineMap(arrLine[i]); + tag += '
'; + } + + document.getElementsByClassName('map')[0].innerHTML += tag; +} + +function getLineMap(line) { + let tag = ''; + tag += '

' + line.name + "

"; + + tag += '
    '; + for (let i = 0; i < line.section.stations.length; i += 1) { + tag += "
  • " + line.section.stations[i] + "
  • "; + } + tag += '
'; + + return tag; } \ No newline at end of file From 38668d4cccd9c56b10b509b29b2cdd895a9c9bc2 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:42:37 +0900 Subject: [PATCH 27/32] =?UTF-8?q?=EB=85=B8=EC=84=A0=EC=97=90=20=EA=B5=AC?= =?UTF-8?q?=EA=B0=84=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index a9a5773e5..1cb3e04e0 100644 --- a/src/index.js +++ b/src/index.js @@ -277,4 +277,16 @@ function getLineMap(line) { tag += ''; return tag; -} \ No newline at end of file +} + +function addStationToSection() { + let station = document.getElementById('#section-station-selector').value; + let index = parseInt(document.getElementById('#section-order-input').value); + let lineName = document.getElementById('selected-line-input').value; + + let lineIndex = arrLine.findIndex(l => l.name == lineName); + let line = arrLine[lineIndex]; + + addStationToSectionArray(line, station, index); + createStationInSectionHTML(line); +} From 265687dca0147c6dc8c78fd954e0036168c68ef4 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:46:18 +0900 Subject: [PATCH 28/32] =?UTF-8?q?=EA=B5=AC=EA=B0=84=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=EC=97=90=20=EC=83=88=EB=A1=9C=EC=9A=B4=20=ED=96=89=EC=9D=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/index.js b/src/index.js index 1cb3e04e0..e0e5df4b3 100644 --- a/src/index.js +++ b/src/index.js @@ -290,3 +290,16 @@ function addStationToSection() { addStationToSectionArray(line, station, index); createStationInSectionHTML(line); } + +function createStationInSectionHTML(line) { + let sectionTable = document.getElementById('#print-section-list-' + line.name); + for(let i = sectionTable.rows.length - 1; i > 0; i--){ + sectionTable.deleteRow(i); + } + + for (let i = 0; i < line.section.stations.length; i++) { + addLineToSectionTable(sectionTable, line.section.stations[i], i); + } + + makeSubwayMap(); +} \ No newline at end of file From 437176d5c1e65a36a5e7a8539c5619de9112da9a Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:46:59 +0900 Subject: [PATCH 29/32] =?UTF-8?q?=EA=B0=81=20=EA=B4=80=EB=A6=AC=20form?= =?UTF-8?q?=EC=9D=84=20=EB=85=B8=EC=B6=9C/=EA=B0=90=EC=B6=A4=20=EC=8B=9C?= =?UTF-8?q?=ED=82=A4=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/index.js b/src/index.js index e0e5df4b3..5ddddf0a1 100644 --- a/src/index.js +++ b/src/index.js @@ -302,4 +302,46 @@ function createStationInSectionHTML(line) { } makeSubwayMap(); +} + +function showManageStations() { + document.getElementById('station-manager').style.display = 'block'; + document.getElementById('line-manager').style.display = 'none'; + document.getElementById('section-manager').style.display = 'none'; + document.getElementsByClassName('map')[0].style.display = 'none'; +} + +function showManageLines() { + document.getElementById('line-manager').style.display = 'block'; + document.getElementById('station-manager').style.display = 'none'; + document.getElementById('section-manager').style.display = 'none'; + document.getElementsByClassName('map')[0].style.display = 'none'; +} + +function showManageSections() { + document.getElementById('section-manager').style.display = 'block'; + document.getElementById('station-manager').style.display = 'none'; + document.getElementById('line-manager').style.display = 'none'; + document.getElementsByClassName('map')[0].style.display = 'none'; +} + +function showSubwaymap() { + document.getElementsByClassName('map')[0].style.display = 'block'; + document.getElementById('station-manager').style.display = 'none'; + document.getElementById('line-manager').style.display = 'none'; + document.getElementById('section-manager').style.display = 'none'; +} + +function showAddDeleteSection(newLine) { + document.getElementById('add-delete-section').style.display = 'block'; + document.getElementById('nline-manage').innerHTML = `${newLine.name} 관리`; + + let lineSectionTables = document.getElementsByClassName('section-table'); + + for(let i = 0; i < lineSectionTables.length; i++) { + lineSectionTables[i].style.display = 'none'; + } + + document.getElementById('#print-section-list-' + newLine.name).style.display = 'block'; + document.getElementById('selected-line-input').value = newLine.name; } \ No newline at end of file From 0566c8bcf132094f79ee02676e3dce8183fe838f Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:47:56 +0900 Subject: [PATCH 30/32] =?UTF-8?q?localStorage=EB=A5=BC=20=EB=8B=A4?= =?UTF-8?q?=EB=A3=A8=EB=8A=94=20=ED=95=A8=EC=88=98/=EB=AA=A8=EB=93=88=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/localStorage.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/localStorage.js diff --git a/src/localStorage.js b/src/localStorage.js new file mode 100644 index 000000000..01a632bb8 --- /dev/null +++ b/src/localStorage.js @@ -0,0 +1,29 @@ +export function addStationToArray(newStation) { + arrStations.push(newStation); + localStorage.setItem("stations",JSON.stringify(arrStations)); +} + +export function deleteStationFromArray(index) { + arrStations.splice(index,1); + localStorage.setItem("stations",JSON.stringify(arrStations)); +} + +export function addLineToArray(newLine) { + arrLine.push(newLine); + localStorage.setItem("lines",JSON.stringify(arrLine)); +} + +export function deleteLineFromArray(index) { + arrLine.splice(index,1); + localStorage.setItem("lines",JSON.stringify(arrLine)); +} + +export function addStationToSectionArray(line, station, index) { + line.section.stations.splice(index,0, station); + localStorage.setItem("lines",JSON.stringify(arrLine)); +} + +export function removeStationFromSectionArray(line, index) { + line.section.stations.splice(index,1); + localStorage.setItem("lines",JSON.stringify(arrLine)); +} From c7133c0affa5dc2df4f388a05de711528103048b Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:48:39 +0900 Subject: [PATCH 31/32] =?UTF-8?q?section=20=ED=81=B4=EB=9E=98=EC=8A=A4=20i?= =?UTF-8?q?mport?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/line.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/line.js b/src/line.js index 76d9600b0..a5c1e6a97 100644 --- a/src/line.js +++ b/src/line.js @@ -1,3 +1,5 @@ +import { Section }from './section.js' + export class Line { constructor(name, firstStation, lastStation) { this.name = name; From 64b8a09392d54b12bc2283fdefe7969227257980 Mon Sep 17 00:00:00 2001 From: Lisboa Date: Tue, 15 Dec 2020 23:49:24 +0900 Subject: [PATCH 32/32] =?UTF-8?q?=EA=B0=81=20=EB=AA=A8=EB=93=88=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=9A=94=EC=86=8C=20import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.js b/src/index.js index 5ddddf0a1..5aad3ff10 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,7 @@ +import {Line} from "./line.js"; +import {Section} from "./section.js"; +import {addStationToArray, addLineToArray, + addStationToSectionArray, deleteLineFromArray, deleteStationFromArray, removeStationFromSectionArray} from "./localStorage.js" window.arrStations = new Array(); window.arrLine = new Array();