From 8882c609ab13381635d6e9eccbfdc982e601434a Mon Sep 17 00:00:00 2001 From: IngaSS Date: Thu, 21 Feb 2019 13:46:05 +0300 Subject: [PATCH 01/10] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=201=20=D0=BA=205=20=D1=83=D1=80=D0=BE=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hw5-1code.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 hw5-1code.js diff --git a/hw5-1code.js b/hw5-1code.js new file mode 100644 index 0000000..a5e63bc --- /dev/null +++ b/hw5-1code.js @@ -0,0 +1 @@ +renderer.render(); From 801af2b67fdbb228ef0c72aaba9cfd1f59d8d169 Mon Sep 17 00:00:00 2001 From: IngaSS Date: Thu, 21 Feb 2019 13:46:11 +0300 Subject: [PATCH 02/10] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=201=20=D0=BA=205=20=D1=83=D1=80=D0=BE=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hw5-1main.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 hw5-1main.html diff --git a/hw5-1main.html b/hw5-1main.html new file mode 100644 index 0000000..d45b872 --- /dev/null +++ b/hw5-1main.html @@ -0,0 +1,14 @@ + + + + + + + + Document + + + + + + From bf52dae0633a8251d416ddc6269c0a8906ca9711 Mon Sep 17 00:00:00 2001 From: IngaSS Date: Thu, 21 Feb 2019 13:46:17 +0300 Subject: [PATCH 03/10] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=201=20=D0=BA=205=20=D1=83=D1=80=D0=BE=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hw5-1renderer.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 hw5-1renderer.js diff --git a/hw5-1renderer.js b/hw5-1renderer.js new file mode 100644 index 0000000..3c8e00a --- /dev/null +++ b/hw5-1renderer.js @@ -0,0 +1,33 @@ +let renderer = { + render() { + let table = this.generateTable(); + document.body.insertAdjacentHTML('afterbegin', table); + }, + + generateTable() { + let letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']; + let numbers = ['1', '2', '3', '4', '5', '6', '7', '8']; + let board = ''; + + for (let i = 0; i < 1; i++) { + board += ''; + for (let j = 0; j < letters.length; j++) { + board += ''+ letters[j] + ''; + } + board += ''; + } + + for(let y = 0; y < numbers.length; y++) { + board += ''; + for(let x = 0; x < numbers.length; x++) { + + board += ''; + } + + board += '' + numbers[y] + '' + ''; + + } + + return '' + board + '
'; + }, +} From d86d45cf90958b1d82b059212b409c4327c78eb6 Mon Sep 17 00:00:00 2001 From: IngaSS Date: Thu, 21 Feb 2019 13:46:22 +0300 Subject: [PATCH 04/10] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=201=20=D0=BA=205=20=D1=83=D1=80=D0=BE=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hw5-1style.css | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 hw5-1style.css diff --git a/hw5-1style.css b/hw5-1style.css new file mode 100644 index 0000000..e42729f --- /dev/null +++ b/hw5-1style.css @@ -0,0 +1,36 @@ +html { + background: lightgrey; +} + +table { + border-collapse: collapse; +} + +td { + width: 30px; + height: 30px; + border: 2px solid black; +} + +tbody tr:nth-child(2n + 1) td:nth-child(2n) { + background: black; +} + +tbody tr:nth-child(2n) td:nth-child(2n+1) { + background: black; +} + +.with_letters > td { + background-color: transparent !important; + width: 30px; + height: 30px; + text-align: center; + border: none; +} + +.with_numbers { + background-color: transparent !important; + border: none; + text-align: center; +} + From 870a56126182d2640f94728afd217e5a479f13f0 Mon Sep 17 00:00:00 2001 From: IngaSS Date: Thu, 21 Feb 2019 13:46:37 +0300 Subject: [PATCH 05/10] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=202=20=D0=BA=205=20=D1=83=D1=80=D0=BE=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hw5-2basket.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 hw5-2basket.js diff --git a/hw5-2basket.js b/hw5-2basket.js new file mode 100644 index 0000000..45b70dc --- /dev/null +++ b/hw5-2basket.js @@ -0,0 +1,26 @@ +let basketGeneration = { + generate() { + let empty = this.generateEmptyBasket(); + document.body.insertAdjacentHTML('afterbegin', empty); + + let list = this.generateFullList(); + document.body.insertAdjacentHTML('afterbegin', list); + }, + + generateEmptyBasket() { + empty = 'Ваша карзина пуста'; + return empty; + }, + + generateFullList() { + list = ''; + for (let i = 0; i < basket.goodlist.length; i++) { + list += '
  • ' + JSON.stringify(basket.goodlist[i].name) + '\n' + JSON.stringify(basket.goodlist[i].price) + ' рублей. ' + '\n' + JSON.stringify(basket.goodlist[i].amount) + ' шт.' + '
  • '; + } + list += '

    Всего в вашей карзине ' + basket.countTotalNumber() + ' товара. На сумму: ' + basket.countTotalPrice() + ' рублей.'; + return '
      ' + list + '
    '; + }, +} + + + From 4866a541b1c90cb42717e7b26267e146e6adf65e Mon Sep 17 00:00:00 2001 From: IngaSS Date: Thu, 21 Feb 2019 13:46:42 +0300 Subject: [PATCH 06/10] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=202=20=D0=BA=205=20=D1=83=D1=80=D0=BE=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hw5-2box.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 hw5-2box.js diff --git a/hw5-2box.js b/hw5-2box.js new file mode 100644 index 0000000..dada1e2 --- /dev/null +++ b/hw5-2box.js @@ -0,0 +1,20 @@ +let basket = { + goodlist: [], + + countTotalPrice() { + var priceSum = 0; + for (i in this.goodlist) { + let finalPrice = this.goodlist[i].price * this.goodlist[i].amount; + priceSum += finalPrice; + } + return priceSum; + }, + + countTotalNumber() { + let totalNum = 0; + for (i in this.goodlist) { + totalNum += this.goodlist[i].amount; + } + return totalNum; + } +} From 760e7f46f0255600e78cd209aabe505931b3e33c Mon Sep 17 00:00:00 2001 From: IngaSS Date: Thu, 21 Feb 2019 13:46:48 +0300 Subject: [PATCH 07/10] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=202=20=D0=BA=205=20=D1=83=D1=80=D0=BE=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hw5-2code.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 hw5-2code.js diff --git a/hw5-2code.js b/hw5-2code.js new file mode 100644 index 0000000..058c48a --- /dev/null +++ b/hw5-2code.js @@ -0,0 +1 @@ +basketGeneration.generate(); From 5aebdbe5b7b540c4365ed7a88549d9eb21b07a7d Mon Sep 17 00:00:00 2001 From: IngaSS Date: Thu, 21 Feb 2019 13:46:53 +0300 Subject: [PATCH 08/10] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=202=20=D0=BA=205=20=D1=83=D1=80=D0=BE=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hw5-2goods.js | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 hw5-2goods.js diff --git a/hw5-2goods.js b/hw5-2goods.js new file mode 100644 index 0000000..e74af0e --- /dev/null +++ b/hw5-2goods.js @@ -0,0 +1,69 @@ +let goods = [ + { + name: 'лампа', + price: 1200, + amount: 4, + putToBasket() { + basket.goodlist.push(this); + } + }, + { + name: 'диван', + price: 25000, + amount: 1, + putToBasket() { + basket.goodlist.push(this); + } + }, + { + name: 'тумба', + price: 4500, + amount: 2, + putToBasket() { + basket.goodlist.push(this); + } + }, + { + name: 'зеркало', + price: 5000, + amount: 4, + putToBasket() { + basket.goodlist.push(this); + } + }, + { + name: 'шкаф', + price: 35000, + amount: 1, + putToBasket() { + basket.goodlist.push(this); + } + }, + { + name: 'туалетный столик', + price: 7000, + amount: 2, + putToBasket() { + basket.goodlist.push(this); + } + }, + { + name: 'пуфик', + price: 2000, + amount: 2, + putToBasket() { + basket.goodlist.push(this); + } + } +] + +console.log(goods); +goods.forEach(function(item, i) { + if (i % 2 == 0) { + item.putToBasket(); + } else { + item.putToBasket(); + item.putToBasket(); + } +}); + From b88114aa9a48574b5fa80b7c05bfa6a5241b52ef Mon Sep 17 00:00:00 2001 From: IngaSS Date: Thu, 21 Feb 2019 13:46:58 +0300 Subject: [PATCH 09/10] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=202=20=D0=BA=205=20=D1=83=D1=80=D0=BE=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hw5-2main.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 hw5-2main.html diff --git a/hw5-2main.html b/hw5-2main.html new file mode 100644 index 0000000..d0cc740 --- /dev/null +++ b/hw5-2main.html @@ -0,0 +1,19 @@ + + + + + + + + + Document + + + + + + + + + + From f543569512862aeccd56988464723c252b35b0f6 Mon Sep 17 00:00:00 2001 From: IngaSS Date: Thu, 21 Feb 2019 13:47:04 +0300 Subject: [PATCH 10/10] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=202=20=D0=BA=205=20=D1=83=D1=80=D0=BE=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hw5-2style.css | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 hw5-2style.css diff --git a/hw5-2style.css b/hw5-2style.css new file mode 100644 index 0000000..3c78067 --- /dev/null +++ b/hw5-2style.css @@ -0,0 +1,3 @@ +html { + background: darkseagreen; +}