Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
aea51d2
Перенес ДЗ из ветки master в ветку les1
Alex-Smil Dec 24, 2018
a540f8d
rename les01ex03HamburgersGUI and add simple console solution of app
Alex-Smil Dec 24, 2018
7b512dd
add les02ex03Gallery
Alex-Smil Dec 27, 2018
4fed5b5
add les02ex04TwoStaticResponse
Alex-Smil Dec 27, 2018
b6409ee
add 404 check
Alex-Smil Dec 27, 2018
4888770
Idea
Alex-Smil Jan 10, 2019
3effef2
add les03ex01-02SingleQuoteToDouble(without apostrophe)
Alex-Smil Jan 10, 2019
7dc9ca2
add les03ex02ValidationFields
Alex-Smil Jan 10, 2019
bbf7134
Моменты по улучшению от Игоря Пимкина:
Alex-Smil Jan 10, 2019
df67191
Idea.
Alex-Smil Jan 14, 2019
ffd2d86
add les04ex01TabsSwitch
Alex-Smil Jan 14, 2019
454fcc0
delete
Alex-Smil Jan 14, 2019
ae893c3
add les04ex01TabsSwitch
Alex-Smil Jan 14, 2019
232bed0
add les04ex02ValidationFieldsWithSelect&AJAX
Alex-Smil Jan 14, 2019
26179ae
add les04ex03OnlyAjaxLiveSearch
Alex-Smil Jan 14, 2019
f28bc31
Убрал лишние пробелы
Alex-Smil Jan 14, 2019
08c1d17
Почисттил стили.
Alex-Smil Jan 14, 2019
e60f28d
add les05ex01goodBtnREMOVE
Alex-Smil Jan 17, 2019
a584f6b
add les05ex02Reviews
Alex-Smil Jan 17, 2019
70a916a
reviews уже не рендерится.
Alex-Smil Jan 17, 2019
5e57580
add les06ex01-02BirthdayInput&errorDialogWithTooltips
Alex-Smil Jan 21, 2019
951115c
add les06ex03SliderInCicle
Alex-Smil Jan 21, 2019
9379ae2
add les06ex04DraggableGoods
Alex-Smil Jan 21, 2019
fc39f9d
Почистил синтаксис
Alex-Smil Jan 21, 2019
47a0510
change .gitignore
Alex-Smil Jan 21, 2019
b81dab4
add les06ex04DraggableGoods_Gulp_4.0-3.9
Alex-Smil Jan 23, 2019
2fa59ce
add les07ex04DraggableGoods_Gulp_4.0-3.9
Alex-Smil Jan 23, 2019
6bda2f2
Убрал баг у первого товара в корзине.
Alex-Smil Jan 23, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
27 changes: 27 additions & 0 deletions les01ex01RemoveMenu/menuES5/Menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function Menu(myId, myClass, myItems) {
this.id = myId;
this.className = myClass;
this.items = myItems;
}

Menu.prototype.render = function () {
var result = `<ul class="${this.className}" id="${this.id}">`;

//Сами пункты меню
for (var i = 0; i < this.items.length; i++){
result += this.items[i].renderItem();
}

result += '</ul>';
return result;
};

//TODO: удаление меню
Menu.prototype.remove = function () {
//document
let parent = document.getElementById(`${this.id}`).parentNode;
parent.removeChild(document.getElementById(`${this.id}`));

// Можно и так
// document.getElementById(`${this.id}`).parentNode.removeChild(document.getElementById(`${this.id}`));
};
11 changes: 11 additions & 0 deletions les01ex01RemoveMenu/menuES5/MenuItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//Класс для пункта меню
function MenuItem(href, title) {
this.href = href;
this.title = title;
}

//Метод возвращает html код для конкретного пункта
MenuItem.prototype.renderItem = function () {
//return '<li><a href="' + this.href + '">' + this.title + '</a></li>'; //ES5
return `<li><a href="${this.href}">${this.title}</a></li>`; //ES6
};
42 changes: 42 additions & 0 deletions les01ex01RemoveMenu/menuES5/menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Menu</title>
<script src="Menu.js"></script>
<script src="MenuItem.js"></script>
<script>
window.onload = function () {
//Пункты меню
var items = [
new MenuItem('/', 'Главная'),
new MenuItem('/about', 'О нас'),
new MenuItem('/service', 'Услуги'),
new MenuItem('/contacts', 'Контакты'),
];

//Само меню
var menu = new Menu('my', 'my', items);

//Выбираем контейнер меню
var menuContainer = document.getElementById('menu1');

//Отображаем на странице html код, который вернул render
menuContainer.innerHTML = menu.render();

// ****************** ex 1 *************************
var menuContainer2 = document.getElementById('menu2');
var menu2 = new Menu('menu2', 'menu2', items);
menuContainer2.innerHTML = menu2.render(items);

// Удаление страницы
menu2.remove();
// menu.remove();
};
</script>
</head>
<body>
<div id="menu1"></div>
<div id="menu2"></div>
</body>
</html>
31 changes: 31 additions & 0 deletions les01ex01RemoveMenu/menuES6/Menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class Menu {
constructor(myId, myClass, myItems)
{
this.id = myId;
this.className = myClass;
this.items = myItems;
}

render () {
var result = `<ul class="${this.className}" id="${this.id}">`;

//Сами пункты меню
for (var i = 0; i < this.items.length; i++){
result += this.items[i].renderItem();
}

result += '</ul>';
return result;
}

//TODO: удаление меню
remove()
{
//document
let parent = document.getElementById(`${this.id}`).parentNode;
parent.removeChild(document.getElementById(`${this.id}`));

// Можно и так
// document.getElementById(`${this.id}`).parentNode.removeChild(document.getElementById(`${this.id}`));
}
}
14 changes: 14 additions & 0 deletions les01ex01RemoveMenu/menuES6/MenuItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//Класс для пункта меню
class MenuItem {
constructor(href, title)
{
this.href = href;
this.title = title;
}

//Метод возвращает html код для конкретного пункта
renderItem () {
//return '<li><a href="' + this.href + '">' + this.title + '</a></li>'; //ES5
return `<li><a href="${this.href}">${this.title}</a></li>`; //ES6
}
}
34 changes: 34 additions & 0 deletions les01ex01RemoveMenu/menuES6/menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Menu</title>
<script src="Menu.js"></script>
<script src="MenuItem.js"></script>
<script>
window.onload = function () {
//Пункты меню
var items = [
new MenuItem('/', 'Главная'),
new MenuItem('/about', 'О нас'),
new MenuItem('/service', 'Услуги'),
new MenuItem('/contacts', 'Контакты'),

new MenuItem(new Menu("vf", "cd", newItems))
];

//Само меню
var menu = new Menu('my', 'my', items);

//Выбираем контейнер меню
var menuContainer = document.getElementById('menu1');

//Отображаем на странице html код, который вернул render
menuContainer.innerHTML = menu.render();
};
</script>
</head>
<body>
<div id="menu1"></div>
</body>
</html>
12 changes: 12 additions & 0 deletions les01ex01RemoveMenu/project.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
����������� �������� <ul> �� Dom - 01:36:35

�������� ��������
��� �������� �������� ���������� ����� removeChild() ������� Node. ���� ����� ������� ���� �� �������� �����:

var articleDiv = document.querySelector("div.article");
// ������� ����, ������� ����� ������� - ������ ��������
var removableNode = document.querySelectorAll("div.article p")[0];
// ������� ����
articleDiv.removeChild(removableNode);

src: https://metanit.com/web/javascript/8.5.php
31 changes: 31 additions & 0 deletions les01ex02SubMenu/Menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function MenuWithSubMenus(myId, myClass, myItems) {
this.id = myId;
this.className = myClass;
this.items = myItems;
}

MenuWithSubMenus.prototype.render = function () {
var result = `<ul class="${this.className}" id="${this.id}">`;

//Сами пункты меню
for (var i = 0; i < this.items.length; i++){
if(this.items[i] instanceof MenuItem) {
result += this.items[i].renderItem();
} else {
result += this.items[i].render();
}
}

result += '</ul>';
return result;
};

//TODO: удаление меню
MenuWithSubMenus.prototype.remove = function () {
//document
let parent = document.getElementById(`${this.id}`).parentNode;
parent.removeChild(document.getElementById(`${this.id}`));

// Можно и так
// document.getElementById(`${this.id}`).parentNode.removeChild(document.getElementById(`${this.id}`));
};
11 changes: 11 additions & 0 deletions les01ex02SubMenu/MenuItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//Класс для пункта меню
function MenuItem(href, title) {
this.href = href;
this.title = title;
}

//Метод возвращает html код для конкретного пункта
MenuItem.prototype.renderItem = function () {
//return '<li><a href="' + this.href + '">' + this.title + '</a></li>'; //ES5
return `<li><a href="${this.href}">${this.title}</a></li>`; //ES6
};
61 changes: 61 additions & 0 deletions les01ex02SubMenu/menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Menu</title>
<script src="Menu.js" defer></script>
<script src="MenuItem.js" defer></script>
<script>
window.onload = function () {
//Пункты меню
let items3 = [
new MenuItem('/', 'Main'),
new MenuItem('/Catalog', 'Catalog'),
new MenuItem('/Sale', 'Sale'),
new MenuItem('/something', 'something'),
];

let items2 = [
new MenuItem('/', 'Main'),
new MenuWithSubMenus('subSubMenu', 'subSubMenu', items3),
new MenuItem('/about', 'About us'),
new MenuItem('/service', 'service'),
new MenuWithSubMenus('subSubMenu', 'subSubMenu', items3),
new MenuItem('/contacts', 'contacts'),
];


var items = [
new MenuItem('/', 'Главная'),
new MenuItem('/about', 'О нас'),
new MenuWithSubMenus('subMenu', 'subMenu', items2),
new MenuItem('/service', 'Услуги'),
new MenuItem('/contacts', 'Контакты')
];

//Само меню
var menu = new MenuWithSubMenus('my', 'my', items2);

//Выбираем контейнер меню
var menuContainer = document.getElementById('menu1');

//Отображаем на странице html код, который вернул render
menuContainer.innerHTML = menu.render();

// ****************** ex 2 *************************
var menuContainer2 = document.getElementById('menu2');
var menu2 = new MenuWithSubMenus('menu2', 'menu2', items);
menuContainer2.innerHTML = menu2.render();

let menuWithSubMenus = new MenuWithSubMenus('main', 'main', items);
menuContainer2.innerHTML = menuWithSubMenus.render();

menu.remove();
};
</script>
</head>
<body>
<div id="menu1"></div>
<div id="menu2"></div>
</body>
</html>
Loading