') .append("
") .append(" ") .addClass(options.toastClass + ' ' + options.toastClass + "-" + map.type) .find("tr"); var $messageContainer = createBlock("td", null, options.centerBlockClass); var $closeElement = $(options.closeHtml); var response = { toastId: toastId, state: 'visible', startTime: new Date(), options: options, map: map }; if (typeof (map) !== 'undefined') { options = $.extend(options, map); iconClass = map.iconClass || iconClass; } toastId++; $container = getContainer(options); if (map.imgClass) { $toastElement.append(createBlock("td", null, options.leftBlockClass + " " + map.imgClass)); } else if (map.imgURI) { var style = "background-size: 100% auto;"; for (var i = 0, k = map.imgURI.length; i < k; i++) { style += "background-image: url('" + map.imgURI[i] + "');"; } $toastElement.append(createBlock("td", null, options.leftBlockClass).attr("style", style)); } if (map.title) { $messageContainer.append(createBlock("div", map.title, options.titleClass)); } if (map.message) { $messageContainer.append(createBlock("div", map.message, options.messageClass)); } if (map.iconClass || options.closeButton) { $toastElement.append($messageContainer).append(createBlock("td", null, options.rightBlockClass)); if (options.closeButton) { $toastElement.find("." + options.rightBlockClass).append($closeElement); } if (map.iconClass && map.iconClass != 'none') $toastElement.find("." + options.rightBlockClass).append(createBlock("i", null, map.iconClass)); } $toastElement = $toastElement.parent().parent(); $toastElement.hide(); if (options.newestOnTop) { $container.prepend($toastElement); } else { $container.append($toastElement); } $toastElement[options.showMethod]( { duration: options.showDuration, easing: options.showEasing, complete: options.onShown } ); if (options.timeOut > 0) { intervalId = setTimeout(hideToast, options.timeOut); } $toastElement.hover(stickAround, delayedhideToast); if (!options.onclick && options.tapToDismiss) { $toastElement.click(hideToast); } if (options.closeButton && $closeElement) { $closeElement.click(function (event) { event.stopPropagation(); closeToast(true); }); } if (options.onclick) { $toastElement.click(function () { options.onclick(); hideToast(); }); } publish(response); if (options.debug && console) { console.log(response); } return $toastElement; function createBlock(elem, text, $class) { return $("<" + elem + "/>").append(text).addClass($class); } function closeToast(override) { if ($(':focus', $toastElement).length && !override) { return null; } return $toastElement.addClass("slideOutRight").delay(1000).queue(function () { if (options.onHidden) { options.onHidden(); } response.state = 'hidden'; response.endTime = new Date(), publish(response); $toastElement.remove(); }); } function hideToast(override) { if ($(':focus', $toastElement).length && !override) { return null; } return $toastElement[options.hideMethod]({ duration: options.hideDuration, easing: options.hideEasing, complete: function () { removeToast($toastElement); if (options.onHidden) { options.onHidden(); } response.state = 'hidden'; response.endTime = new Date(), publish(response); } }); } function delayedhideToast() { if (options.timeOut > 0 || options.extendedTimeOut > 0) { intervalId = setTimeout(hideToast, options.extendedTimeOut); } } function stickAround() { clearTimeout(intervalId); $toastElement.stop(true, true)[options.showMethod]( { duration: options.showDuration, easing: options.showEasing } ); } } function removeToast($toastElement) { if (!$container) { $container = getContainer(); } if ($toastElement.is(':visible')) { return; } $toastElement.remove(); $toastElement = null; if ($container.children().length === 0) { $container.remove(); } } function publish(args) { if (!listener) { return; } listener(args); } function getActualOptions() { return $.extend({}, getDefaultOptions(), vm.options); } function getDefaultOptions() { return { tapToDismiss: true, toastClass: 'toast8', containerId: 'toast8-container', debug: false, closeButton: true, showMethod: 'fadeIn', /*fadeIn, slideDown, and show are built into jQuery*/ showDuration: 300, showEasing: 'swing', /*swing and linear are built into jQuery*/ onShown: undefined, hideMethod: 'fadeOut', hideDuration: 1000, hideEasing: 'swing', extendedTimeOut: 1000, iconClasses: { /*info: 'fa fa-info', nostyle: 'fa fa-info', success: 'fa fa-check', error: 'fa fa-ban', warning: 'fa fa-exclamation', facebook: 'fa fa-facebook', twitter: 'fa fa-twitter', skype: 'fa fa-skype', windows: 'fa fa-windows', android: 'fa fa-android', linkedin: 'fa fa-linkedin', googlePlus: 'fa fa-google-plus', linux: 'fa fa-linux', github: 'fa fa-github'*/ }, iconClass: 'toast8-info', positionClass: 'toast8-bottom-right', timeOut: 5000, /* Set timeOut and extendedTimeout to 0 to make it sticky*/ titleClass: 'toast8-title', messageClass: 'toast8-message', leftBlockClass: 'toast8-avatar-container', centerBlockClass: 'toast8-message-container', rightBlockClass: 'toast8-right-container', target: 'body', closeHtml: "× ", newestOnTop: true }; } function getContainer(options) { if (!options) { options = getActualOptions(); } $container = $('#' + options.containerId); if ($container.length) { return $container; } $container = $('
') .attr('id', options.containerId) .addClass(options.positionClass); $container.appendTo($(options.target)); return $container; } function unwrapArguments(args, type, iconClass, extraClass) { if (args && typeof (args[0]) === 'object') { args[0].type = type; if (!args[0].iconClass) args[0].iconClass = iconClass; if (typeof args[0].imgURI == "string") { args[0].imgURI = [args[0].imgURI]; } return fixTimeOut(args[0], type); } return fixTimeOut({ type: type, message: args[0], title: args[1], imgClass: args[3] || null, iconClass: args[4] || iconClass, }, type); function fixTimeOut(obj, t) { if (typeof obj.timeOut == "number") return obj; var timeOut = getDefaultOptions().timeOut; switch (t) { case "warning": obj.timeOut = timeOut * 2; break; case "error": obj.timeOut = timeOut * 3; break; } return obj; }; } /*function facebook() { return buildToast(unwrapArguments(arguments, "facebook", getActualOptions().iconClasses.facebook)); } function info() { return buildToast(unwrapArguments(arguments, "info", getActualOptions().iconClasses.info)); } function error() { return buildToast(unwrapArguments(arguments, "error", getActualOptions().iconClasses.error)); } function warning() { return buildToast(unwrapArguments(arguments, "warning", getActualOptions().iconClasses.warning)); } function success() { return buildToast(unwrapArguments(arguments, "success", getActualOptions().iconClasses.success)); } function twitter() { return buildToast(unwrapArguments(arguments, "twitter", getActualOptions().iconClasses.twitter)); } function linkedin() { return buildToast(unwrapArguments(arguments, "linkedin", getActualOptions().iconClasses.linkedin)); } function windows() { return buildToast(unwrapArguments(arguments, "windows", getActualOptions().iconClasses.windows)); } function googlePlus() { return buildToast(unwrapArguments(arguments, "google-plus", getActualOptions().iconClasses.googlePlus)); } function skype() { return buildToast(unwrapArguments(arguments, "skype", getActualOptions().iconClasses.skype)); } function linux() { return buildToast(unwrapArguments(arguments, "linux", getActualOptions().iconClasses.linux)); }*/ function nostyle() { return buildToast(unwrapArguments(arguments, "default")); } function github() { var actualOptions = getActualOptions(); var extraClass = { titleClass: actualOptions.titleClass + " text-danger", messageClass: actualOptions.messageClass + " text-muted" }; return buildToast($.extend(extraClass, unwrapArguments(arguments, "github", actualOptions.iconClasses.github, extraClass))); } function android() { return buildToast(unwrapArguments(arguments, "android", getActualOptions().iconClasses.android)); } function subscribe(callback) { listener = callback; } function clear($toastElement) { var localOptions = getActualOptions(); if (!$container) { getContainer(options); } if ($toastElement && $(':focus', $toastElement).length === 0) { $toastElement[localOptions.hideMethod]({ duration: localOptions.hideDuration, easing: localOptions.hideEasing, complete: function () { removeToast($toastElement); } }); return; } if ($container.children().length) { $container[localOptions.hideMethod]({ duration: localOptions.hideDuration, easing: localOptions.hideEasing, complete: function () { $container.remove(); } }); } } })(); }); }(typeof define === 'function' && define.amd ? define : function (deps, factory) { if (typeof window.module !== 'undefined' && window.module.exports) { window.module.exports = factory(window.require(deps[0])); } else { window.toastr8 = factory(window['jQuery']); } })); var isMobile = false; if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) { isMobile = true; } /* Meg kell csinálni hogy a rendelés leadásnál be lehessen pipálni hogy szeretné, hogy másik lássák mit vásárolt */ /*if(isMobile == false){ setTimeout(function(){ last_order(); }, 1000); setInterval(function(){ last_order(); }, 10000); }*/ /*function last_order(){ $.ajax({ type: 'GET', url: '/api/notification/v1/last_order', dataType: 'json', success: function (data) { toastr8.nostyle({ title: data.user.name + ' (' + data.user.city + ') ', message: 'megvásárolta a terméket: ' + data.product.name + ' '+ data.time.display, imgURI: [data.product.image+'&width=90'], positionClass: 'toast8-bottom-left', timeOut: 8000 }); } }); }*/ /* Hírlevél feliratkozás */ $("#newsletter_form").submit(function(e) { e.preventDefault(); $.ajax({ type: "POST", dataType: "json", url: "/hirlevel", data: { email: $(this).find('input').val(), first_name: null, }, success: function(data) { if(data.success == true){ $('#newsletter_form').fadeOut(); $('.subscribe-form').html('' + data.message + '
'); $('.newsletter-text').show('slow'); } }, error: function(xhr, textStatus) { } }); }); /* Kezdőlap */ /*------------------------------ Akciók -----------------------------------*/ $(".on-sale-slider").each(function() { $.ajax({ type: "GET", dataType: "json", url: "/kereses-api?paginate=20&page=1&sale=yes&orderby=default&filter[buyable][]=true", success: function(data) { if(data.products.length == 0){ $('.feature-area').hide(); } while (data.products.length > 0) { chunk_products = data.products.splice(0,1); var products_slider_swiper = ''; $.each(chunk_products, function( key, item ) { var product_second_image = item.images[0]; if(typeof item.images[1] !== "undefined"){ product_second_image = item.images[1]; } products_slider_swiper += '
' + item.category.name + ' (' + item.ratingCount + ') '; if(item.discountedPrice != 0){ products_slider_swiper += '
' + XuPeSystem.Currency.symbol_left+$.number(item.discountedPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' ' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; }else{ products_slider_swiper += '' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; } products_slider_swiper += ' '; }); products_slider_swiper += '
'; $('.on-sale-slider-wrapper').append(products_slider_swiper); } var swiper = new Swiper(".on-sale-slider", { loop: true, slidesPerView: 6, spaceBetween: 0, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 0: { slidesPerView: 2, }, 478: { slidesPerView: 2, }, 576: { slidesPerView: 2, }, 768: { slidesPerView: 3, }, 1024: { slidesPerView: 4, }, 1200: { slidesPerView: 6, }, }, }); } }); }); /*------------------------------ Előrendelhető termékek -----------------------------------*/ $(".deal-slider").each(function() { $.ajax({ type: "GET", dataType: "json", url: "/api/v2/search?preorder=true&limit=5&orderby=random", success: function(data) { while (data.products.length > 0) { chunk_products = data.products.splice(0,1); var products_slider_swiper = ''; $.each(chunk_products, function( key, item ) { var product_second_image = item.images[0]; if(typeof item.images[1] !== "undefined"){ product_second_image = item.images[1]; } products_slider_swiper += '
'; if(item.is_new == true){ products_slider_swiper += ''; } products_slider_swiper += ' ' + item.category.name + ' (' + item.rating.count + ') '; if(item.price.sale_price != 0){ products_slider_swiper += '
' + item.price.display.sale_price + ' ' + item.price.display.gross_price + ' ' + item.price.display.percent + ' '; }else{ products_slider_swiper += '' + item.price.display.gross_price + ' '; } products_slider_swiper += ' Adatlap '; }); products_slider_swiper += '
'; $('.deal-slider-wrapper').append(products_slider_swiper); } countdown_render(); var swiper = new Swiper(".deal-slider", { slidesPerView: 2, spaceBetween: 30, speed: 750, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 0: { slidesPerView: 1, }, 1024: { slidesPerView: 1, }, 1200: { slidesPerView: 2, }, }, }); } }); }); /*------------------------------ Neked ajánljuk -----------------------------------*/ $(".recommend-slider").each(function() { $.ajax({ type: "GET", dataType: "json", url: "/kereses-api?paginate=20&filter[buyable][]=true", success: function(data) { while (data.products.length > 0) { chunk_products = data.products.splice(0,2); var products_slider_swiper = ''; $.each(chunk_products, function( key, item ) { var product_second_image = item.images[0]; if(typeof item.images[1] !== "undefined"){ product_second_image = item.images[1]; } products_slider_swiper += '
' + item.category.name + ' (' + item.ratingCount + ') '; if(item.discountedPrice != 0){ products_slider_swiper += '
' + XuPeSystem.Currency.symbol_left+$.number(item.discountedPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' ' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; }else{ products_slider_swiper += '' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; } products_slider_swiper += ' '; }); products_slider_swiper += '
'; $('.recommend-slider-wrapper').append(products_slider_swiper); } var swiper = new Swiper(".recommend-slider", { loop: true, slidesPerView: 6, spaceBetween: 0, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 0: { slidesPerView: 1, }, 478: { slidesPerView: 2, }, 576: { slidesPerView: 2, }, 768: { slidesPerView: 3, }, 1024: { slidesPerView: 4, }, 1200: { slidesPerView: 6, }, }, }); } }); }); /*------------------------------ Népszerű - Alkatrészek -----------------------------------*/ $(".hot-pc-components-slider").each(function() { $.ajax({ type: "GET", dataType: "json", url: "/kereses-api?paginate=20&filter[categories][]=76da1604-8525-4ffa-a038-0b9196e0dab6&filter[buyable][]=true", success: function(data) { while (data.products.length > 0) { chunk_products = data.products.splice(0,2); var products_slider_swiper = ''; $.each(chunk_products, function( key, item ) { var product_second_image = item.images[0]; if(typeof item.images[1] !== "undefined"){ product_second_image = item.images[1]; } products_slider_swiper += '
' + item.category.name + ' (' + item.ratingCount + ') '; if(item.discountedPrice != 0){ products_slider_swiper += '
' + XuPeSystem.Currency.symbol_left+$.number(item.discountedPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' ' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; }else{ products_slider_swiper += '' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; } products_slider_swiper += ' '; }); products_slider_swiper += '
'; $('.hot-pc-components-slider-wrapper').append(products_slider_swiper); } var swiper = new Swiper(".hot-pc-components-slider", { loop: true, slidesPerView: 6, spaceBetween: 0, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 0: { slidesPerView: 2, }, 478: { slidesPerView: 2, }, 576: { slidesPerView: 2, }, 768: { slidesPerView: 3, }, 1024: { slidesPerView: 4, }, 1200: { slidesPerView: 6, }, }, }); } }); }); /*------------------------------ Népszerű - Szoftverek -----------------------------------*/ $(".hot-softwares-slider").each(function() { $.ajax({ type: "GET", dataType: "json", url: "/kereses-api?paginate=20&filter[categories][]=d091b53b-e323-4ea6-a730-6e794f30a4fc&filter[buyable][]=true", success: function(data) { while (data.products.length > 0) { chunk_products = data.products.splice(0,2); var products_slider_swiper = ''; $.each(chunk_products, function( key, item ) { var product_second_image = item.images[0]; if(typeof item.images[1] !== "undefined"){ product_second_image = item.images[1]; } products_slider_swiper += '
' + item.category.name + ' (' + item.ratingCount + ') '; if(item.discountedPrice != 0){ products_slider_swiper += '
' + XuPeSystem.Currency.symbol_left+$.number(item.discountedPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' ' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; }else{ products_slider_swiper += '' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; } products_slider_swiper += ' '; }); products_slider_swiper += '
'; $('.hot-softwares-slider-wrapper').append(products_slider_swiper); } var swiper = new Swiper(".hot-softwares-slider", { loop: true, slidesPerView: 4, spaceBetween: 0, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 0: { slidesPerView: 2, }, 478: { slidesPerView: 2, }, 576: { slidesPerView: 2, }, 768: { slidesPerView: 3, }, 1024: { slidesPerView: 6, }, 1200: { slidesPerView: 6, }, }, }); } }); }); /*------------------------------ Népszerű - Játékok -----------------------------------*/ $(".hot-games-slider").each(function() { $.ajax({ type: "GET", dataType: "json", url: "/kereses-api?paginate=20&filter[categories][]=556e4d14-6a94-4c12-911e-8d7ad0990597&filter[categories][]=fe6598fb-5330-4f9d-9d9d-dc9eb1531ccd&filter[categories][]=a7b0fdb8-2c56-4979-9b01-c2dee4983770&filter[categories][]=ecf0d20a-f716-4fff-b1b7-f5ade096e214&filter[buyable][]=true", success: function(data) { while (data.products.length > 0) { chunk_products = data.products.splice(0,2); var products_slider_swiper = ''; $.each(chunk_products, function( key, item ) { var product_second_image = item.images[0]; if(typeof item.images[1] !== "undefined"){ product_second_image = item.images[1]; } products_slider_swiper += '
' + item.category.name + ' (' + item.ratingCount + ') '; if(item.discountedPrice != 0){ products_slider_swiper += '
' + XuPeSystem.Currency.symbol_left+$.number(item.discountedPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' ' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; }else{ products_slider_swiper += '' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; } products_slider_swiper += ' '; }); products_slider_swiper += '
'; $('.hot-games-slider-wrapper').append(products_slider_swiper); } var swiper = new Swiper(".hot-games-slider", { loop: true, slidesPerView: 6, spaceBetween: 0, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 0: { slidesPerView: 2, }, 478: { slidesPerView: 2, }, 576: { slidesPerView: 2, }, 768: { slidesPerView: 3, }, 1024: { slidesPerView: 4, }, 1200: { slidesPerView: 6, }, }, }); } }); }); /*------------------------------ Új Termékek -----------------------------------*/ $(".new-products-slider").each(function() { $.ajax({ type: "GET", dataType: "json", url: "/kereses-api?paginate=20&orderby=last_added&filter[buyable][]=true", success: function(data) { while (data.products.length > 0) { chunk_products = data.products.splice(0,2); var products_slider_swiper = ''; $.each(chunk_products, function( key, item ) { var product_second_image = item.images[0]; if(typeof item.images[1] !== "undefined"){ product_second_image = item.images[1]; } products_slider_swiper += '
' + item.category.name + ' (' + item.ratingCount + ') '; if(item.discountedPrice != 0){ products_slider_swiper += '
' + XuPeSystem.Currency.symbol_left+$.number(item.discountedPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' ' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; }else{ products_slider_swiper += '' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; } products_slider_swiper += ' '; }); products_slider_swiper += '
'; $('.new-products-slider-wrapper').append(products_slider_swiper); } new Swiper(".new-products-slider", { loop: true, slidesPerView: 4, spaceBetween: 30, speed: 750, autoplay: { delay: 3500, disableOnInteraction: false, }, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 0: { slidesPerView: 1, }, 478: { slidesPerView: 1, }, 576: { slidesPerView: 1, }, 768: { slidesPerView: 2, }, 1024: { slidesPerView: 3, }, 1200: { slidesPerView: 4, }, }, on: { init() { this.el.addEventListener('mouseenter', () => { this.autoplay.stop(); }); this.el.addEventListener('mouseleave', () => { this.autoplay.start(); }); } }, }); } }); }); /*$('.search_products').each( function() { search_products(1); });*/ /* ha módosult a keresés akkor az első oldal lekérdezése*/ var wait_form_submit; var wait_form_submit_sec; $(".search_products :input").change(function() { var click_this = this; if($(this).attr("class") == 'input_range'){ wait_form_submit_sec = 500; }else{ wait_form_submit_sec = 1; } clearTimeout(wait_form_submit); wait_form_submit = setTimeout(function() { search_products(1, $(click_this).data('attribute')); }, wait_form_submit_sec); }); $('.search_products').on('keyup keypress', function(e) { var keyCode = e.keyCode || e.which; if (keyCode === 13) { search_products(1); e.preventDefault(); return false; } }); }); var product_template_new = '{{if is_release_date == true}}
{{/if}} {{if plus_18 == 1}} {{/if}} {{if is_new == true}} {{/if}} '; /*var product_template = '{{if is_release_date == true}}
{{/if}} {{if plus_18 == 1}} {{/if}} {{if is_new == true}} {{/if}} ';*/ /* Termék oldala kezdete */ /*------------------------------ Hasonló termékek -----------------------------------*/ /*------------------------------ Új Termékek -----------------------------------*/ $(".top-product-similar-slider").each(function() { $.ajax({ type: "GET", dataType: "json", url: "/kereses-kategoria/" + $(this).data('category_sku') + "?paginate=20&page=1&orderby=default&filter[buyable][]=true", success: function(data) { while (data.products.length > 0) { chunk_products = data.products.splice(0,3); var products_slider_swiper = ''; $.each(chunk_products, function( key, item ) { /*console.log(item);*/ var product_second_image = item.images[0]; if(typeof item.images[1] !== "undefined"){ product_second_image = item.images[1]; } products_slider_swiper += '
(' + item.ratingCount + ') '; if(item.discountedPrice != 0){ products_slider_swiper += '
' + XuPeSystem.Currency.symbol_left+$.number(item.discountedPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' ' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; }else{ products_slider_swiper += '' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; } products_slider_swiper += ' '; }); products_slider_swiper += '
'; $('.top-product-similar-slider-wrapper').append(products_slider_swiper); } new Swiper(".top-product-similar-slider", { loop: true, slidesPerView: 4, spaceBetween: 30, speed: 750, autoplay: { delay: 3500, disableOnInteraction: false, }, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 0: { slidesPerView: 1, }, 478: { slidesPerView: 1, }, 576: { slidesPerView: 1, }, 768: { slidesPerView: 2, }, 1024: { slidesPerView: 3, }, 1200: { slidesPerView: 1, }, }, on: { init() { this.el.addEventListener('mouseenter', () => { this.autoplay.stop(); }); this.el.addEventListener('mouseleave', () => { this.autoplay.start(); }); } }, }); } }); }); /*------------------------------ További termékek -----------------------------------*/ /*$(".feature-slider").each(function() { $.ajax({ type: "GET", dataType: "json", url: "", success: function(data) { while (data.products.length > 0) { chunk_products = data.products.splice(0,2); var products_slider_swiper = ''; $.each(chunk_products, function( key, item ) { var product_second_image = item.images[0]; if(typeof item.images[1] !== "undefined"){ product_second_image = item.images[1]; } products_slider_swiper += '
'; if(item.is_new == true){ products_slider_swiper += ''; } products_slider_swiper += ' ' + item.category.name + ' (' + item.rating.count + ') '; if(item.price.sale_price != 0){ products_slider_swiper += '
' + item.price.display.sale_price + ' ' + item.price.display.gross_price + ' '; }else{ products_slider_swiper += '' + item.price.display.gross_price + ' '; } products_slider_swiper += ' '; }); products_slider_swiper += '
'; $('.feature-slider-wrapper').append(products_slider_swiper); } var swiper = new Swiper(".feature-slider", { loop: true, slidesPerView: 4, spaceBetween: 0, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 0: { slidesPerView: 2, }, 478: { slidesPerView: 1, }, 576: { slidesPerView: 1, }, 768: { slidesPerView: 1, }, 1024: { slidesPerView: 2, }, 1200: { slidesPerView: 6, }, }, }); } }); });*/ /*------------------------------ Hasonló termékek -----------------------------------*/ $(".product-similar-slider").each(function() { $.ajax({ type: "GET", dataType: "json", url: "/kereses-kategoria/" + $(this).data('category_sku') + "?paginate=20&page=1&orderby=random&filter[buyable][]=true", success: function(data) { while (data.products.length > 0) { chunk_products = data.products.splice(0,1); var products_slider_swiper = ''; $.each(chunk_products, function( key, item ) { /*console.log(item);*/ var product_second_image = item.images[0]; if(typeof item.images[1] !== "undefined"){ product_second_image = item.images[1]; } products_slider_swiper += '
(' + item.ratingCount + ') '; if(item.discountedPrice != 0){ products_slider_swiper += '
' + XuPeSystem.Currency.symbol_left+$.number(item.discountedPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' ' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; }else{ products_slider_swiper += '' + XuPeSystem.Currency.symbol_left+$.number(item.grossPrice, XuPeSystem.Currency.decimals, XuPeSystem.Currency.decimal_separator, XuPeSystem.Currency.thousands_separator)+XuPeSystem.Currency.symbol_right + ' '; } products_slider_swiper += ' '; }); products_slider_swiper += '
'; $('.product-similar-slider-wrapper').append(products_slider_swiper); } var swiper = new Swiper(".product-similar-slider", { loop: true, slidesPerView: 4, spaceBetween: 0, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { 0: { slidesPerView: 2, }, 478: { slidesPerView: 1, }, 576: { slidesPerView: 1, }, 768: { slidesPerView: 1, }, 1024: { slidesPerView: 2, }, 1200: { slidesPerView: 6, }, }, }); } }); }); /* Szolgáltatások sorra kattintva kijelöli */ $(".product_services tr").click(function() { var checkbox = $(this).find("input[type='checkbox']"); checkbox.attr('checked', !checkbox.attr('checked')); }); /* A termék adatlapján betölti az első oldal értékeléseket */ $('.product_details_review_list').each( function() { load_product_details_review($(this).data('product_id'), 1); }); /* Ha van az oldalon értékelési lehetőség */ $( document ).ready(function() { setTimeout(function() { $('.review_form').each( function() { $('#nav-reviews-tab').tab('show'); $([document.documentElement, document.body]).animate({ scrollTop: $("#tab-reviews").offset().top }, 2000); }); }, 2000); }); $(document).ready(function () { $('.star_rating span').on('click', function(){ /* Ebbe az inputba rakja bele az értéket */ var input = $(this).parent().data('name_input'); /* kiválasztott csillag */ var selected_star = parseFloat($(this).data('value')); /* Végigmegy az összes csillagon és a megfelelő classt hozzáadja vagy elveszi */ var stars = $(this).parent().children('.star_rating span'); for (var i = 0; i < stars.length; i++) { $(stars[i]).removeClass('selected'); } for (i = 0; i < selected_star; i++) { $(stars[i]).addClass('selected'); } /* Ha rákattint az egyik csillagra akkor elmentjük az inputba az értéket */ $('input[name="' + input + '"]').val(selected_star); /* Ha rákattint az egyik csillagra akkor eltüntetjük a hibaüzenetet */ $('input[name="' + input + '"]').prev().html(''); }); }); /* Termék oldalon értékelés leadása */ $(".product_details_review_form").submit(function(e) { /* Submit gomb megszakítása */ e.preventDefault(); var success = true; /* Értékelési értékek lekérdezése */ var price_to_value_ratio = $('input[name="product_review_submit_price_to_value_ratio"]'); var fulfills_expectations = $('input[name="product_review_submit_fulfills_expectations"]'); if(price_to_value_ratio.val() == ''){ success = false; $(price_to_value_ratio.prev()).html('Válassz ki egy értéket!'); }else{ $(price_to_value_ratio.prev()).html(''); } if(fulfills_expectations.val() == ''){ success = false; $(fulfills_expectations.prev()).html('Válassz ki egy értéket!'); }else{ $(fulfills_expectations.prev()).html(''); } if(success == true){ $('.product_details_review_form_error').html(''); $.ajax({ type: "POST", dataType: "json", url: "/api/product/" + $(this).data('product_increment') + "/sent-review", data: { data: $(this).data('review_data'), choice: $('.product_review_submit_choice').val(), pros: $('.product_review_submit_pros').val(), cons: $('.product_review_submit_cons').val(), price_to_value_ratio: price_to_value_ratio.val(), fulfills_expectations: fulfills_expectations.val(), }, success: function(data) { if(data.success == true){ $('#product_details_review_form').fadeOut(); $('.review_form').html('' + data.message + '
'); $('.newsletter-text').show('slow'); } }, error: function(xhr, textStatus) { } }); } }); /* Termékoldal értékelések betöltése */ function load_product_details_review(product_id, page){ /* További értékelések gomb betöltés hozzáadása */ $('.product_details_review_next_button').html(' Betöltés...'); $.ajax({ type: "GET", dataType: "json", url: "/api/product/" + product_id + "/reviews", data: {page: page}, success: function(data) { /* értékelés csillagok */ $('.product_details_review_width').css('width', data.review.width); /* értékelések száma */ $('.product_details_review_count').html(data.review.count); if(data.items.length > 0){ /* Végig megy az összes értékelésen */ $.each(data.items, function( key, value ) { /* Alapértelmezett változók létrehozása */ var review_pros = "-"; var review_cons = "-"; var review_choice = "-"; if(value.pros !== null){ review_pros = value.pros; } if(value.cons !== null){ review_cons = value.cons; } if(value.choice !== null){ review_choice = value.choice; } /* Értékelés lista a termék oldalon */ var review_id = Math.random().toString(36).substring(2,15); $(".product_details_review_list").append(' ' + value.date.human_format + '
A termék kiválasztásának fő szempontjai: ' + review_choice + '
Előnyök: ' + review_pros + '
Hátrányok: ' + review_cons + '
'); /*$(".product_details_review_list").append(' ');*/ $('#product_details_review_' + review_id).show('slow'); }); /* További értékelések gomb megjelenítése ha van következő oldal */ if(data.nextPage !== null){ $('.product_details_review_next').html('További értékelések '); }else{ $('.product_details_review_next').html(''); } }else{ $('.product_details_review_list').html('A termékre még nem érkezett értékelés! '); } }, error: function(xhr, textStatus) { } }); } /* Termék oldalon nincs termék értesítése */ $(".product_available_form").submit(function(e) { e.preventDefault(); $.ajax({ type: "POST", dataType: "json", url: "/termek/elerheto_ertesites", data: { email: $(this).find('input').val(), product: $(this).data('product_id'), }, success: function(data) { if(data.success == true){ Swal.fire({ icon: 'success', title: 'Siker!', text: data.message, html: data.message, }); }else{ Swal.fire({ icon: 'error', title: 'Hiba!', text: data.message, html: data.message, }); } }, error: function(xhr, textStatus) { } }); }); /* Termék oldala vége */ /* Kosár rendszer kezdete */ /* Kosár betöltése oldal betöltésekor */ /* új */ cart_loading(); function cart_loading() { $.ajax({ type: 'GET', url: '/api/v2/cart', dataType: 'json', success: function (data) { $('.cart-count').attr("data-number", data.item_quantity); $('.cart-total-price').html(data.price.display.sub_price); $('.cart-products').html(null); /* Kosár értesítések betöltése */ if(data.message != ""){ $('.cart-notification-messages').html(""+data.message+"
"); }else{ $('.cart-notification-messages').html(null); } /* Kedvezmény értesítések */ if(data.price.discount_message != ""){ $('.cart-discount-messages').html("Kupon figyelmeztető! "+data.price.discount_message+"
"); }else{ $('.cart-discount-messages').html(null); } /* A kosár oldalon a táblázat űrítése */ $('.cart-products-table tbody').html(null); /* Kedvezmény beállítása*/ if(data.price.discount > 0){ $('.cart-discount-amount').html(data.price.display.discount); $('.cart-discount').show(); }else{ $('.cart-discount').hide(); } /* Terméklista */ $.each(data.products, function(index, item) { /* Fenti kosár termékek beszúrása */ $('.cart-products').append(' ' + item.name + ' ' + item.quantity + ' x ' + item.price.display.gross_price + ' '); /* A kosár oldalon táblázat termékek beszúrása */ $('.cart-products-table tbody').append($.tmpl(' ${product_name} {{if sale_price == 0}} ${display_price} {{else}} ${display_price} ${display_sale_price} {{/if}} ${display_total_price} ', { "product_id" : item.id, "product_name" : item.full_name, "product_image" : item.images[0]+'&height=100&width=100', "product_url" : item.url, "stock" : item.stock, "quantity" : $.number(item.quantity, 0, '.', ' '), "display_price" : item.price.display.gross_price, "display_sale_price" : item.price.display.sale_price, "display_total_price" : item.price.display.sub_price, "price" : item.price.gross_price, "sale_price" : item.price.sale_price, })); /* Termékekhez a szolgáltatások betöltése */ $.each(item.services, function(service_index, service) { $('.cart-products-table tbody').append($.tmpl(' ${name} ${price}
${total_price} ', { "service_id" : service.id, "product_id" : item.id, "checked" : service.checked, "name" : service.name, "description" : service.description, "price" : service.price.display.gross_price, "total_price" : service.price.display.sub_price, "quantity" : $.number(item.quantity, 0, '.', ' '), })); $('[data-toggle="tooltip"]').tooltip(); }); }); /* Kosár betöltési aninmáció eltüntetése */ $('.cart-loading').hide(); /* Megfelelő blokkok megjelenítése */ if(data.products.length == 0){ $(".cart-loaded").css("display", "none"); $(".cart-empty").css("display", "block"); }else{ $(".cart-loaded").css("display", "block"); $(".cart-empty").css("display", "none"); } },error:function(){} }); } /* Kosár rendszer vége */ $(document).on("change",".instant_cart_quantity",function() { var var_this = $(this); var prev_count = $(this).data('val'); $.ajax({ type: 'POST', url: '/api/v2/cart/edit', dataType: 'json', data: { product_id: var_this.parent().parent().parent().data('product_id'), quantity: var_this.val(), }, success: function (data) { if(data.success == true){ Swal.fire({ icon: 'success', title: 'Siker!', text: data.message, html: data.message, }); }else{ Swal.fire({ icon: 'error', title: 'Hiba!', text: data.message, html: data.message, }); } cart_loading(); },error:function(){} }); }); /* Termék törlése a kosárból */ $(document).on("click",".cart_remove_product",function() { var cart_remove_this = this; $(cart_remove_this).parent().hide(); $.ajax({ type: 'POST', url: '/api/v2/cart/edit', dataType: 'json', data: { product_id: $(cart_remove_this).data('product_id'), quantity: 0, }, success: function (data) { if(data.success == true){ RemoveFromCart({ id: data.product.id, name: data.product.full_name, brand: data.product.brand, category: data.product.category.full_name, url: data.product.url, image: data.product.images[0], currency: data.product.price.currency, net_price: data.product.price.net_price, gross_price: data.product.price.gross_price, quantity: data.product.quantity, }); Swal.fire({ icon: 'success', title: 'Siker!', text: data.message, html: data.message, }); }else{ Swal.fire({ icon: 'error', title: 'Hiba!', text: data.message, html: data.message, }); } cart_loading(); },error:function(){ $(cart_remove_this).parent().show(); } }); }); $(document).on('keyup', '.add_to_cart_quantity', function(ev){ var max_count = parseInt($(this).attr('max')); var current = parseInt($(this).val()); if(max_count < current){ $(this).val(max_count).change(); } if(current <= 0 || isNaN($(this).val()) == true){ $(this).val(1).change(); } if(isNaN(current) == true){ $(this).val(1).change(); } }); /* Egy termék hozzáadása a kosárhoz */ $(document).on("click",".ajax_add_to_cart",function() { var var_this = this; $(var_this).prop('disabled', true); $(var_this).find('span.loading').removeClass('d-none'); $(var_this).find('i.fa-cart-plus').addClass('d-none'); var additional_products = $.map($('input[name="additional_products[]"]:checked'), function(e,i) { return e.value; }); var qty = 1; if (typeof $('.add_to_cart_quantity').val() !== "undefined") { qty = $('.add_to_cart_quantity').val(); } $.ajax({ type: 'POST', url: '/api/v2/cart/edit', dataType: 'json', data: { additional_products: additional_products, product_id: $(this).data('product_id'), quantity: qty, }, success: function (data) { if(data.success == true){ /* Marketing célra átadni az adatokat */ AddToCart({ id: data.product.id, name: data.product.full_name, brand: data.product.brand, category: data.product.category.full_name, url: data.product.url, image: data.product.images[0], currency: data.product.price.currency, net_price: data.product.price.net_price, gross_price: data.product.price.gross_price, quantity: data.product.quantity, }); Swal.fire({ icon: 'success', title: 'Siker!', text: data.message, html: data.message, showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Kosárhoz', cancelButtonText: 'Vásárlás folytatása' }).then((result) => { if (result.isConfirmed) { window.location.href = "/kosar"; } }); }else{ Swal.fire({ icon: 'error', title: 'Hiba!', text: data.message, html: data.message, }); } cart_loading(); $(var_this).prop('disabled', false); $(var_this).find('span.loading').addClass('d-none'); $(var_this).find('i.fa-cart-plus').removeClass('d-none'); },error:function(){} }); }); $(document).on("change",".cart_change_service",function() { $.ajax({ type: 'POST', url: '/api/v2/cart/service', dataType: 'json', data: { additional_product: $(this).data('service_id'), product_id: $(this).data('product_id'), checked: this.checked, }, success: function (data) { if(data.success == true){ Swal.fire({ icon: 'success', title: 'Siker!', text: data.message, html: data.message, }); }else{ Swal.fire({ icon: 'error', title: 'Hiba!', text: data.message, html: data.message, }); } cart_loading(); },error:function(){} }); }); /* URL paraméter lekérdezés */ function checkResolutionInURL(filter, value) { const url = window.location.href; const urlObj = new URL(url); const params = new URLSearchParams(urlObj.search); const filterValues = params.getAll(filter); const containsResolution = filterValues.includes(value); return containsResolution; } /* Fenti termék kereső */ var timeout_search; $('.searchInput').typeahead({ highlight: true, minLength: 1 }, { limit: 150, async: true, source: function (query, processSync, processAsync) { if (timeout_search) { clearTimeout(timeout_search); } /*timeout_search = setTimeout(function() {*/ SearchBar({"string": query}); return $.ajax({ url: "/kereses-api", type: 'GET', data: {search: query, paginate: 10}, dataType: 'json', success: function (json) { return processAsync(json.products); } }); /*}, 500);*/ }, displayKey: function (data) { return data.full_name; }, templates: { empty: [ 'Nincs találat. ', ].join('\n'), suggestion: function (item) { /*console.log(item);*/ var product_second_image = item.images[0]; if(typeof item.images[1] !== "undefined"){ product_second_image = item.images[1]; } var html = ''; return html; } } }).on('typeahead:asyncrequest', function() { $('.tt-dataset').html('Keresés folyamatban... '); $('.tt-menu').show(); }).on(' typeahead:asyncreceive', function() { }).on('typeahead:selected', function(obj, data){ window.location.href = data.url; }).on('keyup', function(e) { if(e.which == 13) { window.location.href = '/kereses?search='+$(this).val(); } }); /* Termék keresése */ var first_loading = true;