This file contains 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
'use strict'; | |
(function () { | |
var WIZARD_NAMES = ['Иван', 'Хуан Себастьян', 'Мария', 'Кристоф', 'Виктор', 'Юлия', 'Люпита', 'Вашингтон']; | |
var WIZARD_LASTNAMES = ['да Марья', 'Верона', 'Мирабелла', 'Вальц', 'Онопко', 'Топольницкая', 'Нионго', 'Ирвинг']; | |
var WIZARD_COATCOLORS = ['rgb(101, 137, 164)', 'rgb(241, 43, 107)', 'rgb(146, 100, 161)', 'rgb(56, 159, 117)', 'rgb(215, 210, 55)', 'rgb(0, 0, 0)']; | |
var WIZARD_EYESCOLORS = ['black', 'red', 'blue', 'yellow', 'green']; | |
var FIREBALL_COLORS = ['#ee4830', '#30a8ee', '#5ce6c0', '#e848d5', '#e6e848']; | |
var setup = document.querySelector('.setup'); |
This file contains 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
'use strict'; | |
(function () { | |
var WIZARD_NAMES = ['Иван', 'Хуан Себастьян', 'Мария', 'Кристоф', 'Виктор', 'Юлия', 'Люпита', 'Вашингтон']; | |
var WIZARD_LASTNAMES = ['да Марья', 'Верона', 'Мирабелла', 'Вальц', 'Онопко', 'Топольницкая', 'Нионго', 'Ирвинг']; | |
var WIZARD_COATCOLORS = ['rgb(101, 137, 164)', 'rgb(241, 43, 107)', 'rgb(146, 100, 161)', 'rgb(56, 159, 117)', 'rgb(215, 210, 55)', 'rgb(0, 0, 0)']; | |
var WIZARD_EYESCOLORS = ['black', 'red', 'blue', 'yellow', 'green']; | |
var FIREBALL_COLORS = ['#ee4830', '#30a8ee', '#5ce6c0', '#e848d5', '#e6e848']; | |
var setup = document.querySelector('.setup'); |
This file contains 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
window.util = (function () { | |
var ESC_KEYCODE = 27; | |
var ENTER_KEYCODE = 13; | |
return { | |
isEscEvent: function (evt, action) { | |
if (evt.keyCode === ESC_KEYCODE) { | |
action(); | |
} | |
}, |
This file contains 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
'use strict'; | |
var TITLES = ['Большая уютная квартира', 'Маленькая неуютная квартира', 'Огромный прекрасный дворец', 'Маленький ужасный дворец', 'Красивый гостевой домик', 'Некрасивый негостеприимный домик', 'Уютное бунгало далеко от моря', 'Неуютное бунгало по колено в воде']; | |
var TYPES = ['palace', 'flat', 'house', 'bungalo']; | |
var CHECKINS = ['12:00', '13:00', '14:00']; | |
var CHECKOUTS = ['12:00', '13:00', '14:00']; | |
var FEATURES = ['wifi', 'dishwasher', 'parking', 'washer', 'elevator', 'conditioner']; | |
var PHOTOS = ['http://o0.github.io/assets/images/tokyo/hotel1.jpg', 'http://o0.github.io/assets/images/tokyo/hotel2.jpg', 'http://o0.github.io/assets/images/tokyo/hotel3.jpg']; | |
var ads = []; |
This file contains 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
'use strict'; | |
window.backend = (function () { | |
var URL_DOWNLOAD = 'https://js.dump.academy/code-and-magick/data'; | |
var URL_UPLOAD = 'https://js.dump.academy/code-and-magick'; | |
var xhr = new XMLHttpRequest(); | |
xhr.responseType = 'json'; | |
return { |
This file contains 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
window.pin = (function () { | |
createPinElement: function (ad, template) { | |
var pinElement = template.cloneNode(true); | |
var imageElement = pinElement.querySelector('img'); | |
pinElement.style.left = (ad.location.x - window.data.MAIN_PIN_SHARP_END) + 'px'; | |
pinElement.style.top = (ad.location.y - window.data.MAIN_PIN_SIZE) + 'px'; | |
pinElement.dataset.indexOfPin = ad.index; | |
imageElement.src = ad.author.avatar; |
This file contains 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
var onMapPinClick = function (evt) { | |
var target = evt.target; | |
var currentTarget = evt.currentTarget; | |
while (target.parentElement !== currentTarget) { | |
if (!target.parentElement.classList.contains('map__pin--main') && target.parentElement.classList.contains('map__pin')) { | |
var cardElement = template.content.querySelector('.map__card').cloneNode(true); | |
var photoElement = cardElement.querySelector('.popup__photo'); | |
var existPopup = mapElement.querySelector('.popup'); | |
if (existPopup) { | |
existPopup.remove(); |