Initial import: Carteasy Shop (Dev-Stand)

This commit is contained in:
Thomas Bartelt
2026-04-20 01:03:43 +02:00
commit d504f8a05d
3845 changed files with 761050 additions and 0 deletions
@@ -0,0 +1,124 @@
// obtain plugin
var cc = initCookieConsent();
// run plugin with your configuration
cc.run({
current_lang: 'de',
autoclear_cookies: true, // default: false
page_scripts: true, // default: false
force_consent: false, // default: false
// mode: 'opt-in' // default: 'opt-in'; value: 'opt-in' or 'opt-out'
delay: 1000, // default: 0
// auto_language: null // default: null; could also be 'browser' or 'document'
// autorun: true, // default: true
// force_consent: false, // default: false
// hide_from_bots: false, // default: false
// remove_cookie_tables: false // default: false
cookie_name: 'cc_cookie', // default: 'cc_cookie'
cookie_expiration: 365, // default: 182 (days)
// cookie_necessary_only_expiration: 182 // default: disabled
// cookie_domain: location.hostname, // default: current domain
// cookie_path: '/', // default: root
// cookie_same_site: 'Lax', // default: 'Lax'
// use_rfc_cookie: false, // default: false
revision: 0, // default: 0
onFirstAction: function(user_preferences, cookie){
// callback triggered only once
},
onAccept: function (cookie) {
// ...
},
onChange: function (cookie, changed_preferences) {
// ...
},
gui_options: {
consent_modal: {
layout: 'bar', // box/cloud/bar
position: 'bottom center', // bottom/middle/top + left/right/center
transition: 'slide', // zoom/slide
swap_buttons: false // enable to invert buttons
},
settings_modal: {
layout: 'box', // box/bar
// position: 'left', // left/right
transition: 'slide' // zoom/slide
}
},
languages: {
'de': {
consent_modal: {
title: 'Wir verwenden Cookies!',
description: 'Hallo, diese Webseite verwendet notwendige Cookies um ihre Funktionen zu gewährleisten und Tracking Cookies um zu verstehen wie wir die Nutzererfahrung verbessern können. Letztere werden nur mit ihrer Einwilligung gespeichert. <button type="button" data-cc="c-settings" class="cc-link">Lass mich auswählen</button>',
primary_btn: {
text: 'Alle akzeptieren',
role: 'accept_all' // 'accept_selected' or 'accept_all'
},
secondary_btn: {
text: 'Alle ablehnen',
role: 'accept_necessary' // 'settings' or 'accept_necessary'
}
},
settings_modal: {
title: 'Cookie Preferenzen',
save_settings_btn: 'Einstellungen Speichern',
accept_all_btn: 'Alle akzeptieren',
reject_all_btn: 'Alle ablehnen',
close_btn_label: 'Schließen',
cookie_table_headers: [
{col1: 'Name'},
{col2: 'Domain'},
{col3: 'Verfällt'},
{col4: 'Beschreibung'}
],
blocks: [
{
title: 'Cookie Nutzung 📢',
description: 'Wir verwenden Cookies, um die grundlegenden Funktionen der Website sicherzustellen und Ihr Online-Erlebnis zu verbessern. Sie können für jede Kategorie wählen, ob Sie sich an- oder abmelden möchten. Weitere Einzelheiten zu Cookies und anderen sensiblen Daten lesen Sie die vollständige <a href="#" class="cc-link">Datenschutz-Bestimmungen</a>.'
}, {
title: 'Notwendige Cookies',
description: 'Diese Cookies sind für das reibungslose funktionieren der Website unerlässlich. Ohne diese Cookies würde die Website nicht richtig funktionieren',
toggle: {
value: 'necessary',
enabled: true,
readonly: true // cookie categories with readonly=true are all treated as "necessary cookies"
}
}, {
title: 'Performance und Analytics Cookies',
description: 'Diese Cookies erlauben der Webseite das Betriebssystem, Land, Datum und Uhrzeit an dem der Nutzer auf der Seite war zu speichern. Diese Daten sind vollständig anonym und werden nur von Intelectra selbst zur erkennung von starker Abfragenlast und folglichen Verbesserungen der Nutzererfahrung.',
toggle: {
value: 'analytics', // your cookie category
enabled: false,
readonly: false
}/*,
cookie_table: [ // list of all expected cookies
{
col1: 'cc-cookie',
col2: 'intelectra-shop.de',
col3: '1 Jahr',
col4: 'erlaubt Intelectra das erstellen von anonymen Analytics',
is_regex: true
}
]*/
}, /*{
title: 'Advertisement and Targeting cookies',
description: 'These cookies collect information about how you use the website, which pages you visited and which links you clicked on. All of the data is anonymized and cannot be used to identify you',
toggle: {
value: 'targeting',
enabled: false,
readonly: false
}
},*/ {
title: 'Mehr Informationen',
description: 'Bei Fragen zu unserer Richtlinie zu Cookies und Ihren Auswahlmöglichkeiten <a class="cc-link" href="./Kontakt/">kontaktieren Sie uns.</a>.',
}
]
}
}
}
});
@@ -0,0 +1,106 @@
/* document.addEventListener("DOMContentLoaded", () => {
const container = document.getElementById("geraetezuordnung-container");
const loadingIndicator = document.getElementById("loading-indicator");
const lazyloadingUrl = "https://{$SERVER_NAME}/core/base/lazyloading.php"; // Dynamischer Pfad zur PHP-Datei
let offset = 0;
const limit = 10;
let loading = false;
let hasMoreData = true;
const articleId = document.getElementById("geraetezuordnung-container").dataset.articleId;
const loadGeraetezuordnung = async () => {
if (loading || !hasMoreData) return;
loading = true;
loadingIndicator.style.display = "block";
try {
const response = await fetch(`${lazyloadingUrl}?offset=${offset}&limit=${limit}&articleId=${articleId}`);
const result = await response.json();
result.data.forEach(item => {
const div = document.createElement("div");
div.innerHTML = `
<p><strong>${item.bezeichnungoriginal || "Unbekanntes Gerät"}</strong></p>
<p>Nummer: ${item.nr || "N/A"}</p>
`;
container.appendChild(div);
});
offset += limit;
hasMoreData = result.hasMore;
} catch (error) {
console.error("Fehler beim Laden der Gerätezuordnung:", error);
}
loading = false;
loadingIndicator.style.display = "none";
};
const observer = new IntersectionObserver(entries => {
if (entries[0].isIntersecting) {
loadGeraetezuordnung();
}
}, { threshold: 1.0 });
observer.observe(loadingIndicator);
});
*/
document.addEventListener("DOMContentLoaded", () => {
const container = document.getElementById("geraetezuordnung-container");
const loadingIndicator = document.getElementById("loading-indicator");
const lazyloadingUrl = "/web/intelectra_shop/php/lazyloading.php";
const articleId = container.dataset.articleId;
let offset = 0;
const limit = 10;
let loading = false;
let hasMoreData = true;
const loadGeraetezuordnung = async () => {
if (loading || !hasMoreData) return;
loading = true;
loadingIndicator.style.display = "block";
try {
const response = await fetch(`${lazyloadingUrl}?offset=${offset}&limit=${limit}&articleId=${articleId}`);
if (!response.ok) {
throw new Error(`HTTP-Error: ${response.status}`);
}
const result = await response.json();
result.data.forEach(item => {
const div = document.createElement("div");
div.innerHTML = `
<h4>${item.item_name} (${item.parent_wg})</h4>
<p><strong>${item.bezeichnungoriginal}</strong></p>
<p>Nummer: ${item.nr}</p>
<p>Produktionszeitraum: ${item.produktionsstart} - ${item.produktionsende}</p>
`;
container.appendChild(div);
});
offset += limit;
hasMoreData = result.hasMore;
} catch (error) {
console.error("Fehler beim Laden der Gerätezuordnung:", error);
}
loading = false;
loadingIndicator.style.display = "none";
};
// Intersection Observer für Lazy Loading
const observer = new IntersectionObserver(entries => {
if (entries[0].isIntersecting) {
loadGeraetezuordnung();
}
}, { threshold: 1.0 });
observer.observe(loadingIndicator);
});
@@ -0,0 +1,23 @@
document.addEventListener("DOMContentLoaded", function () {
let subContainer = document.querySelector(".attributes_table");
let isMouseOverSub = false;
subContainer.addEventListener("mouseenter", () => isMouseOverSub = true);
subContainer.addEventListener("mouseleave", () => isMouseOverSub = false);
subContainer.addEventListener("wheel", function (event) {
let atTop = subContainer.scrollTop === 0;
let atBottom = subContainer.scrollTop + subContainer.clientHeight >= subContainer.scrollHeight;
if ((event.deltaY < 0 && atTop) || (event.deltaY > 0 && atBottom)) {
event.preventDefault();
document.documentElement.scrollBy(0, event.deltaY);
}
}, { passive: false });
window.addEventListener("wheel", function (event) {
if (!isMouseOverSub) {
document.documentElement.scrollBy(0, event.deltaY);
}
});
});
@@ -0,0 +1,181 @@
$(document).ready(function() {
var minFixationHeight = 650;
var useFixation = true;
if ($(window).height() > minFixationHeight && useFixation) {
var startFixationAt = $('#header_sticky').offset().top;
var isFixed = false;
var url = window.location.href;
var idx = url.indexOf("#")
var hash = idx != -1 ? url.substring(idx + 1) : false;
$.event.add(window, "scroll", function() {
var p = $(window).scrollTop();
if (p > startFixationAt && !hash) {
if (!isFixed) {
$('.sticky').each(function() {
$('<div class="stickyPlaceholder">&nbsp;</div>').css('height', $(this).outerHeight(true) + 'px').insertAfter($(this));
});
$('.sticky').addClass('fixed');
isFixed = true;
}
} else {
isFixed = false;
$('.sticky').removeClass('fixed');
$('.stickyPlaceholder').remove();
}
});
}
/* Family structure list
-----------------------------------------------------*/
$('.content_box_structure_family_list .trigger_opening').bind('click', function() {
var papa = $(this).parent('.content_box_structure_family_list');
if ($(this).hasClass('isOpen')) {
$('.family_list_content', papa).stop().animate({
'height': '170px'
});
$(this).removeClass('isOpen');
} else {
var container = $('.family_list_content', papa);
var oldContainerHeight = container.outerHeight();
container.css({
'overflow': 'visible',
'height': 'auto'
});
var height = container.height();
container.css({
'overflow': 'hidden',
'height': oldContainerHeight + 'px'
});
$('.family_list_content', papa).stop().animate({
'height': height + 'px'
});
$(this).addClass('isOpen');
}
});
/* Item details
-----------------------------------------------------*/
/* Replace manufacturer logo */
var itemManuLogoContainer = $('.content_item #manufacturer_wrapper .manufacturer_logo');
var curItemManuLogo = itemManuLogoContainer.css('backgroundImage');
curItemManuLogo = /^url\((['"]?)(.*)\1\)$/.exec(curItemManuLogo);
curItemManuLogo = curItemManuLogo ? curItemManuLogo[2] : false;
if (curItemManuLogo) {
var maxwidth = itemManuLogoContainer.innerWidth();
var maxheight = itemManuLogoContainer.innerHeight();
var newItemManuLogo = $('<img />').attr({
'src': curItemManuLogo
}).appendTo(itemManuLogoContainer);
$(newItemManuLogo).load(function() {
itemManuLogoContainer.css({
'backgroundImage': 'none'
});
var width = newItemManuLogo.width();
var height = newItemManuLogo.height();
if (width > height) {
width = maxwidth - 10;
newItemManuLogo.css({
'width': width + 'px'
});
} else if (height > width) {
height = maxheight - 10;
newItemManuLogo.css({
'height': height + 'px'
});
}
var toppos = (maxheight - newItemManuLogo.height()) / 2;
newItemManuLogo.css({
'marginTop': toppos + 'px'
});
});
}
/* Variant box action */
$('.content_item .item_variant_box').unbind('click').bind('click', function(e) {
e.preventDefault();
$(this).next('.variant_selection_box').slideToggle({
'duration': 100,
'easing': 'linear'
});
if ($(this).next('.item_variant_box').hasClass('item_variant_box_active')) {
$(this).next('.item_variant_box').removeClass('item_variant_box_active');
}
else {
$(this).next('.item_variant_box').addClass('item_variant_box_active');
}
});
/* Graduated prices box */
$('#graduated_price_title').unbind('click').bind('click', function() {
$('#graduated_price_content').slideToggle({
'duration': 100,
'easing': 'linear'
});
if ($('.graduated_price_title_arrow').hasClass('graduated_price_title_arrow_open')) {
$('.graduated_price_title_arrow').removeClass('graduated_price_title_arrow_open');
$('.graduated_price_title_wrapper').removeClass('graduated_price_title_wrapper_open');
} else {
$('.graduated_price_title_arrow').addClass('graduated_price_title_arrow_open');
$('.graduated_price_title_wrapper').addClass('graduated_price_title_wrapper_open');
}
});
/* QR Code */
$('.content_item #qrcode').qrcode({
width: 95,
height: 95,
text: window.location.href
});
/* Image slider */
// clearInterval(slideImagesInterval);
/* Cashdesk
-----------------------------------------------------*/
/* Trigger click on input-radio on click at payment method container */
$('.cashdesk .payment_method_line, .cashdesk .shipping_method_line').unbind('click').bind('click', function(e) {
$('input', this).prop('checked', true).trigger('change');
});
/* Customer center
-----------------------------------------------------*/
/* hover address-boxes START */
// $('.address').unbind('mouseenter').bind('mouseenter', function() {
// $(this).stop().animate({
// 'backgroundColor': '#FFE8D7'
// }, 100);
// }).bind('mouseleave', function() {
// $(this).stop().animate({
// 'backgroundColor': '#ffffff'
// }, 100);
// });
/* hover address-boxes START END */
});
@@ -0,0 +1,529 @@
$(document).ready(function() {
var alwaysEmptyOnFocus = false;
// Replace existing focus event actions
$('#search_item').unbind('focus').bind('focus', function() {
$('#account_kontext,#shoppingcart_kontext').css({
'display': 'none'
});
$('.main_widget_account_wrapper').removeClass('main_widget_account_wrapper_active');
$('.main_widget_shoppingcart2').removeClass('main_widget_shoppingcart2_active');
$('.search_wrapper,.search_widget_wrapper').addClass('search_wrapper_hover');
var search_item_value = $(this).val();
if (search_item_value === $(this).attr('data-defaultv') || alwaysEmptyOnFocus) {
$(this).val('');
}
}).bind('blur', function() {
setTimeout(function() {
$('.search_wrapper,.search_widget_wrapper').removeClass('search_wrapper_hover');
var search_item_value = $('#search_item').val();
if (search_item_value === $('#search_item').attr('data-defaultv') || search_item_value === '') {
$('#search_item').val($('#search_item').attr('data-defaultv'));
}
$('#searchResultBox').empty().remove();
}, 250);
});
$('#search_item2').unbind('focus').bind('focus', function() {
$('#account_kontext,#shoppingcart_kontext').css({
'display': 'none'
});
$('.main_widget_account_wrapper').removeClass('main_widget_account_wrapper_active');
$('.main_widget_shoppingcart2').removeClass('main_widget_shoppingcart2_active');
$('.search_wrapper,.search_widget_wrapper').addClass('search_wrapper_hover');
var search_item_value = $(this).val();
if (search_item_value === $(this).attr('data-defaultv') || alwaysEmptyOnFocus) {
$(this).val('');
}
}).bind('blur', function() {
setTimeout(function() {
$('.search_wrapper,.search_widget_wrapper').removeClass('search_wrapper_hover');
var search_item_value = $('#search_item2').val();
if (search_item_value === $('#search_item2').attr('data-defaultv') || search_item_value === '') {
$('#search_item2').val($('#search_item2').attr('data-defaultv'));
}
$('#searchResultBox').empty().remove();
}, 250);
});
$('#search_item3').unbind('focus').bind('focus', function() {
$('#account_kontext,#shoppingcart_kontext').css({
'display': 'none'
});
$('.main_widget_account_wrapper').removeClass('main_widget_account_wrapper_active');
$('.main_widget_shoppingcart2').removeClass('main_widget_shoppingcart2_active');
$('.search_wrapper,.search_widget_wrapper').addClass('search_wrapper_hover');
var search_item_value = $(this).val();
if (search_item_value === $(this).attr('data-defaultv') || alwaysEmptyOnFocus) {
$(this).val('');
}
}).bind('blur', function() {
setTimeout(function() {
$('.search_wrapper,.search_widget_wrapper').removeClass('search_wrapper_hover');
var search_item_value = $('#search_item3').val();
if (search_item_value === $('#search_item3').attr('data-defaultv') || search_item_value === '') {
$('#search_item3').val($('#search_item3').attr('data-defaultv'));
}
$('#searchResultBox').empty().remove();
}, 250);
});
$('.search_widget_wrapper form .search_button').click(function(e) {
e.preventDefault();
var allOk = true;
if ($('#search_item').val() === $('#search_item').attr('data-defaultv')) {
$('#search_item').val('alle/all');
}
if (!$('#search_item2').val() || $('#search_item2').val() === $('#search_item2').attr('data-defaultv')) {
if ($('#search_item3').val() && $('#search_item3').val() !== $('#search_item3').attr('data-defaultv')) {
$('#search_item2').val($('#search_item3').val());
$('#search_item3').val('');
} else {
allOk = false;
}
}
if ($('#search_item3').val() === $('#search_item3').attr('data-defaultv')) {
$('#search_item3').val('');
}
if (allOk) {
$(this).prop('disabled', true).val('Lade');
$('.search_widget_wrapper .loading_indicator').css({
display: 'block'
});
$('#layout_laden').css({
'height': $('body').height() + 'px',
'opacity': '0.5'
}).show();
$('#layout_laden_window').css({
display: 'block'
});
$(this).parent('form').submit();
} else {
alert('Bitte geben Sie einen Suchbegriff ein');
}
});
$('#searchcontent_item').unbind('focus').bind('focus', function() {
$('#account_kontext,#shoppingcart_kontext').css({
'display': 'none'
});
$('.main_widget_account_wrapper').removeClass('main_widget_account_wrapper_active');
$('.main_widget_shoppingcart2').removeClass('main_widget_shoppingcart2_active');
$('.search_wrapper,.search_widget_wrapper').addClass('search_wrapper_hover');
var search_item_value = $(this).val();
if (search_item_value === $(this).attr('data-defaultv') || alwaysEmptyOnFocus) {
$(this).val('');
}
}).bind('blur', function() {
setTimeout(function() {
$('.search_wrapper,.search_widget_wrapper').removeClass('search_wrapper_hover');
var search_item_value = $('#searchcontent_item').val();
if (search_item_value === $('#searchcontent_item').attr('data-defaultv') || search_item_value === '') {
$('#searchcontent_item').val($('#searchcontent_item').attr('data-defaultv'));
}
$('#searchResultBox').empty().remove();
}, 250);
});
$('#searchcontent_item2').unbind('focus').bind('focus', function() {
$('#account_kontext,#shoppingcart_kontext').css({
'display': 'none'
});
$('.main_widget_account_wrapper').removeClass('main_widget_account_wrapper_active');
$('.main_widget_shoppingcart2').removeClass('main_widget_shoppingcart2_active');
$('.search_wrapper,.search_widget_wrapper').addClass('search_wrapper_hover');
var search_item_value = $(this).val();
if (search_item_value === $(this).attr('data-defaultv') || alwaysEmptyOnFocus) {
$(this).val('');
}
}).bind('blur', function() {
setTimeout(function() {
$('.search_wrapper,.search_widget_wrapper').removeClass('search_wrapper_hover');
var search_item_value = $('#searchcontent_item2').val();
if (search_item_value === $('#searchcontent_item2').attr('data-defaultv') || search_item_value === '') {
$('#searchcontent_item2').val($('#searchcontent_item2').attr('data-defaultv'));
}
$('#searchResultBox').empty().remove();
}, 250);
});
$('#searchcontent_item3').unbind('focus').bind('focus', function() {
$('#account_kontext,#shoppingcart_kontext').css({
'display': 'none'
});
$('.main_widget_account_wrapper').removeClass('main_widget_account_wrapper_active');
$('.main_widget_shoppingcart2').removeClass('main_widget_shoppingcart2_active');
$('.search_wrapper,.search_widget_wrapper').addClass('search_wrapper_hover');
var search_item_value = $(this).val();
if (search_item_value === $(this).attr('data-defaultv') || alwaysEmptyOnFocus) {
$(this).val('');
}
}).bind('blur', function() {
setTimeout(function() {
$('.search_wrapper,.search_widget_wrapper').removeClass('search_wrapper_hover');
var search_item_value = $('#searchcontent_item3').val();
if (search_item_value === $('#searchcontent_item3').attr('data-defaultv') || search_item_value === '') {
$('#searchcontent_item3').val($('#searchcontent_item3').attr('data-defaultv'));
}
$('#searchResultBox').empty().remove();
}, 250);
});
$('.search_widget_wrapper form .searchcontent_button').click(function(e) {
e.preventDefault();
var allOk = true;
if ($('#searchcontent_item').val() === $('#searchcontent_item').attr('data-defaultv')) {
$('#searchcontent_item').val('alle/all');
}
/*if (!$('#searchcontent_item2').val() || $('#searchcontent_item2').val() === $('#searchcontent_item2').attr('data-defaultv')) {
if ($('#searchcontent_item3').val() && $('#searchcontent_item3').val() !== $('#searchcontent_item3').attr('data-defaultv')) {
$('#searchcontent_item2').val($('#searchcontent_item3').val());
$('#searchcontent_item3').val('');
} else {
allOk = false;
}
}
if ($('#searchcontent_item3').val() === $('#searchcontent_item3').attr('data-defaultv')) {
$('#searchcontent_item3').val('');
}*/
if (allOk) {
$(this).prop('disabled', true).val('Lade');
$('.search_widget_wrapper .loading_indicator').css({
display: 'block'
});
$('#layout_laden').css({
'height': $('body').height() + 'px',
'opacity': '0.5'
}).show();
$('#layout_laden_window').css({
display: 'block'
});
$(this).parent('form').submit();
} else {
alert('Bitte geben Sie einen Suchbegriff ein');
}
});
// Replace existing click event actions
$('.main_widget_account_wrapper').unbind('click').bind('click', function(e) {
e.preventDefault();
if (!$('.main_widget_account_wrapper').hasClass('main_widget_account_wrapper_active') && $('.main_widget_shoppingcart2').hasClass('main_widget_shoppingcart2_active')) {
$('#shoppingcart_kontext').css({
'display': 'none'
});
$('.main_widget_shoppingcart2').removeClass('main_widget_shoppingcart2_active');
}
if ($('.main_widget_account_wrapper').hasClass('main_widget_account_wrapper_active')) {
$('.main_widget_account_wrapper').removeClass('main_widget_account_wrapper_active');
$('#account_kontext').css({
'display': 'none'
});
} else {
$('.main_widget_account_wrapper').addClass('main_widget_account_wrapper_active');
$('#account_kontext').css({
'display': 'block'
});
}
});
// Replace existing click event actions
$('.main_widget_shoppingcart2').unbind('click').bind('click', function(e) {
e.preventDefault();
if ($(this).hasClass('empty_card')) {
window.location.href = '/Warenkorb/';
}
if (!$('.main_widget_shoppingcart2').hasClass('main_widget_shoppingcart2_active') && $('.main_widget_account_wrapper').hasClass('main_widget_account_wrapper_active')) {
$('#account_kontext').css({
'display': 'none'
});
$('.main_widget_account_wrapper').removeClass('main_widget_account_wrapper_active');
}
if ($('.main_widget_shoppingcart2').hasClass('main_widget_shoppingcart2_active')) {
$('.main_widget_shoppingcart2').removeClass('main_widget_shoppingcart2_active');
$('#shoppingcart_kontext').css({
'display': 'none'
});
} else {
$('.main_widget_shoppingcart2').addClass('main_widget_shoppingcart2_active');
$('#shoppingcart_kontext').css({
'display': 'block'
});
}
});
/* Logo rodeo
-----------------------------------------------------*/
/*$('#logoRodeoSpool div').hover(function() {
$(this).stop().animate({
'opacity': 1
}, 200);
}, function() {
$(this).stop().animate({
'opacity': 0.3
}, 200);
});*/
/* Navigation
-----------------------------------------------------*/
$.post('/index.php?website_modul=website_menu', {
config: {
fullWidth: true,
depth: 2,
splitInParentGroups: true
}
}, function(data) {
$('#main_menu_ajax_container').html(data);
var subElements = $('#main_widget_item_categories_dropdown .main_navigation_subnav .subNavRoller .subbox').length;
var subBoxWidth = $('#main_widget_item_categories_dropdown .main_navigation_subnav .subNavRoller .subbox').width();
var minHeight = 250;
// Set max sub nav height
var offset = $('#main_widget_item_categories_dropdown .main_navigation_subnav').offset();
var topOffset = 0;
if (offset) {
topOffset = offset.top;
}
var maxSubHeight = $(window).height() - topOffset - 50;
$('#main_widget_item_categories_dropdown .main_navigation_subnav').css({
'maxHeight': maxSubHeight + 'px'
});
// Set roller width
$('#main_widget_item_categories_dropdown .main_navigation_subnav .subNavRoller').css({
'width': (subBoxWidth * subElements) + 'px'
});
// Add sub vert. scroller
$('#main_widget_item_categories_dropdown .main_navigation_subnav .subNavRoller .subbox').each(function() {
var $this = this;
$(this).css({
'maxHeight': maxSubHeight + 'px'
});
if ($(this).height() < minHeight) {
$(this).css({
'height': minHeight + 'px'
});
}
var box = $('.subboxScroller', $this);
var boxRealHeight = box.outerHeight();
if (boxRealHeight > maxSubHeight) {
$(this).addClass('scrollable');
// Scroll up
$('.subboxScrollDown', this).bind('click', function(e) {
e.preventDefault();
var curPos = box.position().top;
var newPos = curPos - maxSubHeight;
var maxPos = maxSubHeight - boxRealHeight - (2 * $(this).height());
if (newPos < maxPos) {
newPos = maxPos;
}
$('.subboxScroller', $this).animate({
'top': newPos + 'px'
});
});
// Scroll down
$('.subboxScrollUp', this).bind('click', function(e) {
e.preventDefault();
var curPos = box.position().top;
var newPos = curPos + maxSubHeight;
var maxPos = 0;
if (newPos > maxPos) {
newPos = maxPos;
}
$('.subboxScroller', $this).animate({
'top': newPos + 'px'
});
});
}
});
var defaultDelay = 200;
var microDelay = 5;
var delay = defaultDelay;
var animationDuration = 200;
var delayTimeout, menuItemTimeout;
// Replace existing hover event actions
$('#main_widget_item_categories_dropdown').bind('mouseenter', function() {
delayTimeout = setTimeout(function() {
delay = microDelay;
}, defaultDelay);
}).bind('mouseleave', function(e, param1) {
clearTimeout(delayTimeout);
clearTimeout(menuItemTimeout);
delay = defaultDelay;
$('#main_widget_item_categories_dropdown .main_navigation_subnav').stop().animate({
'height': '0px'
}, animationDuration, function() {
if (param1 != 'hideSubsOnly') {
$('.menu_item_hover').trigger('defocus');
}
$(this).removeClass('visible');
});
});
$('#main_widget_item_categories_dropdown .menu_item').unbind('mouseenter mouseleave').bind('mouseenter', function() {
var button = $(this);
var isEmpty = $(this).hasClass('isEmpty');
menuItemTimeout = setTimeout(function() {
$('.menu_item_hover').trigger('defocus');
button.addClass('menu_item_hover');
$('<span class="itemRoof"></span>').appendTo(button);
$('<span class="itemBottom"></span>').appendTo(button);
var buttonRel = button.attr('data-rel');
if (!isEmpty) {
var subBox = $('.subbox[data-rel="' + buttonRel + '"]');
var newHeight = $(subBox).outerHeight();
if (newHeight > maxSubHeight) {
newHeight = maxSubHeight;
} else if (newHeight < minHeight) {
newHeight = minHeight;
}
var pos = $(subBox).position();
if (pos) {
var newLeft = $(subBox).position().left;
$('#main_widget_item_categories_dropdown .main_navigation_subnav').addClass('visible').stop().animate({
'height': newHeight + 'px'
}, animationDuration);
$('#main_widget_item_categories_dropdown .main_navigation_subnav .subNavRoller').stop().animate({
'left': -newLeft + 'px'
}, animationDuration);
}
} else {
$('#main_widget_item_categories_dropdown').trigger('mouseleave', ['hideSubsOnly']);
}
}, delay);
}).bind('defocus', function() {
var button = $(this);
button.removeClass('menu_item_hover');
$('.itemRoof', button).remove();
$('.itemBottom', button).remove();
});
});
// Click action on newsletter widget
$('.newsletter_widget_wrapper').click(function() {
//window.location.href = '/newsletter_registration/';
});
// Remove live search
$('#search_item').unbind('keyup');
// Left category navigation
$('.itemcategory_widget_wrapper .level_1.active').click(function(e) {
e.preventDefault();
if ($(this).hasClass('isClosed')) {
$('.itemcategory_widget_wrapper .level_2,.itemcategory_widget_wrapper .level_3').css({
display: 'block'
});
} else {
$('.itemcategory_widget_wrapper .level_2,.itemcategory_widget_wrapper .level_3').css({
display: 'none'
});
}
$(this).toggleClass('isClosed');
});
$('.itemcategory_widget_wrapper .level_2.active').click(function(e) {
e.preventDefault();
if ($(this).hasClass('isClosed')) {
$('.itemcategory_widget_wrapper .level_3').css({
display: 'block'
});
} else {
$('.itemcategory_widget_wrapper .level_3').css({
display: 'none'
});
}
$(this).toggleClass('isClosed');
});
});