5001var storeuidIndex = hashArr.indexOf('r') + 1;5002var storeuid = hashArr[storeuidIndex];50035004if (hashArr[storepartValueIndex].indexOf('-') !== -1) {5005storepartuid = hashArr[storepartValueIndex].slice(0, hashArr[storepartValueIndex].indexOf('-'));5006} else {5007storepartuid = hashArr[storepartValueIndex];5008}5009if (window.history.state) {5010optsFromHistory = window.history.state.opts;5011optsFromHistory.storepart = storepartuid;5012
} if (!t_store_isStorepartFromHistoryActive(storepartuid, recid, options)) { t_store_loadProducts('', storeuid, optsFromHistory); } } else if (!t_store_isStorepartFromHistoryActive(options.storepart, recid, options)) { t_store_loadProducts('', recid, options); } } else if (window.history.state && window.history.state.productData) { try { var urlBeforePopupOpen = window.urlBeforePopupOpen; var titleBeforePopupOpen = window.titleBeforePopupOpen; productData = window.history.state.productData; storepartuid = productData.opts.storepart; options = productData.opts; recid = productData.recid; t_store_history_pushState( { storepartuid: storepartuid, opts: options, recid: recid, }, null, urlBeforePopupOpen ); if (isiOS && isSafari) { document.querySelector('head link[rel="canonical"]').setAttribute('href', urlBeforePopupOpen); document.title = titleBeforePopupOpen; } } catch (error) { console.error(error); } } if (recid) { if ( document.getElementById('rec' + recid).querySelector('.js-store-parts-switcher') && !options.hideStoreParts ) { t_store_setActiveStorePart(recid); } if (options.tabs) { t_store_onFuncLoad('t_store_tabs_videoClearFrame', function () { t_store_tabs_videoClearFrame(recid); }); } } var popup = document.querySelector('.t-popup'); setTimeout(function () { popup.scrollTop = 0; Array.prototype.forEach.call(document.querySelectorAll('.t-popup:not(.t-popup_show)'), function (popup) { popup.style.display = 'none'; }); }, 300); document.removeEventListener('keydown', t_store_closePopupKeyDown); window.removeEventListener('resize', window.t_store_prodPopup_updateGalleryThumbsEvent); t_store_triggerEvent(document.body, 'twishlist_addbtn'); t_store_triggerEvent(popup, t_store_POPUP_CLOSED_EVENT_NAME);}function t_store_isStorepartFromHistoryActive(storepartuid, recid, opts) { var rec = document.getElementById('rec' + recid); if (opts && !opts.storePartsArr) { /* when we have 'catalog' with multiple storeparts, opts include storePartsArr key so if we don't have this key we know - storepart is active because in this case we have only one part */ return true; } if (!storepartuid) { return false; } var activeStorepartUid = rec.querySelector('.js-store-parts-switcher.t-active')?.getAttribute('data-storepart-uid'); return parseInt(activeStorepartUid, 10) === parseInt(storepartuid, 10);}function t_store_closePopup_routing() { window.onpopstate = function () { var options; if (window.history.state) { if (window.history.state.productData) { var productPopupData = window.history.state.productData; var recid = productPopupData.recid, productObj = productPopupData.productObj,