;(function($) {
// wrap tables in content for swipe on mobile devices
$(function() {
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/i.test(navigator.userAgent);
$('article.content').find('table').wrap('
');
if(isMobile){
$('html').addClass('mobile');
}
var videos = [];
$('[data-video-src]').each(function(i, e) {
var video = {
src: $(e).data('video-src'),
autoplay: $(e).data('video-autoplay'),
loop: $(e).data('video-loop'),
poster: $(e).data('video-poster')
};
if (video.src && !$(e).find('>.wm-video').size()) {
var srcs = video.src.split(';');
var wrapper = document.createElement('div');
wrapper.className = 'wm-video';
var videoEl = document.createElement('video');
if (video.autoplay) {
videoEl.autoplay = video.autoplay;
}
if (video.loop) {
videoEl.loop = video.loop;
}
if (video.poster) {
videoEl.autoplay = video.poster;
}
videos.push({
el: $(e),
wrapper: $(wrapper),
video: $(videoEl)
});
addEvent(videoEl, i);
videoEl.src = video.src;
$(wrapper).append(videoEl);
$(e).prepend(wrapper);
}
});
function addEvent(v, i) {
v.addEventListener( "loadedmetadata", function () {
calcPosItem(i);
}, false );
}
function calcPosItem(i) {
var c = videos[i].video[0].videoWidth/videos[i].video[0].videoHeight;
var d = videos[i].el.width()/videos[i].el.height();
if(c > d) {
videos[i].wrapper.addClass('vertical');
} else {
videos[i].wrapper.removeClass('vertical');
}
}
function calcPos() {
for (var i = 0; i < videos.length; i++) {
calcPosItem(i);
}
}
$(window).resize(calcPos);
});
}(jQuery));$(function () {
$(document).click(function (event) {
$('.contacts-block').each(function() {
if ($(event.target).closest($(this)).length) {
return;
} else {
$(this).find('.tgl-but').prop("checked", false);
$(this).find('.icon').removeClass('active');
}
});
});
function setMargin($block) {
if (Math.max(document.documentElement.clientWidth, window.innerWidth || 0) > 960) {
$block.find(".block-body-drop").css({
"margin-left": "0px"
});
} else {
var left = $block.offset().left * -1;
$block.find(".block-body-drop").css({
"margin-left": left + "px"
});
}
}
$('.contacts-block').each(function() {
var $block = $(this),
allClasses = $block.attr("class").split(" "),
mainClass = allClasses[0],
mainSelector = document.location.pathname == "/" ? ".title-page .side-panel ."+mainClass+" .block-body-drop" : ".side-panel ."+mainClass+" .block-body-drop",
styles = document.styleSheets;
for(var i = 0; i < styles.length; i++) {
if (styles[i].href && styles[i].href.indexOf("styles.css") !== -1) {
for(var j = 0; j < styles[i].cssRules.length; j++) {
if (styles[i].cssRules[j].selectorText == mainSelector && styles[i].cssRules[j].style.width == "100vw") {
$block.data("fullwidth", 1);
setMargin($block);
break;
}
}
break;
}
}
});
$(window).resize(function() {
$('.contacts-block').each(function() {
var $block = $(this);
if ($block.data("fullwidth") == 1) {
setMargin($block);
}
});
});
$('.contacts-block').each(function() {
var $block = $(this);
$block.find('.icon').click(function() {
if ($block.data("fullwidth") == 1) {
setMargin($block);
}
if ($block.find('.tgl-but').prop("checked")) {
$(this).removeClass('active');
} else {
$(this).addClass('active');
}
});
});
});
$(function () {
$(document).click(function (event) {
$('.contacts-block').each(function() {
if ($(event.target).closest($(this)).length) {
return;
} else {
$(this).find('.tgl-but').prop("checked", false);
$(this).find('.icon').removeClass('active');
}
});
});
function setMargin($block) {
if (Math.max(document.documentElement.clientWidth, window.innerWidth || 0) > 960) {
$block.find(".block-body-drop").css({
"margin-left": "0px"
});
} else {
var left = $block.offset().left * -1;
$block.find(".block-body-drop").css({
"margin-left": left + "px"
});
}
}
$('.contacts-block').each(function() {
var $block = $(this),
allClasses = $block.attr("class").split(" "),
mainClass = allClasses[0],
mainSelector = document.location.pathname == "/" ? ".title-page .side-panel ."+mainClass+" .block-body-drop" : ".side-panel ."+mainClass+" .block-body-drop",
styles = document.styleSheets;
for(var i = 0; i < styles.length; i++) {
if (styles[i].href && styles[i].href.indexOf("styles.css") !== -1) {
for(var j = 0; j < styles[i].cssRules.length; j++) {
if (styles[i].cssRules[j].selectorText == mainSelector && styles[i].cssRules[j].style.width == "100vw") {
$block.data("fullwidth", 1);
setMargin($block);
break;
}
}
break;
}
}
});
$(window).resize(function() {
$('.contacts-block').each(function() {
var $block = $(this);
if ($block.data("fullwidth") == 1) {
setMargin($block);
}
});
});
$('.contacts-block').each(function() {
var $block = $(this);
$block.find('.icon').click(function() {
if ($block.data("fullwidth") == 1) {
setMargin($block);
}
if ($block.find('.tgl-but').prop("checked")) {
$(this).removeClass('active');
} else {
$(this).addClass('active');
}
});
});
});
$(function () {
$(document).click(function (event) {
$('.contacts-block').each(function() {
if ($(event.target).closest($(this)).length) {
return;
} else {
$(this).find('.tgl-but').prop("checked", false);
$(this).find('.icon').removeClass('active');
}
});
});
function setMargin($block) {
if (Math.max(document.documentElement.clientWidth, window.innerWidth || 0) > 960) {
$block.find(".block-body-drop").css({
"margin-left": "0px"
});
} else {
var left = $block.offset().left * -1;
$block.find(".block-body-drop").css({
"margin-left": left + "px"
});
}
}
$('.contacts-block').each(function() {
var $block = $(this),
allClasses = $block.attr("class").split(" "),
mainClass = allClasses[0],
mainSelector = document.location.pathname == "/" ? ".title-page .side-panel ."+mainClass+" .block-body-drop" : ".side-panel ."+mainClass+" .block-body-drop",
styles = document.styleSheets;
for(var i = 0; i < styles.length; i++) {
if (styles[i].href && styles[i].href.indexOf("styles.css") !== -1) {
for(var j = 0; j < styles[i].cssRules.length; j++) {
if (styles[i].cssRules[j].selectorText == mainSelector && styles[i].cssRules[j].style.width == "100vw") {
$block.data("fullwidth", 1);
setMargin($block);
break;
}
}
break;
}
}
});
$(window).resize(function() {
$('.contacts-block').each(function() {
var $block = $(this);
if ($block.data("fullwidth") == 1) {
setMargin($block);
}
});
});
$('.contacts-block').each(function() {
var $block = $(this);
$block.find('.icon').click(function() {
if ($block.data("fullwidth") == 1) {
setMargin($block);
}
if ($block.find('.tgl-but').prop("checked")) {
$(this).removeClass('active');
} else {
$(this).addClass('active');
}
});
});
});
$(function() {
$('.up_button').click(function () {
var up_speed = $(this).data('speed')
$('body, html').animate({
scrollTop: 0
}, up_speed);
});
});
$(function() {
var $search = $('.wm-search');
var debounce = (function () {
return function (fn, time) {
var timer, func;
func = function() {
var args = [].slice.call(arguments, 0);
window.clearTimeout(timer);
timer = window.setTimeout(function () {
window.requestAnimationFrame && window.requestAnimationFrame(function() {
fn.apply(null, args);
}) || fn.apply(null, args);
}, time)
};
return func;
}
}());
function init() {
$search.each(function() {
var $this = $(this),
options = {};
var curMedia = $this.attr('data-setting-media');
if ($this.attr('data-setting-animate_list')) {
var media_type,
body_width = $('body').width();
var mediaList = ["screen", "tablet_landscape", "tablet_portrait", "mobile_landscape", "mobile_portrait"];
var media_ind, animate_list_arr;
if (body_width >= 961) {
media_type = "screen";
} else if (body_width <= 960 && body_width >= 769) {
media_type = "tablet_landscape";
} else if (body_width <= 768 && body_width >= 641) {
media_type = "tablet_portrait";
} else if (body_width <= 640 && body_width >= 481) {
media_type = "mobile_landscape";
} else if (body_width <= 480) {
media_type = "mobile_portrait";
}
media_ind = mediaList.indexOf(media_type);
animate_list_arr = $this.attr('data-setting-animate_list').split(",");
options.animation = $this.attr('data-setting-type');
if(curMedia != media_type) {
if (animate_list_arr[media_ind] == 1) {
$this.attr('data-setting-media', media_type);
$this.find('.wm-search-inner').wmSearch(options);
} else {
$this.find('.wm-search-inner').wmSearch('destroy');
}
}
}
});
}
$(window).on('resize', debounce(init, 300));
init();
});
(function($) {
function getInternetExplorerVersion(){
var rv = -1;
if (navigator.appName == 'Microsoft Internet Explorer') {
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
} else if (navigator.appName == 'Netscape') {
var ua = navigator.userAgent;
var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
return rv;
}
$.fn.wmSearch = function(options){
if (options === 'destroy') {
return this.each(function () {
var $this = $(this);
var inp = $this.find('input[name=search]');
var search_but = $this.find('button');
var $wrap = $this.parent('div');
$this.css('justify-content','flex-start');
$wrap.css('visibility','visible');
search_but.css('visibility','visible');
inp.stop(true).show().css({
'opacity': '',
'max-width':''
});
if ($this.data('wm_search')) {
search_but.off('.' + $this.data('wm_search'));
$(document).off('.' + $this.data('wm_search'));
$this.removeData('wm_search');
}
});
} else {
var defaults = $.extend({
animation : 'fade'
}, options);
return this.each(function () {
var clss = 'wm_search_' + Date.now();
var $this = $(this);
var inp = $this.find('input[name=search]');
var search_but = $this.find('button');
var $wrap = $this.parent('div');
$this.css('justify-content','flex-end');
$wrap.css('visibility','hidden');
search_but.css('visibility','visible');
if ($this.data('wm_search')) {
return;
}
if (defaults.animation == 'slide') {
var iebrw = getInternetExplorerVersion();
if (iebrw == 9 || iebrw == 10 || iebrw == 11) {
inp.hide();
search_but.on('click.' + clss, function () {
var wrapVis = $wrap.css('visibility');
if(wrapVis=="hidden"){
$wrap.css('visibility','visible');
inp.fadeIn().focus();
return false;
}
});
$(document).on('click.' + clss, function(event){
if( $(event.target).closest('.wm-search-inner').length )
return;
inp.fadeOut();
$wrap.css('visibility','hidden');
event.stopPropagation();
});
} else {
inp.css({
'max-width':'0px',
'opacity':'0'
});
search_but.on('click.' + clss, function () {
var wrapVis = $wrap.css('visibility');
if(wrapVis=="hidden"){
$wrap.css('visibility','visible');
inp.addClass('slide_search').css({
'opacity': '1',
'max-width':'100%'
}).focus();
return false;
}
});
$(document).on('click.' + clss, function(event){
if( $(event.target).closest('.wm-search-inner').length )
return;
inp.css({
'opacity': '0',
'max-width':'0'
});
$wrap.css('visibility','hidden');
event.stopPropagation();
});
}
} else {
search_but.on('click.' + clss, function () {
var wrapVis = $wrap.css('visibility');
if(wrapVis=="hidden"){
$wrap.css('visibility','visible');
inp.fadeIn().focus();
return false;
}
});
inp.hide();
$(document).on('click.' + clss, function(event){
if( $(event.target).closest('.wm-search-inner').length )
return;
inp.fadeOut();
$wrap.css('visibility','hidden');
event.stopPropagation();
});
}
$this.data('wm_search', clss);
});
}
}
})(jQuery);
;(function(window, document) {
if (!window.photoSwipeSettings) {
window.photoSwipeSettings = {};
}
var psSettings = window.photoSwipeSettings;
function initPhotoSwipeFunc(settings) {
if (!settings.preloadImages) {
settings.preloadImages = false;
}
var settingsKeys = Object.keys(psSettings);
if (settingsKeys.length) {
settingsKeys.forEach(function(key) {
if (key !== 'hashData') {
psSettings[key].push(settings[key]);
}
});
} else {
Object.keys(settings).forEach(function(key) {
psSettings[key] = [];
psSettings[key].push(settings[key]);
});
}
var galleryIteration = 0;
psSettings.gallery.forEach(function(str){
if (str === settings.gallery) {
galleryIteration++;
}
var index = psSettings.gallery.indexOf(settings.gallery);
if (galleryIteration > 1) {
settingsKeys.forEach(function(key) {
if (key !== 'hashData') {
psSettings[key].splice(index, 1);
}
});
galleryIteration = 0;
}
});
if (!psSettings.hashData) {
psSettings.hashData = photoswipeParseHash();
}
var hashData = psSettings.hashData;
var hashDataKeys = Object.keys(hashData);
if (hashDataKeys.length) {
settings.preloadImages = true;
}
var galleryElements = document.querySelectorAll(psSettings.gallery.join(','));
var galleryLength = galleryElements.length;
var pswpHTML = '
';
var pswpHTMLEnd = '
';
var pswpShare = '', pswpFullscreen = '', pswpZoom = '', curGallery;
for(var i = 0; i < galleryLength; i++) {
curGallery = galleryElements[i];
if (curGallery.getAttribute('data-popup-share') === '1') {
pswpShare = ''
}
if (curGallery.getAttribute('data-popup-fullscreen') === '1') {
pswpFullscreen = '';
}
if (curGallery.getAttribute('data-popup-zoom') === '1') {
pswpZoom = '';
}
curGallery.setAttribute('data-pswp-uid', i+1);
curGallery.dataGID = i+1;
if (settings.preloadImages) {
parseGalleryImages(curGallery);
} else {
parseGalleryThumbs(curGallery);
if (hashData.pid && hashData.gid && hashData.gid === curGallery.dataGID) {
openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true);
}
}
}
var pswpOverlay = document.querySelectorAll('.pswp');
if (pswpOverlay.length === 0) {
pswpHTML = pswpHTML + pswpShare + pswpFullscreen + pswpZoom + pswpHTMLEnd;
var pswpContainer = document.createElement('div');
pswpContainer.innerHTML = pswpHTML;
document.body.appendChild(pswpContainer);
}
function parseGalleryImages(gallery){
var images = gallery.querySelectorAll(settings.item + ' img');
var imagesLen = images.length;
var loadedArr = [];
for (var ind = 0; ind < imagesLen; ind++) {
setDataSize(images[ind]);
}
function setDataSize(img) {
var tempImg = new Image();
var link = closest(img, function(el) {
return (el.tagName && el.tagName === 'A');
});
if(link){
tempImg.src = link.getAttribute('href');
}
if (!link) {return false;}
tempImg.addEventListener('load', function() {
link.setAttribute('data-size', tempImg.naturalWidth + 'x' + tempImg.naturalHeight);
tempImg = null;
loadedArr.push('loaded');
if (loadedArr.length === imagesLen) {
parseGalleryThumbs(gallery);
if (hashData.pid && hashData.gid && hashData.gid === gallery.dataGID) {
openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true);
}
}
});
}
}
function parseGalleryThumbs(gallery) {
var thumbs = gallery.querySelectorAll(settings.item);
var thumbsLen = thumbs.length;
var items = [];
var item, link, image, title, desc, size, obj;
for (var i = 0; i < thumbsLen; i++) {
item = thumbs[i];
item.dataPSIndex = i;
item.addEventListener('click', onThumbsClick);
image = item.querySelector('img');
link = item.querySelector('a[data-size]');
title = link.getAttribute('data-title');
desc = item.querySelector(settings.itemDesc);
size = link.getAttribute('data-size').split('x');
obj = {
src: link.getAttribute('href'),
w: parseInt(size[0], 10),
h: parseInt(size[1], 10)
};
if (title) {
obj.title = title;
}
if (desc && desc.innerHTML) {
obj.title += ' ' + desc.innerHTML + '';
}
if (link.children.length > 0) {
obj.msrc = image.getAttribute('src');
}
obj.el = item;
items.push(obj);
}
return items;
}
function onThumbsClick(e) {
e = e || window.event;
e.preventDefault ? e.preventDefault() : e.returnValue = false;
var eTarget = e.target || e.srcElement;
var clickedItem = closest(eTarget, function(el) {
return ('dataPSIndex' in el);
});
var clickedGallery = closest(clickedItem, function(el) {
return el.getAttribute('data-pswp-uid');
});
var index = clickedItem.dataPSIndex;
openPhotoSwipe(index, clickedGallery);
return false;
}
function closest(el, fn) {
return el && (fn(el) ? el : closest(el.parentNode, fn));
}
function openPhotoSwipe(index, gallery, disableAnimation, fromURL) {
var pswpElement = document.querySelectorAll('.pswp')[0];
if (!gallery) {
return false;
}
var items = parseGalleryThumbs(gallery);
var options = {
galleryUID: gallery.getAttribute('data-pswp-uid'),
getThumbBoundsFn: function(index) {
var thumbnail = items[index].el.getElementsByTagName('img')[0];
var pageYScroll = window.pageYOffset || document.documentElement.scrollTop;
var rect = thumbnail.getBoundingClientRect();
return {x:rect.left, y:rect.top + pageYScroll, w:rect.width};
}
};
if (fromURL) {
if(options['galleryPIDs']) {
for (var j = 0; j < items.length; j++) {
if (items[j].pid === index) {
options.index = j;
break;
}
}
} else {
options.index = parseInt(index, 10) - 1;
}
} else {
options.index = parseInt(index, 10);
}
if (isNaN(options.index) ) {
return;
}
if (disableAnimation) {
options.showAnimationDuration = 0;
options.hideAnimationDuration = 0;
}
var pswpGallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
pswpGallery.init();
pswpGallery.listen('close', function() {
setTimeout(function(){
pswpElement.classList.remove('pswp--open');
}, 500);
});
}
function photoswipeParseHash() {
var hash = location.hash.substring(1), params = {};
if (hash.length < 5) {
return params;
}
var vars = hash.split('&'), varsL = vars.length, pair;
for (var i = 0; i < varsL; i++) {
if (!vars[i]) {continue;}
pair = vars[i].split('=');
if (pair.length < 2) {continue;}
params[pair[0]] = pair[1];
}
if (params.gid) {
params.gid = parseInt(params.gid, 10);
}
return params;
}
}
if (!window.initPhotoSwipeFunc) {
window.initPhotoSwipeFunc = initPhotoSwipeFunc;
}
}(window, document));
$(function() {
var $win = $(window);
var debounce = (function () {
return function (fn, time) {
var timer, func;
func = function() {
var args = [].slice.call(arguments, 0);
window.clearTimeout(timer);
timer = window.setTimeout(function () {
window.requestAnimationFrame && window.requestAnimationFrame(function() {
fn.apply(null, args);
}) || fn.apply(null, args);
}, time)
};
return func;
}
}());
var throttle = (function() {
return function (fn, threshhold, scope) {
threshhold || (threshhold = 250);
var last,
deferTimer,
func;
func = function () {
var context = scope || this;
var now = +new Date,
args = arguments;
if (last && now < last + threshhold) {
// hold on to it
clearTimeout(deferTimer);
deferTimer = setTimeout(function () {
last = now;
fn.apply(context, args);
}, threshhold);
} else {
last = now;
fn.apply(context, args);
}
};
return func;
}
}());
var psSettings = {
gallery: '.blocklist .body',
item: '.image',
itemDesc: '.text',
preloadImages: true
};
$('.blocklist').each(function() {
var $blocklist = $(this),
$items = $blocklist.find('.item-outer'),
$list = $blocklist.find('.list'),
$body = $blocklist.find('.body'),
$controls = $blocklist.find('.controls'),
$pagers = $blocklist.find('.bx-pager-wrap'),
//$auto_controls = $blocklist.find('.auto_controls'),
options = {},
count,
col_arr, pager_arr, controls_arr,
bxslider,
auto_controls_arr,
containerWidth,
isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
media_type,
//id = $blocklist.attr('data-layer_id') ? $blocklist.attr('data-layer_id') : $blocklist.attr('item_id'),
slider_arr = $blocklist.attr('data-slider').split(","),
swipe_arr = $blocklist.attr('data-swipe').split(",");
// Equal height
var equalizerSelector = $blocklist.attr('data-setting-vertical_aligner'),
isItemFlex;
function columnConform() {
var rowDivs = [],
currentTallest = 0,
currentRowStart = 0;
isItemFlex = $items.find('.item').css('display') == 'flex';
$items.each(function(index) {
// Refresh
$(this).find(equalizerSelector).css('min-height', '');
$(this).find(equalizerSelector).css('margin-top', '');
var $itemOuter = $(this),
$item = $itemOuter.find('.item'),
itemHeight = sumChildrenHeight($item);
$item.data("originalHeight", itemHeight);
if (currentRowStart != $itemOuter.position().top) {
if (rowDivs.length > 1) {
for (var currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
setConformingHeight(rowDivs[currentDiv], currentTallest);
}
}
// set the variables for the new row
rowDivs = [];
currentRowStart = $itemOuter.position().top;
currentTallest = itemHeight;
rowDivs.push($item);
} else {
rowDivs.push($item);
currentTallest = (currentTallest < itemHeight) ? (itemHeight) : (currentTallest);
}
});
// do the last row
if (rowDivs.length > 1) {
for (var currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
setConformingHeight(rowDivs[currentDiv], currentTallest);
}
}
}
function setConformingHeight(el, newHeight) {
var $equalizer = el.find(equalizerSelector);
if (!$equalizer.length) return;
var $beforeEqualizer = $equalizer.prev(),
elHeight = (el.data("originalHeight") == undefined) ? (sumChildrenHeight(el)) : (el.data("originalHeight")),
differHeight = newHeight - elHeight;
if (differHeight == 0) return;
var equalizerMargin = parseInt(document.defaultView.getComputedStyle($equalizer[0], "").marginTop),
beforeEqualizerMargin = !isItemFlex && $beforeEqualizer.length ? parseInt(document.defaultView.getComputedStyle($beforeEqualizer[0], "").marginBottom) : 0,
newMargin = equalizerMargin>beforeEqualizerMargin ? equalizerMargin : beforeEqualizerMargin;
$equalizer.css('margin-top', differHeight+newMargin);
}
function sumChildrenHeight(el) {
var sum = 0;
el.children().each(function() {
sum += $(this).outerHeight();
});
return sum;
}
if (equalizerSelector && equalizerSelector !== "none") {
setTimeout(function () {
columnConform();
}, 0);
$win.on('resize', debounce(columnConform, 300));
}
if (slider_arr.indexOf('1')>-1 && $.fn.bxSlider) {
options.pagerSelector= $blocklist.attr('data-setting-pager_selector');
options.prevSelector = $blocklist.attr('data-setting-prev_selector');
options.nextSelector = $blocklist.attr('data-setting-next_selector');
options.prevText = $blocklist.attr('data-setting-prev_text') || '';
options.nextText = $blocklist.attr('data-setting-next_text') || '';
options.auto = !!parseInt($blocklist.attr('data-setting-auto'));
options.controls = !!parseInt($blocklist.attr('data-setting-controls'));
options.pager = !!parseInt($blocklist.attr('data-setting-pager').split(',')[0]);
options.pause = parseInt($blocklist.attr('data-setting-pause'), 10) || 4000;
options.useCSS = isMobile;
options.infiniteLoop = true;
options.adaptiveHeight = false;
options.mode = $blocklist.attr('data-setting-mode') || 'horizontal';
options.touchEnabled = options.mode === 'horizontal';
options.slideMargin = 0;
options.maxSlides = parseInt($blocklist.attr('data-setting-count').split(',')[0], 10) || 1;
options.minSlides = options.mode === 'horizontal' ? 1 : options.maxSlides;
options.moveSlides = $blocklist.attr('data-setting-move') || 0;
options.autoControlsSelector = $blocklist.attr('data-setting-auto_controls_selector');
options.autoControls = !!parseInt($blocklist.attr('data-setting-auto_controls').split(',')[0]);
options.autoControlsCombine = !!parseInt($blocklist.attr('data-setting-autoControlsCombine'));
options.autoHover = true;
col_arr = $blocklist.attr('data-setting-columns').split(",");
pager_arr = $blocklist.attr('data-setting-pager').split(",");
controls_arr = $blocklist.attr('data-setting-controls').split(",");
auto_controls_arr = $blocklist.attr('data-setting-auto_controls').split(",");
if (!options.autoControls && options.auto) {
options.onSlideAfter = function() {
bxslider.startAuto();
}
}
$items.removeClass('hidden');
if ($list.parent().hasClass('bx-viewport')) {
$list.unwrap();
$list.unwrap();
}
function init(force) {
var setting_columns,
isJustify, space_between,
body_width = $('body').width(),
mediaList = ["screen", "tablet_landscape", "tablet_portrait", "mobile_landscape", "mobile_portrait"],
slider_arr = $blocklist.attr('data-slider').split(",");
if (body_width >= 961) {
media_type = "screen";
} else if (body_width <= 960 && body_width >= 769) {
media_type = "tablet_landscape";
} else if (body_width <= 768 && body_width >= 641) {
media_type = "tablet_portrait";
} else if (body_width <= 640 && body_width >= 481) {
media_type = "mobile_landscape";
} else if (body_width <= 480) {
media_type = "mobile_portrait";
}
var media_ind = mediaList.indexOf(media_type);
var newContainerWidth = $blocklist.width(), itemHeight, viewportHeight;
if (!$blocklist.is(':visible')) {
if (bxslider) {
bxslider.destroySlider();
}
return;
}
if (force!=='force' && containerWidth && containerWidth === newContainerWidth) {
return;
}
containerWidth = newContainerWidth;
if (bxslider) {
bxslider.destroySlider();
}
count = parseInt($blocklist.attr('data-setting-count').split(',')[media_ind], 10);
isJustify = $body.css('justify-content') === "space-between";
$controls.css("pointer-events","none");
$controls.find('.prev').css("pointer-events","auto");
$controls.find('.next').css("pointer-events","auto");
$list.width('auto');
$items
.attr('style', '')
.slice(1).addClass('hidden').end()
.width(options.slideWidth = $items.width())
.removeClass('hidden');
if (pager_arr.length > 1) {
options.pager = !!parseInt(pager_arr[media_ind]);
}
if (controls_arr.length > 1) {
options.controls = !!parseInt(controls_arr[media_ind]);
}
if (auto_controls_arr.length > 1) {
options.autoControls = !!parseInt(auto_controls_arr[media_ind]);
}
$(options.pagerSelector).css({"display": options.pager == true ? "flex" : "none"});
$blocklist.find(".controls").css({"display": options.controls == true ? "flex" : "none"});
if (options.mode === 'vertical') {
itemHeight = Math.max.apply(Math, $items.map(function() {
return $(this).height()
}).get());
$items.css('min-height', itemHeight);
viewportHeight = itemHeight * count;
options.maxSlides = options.minSlides = count;
} else {
setting_columns = col_arr[media_ind] == "auto" ? false : parseInt(col_arr[media_ind]);
if (setting_columns) {
count = setting_columns;
}
options.maxSlides = Math.min(count, Math.ceil($items.parent().width() / $items.width()));
}
if (isJustify) {
if (options.maxSlides > 1) {
space_between = Math.floor(($body.width() - $items.width() * options.maxSlides)/ (options.maxSlides-1));
space_between = space_between < 0 ? 0 : space_between;
} else {
space_between = 0;
}
options.slideMargin = space_between;
}
if ($items.length > options.maxSlides && slider_arr[media_ind] == 1) {
$list.css({'justify-content': 'flex-start'});
if (bxslider) {
bxslider.reloadSlider(options);
} else {
$list.data('bxslider', (bxslider = $list.bxSlider(options)));
}
if(options.pager){
$pagers.css('display', 'flex');
}
} else {
if(swipe_arr[media_ind]!=1){
$list.css({'justify-content': isJustify ? 'space-between' : 'inherit', 'flex-wrap': 'wrap'});
if($list.width()/count < $items.width()) {
$items.css('width', $items.width()-1);
} else {
$items.css('width', $items.width());
}
} else {
$list.css({'flex-wrap': 'nowrap'});
}
$pagers.hide();
$controls.hide();
}
/*if (parseInt(slider_arr[media_ind]) === 0 || parseInt(swipe_arr[media_ind]) === 0) {
$items.css('width', '');
}*/
if (viewportHeight && slider_arr[media_ind] == 1) {
$list.parent().css('min-height', viewportHeight);
}
if (options.mode === 'horizontal') {
var align = {};
switch ($body.css('justify-content')) {
case 'flex-end':
align['margin-left'] = 'auto';
align['margin-right'] = '0px';
break;
case 'center':
align['margin-left'] = 'auto';
align['margin-right'] = 'auto';
break;
default:
align['margin-left'] = '0px';
align['margin-right'] = 'auto';
}
$blocklist.find('.bx-wrapper').css(align);
}
$blocklist.wm_img_convert();
}
$win.on('resize', debounce(init, 300));
$win.on('load', function(){
init('force');
$win.trigger('resize');
});
init();
} else {
$pagers.hide();
$controls.hide();
}
$win.on('resize', debounce(swipeScrollInit, 300));
swipeScrollInit();
function swipeScrollInit() {
var $shadowLeft = $blocklist.find(".swipe-shadow-left");
var $shadowRight = $blocklist.find(".swipe-shadow-right");
if ($list.css("overflow-x") == "auto") {
var scroll_width = $list.get(0).scrollWidth;
var view_width = $list.width();
$shadowLeft.css("pointer-events","none");
$shadowRight.css("pointer-events","none");
$list.off('scroll');
$list.on('scroll', throttle(swipeScrollCheack, 200));
swipeScrollCheack();
function swipeScrollCheack() {
var scroll_left = $list.scrollLeft();
if (scroll_left > 0) {
$shadowLeft.show();
} else {
$shadowLeft.hide();
}
if (scroll_left + view_width >= scroll_width - 1) {
$shadowRight.hide();
} else {
$shadowRight.show();
}
}
} else {
$shadowLeft.hide();
$shadowRight.hide();
}
}
if($blocklist.attr('data_photo_swipe') == 1){
//$('.pswp').appendTo('body');
initPhotoSwipeFunc(psSettings);
$win.on('resize', function() {
initPhotoSwipeFunc(psSettings);
});
}
$(document).on('click', '.shop2-product-btn2', function(e) {
var $this = $(this),
$form = $this.closest('form'),
form = $form.get(0),
adds = $form.find('.additional-cart-params'),
len = adds.length,
i, el,
a4 = form.amount.value,
kind_id = form.kind_id.value;
e.preventDefault();
if (len) {
a4 = {
amount: a4
};
for (i = 0; i < len; i += 1) {
el = adds[i];
if (el.value) {
a4[el.name] = el.value;
}
}
}
shop2.cart.add(kind_id, a4, function(d) {
$('#shop2-cart-preview').replaceWith(d.data);
if (d.errstr) {
shop2.msg(d.errstr, $this);
} else {
shop2.msg(window._s3Lang.JS_ADDED, $this);
}
if (d.panel) {
$('#shop2-panel').replaceWith(d.panel);
}
});
});
});
var blockListBody = document.querySelectorAll('.blocklist .body-outer');
s3ContentColumns(blockListBody, {
body: '.list',
items: '.item-outer'
});
});
// s3ContentColumns v1.0.0
(function(window, document, undefined) {
var vendors = ['ms', 'moz', 'webkit', 'o'], vendorsLength = 4;
var docElem = document.documentElement;
var winWidth = window.innerWidth || docElem.clientWidth || document.body.clientWidth;
var classListFlag = ('classList' in docElem);
var defaults = {
body: false,
items: 'random',
columns: '0,0,0,0,0',
onBeforeInit: function() {},
onAfterInit: function() {}
};
var elementMethods = {
sHasClass: function(classN) {
var elem = this;
if (classListFlag) {
return elem.classList.contains(classN);
} else {
return elem.className && new RegExp('\\b' + classN + '\\b').test(elem.className);
}
},
sAddClass: function(classes) {
var elem = this, classArr = classes.split(/\s/g), classLength = classArr.length, clInd;
if (classListFlag) {
for (clInd = 0; clInd < classLength; clInd++) {elem.classList.add(classArr[clInd]);}
} else {
for (clInd = 0; clInd < classLength; clInd++) {
if (!elem.sHasClass(classArr[clInd])) {elem.className += ' ' + classArr[clInd];}
}
}
return elem;
},
sRemoveClass: function(classes) {
var elem = this, classArr = classes.split(/\s/g), classLength = classArr.length, clInd;
if (classListFlag) {
for (clInd = 0; clInd < classLength; clInd++) {elem.classList.remove(classArr[clInd]);}
} else {
var reg;
for (clInd = 0; clInd < classLength; clInd++) {
reg = new RegExp('\\b' + classArr[clInd] + '\\b', 'g');
elem.className = elem.className.replace(reg, ' ').replace(/^\s\s*|\s\s*$/, '');
}
}
return elem;
},
sCSS: function(property, value) {
var elem = this, css3Reg = new RegExp('perspective|transform|box-sizing|user-select', 'g');
function cssPrefix(prop) {
if (prop.match(css3Reg) && !(prop in elem.style)) {
for (var v = 0; v < vendorsLength; v++) {
if ('-'+vendors[v]+'-'+prop in elem.style) {
prop = '-'+vendors[v]+'-'+prop;
break;
}
}
}
return prop;
}
if (typeof property === 'string' && value !== undefined) {
elem.style[cssPrefix(property)] = value;
} else if (typeof property === 'string' && value === undefined) {
return getComputedStyle(elem)[property];
} else if (typeof property === 'object') {
for (var cssProp in property) {
if (property.hasOwnProperty(cssProp)) {
elem.style[cssPrefix(cssProp)] = property[cssProp];
}
}
}
return elem;
},
sDataset: function(){
var elem = this, tempData = {};
function setValue(val) {
var num = parseInt(val), nanVal = NaN;
if (val === 'false') {
return false;
} else if (val === 'true') {
return true;
} else if (!(/\D/.test(val)) && typeof num === 'number' && num !== nanVal) {
return num;
} else {
return val;
}
}
if (elem.dataset) {
for (var propName in elem.dataset) {
if (!elem.dataset.hasOwnProperty(propName)) {continue;}
tempData[propName] = setValue(elem.dataset[propName]);
}
} else {
var elAttr = elem.attributes, attrLen = elAttr.length;
for (var ati = 0; ati < attrLen; ati++) {
if (/data-/.test(elAttr[ati].name) === false) {continue;}
var dOpt = elAttr[ati].name.replace(/data-|-\w/gi, function(str) {
if (str === 'data-') {return '';}
return str.replace('-', '').toUpperCase();
});
tempData[dOpt] = setValue(elAttr[ati].value);
}
}
return tempData;
},
sClosest: function(fn) {
var elem = this, prnt = elem.parentNode;
return elem && (fn(elem) ? elem : ('sClosest' in prnt ? prnt.sClosest(fn) : prnt));
}
};
for (var method in elementMethods) {
if (elementMethods.hasOwnProperty(method) && !Element.prototype[method]) {
Object.defineProperty(Element.prototype, method, {
enumerable: false,
value: elementMethods[method]
});
}
}
var pluginObj = {
getDOMEl: function(selector) {
if (selector && typeof(selector) === 'string' && /[.\-]\b/g.test(selector)) {
return document.querySelector(selector);
} else if (selector && typeof(selector) === 'object' && selector.tagName) {
return selector;
} else {
return false;
}
},
extend: function(out) {
out = out || {};
var i = 1, argLen = arguments.length;
for (; i < argLen; i++) {
if (!arguments[i]) {continue;}
for (var key in arguments[i]) {
if (arguments[i].hasOwnProperty(key)) {out[key] = arguments[i][key];}
}
}
return out;
},
getMedia: function() {
var mediaType = 'screen', mediaIndex = 0;
if (window.matchMedia('all and (max-width: 480px)').matches) {
mediaType = 'mobile_portrait';
mediaIndex = 4;
} else if (window.matchMedia('all and (max-width: 640px)').matches) {
mediaType = 'mobile_landscape';
mediaIndex = 3;
} else if (window.matchMedia('all and (max-width: 768px)').matches) {
mediaType = 'tablet_portrait';
mediaIndex = 2;
} else if (window.matchMedia('all and (max-width: 960px)').matches) {
mediaType = 'tablet_landscape';
mediaIndex = 1;
}
return [mediaIndex, mediaType];
},
getArray: function(arg) {
var arr = [], len, ind, tempArr = [];
function setValue(val) {
var num = parseInt(val), nanVal = NaN;
if (val === 'false') {
return false;
} else if (val === 'true') {
return true;
} else if (!(/\D/.test(val)) && typeof num === 'number' && num !== nanVal) {
return num;
} else {
return val;
}
}
if (typeof arg === 'string') {
arr = arg.split(',');
}
len = arr.length;
for (ind = 0; ind < len; ind++) {
tempArr.push(setValue(arr[ind]));
}
return tempArr;
},
createColumnsTable: function(wrap) {
var data = wrap.dataColumns, index;
data.options.onBeforeInit(wrap, data);
var columnsAmount = data.columnsArr[data.media[0]];
var columnsTable = wrap.querySelector('.columns-table');
if (columnsTable) {
var itemsTable = data.items[0].sClosest(function(elem){return elem.sHasClass('columns-table');});
if (itemsTable && itemsTable.sHasClass('columns-table')) {
for (index = 0; index < data.itemsAmount; index++) {
data.body.appendChild(data.items[index]);
}
}
if (columnsAmount) {
columnsTable.innerHTML = '';
} else {
data.body.removeChild(columnsTable);
}
} else {
if (columnsAmount) {
columnsTable = document.createElement('div').sAddClass('columns-table');
data.body.appendChild(columnsTable);
}
}
if (columnsAmount) {
var cellStr = '';
if (data.itemsAmount < columnsAmount) {
columnsAmount = data.itemsAmount;
}
for (index = 0; index < columnsAmount; index++) {
cellStr += '';
}
columnsTable.innerHTML = cellStr;
var columnsCells = wrap.querySelectorAll('.columns-cell');
if (columnsAmount === 1) {
for (index = 0; index < data.itemsAmount; index++) {
columnsCells[0].appendChild(data.items[index]);
}
} else {
var cellWidth = columnsCells[0].clientWidth || parseFloat(columnsCells[0].sCSS('width'));
data.body.sCSS('width', cellWidth + 'px');
var totalHeight = data.body.offsetHeight;
var avgColumn = Math.ceil(totalHeight / columnsAmount);
var heightCounter = 0;
var columnArrInd = 0;
var remColumn, remItems, newAvgColumn;
var currItem, currHeight, nextItem, nextHeight;
for (var itemInd = 0; itemInd < data.itemsAmount; itemInd++) {
currItem = data.items[itemInd];
if (currItem === undefined || currItem.sHasClass('columns-table')) {continue;}
currHeight = currItem.offsetHeight;
nextItem = data.items[itemInd + 1];
nextHeight = 0;
if (nextItem) {
nextHeight = nextItem.offsetHeight;
}
if (columnArrInd >= columnsAmount) {
columnArrInd = columnsAmount - 1;
}
columnsCells[columnArrInd].appendChild(currItem);
totalHeight -= currHeight;
heightCounter += currHeight;
if (totalHeight) {
remColumn = columnsAmount - (columnArrInd + 1);
remItems = data.itemsAmount - (itemInd + 1);
newAvgColumn = totalHeight / remColumn;
var surplus = newAvgColumn - heightCounter;
var testA = remItems <= remColumn;
var testB = nextHeight >= newAvgColumn;
var testC = surplus <= nextHeight/2;
var testD = avgColumn >= newAvgColumn && heightCounter >= newAvgColumn;
if (testA || testB || testC || testD) {
heightCounter = 0;
columnArrInd++;
}
}
}
data.body.sCSS('width', '');
}
}
data.options.onAfterInit(wrap, data);
}
};
var pluginMethods = {
init: function(element, params) {
var wrap = pluginObj.getDOMEl(element);
if (!wrap) {return false;}
var data = wrap.dataColumns, body, items, itemsAmount;
if (wrap && typeof(params) === 'string') {
if (data && data.status === 'inited') {
return false;
} else if (data && data.options) {
params = pluginObj.extend({}, data.options);
}
}
if (wrap && typeof(params) !== 'string') {
var options = pluginObj.extend({}, defaults, params, wrap.sDataset());
body = wrap.querySelector(options.body) || wrap;
items = wrap.querySelectorAll(options.items);
if (items && !items.length) {
items = [];
var contentNodes = body.childNodes;
var nodesLength = contentNodes.length;
var tempTag, key, tempArr = [];
for (key = 0; key < nodesLength; key++) {
if (!contentNodes[key].tagName && contentNodes[key].nodeValue && /[\wа-яё]+/gi.test(contentNodes[key].nodeValue)) {
tempTag = document.createElement('span');
tempTag.innerHTML = contentNodes[key].nodeValue.replace(/^\s+|\s+$/g, '');
tempArr.push([contentNodes[key], tempTag]);
}
}
nodesLength = tempArr.length;
for (key = 0; key < nodesLength; key++) {
body.insertBefore(tempArr[key][1], tempArr[key][0].nextSibling);
tempArr[key][0].nodeValue = '';
}
nodesLength = body.children.length;
for (key = 0; key < nodesLength; key++) {
items.push(body.children[key]);
}
}
itemsAmount = items.length;
data = wrap.dataColumns = {
options: options,
status: 'inited',
media: pluginObj.getMedia(),
body: body,
items: items,
itemsAmount: itemsAmount,
columnsArr: pluginObj.getArray(options.columns),
handlers: {
resizeWindow: function() {
var newWinWidth = window.innerWidth || docElem.clientWidth || document.body.clientWidth;
if (newWinWidth !== winWidth) {
var newMedia = pluginObj.getMedia();
if (newMedia[1] !== data.media[1]) {
data.media = newMedia;
pluginObj.createColumnsTable(wrap);
}
}
}
}
};
var contentImages = wrap.querySelectorAll('img');
var imagesLength = contentImages.length, hasSVG = false;
if (imagesLength) {
var imagesLoadCounter = 0, currentImg, curSrc;
for (var imgInd = 0; imgInd < imagesLength; imgInd++) {
currentImg = contentImages[imgInd];
if (/image\/svg\+xml|\.svg$/g.test(currentImg.getAttribute('src'))) {
hasSVG = true;
break;
}
if (currentImg.complete || currentImg.complete === undefined){
curSrc = currentImg.src + '?imgsrc=' + (new Date()).getTime();
currentImg.src = curSrc;
}
currentImg.addEventListener('load', function() {
imagesLoadCounter++;
if (imagesLoadCounter === imagesLength) {
initPlugin();
}
});
}
if (hasSVG) {
initPlugin();
}
} else {
initPlugin();
}
}
function initPlugin() {
if (items && itemsAmount) {
pluginObj.createColumnsTable(wrap);
window.addEventListener('resize', data.handlers.resizeWindow);
}
}
return wrap;
}
};
function s3ContentColumnsPlugin(element, method) {
if (!element) {return false;}
if (pluginMethods[method]) {
return pluginMethods[method].apply(this, arguments);
} else if (typeof method === 'object' || !method) {
if (pluginObj.getDOMEl(element)) {
return pluginMethods.init.apply(this, arguments);
} else if (element.length) {
var elementsLen = element.length;
for (var argInd = 0; argInd < elementsLen; argInd++) {
pluginMethods.init(element[argInd], method);
}
}
} else {
return console.error('Метод ' + method + ' не найден в плагине s3ContentColumns');
}
}
if (!window.s3ContentColumns) {
window.s3ContentColumns = s3ContentColumnsPlugin;
}
}(window, document));
/*
* wmS3Menu v1.0.0
* K.I. 433
*/
;(function ($, window, document, undefined ) {
var pluginName = 'wmS3Menu',
defaults = {
screenButton: false,
responsiveTl: false,
responsiveTp: false,
responsiveMl: false,
moreText: '...',
childIcons: false,
childIconsClass: 'has-child-icon'
};
// Проверка на касание
var isTouchable = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
var $win = $(window);
var winWidth = $win.width();
var $doc = $(document);
var pluginObj = {
_events: {
hover: function(menuWrap, item, settings){
var link = item.find('> a');
var linkIcon = link.find('.' + settings.childIconsClass);
var iconLen = linkIcon.length;
var subMenu = item.find('> ul');
var showTimeout;
// Отображение
function menuShow() {
clearTimeout(showTimeout);
item.siblings().find('> ul').css('display', '');
// Определение положения выпадашки чтобы не выводилось за пределы окна
pluginObj._menuPosition(subMenu);
link.addClass('hover');
if (iconLen) {
linkIcon.addClass('hover');
}
}
// Скрытие
function menuHide() {
showTimeout = setTimeout(function(){
link.removeClass('hover');
subMenu.css('display', '');
if (iconLen) {
linkIcon.removeClass('hover');
}
}, 500);
}
// Отключение и подключение событий
item.off({
'mouseenter.wmS3Menu': menuShow,
'mouseleave.wmS3Menu': menuHide
});
item.on({
'mouseenter.wmS3Menu': menuShow,
'mouseleave.wmS3Menu': menuHide
});
},
click: function(menuWrap, item, settings){
var link = item.find('> a');
var linkIcon = link.find('.' + settings.childIconsClass);
var iconLen = linkIcon.length;
var subMenu = item.find('> ul');
// Переключение отображения
function menuToggle() {
if (subMenu.is(':visible')) {
if (isTouchable) {
document.location = link.attr('href');
}
link.removeClass('hover');
subMenu.css('display', '');
item.removeClass('submenu-opened');
if (iconLen) {
linkIcon.removeClass('hover');
}
} else {
item.siblings().find('> ul').css('display', '');
item.siblings().find('> a').removeClass('hover');
item.siblings().find('> a .' + settings.childIconsClass).removeClass('hover');
// Определение положения выпадашки чтобы не выводилось за пределы окна
pluginObj._menuPosition(subMenu);
link.addClass('hover');
item.addClass('submenu-opened');
if (iconLen) {
linkIcon.addClass('hover');
}
}
return false;
}
// Отключение и подключение событий
link.off('click.wmS3Menu');
link.on('click.wmS3Menu', menuToggle);
},
click_tree: function(menuWrap, item, settings){
var link = item.find('> a');
var linkIcon = link.find('.' + settings.childIconsClass);
var subMenu = item.find('> ul');
// Переключение отображения
function menuToggle(event) {
var targ = $(event.target);
if (targ.closest(linkIcon).length) {
if (subMenu.is(':visible')) {
link.removeClass('hover');
subMenu.css('display', '');
item.removeClass('submenu-opened');
linkIcon.removeClass('hover');
} else {
// Определение положения выпадашки чтобы не выводилось за пределы окна
pluginObj._menuPosition(subMenu);
link.addClass('hover');
item.addClass('submenu-opened');
linkIcon.addClass('hover');
}
return false;
}
}
// Отключение и подключение событий
link.off('click.wmS3Menu');
link.on('click.wmS3Menu', menuToggle);
}
},
_menuPosition: function(subMenu) {
// Определение положения выпадашки чтобы не выводилось за пределы окна
winWidth = $win.width();
subMenu.css('display', 'block');
if (subMenu.parent().hasClass('first-level') === false) {
subMenu.css({
'visibility': 'hidden',
'opacity': 0
});
var menuRect = subMenu[0].getBoundingClientRect();
var marginR = parseInt(subMenu.css('margin-right'));
var parentWidth = subMenu.parent().width();
if (marginR > parentWidth) {
subMenu.css('margin-right', parentWidth);
}
if (menuRect.right >= winWidth) {
subMenu.css({
'left': '-100%',
'margin-left': 0
});
}
subMenu.css({
'visibility': '',
'opacity': ''
});
}
}
};
function Plugin(element, options) {
this.element = element;
this.options = $.extend({}, defaults, options, $(this.element).data()) ;
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Plugin.prototype = {
init: function () {
var settings = this.options;
// Определение ширины медиа
var moreButFlag = false;
if (window.matchMedia('all and (max-width: 640px)').matches) {
moreButFlag = settings.responsiveMl;
} else if (window.matchMedia('all and (max-width: 768px)').matches) {
//moreButFlag = settings.responsiveTp;
} else if (window.matchMedia('all and (max-width: 960px)').matches) {
moreButFlag = settings.responsiveTl;
} else {
moreButFlag = settings.screenButton;
}
// Обертка меню
var menuWrap = $(this.element);
var menuClass = menuWrap.attr('class');
var menuMainUl = $(this.element.querySelector('ul'));
var widgetClass = menuClass.match(/widget-\d+/)[0];
// Проверка на наличие меню в Side panel
if (window.side_panel_controller && side_panel_controller.inPanel(widgetClass)) {
moreButFlag = false;
}
menuMainUl.children().addClass('first-level');
// Настройки для горизонтального меню
if (!!menuClass.match(/horizontal/i)) {
var menuWidth = menuMainUl.width();
var itemsWidth = 0, hideArr = [], hideLength;
// Кнопка More
var moreBut = menuMainUl.find('.more-button');
if (!moreBut.length) {
moreBut = $('