$(document).ready(function () {
if ($('.main-header .FH').length){
// FASHION DEPTH ==========
var fullMenu = '';
$('ul.base-menu li.ifDrop').each(function(){
fullMenu = fullMenu + '
';
});
$('.nav-menu.base-menu').addClass('container-h');
$('ul.base-menu li.all-product-button').remove();
$('ul.base-menu').prepend(fullMenu);
$('ul.base-menu li > a > i').removeClass('fa-angle-right');
$('ul.base-menu li > a > i').addClass('fa-angle-down');
$('ul.base-menu ul.drop-list').each(function(){
if(!$(this).parent('div.menu-dd').length){
$('').insertBefore($(this));
}
})
$('div.menu-dd').each(function(){
var image = $(this).next('ul.drop-list').find('li.image').html();
var slider = $(this).next('ul.drop-list').find('li.slider-menu').html();
$(this).next('ul.drop-list').find('li.image').remove();
$(this).next('ul.drop-list').find('li.slider-menu').remove();
var subcat = $(this).next('ul.drop-list').html();
if(subcat != undefined){
var w = $(this).next('ul.drop-list').hasClass('w60') ? 'w60' : 'w100';
$(this).next('ul.drop-list').remove();
$(this).append('');
if ( $(image).length ) {
$(this).append(''+image+'
');
}
if ( $(slider).length ) {
$(this).append('');
}
}
});
// BASE MENU ==========
$('ul.base-menu').show();
};
// 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'});
}
})
// FASHION MENU ==========
function Menu(){
$('.menu-dd').each(function() {
var $this = $(this);
var Nli = $this.find('li').length;
var Nlink = $this.find('a').length;
var Ncol = Math.ceil(Nlink / 15);
var Mbanner = $this.find('.cat-img').length;
Ncol = Ncol == 0 ? 1 : Ncol;
col = Nli > Ncol ? Ncol : Nli;
col = (col + (Mbanner ? 1 : 0) > 4) ? 4 : col;
$this.addClass('column' + col);
if (Mbanner){$this.addClass('banner');};
if ($this.find('li span > a').length == 0){
$this.addClass('no-sub');
};
if ($this.hasClass('column4')){
$this.parent().addClass('initial-h');
};
});
};
Menu();
$('.main-header .menu-drop').hover(function() {
$('.main-header .menu-drop .menu-dd').removeClass('open');
$(this).children('.menu-dd').stop().addClass('open');
if ( $('.slide-item-menu').length ) {
$('.slide-item-menu').owlCarousel({items:1,navigation:!0,pagination:!1});
// get owl element
var owl = $('.slide-item-menu');
// get owl instance from element
var owlInstance = owl.data('owlCarousel');
// if instance is existing
if(owlInstance != null)
owlInstance.reinit();
};
},function() {
$('.main-header .menu-drop .menu-dd').removeClass('open');
});
$(document).on('click', '.search-m', function() {
$('.search-toggle').toggleClass('visible');
$('.main-header').toggleClass('search-active');
});
$('.search-form-box.search-toggle').prepend('');
$(document).on('click', '.search-modal', function(event) {
event.preventDefault();
$('.main-header .acount-section .search-m').click();
$('#_autocompleteSearchMobileToggle').val('');
});
});
/**
* Scrie aici codul tau Javascript...
*/
$("#_autocompleteSearchMobileToggle").attr("placeholder", "Caută aici mărimea, modelul sau brandul preferat");
g_js(function() {
$("img").bind("cut copy", function(e) {
e.preventDefault();
});
$('body').on('contextmenu', 'img', function(e){ return false; });
});
$(document).ready(function(){
$("h2.resp-accordion:has(.__productReviewCount)").each(function(){
var $h2 = $(this);
var $h3 = $("").html($h2.html());
$.each($h2.prop("attributes"), function() {
$h3.attr(this.name, this.value);
});
$h2.replaceWith($h3);
});
$(".resp-accordion.tab-grup:contains('Descriere')").each(function() {
var originalText = $(this).text();
var newText = originalText.replace("Descriere", $('#product-page h1.title span').text() + " - Descriere");
$(this).html($(this).html().replace(originalText, newText));
});
$(".resp-accordion.tab-grup:contains('Review-uri')").each(function() {
$(this).contents().filter(function() {
return this.nodeType === 3 && $(this).text().trim() === "Review-uri"; // Select only the text node containing "Review-uri"
}).replaceWith($('#product-page h1.title span').text() + " - Review-uri"); // Replace the text content directly
});
$('h3.resp-accordion').click(function(){
if($(this).hasClass('open')){
$(this).removeClass('open');
$(this).siblings('.-g-product-review-box').slideUp();
} else {
$(this).addClass('open');
$(this).siblings('.-g-product-review-box').slideDown();
}
});
});