From 8f878f3e2e0d97b7b7da34e94e4f047c08b604c0 Mon Sep 17 00:00:00 2001 From: chip777 Date: Sat, 12 Feb 2022 12:25:08 +0300 Subject: [PATCH 1/2] initial files --- 1.html | 74 +++++++++++++++++++++++++++++++++++++++++++++++ 2.html | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3.html | 36 +++++++++++++++++++++++ 4.html | 34 ++++++++++++++++++++++ 4 files changed, 235 insertions(+) create mode 100644 1.html create mode 100644 2.html create mode 100644 3.html create mode 100644 4.html diff --git a/1.html b/1.html new file mode 100644 index 0000000..e695925 --- /dev/null +++ b/1.html @@ -0,0 +1,74 @@ + + + + + Homework + + + + + +
+ + +
Уверен, ты справишься с этим заданием!
+ + +
+ Lorem ipsum dolor sit, amet consectetur adipisicing elit. Quaerat, expedita. +
+
+ + + + \ No newline at end of file diff --git a/2.html b/2.html new file mode 100644 index 0000000..abdabe9 --- /dev/null +++ b/2.html @@ -0,0 +1,91 @@ + + + + + + Document + + + +
+ + + +
+ +
+ + + + \ No newline at end of file diff --git a/3.html b/3.html new file mode 100644 index 0000000..c38ed4a --- /dev/null +++ b/3.html @@ -0,0 +1,36 @@ + + + + + Homework + + + + + + \ No newline at end of file diff --git a/4.html b/4.html new file mode 100644 index 0000000..c48a6bb --- /dev/null +++ b/4.html @@ -0,0 +1,34 @@ + + + + + Homework + + + + + + \ No newline at end of file From dd1b62ca09826666d9ed197ecb2c37454b9b31dd Mon Sep 17 00:00:00 2001 From: chip777 Date: Sun, 13 Feb 2022 16:56:00 +0300 Subject: [PATCH 2/2] lesson7 --- 1.html | 19 ++++++++++++++++++- 2.html | 15 ++++++++------- 3.html | 4 +++- 4.html | 8 ++++++-- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/1.html b/1.html index e695925..a9f06e6 100644 --- a/1.html +++ b/1.html @@ -59,6 +59,19 @@ X6: "Знаю, программирование это нелегко.", H99: "Однако, программирование, в итоге, принесет свои плоды.", }; + const tabText = document.querySelector('.text'); + const clear = function () { + document.querySelectorAll('.nav-link').forEach(el => + el.classList.remove('active') + ); + }; + + document.querySelector('.nav') + .addEventListener('click', tgt => { + clear(); + tgt.target.classList.add('active'); + tabText.textContent = panelText[tgt.target.parentElement.dataset.text]; + }); /* @@ -67,7 +80,11 @@ шрифт у текста, никакого резкого увеличения шрифта не должно быть при перетаскивании ползунка. */ - + + const fSize = document.querySelector('#inputDiv'); + document.querySelector('input').addEventListener('input', event => { + fSize.style.fontSize = `${event.target.value}px`; + }); diff --git a/2.html b/2.html index abdabe9..f8146b3 100644 --- a/2.html +++ b/2.html @@ -47,15 +47,14 @@ /** * @returns {string} html-разметка для товара */ - getProductMarkup() { + getProductMarkup({name: name, price: price, imageUrl: imageUrl, id: id}) { return `
${name}
Цена: ${price} р.
Подробнее -
- `; + `; } } @@ -77,13 +76,15 @@ ], }; - const productsEl = document.querySelector('products'); + const productsEl = document.querySelector('.products'); document.querySelector('header').addEventListener('click', event => { - if (!event.currentTarget.classList.contains('.menuButton')) { + if (!event.target.classList.contains('menuButton')) { return; } - productsEl.innerHTML = products[event.currentTarget.dataset.type] - .map(product => product.getProductMarkup()); + productsEl.innerHTML = products[event.target.dataset.type] + .map(product => product.getProductMarkup(product)).join(''); + console.log(productsEl.innerHTML); + }); diff --git a/3.html b/3.html index c38ed4a..61a6b84 100644 --- a/3.html +++ b/3.html @@ -24,8 +24,10 @@ * @returns {number} - Набольшее число из набора цифр числа, переданного в * параметр "n" */ + function descendingOrder(n) { - + const mass = [...String(n)]; + return mass.sort().reverse().join(''); } console.log(descendingOrder(42145)); // 54421 diff --git a/4.html b/4.html index c48a6bb..d0ab788 100644 --- a/4.html +++ b/4.html @@ -21,9 +21,13 @@ * @param {number} height - Rectangle height * @return {Rectangle} */ - function Rectangle() { - + function Rectangle(width, height) { + this.width = width; + this.height = height; } + Rectangle.prototype.getArea = function () { + return this.width * this.height; + }; const r = new Rectangle(10, 20); console.log(r.width); // 10