Store
ec.storefront.staticPages.staticStorefrontEnabled = true; ec.storefront.staticPages.staticContainerID = 'static-ec-store'; ec.storefront.staticPages.dynamicContainerID = 'dynamic-ec-store'; ec.storefront.staticPages.autoSwitchStaticToDynamicWhenReady = true;
function isEmpty(str) { return (!str || 0 === str.length); }
function isNotEmpty(str) { return !isEmpty(str); }
function findFirstNotEmpty(urlArray) { if (!urlArray) { return ""; }
for (var i = 0; i 4 ? a + a : ''); } return [ parseInt(color.substr(1, 2), 16), parseInt(color.substr(3, 2), 16), parseInt(color.substr(5, 2), 16), color.length > 7 ? parseInt(color.substr(7, 2), 16)/255 : 1 ]; } if (color.indexOf('rgb') === -1) { // convert named colors var tmp = document.body.appendChild(document.createElement('fictum')); // intentionally use unknown tag to lower chances of css rule override with var flag = 'rgb(1, 2, 3)'; // this flag tested on chrome 59, ff 53, ie9, ie10, ie11, edge 14 tmp.style.color = flag; if (tmp.style.color !== flag) return; // color set failed - some monstrous css rule is probably taking over the color of our object tmp.style.color = color; if (tmp.style.color === flag || tmp.style.color === '') return; // color parse failed color = getComputedStyle(tmp).color; document.body.removeChild(tmp); } if (color.indexOf('rgb') === 0) { if (color.indexOf('rgba') === -1) color += ',1'; // convert 'rgb(R,G,B)' to 'rgb(R,G,B)A' which looks awful but will pass the regxep below return color.match(/[\.\d]+/g).map(function (a) { return +a }); } }
function isColorDark(color) { var c = getColorValues(color); // расчет Photoshop’s RGB-to-Greyscale на основе HSP Color Model http://alienryderflex.com/hsp.html var hsp = Math.sqrt( 0.299 * (c[0] * c[0]) + 0.587 * (c[1] * c[1]) + 0.114 * (c[2] * c[2]) ); // считаем цвет темным если его яркость не больше 200 return !!(hsp ' + css + '
'; }
function init() { setCellInterval(params.productCellSpacing, params.categoryCellSpacing); checkLayout(); window.addEventListener('resize', function() { checkLayout(); }); }
init(); };
var ecwidContainer = document.querySelector('.ec-static-container .ec-size'); var breakpoints = { 320: 'ec-size--xxs', 414: 'ec-size--xs', 480: 'ec-size--s', 768: 'ec-size--m', 1024: 'ec-size--l', 1100: 'ec-size--xl', 1440: 'ec-size--xxl' };
function onResize() { var w = ecwidContainer.offsetWidth; for (var i in breakpoints) { if (w >= i) { ecwidContainer.classList.add(breakpoints[i]); } else { ecwidContainer.classList.remove(breakpoints[i]); } } } onResize(); window.addEventListener('load', onResize); window.addEventListener('resize', onResize);
var links = document.querySelectorAll(".ec-static-container a"); for (var i = 0; i