navINIT(); function navINIT() { async function getAllProdouctsIds() { let res = await API_SERVICES_ACTIONS.getAPIService( "apis/v4/bizgaze/integrations/products/getallproducts", true ); if (res.isError) { console.log(res.errorMsg); return; } res = JSON.parse(res.response.result); for (let i = 0; i < res.length; i++) { let curr = res[i]; let productname = curr.productname; let id = curr.productid; // ACCESSORIES switch (productname) { case "Zeno Sleekbook": appendIdNav("zenosleekbook", id); break; case "Zeno Dualbook": appendIdNav("zenodualbook", id); break; case "FYRO Flagship": appendIdNav("fyroflagship", id); break; case "AIO Fyro": // appendIdNav('fyroaio',id); break; case "AIO Zeno": // appendIdNav('zenoaio',id); default: break; } } } function appendIdNav(className, id) { let html = $(`.${className}`).attr("href"); const pattern = /{[^}]+}/g; const replacedString = html.replace(pattern, id); $(`.${className}`).parents(".nav-tab-show").removeClass("d-none"); $(`.${className}`).attr("href", replacedString); } if ( !window.location.href.includes("orderconfirmation") && !window.location.href.includes("/w/") ) { loadCart(); } function loadHelper(src = "./dist/js/utils/helpers.js") { if ($(`script[src="${src}"]`).length > 0) { return new Promise((resolve) => resolve()); } return new Promise(function (resolve, reject) { var s; s = document.createElement("script"); s.src = src; s.onload = resolve; s.onerror = reject; document.head.appendChild(s); }); } async function loadCart() { if (!window.location.href.includes("services/paymentmethod.html")) { let files = ["./dist/js/shoppingcart/addtocart.js"]; await loadHelper(); for (let i = 0; i < files.length; i++) { if ($(`script[src="${files[i]}"]`).length > 0) { continue; } try { await loadHelper(files[i]); } catch (error) { console.log(error); return; } } } setLengthCart(); getAllProdouctsIds(); } let URLNAMENAV = window.location.href; const isTransparent = URLNAMENAV.includes("login") || URLNAMENAV.includes("orderconfirmation") || URLNAMENAV.includes("services/paymentmethod.html"); let nav_html = `
`; $("#navbar-head").html(nav_html); $(".explandlinavnameparent").click(function (e) { let parentElement = $(e.target).parents(".expandlinav"); if ($(parentElement).find(".content-expandlinav").hasClass("d-none")) { const name = $(parentElement).find(".viewall_li").data("name"); $(parentElement) .find(".viewall_li") .html(`view all`); $(parentElement).find(".content-expandlinav").removeClass("d-none"); } else { $(parentElement).find(".viewall_li").html("+"); $(parentElement).find(".content-expandlinav").addClass("d-none"); } }); let width = $(window).width(); if (width <= 576) { $(".success-img.left-block").attr({ width: "250px", height: "250px" }); $(".product_item").addClass("flex-column"); } $(".menu-negative-mrg2,.menu-negative-mrg3,.menu-negative-mrg4").css( "width", width ); let ele_page = $("body").hasClass("product_pg"); if (ele_page == true) { $(".header-area").removeClass("bg-white"); $(".main-menu").find("nav ul li a").addClass("text-white"); $(".header-bottom.sticky-bar").removeClass("sticky-bar"); let src = `../dist/assets/imgs/anwi-logo-2.png`; $(".logo-menu-wrap").find(".logo a img").attr("src", src); $(".main-body").find("iframe").attr("width", width); if (width <= 575 && width >= 390) { $(".main-body").find("iframe").attr({ width: width, height: 236, }); } else if (width <= 390 && width >= 270) { $(".main-body").find("iframe").attr({ width: width, height: 210, }); } else if (width <= 998 && width > 575) { $(".main-body").find("iframe").attr({ width: width, height: 530, }); } else if (width <= 2720 && width > 2300) { $(".main-body").find("iframe").attr({ width: width, height: 1440, }); } else if (width <= 2300 && width > 1921) { $(".main-body").find("iframe").attr({ width: width, height: 1132, }); } else if (width <= 1920 && width > 1620) { $(".main-body").find("iframe").attr({ width: width, height: 1083, }); } else { $(".main-body").find("iframe").attr({ width: width, height: 861, }); } } $("a.ram_data").click(function () { let item_id = $(this).attr("accessories_id"); let loc_path = "/products.html"; if (window.location.pathname.includes(loc_path)) { window.location.href = `?itemid=${item_id}`; } else { window.location.href = `/products.html#itemid=${item_id}`; } }); // $(".main-menu nav ul").find("li").each(function () { // var current = window.location.pathname; // var $this = $(this).find("a"); // if (current != "/") { // if ($this.attr('href').indexOf(current) !== -1) { // $(this).addClass('active_nav'); // } // } // }) // destroy localstorage data let loc_path = "/productdetails.html"; if (window.location.pathname.includes(loc_path) === false) { localStorage.removeItem("product_data"); localStorage.removeItem("top_data"); } let loc_path1 = "/productcatloguedetails.html"; if (window.location.pathname.includes(loc_path1) === false) { localStorage.removeItem("product_catlogue_obj"); } //services pages links and sources let $body_pg = $("body").hasClass("services_page"); let $hm_pg = "../index.html"; let $nav_img = "../dist/assets/imgs/anwi-logo-1.png"; let $footer_img = "../dist/assets/imgs/anwi-logo-2.png"; let $scrool_top_img = "../dist/assets/imgs/Home/rocket-footer.png"; let $about_pg = $("body").hasClass("about_page"); if ($about_pg == true) { $(".main-menu").find("nav ul li a").addClass("text-dark"); let img_src = `./dist/assets/imgs/anwi-logo-1.png`; $(".logo-menu-wrap").find(".logo a img").attr("src", img_src); $(".header-bottom").addClass("sticky-bar stick"); $("body.about_page") .find(".header-large-device") .find(".header-action-wrap") .find(".same-style") .find("svg") .find("path") .attr("fill", "#000"); } let $body_nav = $("body").attr("class"); if ( $body_nav === "support_pg" || $body_nav === "media_page" || $body_nav === "meter_pg" ) { $(".main-menu").find("nav ul li a").addClass("text-dark"); let img_src = `./dist/assets/imgs/anwi-logo-1.png`; $(".logo-menu-wrap").find(".logo a img").attr("src", img_src); $(".same-style").find("svg path").attr("fill", "#000"); } if ($body_pg == true) { $(".header-large-device") .find(".logo-menu-wrap .logo") .find("a") .attr("href", $hm_pg); $(".header-large-device") .find(".logo-menu-wrap .logo") .find("a img") .attr("src", $nav_img); $(".mobile-logo").find("a").attr("href", $hm_pg); $(".mobile-logo").find(".logo a img").attr("src", $nav_img); $("body.services_page") .find(".header-large-device") .find(".header-action-wrap") .find(".same-style") .find("svg") .find("path") .attr("fill", "#000"); $(".main-menu") .find("nav ul") .find("li a") .each(function () { $(this).addClass("text-dark"); $(".header-bottom").addClass("sticky-bar stick"); let $arc = $(this).attr("href"); let $spcial_char = $arc.includes("./"); if ($spcial_char === true) { let $refarence = `.${$arc}`; $(this).attr("href", $refarence); } }); $(".same-style") .find("a") .each(function () { let $arc1 = $(this).attr("href"); let $spcial_char1 = $arc1.includes("./"); if ($spcial_char1 === true) { let $refarence1 = `.${$arc1}`; $(this).attr("href", $refarence1); } }); $(".tab-content") .find("img") .each(function () { let $img_src = $(this).attr("src"); let $img_src1 = $img_src.includes("./"); if ($img_src1 === true) { let $refarenceimg1 = `.${$img_src}`; $(this).attr("src", $refarenceimg1); } }); $(".clickable-mainmenu-wrap") .find("nav ul") .find("li a") .each(function () { let $arc_mbil = $(this).attr("href"); let $spcial_char_mbil = $arc_mbil.includes("./"); if ($spcial_char_mbil === true) { let $refarence_mbil = `.${$arc_mbil}`; $(this).attr("href", $refarence_mbil); } }); } setTimeout(() => { if (width <= 600) { $(".same-style").find("svg path").attr("fill", "#000"); } }, 300); // overview $(".overview").click(function (e) { let name = $(e.target).data("overview"); document.querySelector(name)?.scrollIntoView({ behavior: "smooth", }); }); $(".overviewspecs").click(function (e) { document.querySelector("#specification_data")?.scrollIntoView({ behavior: "smooth", }); }); }