var mobile = function detectmob(){ if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i) ){ return true; } else { return false; } }(); var lockSend = false; var music; $(window).load(function () { $("html").addClass("loaded"); setTimeout(function () { $(".preloader").remove(); }, 1500); }); $(document).ready(function () { var href = window.location.href; if ( href.length > 0 ) { console.log(slug); var slug = href.split( '/pl/')[1]; if ( slug != undefined ) { var slug2 = slug.split( '/' )[1]; if ( slug2 != undefined ) { var slug3 = slug2.split( '.html' ); if ( slug3 != undefined ) { $( 'body' ).addClass( slug3[0] ); } } } } // aquascreen var as_link; var as_txt; if ( $('body').hasClass('langpl') ) { as_link = 'broszura_pl'; as_txt = 'pobierz ulotkę informacyjną'; } else if ( $('body').hasClass('langen') ) { as_link = 'broszura_eng'; as_txt = 'download the leaflet'; } else if ( $('body').hasClass('langde') ) { as_link = 'broszura_de'; as_txt = 'flyer herunterladen'; } else { as_link = 'broszura_ros'; as_txt = 'скачать флаер'; } if ( $('.introIn h1').text() === 'aquascreen' ) { $('.intro p:first-of-type').append('' + as_txt + ''); } // polimery $(".polimery").click(function (event) { $(".cbPopup.cbPolimery").addClass("shown"); $(".newsletterOverlay").removeClass("hide"); $("html").addClass("popupOpened"); event.preventDefault(); }); $(".cbPopup.cbPolimery").append(''); $(".cbPopup.cbPolimery .cbPopupBottom").niceScroll({ mousescrollstep: 20, cursorborder: 0, cursorborderradius: 0, cursorcolor: "#909090", background: "#ddd", cursoropacitymin: 1, cursoropacitymax: 1, autohidemode: false }); $(".cbPopup.cbPolimery .cbPopupClose").click(function (event) { $(this).parent(".cbPopup").removeClass("shown"); $(".newsletterOverlay").addClass("hide"); $("html").removeClass("popupOpened"); event.preventDefault(); }); // popup $('.cbPopup:not(.cbPolimery) .cbPopupTop').each(function(){ var src = $(this).children('img').attr('src'); $(this).css({ 'background':'url('+src+') center top no-repeat', 'background-size':'cover' }); $(this).children('img').remove(); }); if(mobile){ $('.logistykaBlock').prependTo('.contactLeft'); $('.dirButton').remove(); }else{ $('.dirButton2').remove(); } $("#form-newsletter").submit(function () { $(".news_komunikat").hide(); $(".news_komunikat_agree").hide(); var hasError = false; var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; var checkbox = $(this).find(".agree input").prop('checked'); var emailaddressVal = $(this).find("#form_email").val(); console.log(checkbox); if (checkbox == false){ $(this).siblings(".news_komunikat_agree").fadeIn().html('Zaznacz pole zgód.'); hasError = true; } if (emailaddressVal == '') { $(this).siblings(".news_komunikat").fadeIn().html('Wpisz swój adres e-mail.'); hasError = true; } else if (!emailReg.test(emailaddressVal)) { $(this).siblings(".news_komunikat").fadeIn().html('Sprawdź poprawność adresu.'); hasError = true; } var form = $(this); if (hasError == false) { $.ajax({ type: this.method, url: this.action, data: $(this).serialize(), success: function (data) { form.fadeOut(); form.siblings(".news_komunikat").fadeIn().html(data); }, error: function (data) { console.log(data); form.show(); form.siblings(".news_komunikat").fadeIn().html(data); } }); } return false; }); $('body').find('*').not('script').contents().filter(function () { return this.nodeType === 3; }).each(function () { var newTxt = $(this).text().replace("Plastica Sp. z o.o.", "Plastica Sp. z o.o."); newTxt = newTxt.replace("Plastica Sp. z o. o.", "Plastica Sp. z o. o."); newTxt = newTxt.replace("TZMO SA", "TZMO SA"); newTxt = newTxt.replace(/ ([wzoiau]{1}|aby) /ig, ' $1 ');//ipad problem   $(this).replaceWith(newTxt); }); $('.siteMapItem a:contains("B+R")').each(function(){ var txt = $(this).text(); txt = txt.replace("B+R", 'B+R'); $(this).html(txt); }); var wHeight = $(window).height(); var wWidth = $(window).width(); // minigaleria /*$('.newsContent .tinyContent img').each(function(){ var u = $(this).attr('src'); $(this).wrap(''); $(this).attr({ 'src':u.replace('aktualnosci','aktualnosci_thumb'), 'width':'', 'height':'' }); });*/ $('.tinyContent a[href]').filter(function() { return /(.jpg|.gif|.png)$/.test($(this).attr('href')) }).attr('data-gallery', ''); // formatowanie tekstu $(".halfPic .hpIn h2, .halfPic .hpIn h2 *").replaceText(/\b \b/gi, ""); // ie detect var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE"); if ($.browser.msie) { $(".body").addClass("ie"); } // formularz kontaktowy $('.contactRight form').submit(function () { if (lockSend) return false; var ok = true; var checkbox_contact = $(this).find("#agree_form").prop('checked'); if ($('#form_name').val() == '' || $('#form_name').val().length < 5) { $('#form_name').addClass('error'); ok = false; } else { $('#form_name').removeClass('error'); } if (checkbox_contact == false){ $('#agree_form').addClass('error'); ok = false; } else { $('#agree_form').removeClass('error'); } if (!validateEmail($('#form_email').val())) { $('#form_email').addClass('error'); ok = false; } else { $('#form_email').removeClass('error'); } if ($('#form_content').val().length < 10) { $('#form_content').addClass('error'); ok = false; } else { $('#form_content').removeClass('error'); } if (ok) { lockSend = true; $('.contactSubmit').val('wysyłanie...'); $.ajax({ type: "POST", url: "ajax.php", data: { akcja: 'kontakt', name: $('#form_name').val(), email: $('#form_email').val(), phone: $('#form_phone').val(), subject: $('#form_subject').val(), content: $('#form_content').val(), captcha: $('#form_captcha').val(), }, success: function (data) { lockSend = false; if (data.wynik == 'OK') { $('.contactRight form').remove(); $('.contactRight p').after('

Wiadomość została wysłana.

'); } else { $('.contactRight form').remove(); $('.contactRight p').after('

Wystąpił problem podczas wysyłania wiadomości.

'); } }, error: function (error) { lockSend = false; }, dataType: 'json' }); } return false; }); // scrollbar /*$("html").niceScroll({ mousescrollstep: 60, cursorborder:0, cursorborderradius:0, cursorcolor:"#909090", background:"#ddd", cursoropacitymin:1, cursoropacitymax:1 });*/ // cookies $(".cookieClose").click(function (event) { $("#cookiesBox").addClass("closed"); $.cookie("cookieAlertPlastica", "dontShow", {expires: 365, path: '/'}); event.preventDefault(); return false; }); //if (wHeight <= 768) { if ($.cookie("cookieAlertPlastica")) { $("#cookiesBox").remove(); } else { $("#cookiesBox").css("display", "block"); } //} // newsletter $(".nlBottomBtn").click(function (event) { $(".newsletterOverlay").removeClass("hide"); $(".newsletterPopup").removeClass("hide"); event.preventDefault(); }); $(".nlClose").click(function (event) { $(".newsletterOverlay").addClass("hide"); $(".newsletterPopup").addClass("hide"); event.preventDefault(); }); // layout if ($(".homeContent").length > 0) { if (wWidth <= 1024) { mobCircles(); $(".bgDots").remove(); } else { homeAnim(); } $("body").addClass("home"); } else { setTimeout(function () { $("body").addClass("noHome"); $("#top, #footer").addClass("shown"); }, 0); } if (wHeight <= 768) { $(".homeContent").css("height", $(window).height() - 70 - $("#footer").height() - 1 + "px"); } else { $(".homeContent").css("height", $(window).height() - 123 + "px"); } $(window).resize(function () { if (wHeight <= 768) { if ($(".sProd").length > 0) { $(".sProd .intro").css("height", $(window).height() - 70 + "px"); } $(".homeContent").css("height", $(window).height() - 70 - $("#footer").height() - 1 + "px"); } else { if ($(".sProd").length > 0) { $(".sProd .intro").css("height", $(window).height() - 83 + "px"); } $(".homeContent").css("height", $(window).height() - 123 + "px"); } }); // mapa Google var vectorSource = new ol.source.Vector({}); var places = [ [18.912672, 53.163472, 'img/marker.png'], ]; var features = []; for (var i = 0; i < places.length; i++) { var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(ol.proj.transform([places[i][0], places[i][1]], 'EPSG:4326', 'EPSG:3857')), }); var iconStyle = new ol.style.Style({ image: new ol.style.Icon({ anchor: [0.5, 0.5], anchorXUnits: 'fraction', anchorYUnits: 'fraction', src: places[i][2], color: places[i][3], crossOrigin: 'anonymous', }) }); iconFeature.setStyle(iconStyle); vectorSource.addFeature(iconFeature); } var vectorLayer = new ol.layer.Vector({ source: vectorSource, updateWhileAnimating: true, updateWhileInteracting: true, }); var map = new ol.Map({ target: 'gMap', layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }), vectorLayer ], view: new ol.View({ center: ol.proj.fromLonLat([18.912672, 53.163472]), zoom: 9 }), loadTilesWhileAnimating: true }); /*$(".contactTop a.dirButton").click(function (event) { $(".contactTop, .contactLeft, .contactRight, .mapOverlay").css("display", "none"); $(".dojazdCont").css("display", "block"); event.preventDefault(); }); $(".dirInput").keyup(function (event) { if (event.keyCode == 13) { $("#gMap").gmap3({ getroute: { options: { origin: $(".dirInput").val(), destination: [53.166918, 18.913073], travelMode: google.maps.DirectionsTravelMode.DRIVING }, callback: function (results) { if (!results) return; $(this).gmap3({ map: { options: { center: [53.163472, 18.912672], zoom: 6, } }, directionsrenderer: { container: $("#directions"), options: { directions: results } } }); } } }); return false; } return false; event.preventDefault(); }); $(".dirBack").click(function (event) { if (wWidth <= 768) { $(".contactTop, .contactLeft, .contactRight").css("display", "block"); } else { $(".mapOverlay").css("display", "block"); $(".contactLeft, .contactRight").css("display", "table-cell"); //$(".contactTop").css("display", "table"); } $(".dojazdCont").css("display", "none"); $("#gMap").gmap3({ map: { options: { center: [53.163472, 18.912672], zoom: 8, mapTypeId: google.maps.MapTypeId.ROADMAP, disableDefaultUI: true, styles: [ { "stylers": [ {"saturation": -100} ] } ] } }, marker: { latLng: [53.166918, 18.913073], options: { icon: "img/marker.png", draggable: false } } }); event.preventDefault(); });*/ if ($(".contactMap").length > 0) { $("html").addClass("contact"); } $(".formField").click(function () { $(this).find("label").css("opacity", 0); $(this).find("label.agree").css("opacity", 1); }); $("body").click(function (e) { if (e.target !== 'label' || e.target !== 'input' || e.target !== 'textarea' || e.target.class !== 'formField' ) { //console.log("xxx"); } }); // mapa strony var $siteMap = $('.siteMap'); $siteMap.imagesLoaded(function () { $siteMap.masonry({ itemSelector: '.siteMapItem' }); }); // oferta if (wWidth > 1024) { $(".olItem:nth-child(even)").each(function () { $(this).find("div:first-child").detach().insertAfter($(this).find("div:last-child")); }); } $(".halfPic").each(function () { var _this = $(this); if (_this.find(".halfPicRight img").length > 0) { _this.find(".halfPicRight").addClass("hasImg"); } if (_this.find(".halfPicLeft img").length > 0) { _this.find(".halfPicLeft").addClass("hasImg"); } }); $(window).resize(function() { $(".halfPic").each(function () { var _this = $(this); if (_this.find(".halfPicRight img").length > 0) { _this.find(".halfPicRight").addClass("hasImg"); } if (_this.find(".halfPicLeft img").length > 0) { _this.find(".halfPicLeft").addClass("hasImg"); } }); }); if ($(".sProd").length > 0) { var prodClass = $(".sProd").attr("class").split("sProd prod"); $("#prodNav ul li.pn" + prodClass[1]).css("display", "none"); if (wHeight <= 768) { $(".sProd .intro").css("height", $(window).height() - 70 + "px"); $('').appendTo(".intro"); } else { $(".sProd .intro").css("height", $(window).height() - 83 + "px"); $('').appendTo(".intro"); $("#dots").hide(); } $(".scrollDown").live('click', function () { console.log("ads"); $("html, body").animate({ scrollTop: $(".row:first-child").next().offset().top }, 2000, function () { $("body").off("mousewheel"); }); return false; }); $(".sProd .row").each(function (index) { if (index == 0) { } else { if ($(this).find(".display > div").hasClass("halfPic")) { if ($(this).find(".display > div.halfPic .halfPicLeft img").length > 0) { $(this).find(".display > div").prepend('
'); } else { $(this).find(".display > div").prepend('
'); } } else if ($(this).find(".cbPopup").length > 0) { } else { if ($(this).find(".colorPic").length > 0) { $(this).find(".colorPicText").prepend('
'); } else { $(this).find(".display > div").prepend('
'); } } } }); $(".num").each(function (index) { $(this).text("").text(index + 1); }); $(".cbPopup:not(.cbPolimery)").append(''); $(".cbPopupBottom").niceScroll({ mousescrollstep: 20, cursorborder: 0, cursorborderradius: 0, cursorcolor: "#909090", background: "#ddd", cursoropacitymin: 1, cursoropacitymax: 1, autohidemode: false }); $('.newsletterOverlay, .cbPopupTop').bind('mousewheel DOMMouseScroll', function (event) { var delta = event.originalEvent.wheelDelta || event.originalEvent.detail; $('.cbPopup.shown .cbPopupBottom').getNiceScroll().doScrollPos(0, $('.cbPopup.shown .cbPopupBottom').scrollTop() - delta); }); if (wWidth <= 768 || wHeight <= 800) { setTimeout(function () { $(".cbPopupBottom").css({ 'height': $(window).height() / 2 - 60 + "px" }); $("#ascrail2001").css({ "top": $(".cbPopupTop").height() + $(".cbPopup").css("top") }); }, 500); } $('.newsletterOverlay').click(function () { $(".cbPopup.shown .cbPopupClose").click(); }); $(".halfMore").click(function (event) { $(this).closest(".row").next(".row").find(".cbPopup").addClass("shown"); $(".newsletterOverlay").removeClass("hide"); $("html").addClass("popupOpened"); event.preventDefault(); }); $(".cbPopupClose").click(function (event) { $(this).parent(".cbPopup").removeClass("shown"); $(".newsletterOverlay").addClass("hide"); $("html").removeClass("popupOpened"); event.preventDefault(); }); $(".halfPic h2 a").click(function (event) { $(this).closest(".hpIn").find(".halfMore").trigger("click"); $("html").addClass("popupOpened"); event.preventDefault(); }); } // mobile $(".mobMenu").click(function (event) { if ($("body").hasClass("mobActive")) { $("body").removeClass("mobActive"); } else { $("body").addClass("mobActive"); } event.preventDefault(); }); $(".slideOverlay").click(function () { $("body").removeClass("mobActive"); }); $(".slideMenu").niceScroll({ mousescrollstep: 60, cursoropacitymax: 0 }); // inne if ($(".subShortIn").html() == "") { $(".subShortTxt").addClass("newsSubShort"); } if ($(".docContent").length > 0) { $(".subShortIn").html(""); $(".subShortTxt").addClass("newsSubShort"); } // kariera if ( $(".soLeft > h1 span:contains('dołącz do nas')").length > 0 || $(".soLeft > h1 span:contains('dołącz do nas')").length > 0 ) { $("body").addClass("firstOffer"); } // muzyczka if ($(".homeContent").length > 0 && wWidth > 1024) { music = new buzz.sound("music/preview.mp3", { preload: true, autoplay: false, loop: true, volume: 3 }); setTimeout(function () { music.fadeTo(25, 10000).play(); }, 1); $(".musicToggle").toggle(function () { music.pause(); }, function () { music.play(); }); } else { $(".musicToggle").remove(); } if (wHeight <= 768 && $(".sProd").length > 0) { $("#dots").hide(); } // praca var ostCount = parseInt($(".ostCount").text()); $(".ostCount").text(ostCount - 1); // kontakt select $('.dzial-select').on( 'click tap', function() { $('.clientServList').toggleClass('shown'); }); $('.clientServList li').on( 'click tap', function() { $(".dzial-select option[value='" + $(this).attr('data-select') + "']").attr('selected', 'selected').siblings().removeAttr('selected'); $('.clientServList').toggleClass('shown'); console.log($(this).attr('data-select')); }); }); $(window).load(function () { // lista dokumentów var $container = $('#docList'); $container.imagesLoaded(function () { $container.masonry({ itemSelector: '.item' }); }); $("#docList .item").each(function (index) { $(this).css("z-index", index); }); }); function homeAnim() { setTimeout(function () { $(".cb1").addClass("shown"); }, 1500); setTimeout(function () { $(".kDots, .linesBold").addClass("shown firstAnim"); }, 2000); setTimeout(function () { $(".kDots").removeClass("firstAnim"); }, 6000); setTimeout(function () { $(".kDots").addClass('pulseAnim'); }, 8000); setTimeout(function () { $(".cb2, .cb3, .cb4, .cb5, .cb6, .cb7, .cb8, .cb9").addClass("shown"); }, 3000); setTimeout(function () { $(".circlesSmall, .shadow").addClass("shown"); }, 5000); setTimeout(function () { $(".linesNormal").addClass("shown"); }, 5500); setTimeout(function () { $("#top, #footer").addClass("shown"); }, 5500); setTimeout(function () { $("li.cb1 span").addClass("shown"); }, 7500); $(".cb2, .cb3, .cb4, .cb5, .cb6, .cb7, .cb8, .cb9, .cs9").hover(function () { $(this).css({ "transition-delay": '0', "transform": "scale(1.1)", "transition": "all 300ms ease" }); }, function () { $(this).css({"transform": ''}); }); } function mobCircles() { setTimeout(function () { $(".cb1").addClass("shown"); }, 0); setTimeout(function () { $(".kDots, .linesBold").addClass("shown firstAnim"); }, 0); setTimeout(function () { $(".kDots").removeClass("firstAnim"); }, 0); setTimeout(function () { $(".kDots").addClass('pulseAnim'); }, 0); setTimeout(function () { $(".cb2, .cb3, .cb4, .cb5, .cb6, .cb7, .cb8, .cb9").addClass("shown"); }, 0); setTimeout(function () { $(".linesNormal").addClass("shown"); }, 7000); setTimeout(function () { $("#top, #footer, li.cb1 span").addClass("shown"); }, 0); $(".cb2, .cb3, .cb4, .cb5, .cb6, .cb7, .cb8, .cs9, .cb9").hover(function () { $(this).css({ "transition-delay": '0', "transform": "scale(1.1)", "transition": "all 300ms ease" }); }, function () { $(this).css({"transform": ''}); }); } function validateEmail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); }