$(document).ready(function () {
if ($('.main-header .FH').length){
// BASE MENU
$('ul.base-menu').show();
};
// LEVEL DEPTH FOR MOBILE
if($(window).width() < 1090) {
var fullMenu = '';
$('ul.base-menu li.ifDrop').each(function(){
fullMenu = fullMenu + '
'+$(this).html()+'';
});
$('ul.base-menu li.all-product-button').remove();
$('.nav-menu.base-menu').prepend(fullMenu);
}
// FIXED HEADER
function fixNav(){
if (!$('.cart-menu').length && !$('.-g-template-black-friday').length){
var nav = $('.main-header');
var pos = nav.height();
var posDelay = nav.height()*2;
var prevScroll = 0;
nav.addClass('fix-nav');
$(window).scroll(function () {
var fix = ($(this).scrollTop() > posDelay) ? true : false;
if(fix){
nav.addClass('fade-menu', fix);
setTimeout(function() {
nav.addClass('animate-menu');
}, 250);
$('body').css('margin-top', pos);
if($(this).scrollTop() > prevScroll){
nav.removeClass('active-menu');
}else{
nav.addClass('active-menu');
}
}else{
$('body').css('margin-top', 0);
nav.removeClass('fade-menu active-menu animate-menu', fix);
}
prevScroll = $(this).scrollTop();
});
}
}
$.Gomag.bind('Widget/Add/After', function(){
fixNav();
// BF SIDEBAR + MENU STICKY
if($('.-g-template-black-friday').length){
$('.main-header').css({'top' : '-' + ($('.discount-tape').height() + $('.top-head-bg').height()) + 'px'});
}
if($( window ).width() > 991 && $('.-g-template-black-friday').length){
$('.landing-h .side-menu.fixed').css({'top' : $('#navigation').outerHeight() + 20 + 'px'});
}
})
// ITC MENU ==========
function buildMenu(){
$('.main-header .__ignoreSubmenu').each(function() {
var $this = $(this);
if ($this.find('li').length > 20){
$this.addClass('col3');
}else if ($this.find('li').length >= 11){
$this.addClass('col2');
}else if ($this.find('li').length < 10){
$this.addClass('col1');
}else{}
});
};
buildMenu();
$('.main-header .menu-drop').hover(function() {
$(this).find('.menu-dd').addClass('visible');
if ( $('.slide-item-menu').length ) {
$('.slide-item-menu').owlCarousel({items:1,navigation:!0,pagination:!1});
var owl = $('.slide-item-menu'); // get owl element
var owlInstance = owl.data('owlCarousel'); // get owl instance from element
if(owlInstance != null) // if instance is existing
owlInstance.reinit();
$.Gomag.eqProductRow();
};
}, function(){
$(this).find('.menu-dd').removeClass('visible');
});
$('.main-header ul.nav-menu li.ifDrop').has('ul.drop-list').addClass('drop-parent');
$('.main-header .drop-parent').hover(function() {
$(this).find('.drop-list').addClass('visible');
$(this).find('.drop-list').show();
var itemNumber = $(this).find('.col').length,
itemWidth = $(this).find('.col').outerWidth(),
elemCount = $(this).find('.drop-list li a').length,
imgCount = $(this).find('.drop-list .image').length;
if(elemCount < 10 && imgCount == 0){
$('.menu-dd').css({"padding-right" : "0px", "width" : itemWidth + 258 + "px"});
}
else{
$('.menu-dd').css({"padding-right" : "0px", "width" : itemNumber * itemWidth + 258 + "px"});
}
},function() {
$(this).find('.drop-list').removeClass('visible');
$(this).find('.drop-list').hide();
$('.menu-dd').css({"width" : 255 + "px"});
})
});
/**
* Scrie aici codul tau Javascript...
*/
/* GOMK-43185 */
if($(window).width() > 768){
$('.detail-recomended').appendTo('.product-bottom .row');
}
/* casaidea JS (22 OCT 2022) */
function menuUpdate(){
if($('.drop-list li .col .title .title').length){
$('.drop-list li .col .title .title').each(function(){
if(!$(this).hasClass('cls-mainMenuD-updated')){
if(
$(this).find('.category-icon').length > 0 &&
$(this).find('.list').length < 1
){
var storeImg = $(this).find('.category-icon');
$(this).find('.category-icon').remove();
$(this).html(''+$(this).html()+'');
$(storeImg).prependTo($(this));
}
$(this).addClass('cls-mainMenuD-updated')
}
})
}
}
menuUpdate();
$(document).ready(function() {
if($('#product-page').find('#productQuantity').length && $('#product-page').find('.add-section').length)
{
var pq = $('#product-page').find('#productQuantity').val();
pq = parseFloat(pq);
if(pq == 2)
{
$('#product-page').find('.add-section').append('Ultimele doua produse in stoc');
}
else if(pq == 1)
{
$('#product-page').find('.add-section').append('Ultimul produs in stoc');
}
}
if($('#product-page').find('.pre-order').length)
{
$($('#product-page').find('.pre-order').html('In stoc furnizor'));
}
if($('#product-page').find('.stock-status').length && $('#product-page').find('.__shippingDeliveryTime'))
{
var html = $('#product-page').find('.stock-status')[0].outerHTML;
$('#product-page').find('.stock-status').remove();
$('#product-page').find('.__shippingDeliveryTime').after(html);
}
$('.main-header .drop-list li.image').parent().addClass('banner-type');
if ($(window).width()< 991) {
$('.product-box .-g-product-list-image-carousel').removeClass('-g-product-list-image-carousel');
}
// FILTERS STICKY
if ($('#nav-filter').length) {
$('#nav-filter .option-group').addClass('ignoreMore');
//toggle filter
$(document).on('click', '#nav-filter .filter.box .title-h', function(e){
e.preventDefault();
$(this).addClass('ignore');
$('#nav-filter .filter.box .title-h').each(function(){
if(!$(this).hasClass('ignore')){
$(this).removeClass('ttl-bg')
}
})
$(this).removeClass('ignore');
$(this).toggleClass('ttl-bg');
$(this).next().addClass('ignoreSlide');
$('#nav-filter .option-group').each(function(){
if(!$(this).hasClass('ignoreSlide')){
$(this).hide();
}
})
$(this).next().removeClass('ignoreSlide');
$(this).next().toggle();
});
$(document).mouseup(function(e) {
var container = $('#nav-filter .filter.box').not('.-g-category-filters-remove-all');
if (!container.is(e.target) && container.has(e.target).length === 0){
$(this).find('.option-group').removeClass('ignore').hide();
$(this).find('.title-h').removeClass('ttl-bg');
}
});
}
if ($(window).width() > 991 && $('#nav-filter').length) {
var filters = $('#nav-filter').removeClass('col-sm-3 col-xs-12').clone();
$('.main-header').append('');
$('.filter-sep .fh').append(filters);
/*$('#nav-filter').scrollToFixed({
marginTop: $('.catTitle').outerHeight() + 120,
limit: function() {
if($('.bottom-section').length){
var limit = $('.bottom-section').offset().top - $('#nav-filter').outerHeight(true) - 20;
}else{
var limit = $('.catDesc').offset().top - $('#nav-filter').outerHeight(true) - 20;
}
return limit;
}
});*/
};
/* for read more adjustements */
if(
jQuery('.-g-product-review-box').length > -1 &&
jQuery('.-g-product-review-box .comment-row').length > -1
){
var getTotal = jQuery('.-g-product-review-box .comment-row').length;
if(getTotal > 3){
jQuery('.-g-product-review-box .comment-row').each(function(e){
var getEach = e+1;
if(getEach > 3){
jQuery(this).css("display","none");
}
});
if(
jQuery('.-g-product-review-box .r-m-c').length < 1
){
jQuery('ยป Vezi mai multe
').insertBefore(jQuery('.-g-product-review-box .comments-form'));
}
}
}
/* on click display */
jQuery(document).on('click','.r-m-c',function(){
jQuery('.-g-product-review-box .comment-row').show();
jQuery(this).parent().remove();
});
});
//change filter holder
if ($('#nav-filter').length) {
$('#nav-filter .filter.box').not('.-g-category-filters-remove-all').each(function(){
var filterh = $(this).html();
$(this).find('.title-h, .option-group, .more-filter').remove();
$(this).prepend(''+filterh+'
');
});
if ($(window).width() > 768) {
$('.result-section .order-type').insertAfter('.filter.box:last-child');
$('.order-type').addClass('filter box');
$('.list-grid').insertAfter('.order-type');
}
}
$(window).load(function(){
});