This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript" > | |
| // получаем все картинки в статье | |
| let elems = document.querySelectorAll('.com-content-article img'); | |
| // перебираем все картинки в статье | |
| for (let elem of elems) { | |
| // удаляем атрибут onmouseout | |
| elem.removeAttribute("onmouseout"); | |
| // удаляем атрибут onmouseover |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // mysql -u root -p autoruk < j25_content.sql | |
| $servername = "localhost"; | |
| $database = ""; | |
| $username = ""; | |
| $password = ""; | |
| // Создаем соединение | |
| $link = mysqli_connect($servername, $username, $password, $database); | |
| // Проверяем соединение | |
| if (!$link) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // описание метода api telegram | |
| // https://core.telegram.org/bots/api#sendmessage | |
| $tg_user = '1234567890'; // id пользователя, которому отправиться сообщения | |
| $bot_token = '1234567890:XXXXXX'; // токен бота | |
| $text = "Первая строка сообщения <a href='https://vk-book.ru/'>со ссылкой</a> \n Вторая строка с <b>жирным</b> текстом"; | |
| // параметры, которые отправятся в api телеграмм |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // call function from second | |
| let timeout = 300; | |
| /** | |
| * Delete adverts | |
| */ | |
| function removeAdvert() { | |
| // find a classes advert in content | |
| let codeBlocks = document.getElementsByClassName('code-block'); | |
| for (let key in codeBlocks) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Общие требования по ООП | |
| - Клсс должен быть самодостаточный | |
| - В классе не должно быть обращения к переменным объявленным глобально (переменную можно передать в качестве | |
| параметров в класс) | |
| - Не должно быть вызовов в конструкторе методов класса (Конструктор только для инициализации) | |
| - Обращение к DOM только по ссылке | |
| - Методы класса не более 10 строк, иначе такой метод должен вызывать волнение | |
| - Не должно быть сложных условий которые тяжело анализировать (значит в условии что-то не так) | |
| - Не должно быть больших вложений, IF в IF. Как вариант 1 IF можно вынести в другой метод класса и вызывать |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Надо исправить: Обращаться в классе на прямую к DOM является очень плохой практикой | |
| * Лучше передавать в класс ссылку на элемент и дальше уже работать в классе с этим элементом | |
| * как пример: допустим есть такой класс | |
| class MyClass { | |
| constructor(element){ | |
| this.element = element; | |
| } | |
| method(name){ | |
| this.element.querySelector('.myclass').textContent = name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CardList { | |
| constructor(element) { | |
| this.list = []; | |
| this.element = element; | |
| } | |
| /** | |
| * генерируем карточки | |
| * @param {*} initialCard | |
| */ | |
| render(initialCard) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Студент делает длинную проверку и незнает как сократить | |
| * if (popupName.value.length > 1 && popupName.value.length < 31 && ((popupLink.value.slice(0, 7) == "http://" && popupLink.value.length > 7) || | |
| * (popupLink.value.slice(0, 8) == "https://" && popupLink.value.length > 8))) { | |
| * Ну во первых мы в качестве параметров передаём объекты | |
| * и разбиваем на две функции | |
| */ | |
| function _checkLength(item, min, max) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "likes": [ | |
| { | |
| "name": "Tim Berners-Lee", | |
| "about": "Inventor, scientist", | |
| "avatar": "https://media.wired.com/photos/5c86f3dd67bf5c2d3c382474/4:3/w_2400,h_1800,c_limit/TBL-RTX6HE9J-(1).jpg", | |
| "_id": "d285e3dceed844f902650f40" | |
| } | |
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Component { | |
| constructor() { | |
| if (new.target === Component) { | |
| throw new Error(`Can't instantiate Component, only concrete one.`); | |
| } | |
| } | |
| get template() { | |
| throw new Error(`You have to define template.`); |