window.isMobile = !1;
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
window.isMobile = !0
}
function t_throttle(fn, threshhold, scope) {
var last;
var deferTimer;
threshhold || (threshhold = 250);
return function() {
var context = scope || this;
var now = +new Date();
var args = arguments;
if (last && now < last + threshhold) {
clearTimeout(deferTimer);
deferTimer = setTimeout(function() {
last = now;
fn.apply(context, args)
}, threshhold)
} else {
last = now;
fn.apply(context, args)
}
}
}
function t657_init(recid) {
var rec = document.querySelector('#rec' + recid);
if (!rec)
return;
var wrapperBlock = rec.querySelector('.t657');
var storageItem = wrapperBlock.getAttribute('data-storage-item');
var lastOpen;
try {
lastOpen = localStorage.getItem(storageItem)
} catch (error) {
console.log('Your web browser does not support localStorage. Error status: ', error)
}
if (!lastOpen) {
wrapperBlock.classList.remove('t657_closed')
}
wrapperBlock.addEventListener('click', function(event) {
if (event.target && event.target.closest('.t657__btn, .t657__close-button')) {
wrapperBlock.classList.add('t657_closed');
try {
localStorage.setItem(storageItem, Math.floor(Date.now() / 1000))
} catch (error) {
console.log('Your web browser does not support localStorage. Error status: ', error)
}
event.preventDefault()
}
})
}
function t390_initPopup(recId) {
var rec = document.getElementById('rec' + recId);
if (!rec)
return;
var container = rec.querySelector('.t390');
if (!container)
return;
rec.setAttribute('data-animationappear', 'off');
rec.style.opacity = 1;
var popup = rec.querySelector('.t-popup');
var popupTooltipHook = popup.getAttribute('data-tooltip-hook');
var analitics = popup.getAttribute('data-track-popup');
var popupCloseBtn = popup.querySelector('.t-popup__close');
var hrefs = rec.querySelectorAll('a[href*="#"]');
var escapeEvent = t390_escClosePopup.bind(this, recId);
if (popupTooltipHook) {
t_onFuncLoad('t_popup__addAttributesForAccessibility', function() {
t_popup__addAttributesForAccessibility(popupTooltipHook)
});
document.addEventListener('click', function(event) {
var target = event.target;
var href = target.closest('a[href="' + popupTooltipHook + '"]') ? target : !1;
if (!href)
return;
event.preventDefault();
t390_showPopup(recId, escapeEvent);
t_onFuncLoad('t_popup__resizePopup', function() {
t_popup__resizePopup(recId)
});
t390__lazyLoad();
if (analitics && window.Tilda) {
Tilda.sendEventToStatistics(analitics, popupTooltipHook)
}
});
t_onFuncLoad('t_popup__addClassOnTriggerButton', function() {
t_popup__addClassOnTriggerButton(document, popupTooltipHook)
})
}
popup.addEventListener('scroll', t_throttle(function() {
t390__lazyLoad()
}));
popup.addEventListener('click', function(event) {
if (event.target === this)
t390_closePopup(recId, escapeEvent)
});
popupCloseBtn.addEventListener('click', function() {
t390_closePopup(recId, escapeEvent)
});
for (var i = 0; i < hrefs.length; i++) {
hrefs[i].addEventListener('click', function() {
var url = this.getAttribute('href');
if (!url || url.substring(0, 7) != '#price:') {
t390_closePopup(recId, escapeEvent);
if (!url || url.substring(0, 7) == '#popup:') {
setTimeout(function() {
if (typeof t_triggerEvent === 'function')
t_triggerEvent(document.body, 'popupShowed');
document.body.classList.add('t-body_popupshowed')
}, 300)
}
}
})
}
var curPath = window.location.pathname;
var curFullPath = window.location.origin + curPath;
var isAndroid = /(android)/i.test(navigator.userAgent);
if (isAndroid) {
var selects = 'a[href^="#"]:not([href="#"]):not([href^="#price"]):not([href^="#popup"]):not([href^="#prodpopup"]):not([href^="#order"]):not([href^="#!"]),' + 'a[href^="' + curPath + '#"]:not([href*="#!/tproduct/"]):not([href*="#!/tab/"]):not([href*="#popup"]),' + 'a[href^="' + curFullPath + '#"]:not([href*="#!/tproduct/"]):not([href*="#!/tab/"]):not([href*="#popup"])';
var selectors = rec.querySelectorAll(selects);
for (var i = 0; i < selectors.length; i++) {
selectors[i].addEventListener('click', function(event) {
var hash = this.hash.trim();
if (window.location.hash) {
setTimeout(function() {
window.location.href = hash
}, 50)
}
})
}
}
function t390_escClosePopup(recId) {
if (arguments[1].key === 'Escape')
t390_closePopup(recId, escapeEvent)
}
}
function t390_showPopup(recId, escapeEvent) {
var rec = document.getElementById('rec' + recId);
if (!rec)
return;
var container = rec.querySelector('.t390');
if (!container)
return;
var windowWidth = window.innerWidth;
var screenMin = rec.getAttribute('data-screen-min');
var screenMax = rec.getAttribute('data-screen-max');
if (screenMin && windowWidth < parseInt(screenMin, 10))
return;
if (screenMax && windowWidth > parseInt(screenMax, 10))
return;
var popup = rec.querySelector('.t-popup');
var documentBody = document.body;
t_onFuncLoad('t_popup__showPopup', function() {
t_popup__showPopup(popup)
});
if (typeof t_triggerEvent === 'function')
t_triggerEvent(document.body, 'popupShowed');
documentBody.classList.add('t-body_popupshowed');
documentBody.classList.add('t390__body_popupshowed');
document.addEventListener('keydown', escapeEvent)
}
function t390_closePopup(recId, escapeEvent) {
var rec = document.getElementById('rec' + recId);
var popup = rec.querySelector('.t-popup');
var popupActive = document.querySelector('.t-popup.t-popup_show');
if (popup === popupActive) {
if (typeof t_triggerEvent === 'function')
t_triggerEvent(document.body, 'popupHidden');
document.body.classList.remove('t-body_popupshowed');
document.body.classList.remove('t390__body_popupshowed')
}
popup.classList.remove('t-popup_show');
t_onFuncLoad('t_popup__addFocusOnTriggerButton', function() {
t_popup__addFocusOnTriggerButton()
});
setTimeout(function() {
var popupHide = document.querySelectorAll('.t-popup:not(.t-popup_show)');
for (var i = 0; i < popupHide.length; i++) {
popupHide[i].style.display = 'none'
}
}, 300);
document.removeEventListener('keydown', escapeEvent)
}
function t390_sendPopupEventToStatistics(popupName) {
var virtPage = '/tilda/popup/';
var virtTitle = 'Popup: ';
if (popupName.substring(0, 7) == '#popup:') {
popupName = popupName.substring(7)
}
virtPage += popupName;
virtTitle += popupName;
if (window.Tilda && typeof Tilda.sendEventToStatistics == 'function') {
Tilda.sendEventToStatistics(virtPage, virtTitle, '', 0)
} else {
if (ga) {
if (window.mainTracker != 'tilda') {
ga('send', {
hitType: 'pageview',
page: virtPage,
title: virtTitle
})
}
}
if (window.mainMetrika && window[window.mainMetrika]) {
window[window.mainMetrika].hit(virtPage, {
title: virtTitle,
referer: window.location.href
})
}
}
}
function t390__lazyLoad() {
var allRecords = document.getElementById('allrecords');
if (window.lazy === 'y' || (allRecords && allRecords.getAttribute('data-tilda-lazy') === 'yes')) {
t_onFuncLoad('t_lazyload_update', function() {
t_lazyload_update()
})
}
}
function t395_init(recid) {
var rec = document.getElementById('rec' + recid);
if (!rec)
return;
var allRecords = document.getElementById('allrecords');
var tildaMode = allRecords ? allRecords.getAttribute('data-tilda-mode') : '';
var tildaLazyMode = allRecords ? allRecords.getAttribute('data-tilda-lazy') : '';
var tabs = rec ? rec.querySelectorAll('.t395__tab') : [];
if (tildaMode !== 'edit' && tildaMode !== 'preview') {
setTimeout(function() {
t395_scrollToTabs(recid);
var activeTab = rec.querySelector('.t395__tab_active');
if (activeTab) {
var currentButton = activeTab.querySelector('.t395__title');
if (currentButton) {
currentButton.setAttribute('tabindex', 0);
currentButton.setAttribute('aria-selected', !0)
}
var currentTabIndex = activeTab.getAttribute('data-tab-number');
var wrapper = rec.querySelector('.t395__wrapper');
wrapper.setAttribute('data-tab-current', currentTabIndex)
}
}, 300)
}
t395_addAttributesToBlocksInsideTabs(recid, tabs);
Array.prototype.forEach.call(tabs, function(tab, i) {
tab.addEventListener('click', function(event) {
var tabNumber = i + 1;
var targetTab = event.target.closest('.t395__tab');
if (targetTab && targetTab.classList.contains('t395__tab_active') && !event.isTrusted)
return;
t395_switchBetweenTabs(recid, tabNumber, targetTab, tildaMode, tildaLazyMode)
});
tab.addEventListener('keydown', function(event) {
var currentIndex = Number(rec.querySelector('.t395__wrapper').getAttribute('data-tab-current'));
var targetTab = event.target.closest('.t395__tab');
if (targetTab && targetTab.classList.contains('t395__tab_active') && !event.isTrusted)
return;
var prevent = !1;
switch (event.key) {
case 'Left':
case 'ArrowLeft':
currentIndex = currentIndex === 1 ? tabs.length : currentIndex - 1;
targetTab = rec.querySelector('[data-tab-number="' + currentIndex + '"]');
t395_switchBetweenTabs(recid, currentIndex, targetTab, tildaMode, tildaLazyMode);
t395_showActiveTabFromKeyboard(recid, currentIndex, tabs);
prevent = !0;
break;
case 'Right':
case 'ArrowRight':
currentIndex = currentIndex === tabs.length ? 1 : currentIndex + 1;
targetTab = rec.querySelector('[data-tab-number="' + currentIndex + '"]');
t395_switchBetweenTabs(recid, currentIndex, targetTab, tildaMode, tildaLazyMode);
t395_showActiveTabFromKeyboard(recid, currentIndex, tabs);
prevent = !0;
break;
default:
break
}
if (prevent) {
event.stopPropagation();
event.preventDefault()
}
})
});
if (tabs.length) {
t395_alltabs_updateContent(recid);
t395_updateContentBySelect(recid);
var bgColor = rec ? rec.style.backgroundColor : '#ffffff';
var bgColorTargets = rec.querySelectorAll('.t395__select, .t395__firefoxfix');
Array.prototype.forEach.call(bgColorTargets, function(target) {
target.style.background = bgColor
})
}
document.addEventListener('click', function(e) {
if (e.target.closest('[href*="#!/tab/' + recid + '"]')) {
var currentLink = e.target.closest('[href*="#!/tab/' + recid + '"]');
var hash = currentLink.hash;
t395_scrollToTabs(recid, hash)
}
})
}
function t395_addAttributesToBlocksInsideTabs(recid, tabs) {
if (tabs.length > 0) {
Array.prototype.forEach.call(tabs, function(tab, i) {
var firstBlockInsideTabId = tab.getAttribute('data-tab-rec-ids').split(',')[0];
var firstBlockInsideTab = document.querySelector('#rec' + firstBlockInsideTabId);
if (firstBlockInsideTab && !firstBlockInsideTab.getAttribute('aria-labelledby')) {
firstBlockInsideTab.setAttribute('aria-labelledby', 'tab' + (i + 1) + '_' + recid)
}
if (firstBlockInsideTab && !firstBlockInsideTab.getAttribute('role')) {
firstBlockInsideTab.setAttribute('role', 'tabpanel')
}
if (firstBlockInsideTab && !firstBlockInsideTab.getAttribute('tabindex')) {
firstBlockInsideTab.setAttribute('tabindex', '0')
}
})
}
}
function t395_switchBetweenTabs(recid, tabNumber, targetTab, tildaMode, tildaLazyMode) {
var rec = document.getElementById('rec' + recid);
if (!rec)
return;
var activeTab = rec.querySelector('.t395__tab_active');
if (activeTab) {
activeTab.classList.remove('t395__tab_active');
var activeButton = activeTab.querySelector('.t395__title');
if (activeButton) {
activeButton.setAttribute('tabindex', -1);
activeButton.setAttribute('aria-selected', !1)
}
}
targetTab.classList.add('t395__tab_active');
var targetButton = targetTab.querySelector('.t395__title');
if (targetButton) {
targetButton.setAttribute('tabindex', 0);
targetButton.setAttribute('aria-selected', !0)
}
t395_removeUrl();
if (tildaMode !== 'edit' && tildaMode !== 'preview' && tabNumber && typeof history.replaceState !== 'undefined') {
try {
window.history.replaceState('', '', window.location.href + '#!/tab/' + recid + '-' + tabNumber)
} catch (err) {}
}
rec.querySelector('.t395__wrapper').setAttribute('data-tab-current', tabNumber);
t395_alltabs_updateContent(recid);
t395_updateSelect(recid);
var hookBlocks = targetTab.getAttribute('data-tab-rec-ids').split(',');
var event = document.createEvent('Event');
event.initEvent('displayChanged', !0, !0);
var hooksCopy = hookBlocks.slice();
hooksCopy.forEach(function(recid) {
var currentRec = document.getElementById('rec' + recid);
if (!currentRec)
return;
var recordType = currentRec.getAttribute('data-parenttplid') || currentRec.getAttribute('data-record-type');
if (recordType === '395' || recordType === '397') {
var selector = '.t' + recordType + '__tab_active';
var activeIDs = currentRec.querySelector(selector).getAttribute('data-tab-rec-ids');
activeIDs = activeIDs.split(',');
hookBlocks = hookBlocks.concat(activeIDs)
}
});
hookBlocks.forEach(function(curRecid) {
var currentRec = document.getElementById('rec' + curRecid);
if (!currentRec)
return;
var currentRecChildren = currentRec.querySelectorAll('.t-feed, .t-store, .t-store__product-snippet, .t117, .t121, .t132, .t223, .t226, .t228, .t229, .t230, .t268, .t279, .t341, .t346, .t347, .t349, .t351, .t353, .t384, .t385, .t386, .t396, .t400, .t404, .t409, .t410, .t412, .t418, .t422, .t425, .t428, .t433, .t448, .t456, .t477, .t478, .t480, .t486, .t498, .t504, .t506, .t509, .t511, .t517, .t518, .t519, .t520, .t532, .t533, .t538, .t539, .t544, .t545, .t552, .t554, .t569, .t570, .t577, .t592, .t598, .t599, .t601, .t604, .t605, .t609, .t615, .t616, .t650, .t659, .t670, .t675, .t686, .t688, .t694, .t698, .t700, .t726, .t728, .t730, .t734, .t738, .t740, .t744, .t754, .t760, .t762, .t764, .t774, .t776, .t778, .t780, .t786, .t798, .t799, .t801, .t813, .t814, .t822, .t826, .t827, .t829, .t842, .t843, .t849, .t850, .t851, .t856, .t858, .t859, .t860, .t881, .t889, .t902, .t912, .t923, .t937, .t958, .t959, .t979, .t982, .t983, .t989, .t994, .t1053, .t1067, .t1068, .t1069, .t1070, .t1071, .t1072, .t1186, .t368');
Array.prototype.forEach.call(currentRecChildren, function(child) {
child.dispatchEvent(event)
});
var displayChangedBlock = currentRec.querySelector('[data-display-changed="true"]');
if (displayChangedBlock)
displayChangedBlock.dispatchEvent(event)
});
var galaxyEffectBlocks = document.querySelectorAll('.t826');
Array.prototype.forEach.call(galaxyEffectBlocks, function(galaxyEffectBlock) {
galaxyEffectBlock.dispatchEvent(event)
});
if (window.lazy === 'y' || tildaLazyMode === 'yes') {
t_onFuncLoad('t_lazyload_update', function() {
t_lazyload_update()
})
}
}
function t395_showActiveTabFromKeyboard(recid, currentIndex, tabs) {
var rec = document.querySelector('#rec' + recid);
var currentTab = rec.querySelector('[data-tab-number="' + currentIndex + '"]');
if (!currentTab)
return;
var currentButton = currentTab.querySelector('.t395__title');
if (currentButton) {
currentButton.focus()
}
var tabList = rec.querySelector('.t395__wrapper');
if (tabList)
tabList.setAttribute('data-tab-current', currentIndex)
}
function t395_alltabs_updateContent(recid) {
var rec = document.getElementById('rec' + recid);
var activeTabs = rec ? rec.querySelectorAll('.t395__tab_active') : null;
var select = rec ? rec.querySelector('.t395__select') : null;
var tabs = rec.querySelectorAll('.t395__tab');
if (activeTabs.length !== 1)
return !1;
var activeTab = activeTabs[0];
var hookBlocks = activeTab.getAttribute('data-tab-rec-ids').split(',');
var noActive = [];
var popupBlocks = [190, 217, 312, 331, 358, 364, 365, 390, 702, 706, 746, 750, 756, 768, 862, 868, 890, 945, 1013, 1014, ];
Array.prototype.forEach.call(tabs, function(tab) {
if (tab !== activeTab) {
var noActiveHooks = tab.getAttribute('data-tab-rec-ids').split(',');
noActiveHooks.forEach(function(hook) {
if (noActive.indexOf(hook) === -1 && hookBlocks.indexOf(hook) === -1)
noActive.push(hook)
})
}
});
if (t395_checkVisibillityEl(activeTab) || t395_checkVisibillityEl(select)) {
hookBlocks.forEach(function(hook) {
if (hook) {
var hookEl = document.getElementById('rec' + hook);
var hookElRecordType = hookEl ? hookEl.getAttribute('data-parenttplid') || hookEl.getAttribute('data-record-type') : '';
if (hookEl) {
hookEl.classList.remove('t395__off');
hookEl.classList.remove('t397__off');
hookEl.setAttribute('aria-hidden', !1);
hookEl.style.opacity = ''
}
t395_updateTabsByHook(hookElRecordType, hookEl, hook, recid)
}
})
} else {
hookBlocks.forEach(function(hook) {
var hookEl = document.getElementById('rec' + hook);
var hookElRecordType = hookEl ? hookEl.getAttribute('data-parenttplid') || hookEl.getAttribute('data-record-type') : '';
var isPopupBlock = popupBlocks.some(function(id) {
return hookElRecordType == id
});
if (hookEl && !isPopupBlock) {
hookEl.setAttribute('data-animationappear', 'off');
hookEl.classList.add('t395__off');
hookEl.setAttribute('aria-hidden', !0)
}
t395_updateTabsByHook(hookElRecordType, hookEl, hook, recid)
})
}
noActive.forEach(function(noActiveID) {
if (!noActiveID)
return;
var hookEl = document.getElementById('rec' + noActiveID);
var hookElRecordType = hookEl ? hookEl.getAttribute('data-parenttplid') || hookEl.getAttribute('data-record-type') : '';
var isPopupBlock = popupBlocks.some(function(id) {
return hookElRecordType == id
});
if (hookEl && !isPopupBlock) {
hookEl.setAttribute('data-connect-with-tab', 'yes');
hookEl.setAttribute('data-animationappear', 'off');
hookEl.classList.add('t395__off');
hookEl.setAttribute('aria-hidden', !0)
}
t395_updateTabsByHook(hookElRecordType, hookEl, noActiveID, recid)
});
var scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight);
if (scrollHeight - window.innerHeight < window.pageYOffset) {
window.scrollTo(0, 0)
}
}
function t395_updateTabsByHook(hookElRecordType, hookEl, currentID, recid) {
var hookElTab;
switch (hookElRecordType) {
case '395':
if (window.t395_alltabs_updateContent && window.t395_updateSelect && recid !== currentID) {
window.t395_alltabs_updateContent(currentID);
window.t395_updateSelect(currentID);
hookElTab = hookEl ? hookEl.querySelector('.t395__tab') : null;
if (hookElTab)
hookElTab.click()
}
break;
case '397':
if (t397_alltabs_updateContent && t397_updateSelect && recid !== currentID) {
t397_alltabs_updateContent(currentID);
t397_updateSelect(currentID);
hookElTab = hookEl ? hookEl.querySelector('.t397__tab') : null;
if (hookElTab)
hookElTab.click()
}
break
}
}
function t395_checkVisibillityEl(el) {
return !!(el && (el.offsetWidth || el.offsetHeight || el.getClientRects().length))
}
function t395_updateContentBySelect(recid) {
var rec = document.getElementById('rec' + recid);
if (!rec)
return !1;
var select = rec.querySelector('.t395__select');
if (select) {
select.addEventListener('change', function() {
var currentValue = select.value;
var tabIndex = rec.querySelector(".t395__tab[data-tab-rec-ids='" + currentValue + "']");
if (tabIndex)
tabIndex.click()
})
}
}
function t395_updateSelect(recid) {
var rec = document.getElementById('rec' + recid);
if (!rec)
return !1;
var activeTab = rec.querySelector('.t395__tab_active');
var currentTabHooks = activeTab ? activeTab.getAttribute('data-tab-rec-ids') : '';
var select = rec.querySelector('.t395__select');
if (select)
select.value = currentTabHooks
}
function t395_scrollToTabs(recid, hash) {
var rec = document.getElementById('rec' + recid);
var curUrl = hash || decodeURI(window.location.href);
var tabIndexNumber = curUrl.indexOf('#!/tab/');
if (tabIndexNumber === -1)
return !1;
var tabIndexNumberStart = curUrl.indexOf('tab/');
var firstOptionSelect = rec ? rec.querySelector('.t395__wrapper_mobile .t395__select option') : null;
if (firstOptionSelect)
firstOptionSelect.selected = !1;
var tabRec = curUrl.substring(tabIndexNumberStart + 4, tabIndexNumberStart + 4 + recid.length);
if (tabRec !== recid)
return !1;
var tabBlock = rec ? rec.querySelector('.t395') : null;
var tabNumber = parseInt(curUrl.slice(tabIndexNumberStart + 4 + recid.length + 1), 10);
var tabs = rec.querySelectorAll('.t395__tab');
Array.prototype.forEach.call(tabs, function(tab, i) {
if (i === tabNumber - 1) {
tab.click();
tab.classList.add('t395__tab_active')
} else {
tab.classList.remove('t395__tab_active')
}
});
var tabsMob = rec.querySelectorAll('.t395__wrapper_mobile .t395__select option');
var activeTabMob = tabsMob.length ? tabsMob[tabNumber - 1] : null;
if (activeTabMob)
activeTabMob.selected = !0;
var targetOffset = tabBlock.getBoundingClientRect().top + window.pageYOffset;
var target = window.innerWidth > 960 ? targetOffset - 200 : targetOffset - 100;
if (target < 0)
target = 0;
t395_scrollToEl(target)
}
function t395_scrollToEl(elTopPos) {
if (elTopPos === window.pageYOffset)
return !1;
var duration = 300;
var difference = window.pageYOffset;
var cashedDiff = window.pageYOffset;
var step = (10 * (elTopPos || window.pageYOffset)) / duration;
var timer = setInterval(function() {
if (cashedDiff > elTopPos) {
difference -= step
} else {
difference += step
}
window.scrollTo(0, difference);
document.body.setAttribute('data-scrollable', 'true');
if ((cashedDiff > elTopPos && window.pageYOffset <= elTopPos) || (cashedDiff <= elTopPos && window.pageYOffset >= elTopPos)) {
document.body.removeAttribute('data-scrollable');
clearInterval(timer)
}
}, 10);
var timer2 = setTimeout(function() {
clearInterval(timer);
document.body.removeAttribute('data-scrollable');
clearTimeout(timer2)
}, duration * 2)
}
function t395_removeUrl() {
var curUrl = window.location.href;
var indexToRemove = curUrl.indexOf('#!/tab/');
if (indexToRemove === -1) {
indexToRemove = curUrl.indexOf('%23!/tab/')
}
curUrl = curUrl.substring(0, indexToRemove);
if (indexToRemove !== -1) {
if (typeof history.replaceState != 'undefined') {
try {
window.history.replaceState('', '', curUrl)
} catch (err) {}
}
}
}
function t802_insta_init(recId, instaUser) {
var rec = document.getElementById('rec' + recId);
if (!rec)
return;
var container = rec.querySelector('.t802');
if (!container)
return;
var projectId = document.getElementById('allrecords').getAttribute('data-tilda-project-id');
t802_insta_loadflow(recId, projectId, instaUser)
}
function t802_insta_loadflow(recId, projectId, instaUser) {
var url = 'https://insta.tildacdn.com/fish/0.json';
if (instaUser) {
url = 'https://insta.tildacdn.com/json/project' + projectId + '_' + instaUser + '.json'
}
var xhr = new XMLHttpRequest();
xhr.open('GET', url, !0);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status >= 200 && xhr.status < 400) {
var data = xhr.responseText;
if (data) {
try {
var objData = JSON.parse(data)
} catch (error) {
console.log('Error. insta flow json not object');
console.log(data)
}
if (typeof objData === 'object') {
t802_insta_draw(recId, objData)
}
}
} else {
console.log('Error load instgram flow')
}
}
}
;
xhr.send()
}
function t802_insta_draw(recId, objData) {
if (objData && objData.photos && objData.photos.length === 0)
return;
var rec = document.getElementById('rec' + recId);
if (!rec)
return;
var allImgWrappersNum = rec.querySelectorAll('.t802__imgwrapper_empty').length;
for (var i = 0; i < allImgWrappersNum; i++) {
if (objData.photos[i]) {
t802_insta_drawItem(recId, objData.username, objData.photos[i], i)
} else {
var empty = rec.querySelector('.t802__imgwrapper_empty');
if (empty)
empty.remove()
}
}
if (window.lazy === 'y' || document.getElementById('allrecords').getAttribute('data-tilda-lazy') === 'yes') {
t_onFuncLoad('t_lazyload_update', function() {
t_lazyload_update()
})
}
}
function t802_insta_drawItem(recId, userName, photo, counter) {
var rec = document.querySelector('#rec' + recId);
if (!rec)
return;
var empty = rec.querySelector('.t802__imgwrapper_empty');
var isZoomable = rec.querySelector('.t802__container').getAttribute('data-zoom');
if (empty) {
empty.classList.remove('t802__imgwrapper_empty');
var main = empty.parentNode;
var imageWrapper = document.createElement('div');
imageWrapper.classList.add('t802__bgimg');
if (window.lazy === 'y' || document.getElementById('allrecords').getAttribute('data-tilda-lazy') === 'yes') {
imageWrapper.classList.add('t-bgimg');
imageWrapper.setAttribute('data-original', photo.url)
} else {
imageWrapper.style.backgroundImage = 'url(' + photo.url + ')'
}
if (!isZoomable) {
var tagA = document.createElement('a');
tagA.href = photo.link;
tagA.target = '_blank';
empty.appendChild(imageWrapper);
tagA.appendChild(empty);
main.appendChild(tagA)
} else {
imageWrapper.setAttribute('data-zoomable', 'yes');
imageWrapper.setAttribute('data-zoom-target', counter);
imageWrapper.setAttribute('data-img-zoom-url', photo.url);
if (photo.text) {
imageWrapper.setAttribute('data-img-zoom-descr', photo.text)
}
imageWrapper.classList.add('t-zoomable');
empty.appendChild(imageWrapper);
main.appendChild(empty)
}
var hover = empty.querySelector('.t802__hover-wrapper');
if (hover && window.isMobile === !1) {
var text = t802_insta_cropText(recId, '@' + userName + ': ' + photo.text);
var divHover = document.createElement('div');
var divText = document.createElement('div');
divHover.classList.add('t802__hover-filter');
divText.classList.add('t802__text', 't-text', 't-descr_xxs');
divText.innerHTML = text;
hover.appendChild(divHover);
hover.appendChild(divText)
}
}
}
function t802_insta_cropText(recId, text) {
var rec = document.getElementById('rec' + recId);
var colsInLine = rec.querySelector('[data-cols-in-line]').getAttribute('data-cols-in-line');
var maxLength = 130;
if (colsInLine == 6) {
maxLength = 90
}
if (text.length > maxLength) {
text = text.substring(0, maxLength);
text = text.substring(0, Math.min(maxLength, text.lastIndexOf(' ')));
text += ' ...'
}
return text
}
window.requestAnimationFrame = (function() {
return (window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {
window.setTimeout(callback, 1000 / 60)
}
)
}
)();
function t270_scroll(hash, offset) {
if (!hash)
return;
t270_checkLoad(hash, offset);
var excludeHashes = ['#!/tproduct/', '#!/tab/', '#opencart'];
if (excludeHashes.includes(hash)) {
return !0
}
var isHistoryChangeAllowed = window.location.hash !== hash;
var wrapperBlock = document.querySelector('.t270');
var dontChangeHistory = wrapperBlock ? Boolean(wrapperBlock.getAttribute('data-history-disabled')) : !1;
t270_scrollToEl(hash, offset);
if (!dontChangeHistory && isHistoryChangeAllowed) {
if (history.pushState) {
history.pushState(null, null, hash)
} else {
window.location.hash = hash
}
isHistoryChangeAllowed = !1
}
return !0
}
function t270_checkLoad(hash, offset) {
if (window.t270_loadChecked)
return;
var sliderWrappers = document.body.querySelectorAll('.t-slds__items-wrapper');
if (!sliderWrappers.length)
return;
var lastWrapper = sliderWrappers[sliderWrappers.length - 1];
var sliderImgs = lastWrapper ? lastWrapper.querySelectorAll('.t-slds__bgimg') : [];
var lastImg = sliderImgs[sliderImgs.length - 1];
var imageUrl = lastImg ? window.getComputedStyle(lastImg).backgroundImage : '';
imageUrl = imageUrl.substring(5, imageUrl.length - 2);
var preloaderImg = document.createElement('img');
preloaderImg.src = imageUrl ? imageUrl : '';
preloaderImg.addEventListener('load', function() {
t270_scroll(hash, offset);
window.t270_loadChecked = !0
})
}
function t270_scrollToEl(hash, offset) {
var SCROLL_DURATION_MS = 500;
var body = document.body;
if (body.getAttribute('data-scroll'))
return;
var scrollTargetY = t270_getTarget(hash, offset);
if (isNaN(scrollTargetY))
return;
var canSmoothScroll = window.CSS && window.CSS.supports('scroll-behavior', 'smooth') && 'scrollBehavior'in document.documentElement.style;
var userAgent = navigator.userAgent.toLowerCase();
var isAndroid = userAgent.indexOf('android') !== -1;
if (window.isMobile && !isAndroid && canSmoothScroll) {
body.setAttribute('data-scroll', 'true');
window.scrollTo({
left: 0,
top: scrollTargetY,
behavior: 'smooth',
});
setTimeout(function() {
body.removeAttribute('data-scroll')
}, SCROLL_DURATION_MS)
} else {
t270_smoothScrollTo(scrollTargetY, SCROLL_DURATION_MS)
}
}
function t270_smoothScrollTo(targetY, duration=500) {
var body = document.body;
var startY = window.scrollY || window.pageYOffset;
var deltaY = targetY - startY;
var startTime = performance.now();
function easeInOutQuad(t) {
return Math.pow(t, 2)
}
function scroll() {
var currentTime = performance.now();
var elapsedTime = Math.min((currentTime - startTime) / duration, 1);
var ease = easeInOutQuad(elapsedTime);
window.scrollTo(0, startY + deltaY * ease);
if (elapsedTime < 1) {
requestAnimationFrame(scroll)
} else {
body.removeAttribute('data-scroll');
body.removeAttribute('data-scrollable');
window.scrollTo(0, targetY)
}
}
body.setAttribute('data-scroll', 'true');
body.setAttribute('data-scrollable', 'true');
requestAnimationFrame(scroll)
}
function t270_getTarget(hash, offset) {
var target;
try {
if (hash.substring(0, 1) === '#') {
target = document.getElementById(hash.substring(1))
} else {
target = document.querySelector(hash)
}
} catch (event) {
console.log('Exception t270: ' + event.message);
return
}
if (!target) {
target = document.querySelector('a[name="' + hash.substr(1) + '"], div[id="' + hash.substr(1) + '"]');
if (!target)
return
}
target = parseInt(target.getBoundingClientRect().top + window.pageYOffset - offset, 10);
target = Math.max(target, 0);
return target
}