(function () {
"use strict";
var CFG = {
colorParam: "color",
initial: "black",
colors: {
black: "318567737722",
chocolate: "839681424952",
cognac: "595979075302"
}
};
var VISIBLE = 5;
var state = {
color: CFG.initial,
products: {},
imgs: [],
slide: 0,
start: 0,
thumbDragActive: false,
thumbDragMoved: false,
thumbDragBlockClick: false,
thumbDragLastY: 0,
thumbDragAccum: 0,
thumbPointerBlockClick: false,
mainSwipeActive: false,
mainSwipeMoved: false,
mainSwipeStartX: 0,
mainSwipeStartY: 0,
mainSwipeLastX: 0,
mainSwipeBlockClick: false,
mainSlideDirection: 0,
mainAnimTimer: 0,
nativePopupClick: false,
page: {
zeroRecid: "",
accordRecid: "",
successPopupHook: "",
successPopupRecid: "",
catalogRecid: ""
}
};
function q(sel, root) {
return (root || document).querySelector(sel);
}
function qa(sel, root) {
return Array.prototype.slice.call((root || document).querySelectorAll(sel));
}
function recidFromElement(el) {
return el && el.id ? String(el.id).replace(/^rec/, "") : "";
}
function pageRecords() {
return qa("#allrecords > .r.t-rec");
}
function colorCfg(color) {
var cfg = CFG.colors[color];
if (cfg == null) return { uid: "", rec: "" };
if (typeof cfg === "string" || typeof cfg === "number") {
return { uid: String(cfg), rec: "" };
}
return {
uid: String(cfg.uid || ""),
rec: String(cfg.rec || "")
};
}
function detectZeroRecid() {
var rec = pageRecords().find(function (item) {
return item.getAttribute("data-record-type") === "396";
});
return recidFromElement(rec);
}
function getZeroRecid() {
if (!state.page.zeroRecid) state.page.zeroRecid = String(CFG.zero || "") || detectZeroRecid();
return state.page.zeroRecid;
}
function detectAccordRecid() {
var rec = pageRecords().find(function (item) {
return item.getAttribute("data-record-type") === "585" || !!q(".t585", item);
});
return recidFromElement(rec);
}
function getAccordRecid() {
if (!state.page.accordRecid) state.page.accordRecid = String(CFG.accord || "") || detectAccordRecid();
return state.page.accordRecid;
}