"use strict"; var FPN = { imgs: [], countriesArr: [], q: function(selector) { return document.querySelectorAll(selector); }, check: function(selector) { var x = false; try { selector.forEach(function(element, index, array) { if (document.querySelector(element) !== null) { x = true; return; } }, this); } catch(e) { console.warn(e.message); x = true; } if(x) { return x; } }, smallScreen: function(argument) { if (window.innerWidth <= 1040) { return true; } else { return false; } }, loadCountries: function() { FPN.countriesArr.sort(function(a, b){ if(a.name < b.name) return -1; if(a.name > b.name) return 1; return 0; }); for (var i=0; i"+FPN.countriesArr[i].name+""); } } $("#country").trigger("systemChange"); }, countryClicked: function(countryId) { $("#country option[value='"+countryId+"']").prop("selected", "selected"); $("#country").trigger("change"); } }; $(function() { // function to load jQuery plugins when needed function loadPlugin(url, callback) { var script = document.createElement("script") script.type = "text/javascript"; if (script.readyState){ //IE script.onreadystatechange = function(){ if (script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; callback(); } }; } else { //Others script.onload = function(){ callback(); }; } script.src = url; document.head.appendChild(script); } // multiple plugins - urls in array function loadPlugins(urlsArray, callback) { var loadedCount = 0; var multiCallback = function(){ loadedCount++; if (loadedCount >= urlsArray.length) { // callback.call(this, arguments); callback.call(this, arguments); } }; for (let url of urlsArray) { loadPlugin(url, multiCallback); } } // Load ALWAYS // Mobile menu try { if ($(window).width() < 1000) { $("#navigation").attr("aria-hidden", true); } else { $("#navigation").attr("aria-hidden", false); } $(".menu-hamburger").on("click", function (e) { e.preventDefault(); $("#navigation").toggleClass("visible"); $(".menu-hamburger .fa").toggleClass("fa-bars fa-close"); $(".menu-hamburger").attr("aria-expanded", $("#navigation").hasClass("visible")); $("#navigation").attr("aria-hidden", !$("#navigation").hasClass("visible")); }); } catch(e) { console.warn(e.message); } // Language links try { if($(".language-switch:not(.login-page-switch)").length) { var url = window.location.href.split("/"); if(url.length == 5 && url[4] !== "") { $(".language").each(function(){ $(this).attr("href", $(this).attr("href") + url[4]); }); } else { if(url.length == 4 && url[3] !== "") { $(".language").each(function(){ $(this).attr("href", $(this).attr("href") + url[3]); }); } } } } catch(e) { console.warn(e.message); } // Smooth scroll fix for IE try { if(navigator.userAgent.match(/Trident\/7\./)) { // if IE var body = document.querySelector('body'); smoothScrollFix = function(e) { e.preventDefault(); //scroll without smoothing var wheelDelta = e.wheelDelta; var currentScrollPosition = window.pageYOffset; window.scrollTo(0, currentScrollPosition - wheelDelta); } body.addEventListener('mousewheel', smoothScrollFix, false); } } catch(e) { console.warn(e.message); } // terms and conditions modal popup try { $(".open-modal.open-policy").on("click", function (e) { e.preventDefault(); var url = $(this).attr("href"); $.get(url, function (data) { $("body") .append("") .append(""); $(".modal-overlay").fadeIn(); $(".modal-content").append(data).addClass("visible"); $("body").addClass("no-scroll"); }) .success(function() { iubendaPp(window, document); }); }); $(document).on("click", ".close-modal, .modal-overlay", function (e) { $("body").removeClass("no-scroll"); $(".modal-overlay, .modal-content").fadeOut(300, function (e) { $(".modal-overlay, .modal-content").remove(); }); }); } catch (e) { console.warn(e.message); } // End of Load ALWAYS // HOME PAGE if($(".home-page").length) { var dummyData = [{"pt": "22214E"},{"pt": "FIRSTCC/W33"},{"pt": "24126CC/W33"},{"pt": "3IR25X30X20 INNENRING"},{"pt": "4IR45X50X25 INNENRING"},{"pt": "5IR45X50X25,5 INNENRING"},{"pt": "6IR50X55X35 INNENRING"},{"pt": "7IR60X68X25 INNENRING"},{"pt": "8K 24x30x17s"},{"pt": "LASTRN312EM"}]; // no updates, only load data and start slider function startActivity(sectionObject, data) { var htmlList = ""; // console.log(data); for(var i = 0; i<=data.length-1; i++) { htmlList += "
  • " + data[i].Pt + "
  • "; } $(sectionObject.class).html(htmlList); var opts = sectionObject.options; opts.onSliderLoad = function(){ var parentb = sectionObject.class.replace("bx-", ""); $(parentb).css("visibility", "visible").animate({opacity: 1.0}, 1000); } $(sectionObject.class).bxSlider(opts); // no bxslider solution (leave only 5 items in container!): // $(".bx-offers").find("li:first-of-type").slideUp(300, function(){$(this).remove()}).end().append("
  • next
  • "); // $(".bx-offers").find("li:last-of-type").slideDown(); } // data can be updated in interval - we can use that in the future function updateActivity(sectionObject, data) { var htmlList = ""; var currentSlide = sectionObject.slider.getCurrentSlide(); var dataJ = JSON.parse(data); for(var i = 0; i<=dataJ.length-1; i++) { htmlList += "
  • " + dataJ[i].pt + "
  • "; } $(sectionObject.class).html(htmlList); var opts = sectionObject.options; opts.startSlide = currentSlide; sectionObject.slider.reloadSlider(opts); // no bxslider solution (leave only 5 items in container!): // $(".bx-offers").find("li:first-of-type").slideUp(300, function(){$(this).remove()}).end().append("
  • next
  • "); // $(".bx-offers").find("li:last-of-type").slideDown(); } var searchesData = [{"Pt": "26KAAW21MPX", "Br": "Parker"},{"Pt": "26KATF13MPX", "Br": "Parker"},{"Pt": "26KATF10MPX", "Br": "Parker"},{"Pt": "R422P02636", "Br": "Aventics"},{"Pt": "6560 8", "Br": "Camozzi"},{"Pt": "AS2201F-01-06SA", "Br": "SMC"},{"Pt": "VM106511AB313B", "Br": "Norgren"},{"Pt": "DMM-20-50-P-A", "Br": "FESTO"},{"Pt": "4WREE10V50-2X/G24K31/A1V", "Br": "Bosch Rexroth"},{"Pt": "4WHD10D3X//V", "Br": "Bosch Rexroth"},{"Pt": "PGP511A0270CS4D3NE6E5B1B1", "Br": "Parker"},{"Pt": "VT-DFPE-A-2X/G24K0/2A1E/V-014", "Br": "Bosch Rexroth"},{"Pt": "R910942543", "Br": "Bosch Rexroth"},{"Pt": "CD85N20-40-B", "Br": "SMC"},{"Pt": "CD85N25-200C-B", "Br": "SMC"},{"Pt": "27SFAK13SXN", "Br": "Parker"},{"Pt": "3106 14 00", "Br": "Parker"},{"Pt": "3107 06 00", "Br": "Parker"},{"Pt": "0205 17 00", "Br": "Parker"},{"Pt": "M15LCFX", "Br": "Parker"},{"Pt": "M16SCFX", "Br": "Parker"},{"Pt": "DG17V-3-2C-60 9FR9", "Br": "VICKERS"},{"Pt": "HP-ZDR-6-P-210", "Br": "HYDROPRESS"},{"Pt": "CV1-16V-P-0-5", "Br": "EATON"},{"Pt": "LFR-D-MINI D743 546432", "Br": "FESTO"},{"Pt": "2120400010CP", "Br": "METAL WORK"},{"Pt": "MFH-5/3G-1/4-B 19787", "Br": "FESTO"},{"Pt": "PD34143-0033", "Br": "ORIGA"},{"Pt": "SCE210B055", "Br": "ASCO"}]; function getActivity(sectionObject) { try { $.get(sectionObject.url, function(data) { if(sectionObject.class == ".quantity") { $(sectionObject.class).html(data) $(".parts").css("visibility", "visible").animate({opacity: 1.0}, 1000);; } else if(sectionObject.class == ".bx-searches") { startActivity(sectionObject, searchesData); } else { startActivity(sectionObject, data); } }, "json") .fail(function(e) { if(sectionObject.class == ".quantity") { console.log("Parts counter problem."); } else if(sectionObject.class == ".bx-searches") { startActivity(sectionObject, searchesData); } else { startActivity(sectionObject, dummyData); console.log("Connection problem. Dummy data loaded!"); } }); } catch (e) { console.warn(e.message); } } var bx = { parts: { url: "https://b.bearingnet.net/U.svc/fpc/", class: ".quantity" }, offers: { url: "https://b.bearingnet.net/U.svc/fpo/", class: ".bx-offers", options: { mode: 'vertical', speed: 500, delay: 6000, minSlides: 5, maxSlides: 5, moveSlides: 1, wrapperClass: 'bx-custom-wrapper', auto: true, pager: false, controls: false } }, wanted: { url: "https://b.bearingnet.net/U.svc/fpw/", class: ".bx-wanted", options: { mode: 'vertical', speed: 500, delay: 6000, minSlides: 5, maxSlides: 5, moveSlides: 1, wrapperClass: 'bx-custom-wrapper', auto: true, pager: false, controls: false } }, searches: { url: "https://b.bearingnet.net/U.svc/fps/", class: ".bx-searches", options: { speed: 70000, wrapperClass: 'bx-custom-wrapper', ticker: true } } }; getActivity(bx.parts); try { loadPlugin("//bn.azureedge.net/js/bxslider/jquery.bxslider.min.js", function(e) { // bx.offers.slider = $('.bx-offers').bxSlider(bx.offers.options); // bx.wanted.slider = $('.bx-wanted').bxSlider(bx.wanted.options); // bx.searches.slider = $('.bx-searches').bxSlider(bx.searches.options); getActivity(bx.offers); getActivity(bx.wanted); getActivity(bx.searches); var bxTestimonials = $('.bx-testimonials').bxSlider({ mode: 'horizontal' }); var bxAboutHistory = $('.bx-about-history').bxSlider({ mode: 'fade', pagerCustom: ".switch", controls: false }); }); } catch (e) { console.warn(e.message); } try { $(document).on("click", ".faq-accordion .question:not(.question-active)", function(event) { $(".question-active").next(".answer").slideUp().end().removeClass("question-active"); $(this).addClass("question-active").next(".answer").slideDown(); }); } catch (e) { console.warn(e.message); } try { $(".company-email, .company-name").on("keyup", function(event) { if (event.keyCode === 13) { $(this).parents(".container").find(".first-stage-submit").click(); } }); $(".first-stage-submit").on("click", function (e) { e.preventDefault(); var companyEmail = $(this).parents(".container").find(".company-email").val(); var companyName = $(this).parents(".container").find(".company-name").val(); if (companyEmail) { sessionStorage.setItem("companyEmail", companyEmail); } if (companyName) { sessionStorage.setItem("companyName", companyName); } window.location.href = $(".free-trial").attr("href"); }); } catch (e) { console.warn(e.message); } // Brands chart /* try { loadPlugin("//bn.azureedge.net/js/d3.v4.min.js", function(e) { var svg = d3.select("#brands-chart"), margin = {top: 20, right: 80, bottom: 30, left: 50}, width = svg.attr("width") - margin.left - margin.right, height = svg.attr("height") - margin.top - margin.bottom, g = svg.append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")"); var parseTime = d3.timeParse("%d-%m-%y"); var x = d3.scaleTime().range([0, width]), y = d3.scaleLinear().range([height, 0]), z = d3.scaleOrdinal(d3.schemeCategory10); var line = d3.line() // .curve(d3.curveBasis) .x(function(d) { return x(d.date); }) .y(function(d) { return y(d.count); }); d3.tsv("//bn.azureedge.net/js/test_data/brands.csv", type, function(error, data) { if (error) throw error; var brands = data.columns.slice(1).map(function(id) { return { id: id, values: data.map(function(d) { return {date: d.date, count: d[id]}; }) }; }); x.domain(d3.extent(data, function(d) { return d.date; })); y.domain([ d3.min(brands, function(c) { return d3.min(c.values, function(d) { return d.count; }); }), d3.max(brands, function(c) { return d3.max(c.values, function(d) { return d.count; }); }) ]); z.domain(brands.map(function(c) { return c.id; })); g.append("g") .attr("class", "axis axis--x") .attr("transform", "translate(0," + height + ")") .call(d3.axisBottom(x)); g.append("g") .attr("class", "axis axis--y") .call(d3.axisLeft(y)) .append("text") .attr("transform", "rotate(-90)") .attr("y", 6) .attr("dy", "0.71em") .text("Count"); var brand = g.selectAll(".brand") .data(brands) .enter().append("g") .attr("class", "brand") .attr("data-name", function(d) { return d.id; }) .attr("data-max", function(d) { return d.values[d.values.length - 1].count; }); brand.append("path") .attr("class", "line") .attr("d", function(d) { return line(d.values); }) .style("stroke", function(d) { return z(d.id); }); brand.append("path") .attr("class", "line-hover-area") .attr("d", function(d) { return line(d.values); }) .style("stroke", "transparent") .on('mouseover', function(d) { var coordinates = [0, 0]; coordinates = d3.mouse(this); return chartTooltip.show(d.values[d.values.length - 1].count, coordinates[0], coordinates[1]); }) .on('mousemove', function(d) { var coordinates = [0, 0]; coordinates = d3.mouse(this); return chartTooltip.move(d.values[d.values.length - 1].count, coordinates[0], coordinates[1]); }) .on('mouseout', chartTooltip.hide); brand.append("text") .datum(function(d) { return {id: d.id, value: d.values[d.values.length - 1]}; }) .attr("transform", function(d) { return "translate(" + x(d.value.date) + "," + y(d.value.count) + ")"; }) .attr("x", 3) .attr("dy", "0.35em") .style("font", "12px sans-serif") .text(function(d) { return d.id; }); }); var chartTooltip = { visible: 'false', show: function(amount, x, y) { //console.log(amount, x, y); $("#chart-tooltip .brand-amount").text(amount); $("#chart-tooltip").css({ transform: "translate("+x+"px, "+y+"px)" }); svg.attr("class", "highlight-brand"); }, move: function(amount, x, y) { // console.log(amount, x, y); $("#chart-tooltip .brand-amount").text(amount); $("#chart-tooltip").css({ transform: "translate("+x+"px, "+y+"px)" }); svg.attr("class", "highlight-brand"); }, hide: function() { svg.attr("class", ""); } }; function tooltip(argument) { // body... } function type(d, _, columns) { d.date = parseTime(d.date); for (var i = 1, n = columns.length, c; i < n; ++i) d[c = columns[i]] = +d[c]; return d; } function updateData() { // // Get the data again // svg.selectAll(".brand") // // Make the changes // svg.select(".line") // change the line // .duration(750) // .attr("d", valueline(data)); } }); } catch(e) { console.warn(e.message); } */ // End of Brands chart } // End of HOME PAGE // LOGIN PAGE // password-reset-page if($(".login-page, .password-reset-page").length) { $("input").on("keyup", function(event) { if (event.keyCode === 13) { $(this).parents(".container").find('input[type="submit"]').click(); } }); } // End of LOGIN PAGE // end of password-reset-page // MEMBERS LIST // Page if ($("#map-members-list").length) { // http://bn.azureedge.net/js/test_data/members-list.json // $.getJSON('http://wh.bearingnet.net/Home/getmlf', function(data) { // FPN.companiesJsonData = data; // $("#country").trigger("systemChange"); // }); function getCompaniesByCountryId(countryId) { try { var result = $.grep(FPN.companiesJsonData, function(e){ return e.id == countryId; }); return result[0]; } catch(e) { console.log("getML not loaded."); } } function getCompaniesByName(companyName) { var result = []; for(i=0; i=0) { // console.log(FPN.companiesJsonData[i].list[j]); result.push(FPN.companiesJsonData[i].list[j]); } } } return result; } $(document).on("change systemChange", "#country", function (e) { // $("#company-name-filter").val(""); try { var currentCountry = getCompaniesByCountryId($(this).val()); // console.log(getCompaniesByCountryId($(this).val()); $("#members-list-header").text(currentCountry.name); $("#members-list-flag").prop("src", currentCountry.flag); $("#members-list").html(""); $("#members-list").html("
  • "+currentCountry.list.join("
  • ")+"
  • "); if(e.type != "systemChange") { $('html, body').animate({ scrollTop: $("#country").offset().top - 120 }, 1000); } } catch(e) { console.log("ML not loaded."); } }); // $(document).on("keyup", "#company-name-filter", function (e) { // if($(this).val().length >=3) { // console.log($(this).val()); // var filteredCompanies = getCompaniesByName($(this).val()); // console.log(filteredCompanies); // $("#members-list").html("
  • "+filteredCompanies.join("
  • ")+"
  • "); // } // }); } // D3 - Members list map if($(".members-list-map").length) { try { var width = 1142, height = 500, radius = 3.546, dx = radius * 2 * 7 * 2 * Math.sin(Math.PI / 3), dy = radius * 2 * 11 * 1.5, centered, active = null, zoomScale = 1, fontSize = ".25em", pointLocation, pointsOn = false, maxlat = 83; var color; var zoom = d3.behavior.zoom() .size([width, height]); var projection = d3.geo.equirectangular() .rotate([-11, 0]) .scale((width + 1) / 2 / Math.PI) .translate([width / 2, (height / 2)+40]) .precision(.1); // Different // var projection = d3.geo.mercator() // .scale((width + 1) / 2 / Math.PI) // .translate([width / 2, (height / 2) + 40]) // .precision(.1); var path = d3.geo.path().projection(projection); // var transform = d3.geo.transform({point: projectPoint}); // var d3path = d3.geo.path().projection(transform); var graticule = d3.geo.graticule(); if(document.getElementsByTagName('form').length) { var svg = d3.select("form").append("svg") .attr("width", width) .attr("height", height); } else { var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height); } var g = svg.append("g"); var mapGroup = g.append('g'); var arcGroup = g.append('g'); var sonarGroup = g.append('g'); var imageGroup = g.append('g'); // GRID // svg.append("path") // .datum(graticule) // .attr("class", "graticule") // .attr("d", path); // var div = d3.select("body").append("div").attr("class", "map-tooltip"); var mapTooltip = d3.select('body').append('div').attr('class', 'map-tooltip'); d3.json("//bn.azureedge.net/js/test_data/world-topo-min.json", function(error, world) { if (error) throw error; var countries = topojson.feature(world, world.objects.countries).features, neighbors = topojson.neighbors(world.objects.countries.geometries); mapGroup.selectAll("path") .data(countries) .enter().insert("path", ".graticule") .attr("class", function(d, i) { return "country" + " country" + i; }) .attr("data-name", function(d, i) { return d.properties.name; }) .attr("d", path) .style("fill", "#535353"); // #535353 // Hover & Tooltip mapGroup.selectAll("path") .on("mouseenter", showTooltip) .on("mousemove", moveTooltip) .on("mouseleave", hideTooltip) .on("click", showCountry); mapGroup.insert("path", ".graticule") .datum(topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; })) .attr("class", "boundary") .attr("stroke-width", .2) .attr("d", path); // Start drawing data drawing(); }); var amount; function drawing() { // colour countries // http://bn.azureedge.net/js/test_data/members-list.json d3.json("//wh.bearingnet.net/Home/getmlf", function(error, data) { if (error) throw error; window.parent.FPN.companiesJsonData = data; var el, max = 0, errorShown = false; for(var i=0; i < data.length; i++) { if (data[i].companies > max) { max = data[i].companies; } window.parent.FPN.countriesArr[i] = {"id" : data[i].id, "name" : data[i].name}; if (i == data.length - 1) { window.parent.FPN.loadCountries(); } } // color = d3.scale.linear().domain([0, max]).range(['#00bcdf', '#007186']); for(var i=0; i < data.length; i++) { if(data[i].id !== null) { el = document.querySelector(".country" + data[i].id); // el.dataset = {}; el.dataset.id = data[i].id; el.dataset.companies = data[i].companies; el.dataset.parts = data[i].parts; if(data[i].companies < 35) { el.style.fill = "#ff5722"; try { el.classList.add('fewer35members'); } catch(e) { if(!errorShown) { console.warn("ClassList of SVG not supported."); errorShown = true; } } } else { el.style.fill = "#ff5722"; try { el.classList.add('more35members'); } catch(e) { if(!errorShown) { console.warn("ClassList of SVG not supported."); errorShown = true; } } } // el.style.fill = color(data[i].companies); } } }); } var textLine1 = "", textLine2, companiesCount = 0; function showTooltip(){ if ((typeof d3.select(this)[0][0].dataset !== "undefined") && (typeof d3.select(this)[0][0].dataset.companies !== "undefined")) { companiesCount = d3.select(this)[0][0].dataset.companies; textLine2 = "
    (" + companiesCount + " companies)"; mapTooltip.classed('tooltip-nomembers', false); } else { companiesCount = 0; textLine2 = ""; mapTooltip.classed('tooltip-nomembers', true); } textLine1 = d3.select(this).attr("data-name"); d3.select(this) .attr('fill-opacity','0.8'); mapTooltip.classed('tooltip-active', true).html(textLine1 + textLine2); } function moveTooltip(){ var mouse = d3.mouse(svg.node()).map(function(d) { return parseInt(d); }); var marLeft, posTop, tooltipWidth = parseInt(mapTooltip.style("width")) + 30, tooltipHeight = parseInt(mapTooltip.style("height")) + 20; if(mouse[0] > parseInt(svg.style("width")) - tooltipWidth - 35) { marLeft = parseInt(svg.style("width")) - parseInt(mouse[0]) - tooltipWidth - 35; console.log(tooltipWidth); } else { marLeft = 0; } if(mouse[1] < tooltipHeight + 25) { posTop = 5; } else { posTop = mouse[1] - tooltipHeight - 20; } mapTooltip.attr('style', 'left:' + (mouse[0] + 20) + 'px; top:' + posTop + 'px; margin-left:' + marLeft + 'px'); } function hideTooltip(){ d3.select(this) .attr('fill-opacity','1'); mapTooltip.classed('tooltip-active', false); } function showDesc(country, data) { if(data !== undefined) { document.querySelector("#country-desc").style.display = "block"; document.querySelector("#country-desc .country").innerText = country; document.querySelector("#country-desc .companies span").innerText = data.companies; document.querySelector("#country-desc .brands span").innerText = data.brands; document.querySelector("#country-desc .parts span").innerText = data.parts; } else { document.querySelector("#country-desc").className = "empty"; } } function hideDesc() { document.querySelector("#country-desc").style.display = "none"; document.querySelector("#country-desc").className = null; document.querySelector("#country-desc .country").innerText = null; } function randomize(min, max) { Math.floor((Math.random() * min) + max); } function translateCircle(datum, index) { return "translate(" + projection([datum[0].lon, datum[0].lat]) + ")"; } function sonar(sp, text){ sonarGroup.append("circle") .attr("class", "ring") .attr("transform", translateCircle(sp)) .attr("r", 2) .attr("fill", "#00abd9") .attr("fill-opacity", 1); } function showAmount(amount, sp){ sonarGroup.append("text") .text("10") .attr("text-anchor", "middle") .attr("class", "search-text") .attr("transform", translateCircle(sp)) .attr("font-size", "1em") .attr("fill", "#00abd9") .attr("fill-opacity", 1); } function showCountry(){ if(typeof d3.select(this)[0][0].dataset !== "undefined") { var countryId = d3.select(this)[0][0].dataset.id; window.parent.FPN.countryClicked(countryId); } } d3.select(self.frameElement).style("height", height + "px"); } catch (e) { console.warn(e.message); } } // End of MEMBERS LIST // FREE TRIAL FORM if($(".free-trial-page").length) { try { loadPlugin("//bn.azureedge.net/js/select2/js/select2.min.js", function(e) { $(".chips-select").select2({ placeholder: "Brands you can supply", tags: true, tokenSeparators: [',', ' '] }); }); } catch (e) { console.warn(e.message); } try { $(document) .on("change", ".checkbox", function(e) { $(this).parent("label").toggleClass("checked", $(this).is(":checked")); }) .on("change", "#MainContent_FileUpload1, #stockUpload, #FileUpload1", function(e) { var fileName = $(this).val().split("\\"); $(".file-name").text(fileName.slice(-1).pop()); $(".file-info").slideDown(); $(".remove-file").fadeIn(); }) .on("click", ".remove-file", function(e) { $("#stockUpload").val(""); $(this).fadeOut(); $(".file-info").slideUp(); $(".file-name").text(""); }) .on("keyup", "input", function(event) { if (event.keyCode === 13) { $(this).parents(".container").find('.form-submit-btn').click(); } }); try { var companyEmail = sessionStorage.getItem("companyEmail") || null; var companyName = sessionStorage.getItem("companyName") || null; if (companyEmail) { $(".e-mail input").val(companyEmail); } if (companyName) { $(".company-name input").val(companyName); } sessionStorage.removeItem("companyEmail"); sessionStorage.removeItem("companyName"); } catch (e) { console.warn(e.message); } } catch (e) { console.warn(e.message); } } // FREE TRIAL FORM });