Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
29 kB
6
Indexable
Never
(function () {
  try {
    var debug = 1;
    var variation_name = "";
    var cutIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"></path></svg>';
    var arrwIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M224 416c-8.188 0-16.38-3.125-22.62-9.375l-192-192c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L224 338.8l169.4-169.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-192 192C240.4 412.9 232.2 416 224 416z"></path></svg>';
    var searchIcon = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 51.539 51.361" enable-background="new 0 0 51.539 51.361" xml:space="preserve"><path fill="#bfa364" d="M51.539,49.356L37.247,35.065c3.273-3.74,5.272-8.623,5.272-13.983c0-11.742-9.518-21.26-21.26-21.26 S0,9.339,0,21.082s9.518,21.26,21.26,21.26c5.361,0,10.244-1.999,13.983-5.272l14.292,14.292L51.539,49.356z M2.835,21.082 c0-10.176,8.249-18.425,18.425-18.425s18.425,8.249,18.425,18.425S31.436,39.507,21.26,39.507S2.835,31.258,2.835,21.082z"></path></svg>';
    var menuBnrMobHTML = '' +
      '  <div class="egNwMbMenu_hdr_bnr">' +
      '      <a class="egNwMbMenu_hdr_bnr-lnk">' +
      '          <img src="https://www.naturaforce.com/wp-content/uploads/2022/11/NAF-website-packshot-allpages-1200x1200-2023-pack-ANTI-STRESS.jpg" alt="">' +
      '      </a>' +
      '  </div>';

    // COMPLEMENTS ALIMENTAIRES USED
    var mobSliderHTML = '' +
      '  <div class="egNwMbMenu_bdy_slider">' +
      '      <h2 class="egNwMbMenu_bdy_slider-title">Compléments alimentaires</h2>' +
      '      <div class="egNwMbMenu_bdy_slider-wpr">' +
      '          <ul class="egNwMbMenu_bdy_slider-slider">' +
      '              <!-- slider item 1 -->' +
      '              <a href="https://www.naturaforce.com/categorie-produit/complements-alimentaires/complexes/" class="egNwMbMenu_bdy_slider-item">' +
      '                  <img src="https://www.naturaforce.com/wp-content/uploads/2023/10/1-NAF-website-packshot-allpages-1200x1200-2023-complexe-sommeil-face-768x768.jpg">' +
      '                  <span>Complexes</span>' +
      '              </a>' +
      '              <!-- slider item 2 -->' +
      '              <a href="https://www.naturaforce.com/categorie-produit/complements-alimentaires/essentiels/" class="egNwMbMenu_bdy_slider-item">' +
      '                  <img src="https://www.naturaforce.com/wp-content/uploads/2021/11/1-NAF-website-packshot-allpages-1200x1200-2023-collagene-marin-face-620x620.jpg">' +
      '                  <span>Essentiels</span>' +
      '              </a>' +
      '              <!-- slider item 3 -->' +
      '              <a href="https://www.naturaforce.com/categorie-produit/complements-alimentaires/plantes/" class="egNwMbMenu_bdy_slider-item">' +
      '                  <img src="https://www.naturaforce.com/wp-content/uploads/2015/01/1-NAF-website-packshot-allpages-1200x1200-2023-ginseng-face-620x620.jpg">' +
      '                  <span>Plantes</span>' +
      '              </a>' +
      '              <!-- slider item 4  -->' +
      '              <a href="https://www.naturaforce.com/categorie-produit/complements-alimentaires/vitamines-mineraux/" class="egNwMbMenu_bdy_slider-item">' +
      '                  <img src="https://www.naturaforce.com/wp-content/uploads/2021/11/1-NAF-website-packshot-allpages-1200x1200-2023-vitamineC-face-620x620.jpg">' +
      '                  <span>Vitamines & Minéraux</span>' +
      '              </a>' +
      '          </ul>' +
      '      </div>' +
      '  </div>';
    var gensubstgHtml = function (data) {
      var html = data.reduce(function (t, crr) {
        return t += '' +
          '<li class="egNwMbMenu_bdy_menuitems_itm"> <a class="egNwMbMenu_bdy_menuitems_itm_link" href="' + crr.lnk + '">' + crr.txt + '</a>' +
          '      </li>';
      }, '');
      return html;
    }
    var menudata = {
      "nutristgdata": {
        "1": [
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/graines-de-chia-bio-500-g/",
            "txt": "Graines de chia bio"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/poudre-de-banane-bio-300-g/",
            "txt": "Poudre de banane bio"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/poudre-de-moringa-bio-300-g/",
            "txt": "Poudre de moringa bio"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/poudre-dacai-bio-150-g/",
            "txt": "Poudre d’açaï bio"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/baobab-bio-300-g/",
            "txt": "Poudre de baobab bio"
          }
        ],
        "2": [
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/farine-de-patate-douce-400g/",
            "txt": "Farine de patate douce bio 400g"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/huile-de-coco-vierge-bio/",
            "txt": "Huile de coco bio"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pate-a-tartiner-noisettes/",
            "txt": "Pâte à tartiner noisettes bio"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/proteine-de-riz-bio/",
            "txt": "Protéine de riz bio"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/farine-de-patate-douce/",
            "txt": "Farine de patate douce bio 1kg"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/mix-pancakes-bio/",
            "txt": "Mix pour Pancake bio"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/proteine-de-pois-bio/",
            "txt": "Protéine de pois bio"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/sirop-de-yacon/",
            "txt": "Sirop de Yacon bio"
          },
        ],
        "3": [
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/barre-detente-40-g/",
            "txt": "Barre détente bio"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/barre-energie-40-g/",
            "txt": "Barre énergie bio"
          },
        ],
        "4": [
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/jus-dargousier-bio-330ml/",
            "txt": "Jus d’argousier bio"
          },
        ]
      },
      "pkgstgdata": {
        "1": [
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-anti-stress/",
            "txt": "Pack anti stress"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/complements-alimentaires-articulations/",
            "txt": "Pack articulations"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-circulation-sanguine/",
            "txt": "Pack circulation sanguine"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/complements-alimentaires-energie/",
            "txt": "Pack énergie"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-grossesse/",
            "txt": "Pack grossesse"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-menopause/",
            "txt": "Pack ménopause"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-sommeil/",
            "txt": "Pack sommeil"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-antioxydant/",
            "txt": "Pack antioxydant"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/complements-alimentaires-beaute/",
            "txt": "Pack beauté"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-detox/",
            "txt": "Pack detox"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-force/",
            "txt": "Pack force"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/complements-alimentaires-immunite/",
            "txt": "Pack immunité"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-minceur/",
            "txt": "Pack minceur"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-sport-2/",
            "txt": "Pack sport"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-aphrodisiaque/",
            "txt": "Pack aphrodisiaque"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-sante-2/",
            "txt": "Pack bien-être mental"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-digestion/",
            "txt": "Pack digestion"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-glycemie/",
            "txt": "Pack glycémie"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-concentration/",
            "txt": "Pack mémoire"
          },
          {
            "lnk": "https://www.naturaforce.com/produit/complements-alimentaires/pack-recuperation/",
            "txt": "Pack récupération"
          },
        ]
      },
      "bsnstgdata": {
        "1": [
          {
            "lnk": "https://www.naturaforce.com/meilleurs-anti-inflammatoires-naturels/",
            "txt": "Anti-inflammatoire"
          },
          {
            "lnk": "https://www.naturaforce.com/bien-etre-cardiovasculaire/",
            "txt": "Bien-être cardiovasculaire"
          },
          {
            "lnk": "https://www.naturaforce.com/ameliorer-circulation-sanguine/",
            "txt": "Circulation sanguine"
          },
          {
            "lnk": "https://www.naturaforce.com/complements-alimentaires-pour-les-problemes-digestifs/",
            "txt": "Digestion"
          },
          {
            "lnk": "https://www.naturaforce.com/les-complements-alimentaires-autorises-et-interdits-pendant-la-grossesse/",
            "txt": "Grossesse allaitement"
          },
          {
            "lnk": "https://www.naturaforce.com/traitements-naturels-menopause/",
            "txt": "Ménopause"
          },
          {
            "lnk": "https://www.naturaforce.com/complements-alimentaires-pour-les-articulations/",
            "txt": "Articulations"
          },
          {
            "lnk": "https://www.naturaforce.com/baisser-mauvais-cholesterol/",
            "txt": "Cholestérol"
          },
          {
            "lnk": "https://www.naturaforce.com/detoxifier-le-foie/",
            "txt": "Detox"
          },
          {
            "lnk": "https://www.naturaforce.com/se-desintoxiquer-du-sucre/reduire-diabete/",
            "txt": "Glycémie"
          },
          {
            "lnk": "https://www.naturaforce.com/renforcer-son-immunite/",
            "txt": "Immunité"
          },
          {
            "lnk": "https://www.naturaforce.com/vision/",
            "txt": "Vision"
          }
        ],
        "2": [
          {
            "lnk": "https://www.naturaforce.com/tout-savoir-sur-les-vitamines/antioxydants/",
            "txt": "Antioxydant"
          },
          {
            "lnk": "https://www.naturaforce.com/combattre-depression/",
            "txt": "Bien-être mental"
          },
          {
            "lnk": "https://www.naturaforce.com/blog/2019/04/25/comment-booster-votre-concentration-de-maniere-naturelle/",
            "txt": "Concentration mémoire"
          },
          {
            "lnk": "https://www.naturaforce.com/complements-alimentaires-pour-les-problemes-digestifs/",
            "txt": "Digestion"
          },
          {
            "lnk": "https://www.naturaforce.com/les-complements-alimentaires-autorises-et-interdits-pendant-la-grossesse/",
            "txt": "Grossesse allaitement"
          },
          {
            "lnk": "https://www.naturaforce.com/complements-alimentaires-pour-mincir/",
            "txt": "Minceur"
          },
          {
            "lnk": "https://www.naturaforce.com/lutter-contre-le-stress/",
            "txt": "Stress"
          },
          {
            "lnk": "https://www.naturaforce.com/bien-etre-cardiovasculaire/",
            "txt": "Bien-être cardiovasculaire"
          },
          {
            "lnk": "https://www.naturaforce.com/ameliorer-circulation-sanguine/",
            "txt": "Circulation sanguine"
          },
          {
            "lnk": "https://www.naturaforce.com/baisse-du-desir-et-troubles-de-la-sexualite/complements-naturels-pour-le-desir-sexuel/",
            "txt": "Désir sexualité"
          },
          {
            "lnk": "https://www.naturaforce.com/tonus-energie-vitalite/",
            "txt": "Energie"
          },
          {
            "lnk": "https://www.naturaforce.com/traitements-naturels-menopause/",
            "txt": "Ménopause"
          },
          {
            "lnk": "https://www.naturaforce.com/renforcer-son-immunite-sommeil-et-sante/",
            "txt": "Sommeil"
          }
        ],
        "3": [
          {
            "lnk": "https://www.naturaforce.com/tout-savoir-sur-les-vitamines/antioxydants/",
            "txt": "Antioxydant"
          },
          {
            "lnk": "https://www.naturaforce.com/complements-alimentaires-pour-mincir/",
            "txt": "Minceur"
          },
          {
            "lnk": "https://www.naturaforce.com/complements-alimentaires-pour-la-beaute-de-la-peau/",
            "txt": "Beauté de la peau"
          },
        ],
        "4": [
          {
            "lnk": "https://www.naturaforce.com/complements-alimentaires-pour-les-articulations/",
            "txt": "Articulations"
          },
          {
            "lnk": "https://www.naturaforce.com/tonus-energie-vitalite/",
            "txt": "Energie"
          },
          {
            "lnk": "https://www.naturaforce.com/recuperation/",
            "txt": "Récupération"
          },
          {
            "lnk": "https://www.naturaforce.com/bien-etre-cardiovasculaire/",
            "txt": "Bien-être cardiovasculaire"
          },
          {
            "lnk": "https://www.naturaforce.com/comment-prendre-du-poids/",
            "txt": "Force"
          },
          {
            "lnk": "https://www.naturaforce.com/meilleurs-complements-alimentaires-naturels-sportifs/",
            "txt": "Sport"
          },
        ]
      }
    }
    // NUTRITION SUBLIST HTMLS
    var nutriSubStg1html = gensubstgHtml(menudata.nutristgdata[1]);
    var nutriSubStg2html = gensubstgHtml(menudata.nutristgdata[2]);
    var nutriSubStg3html = gensubstgHtml(menudata.nutristgdata[3]);
    var nutriSubStg4html = gensubstgHtml(menudata.nutristgdata[4]);
    var nutriSubStg = '' +
      '  <ul class="egNwMbMenu_bdy_menuitems_itm_sublist">' +
      '      <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="2"> <a class="egNwMbMenu_bdy_menuitems_itm_link egNwMbMenu_bdy_menuitems_itm_link_hassublist">Superaliments<span' +
      '                  class="egNwMbMenu_bdy_menuitems_itm_link_arr">' + arrwIcon + '</span> </a>' +
      '          <ul class="egNwMbMenu_bdy_menuitems_itm_sublist">' + nutriSubStg1html + '</ul>' +
      '      </li>' +
      '      <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="2"> <a class="egNwMbMenu_bdy_menuitems_itm_link egNwMbMenu_bdy_menuitems_itm_link_hassublist">Cuisine<span' +
      '                  class="egNwMbMenu_bdy_menuitems_itm_link_arr">' + arrwIcon + '</span> </a>' +
      '          <ul class="egNwMbMenu_bdy_menuitems_itm_sublist">' + nutriSubStg2html + '</ul>' +
      '      </li>' +
      '      <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="2"> <a class="egNwMbMenu_bdy_menuitems_itm_link egNwMbMenu_bdy_menuitems_itm_link_hassublist">Snacking<span' +
      '                  class="egNwMbMenu_bdy_menuitems_itm_link_arr">' + arrwIcon + '</span> </a>' +
      '          <ul class="egNwMbMenu_bdy_menuitems_itm_sublist">' + nutriSubStg3html + '</ul>' +
      '      </li>' +
      '      <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="2"> <a class="egNwMbMenu_bdy_menuitems_itm_link egNwMbMenu_bdy_menuitems_itm_link_hassublist">Boissons<span' +
      '                  class="egNwMbMenu_bdy_menuitems_itm_link_arr">' + arrwIcon + '</span> </a>' +
      '          <ul class="egNwMbMenu_bdy_menuitems_itm_sublist">' + nutriSubStg4html + '</ul>' +
      '      </li>' +
      '      <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="2"> <a class="egNwMbMenu_bdy_menuitems_itm_link" href="https://www.naturaforce.com/categorie-produit/nutrition/" data-underline>voir tout </a> </li>' +
      '  </ul>';
    // PACKS SUBLIST HTMLS
    var pcksSubStg1html = gensubstgHtml(menudata.pkgstgdata[1]);
    var pcksSubStg = '<ul class="egNwMbMenu_bdy_menuitems_itm_sublist">' + pcksSubStg1html + '</ul>';
    // BESOINS SUBLIST HTMLS
    var bsnsSubStg1html = gensubstgHtml(menudata.bsnstgdata[1]);
    var bsnsSubStg2html = gensubstgHtml(menudata.bsnstgdata[2]);
    var bsnsSubStg3html = gensubstgHtml(menudata.bsnstgdata[3]);
    var bsnsSubStg4html = gensubstgHtml(menudata.bsnstgdata[4]);
    var bsnsSubStg = '' +
      '  <ul class="egNwMbMenu_bdy_menuitems_itm_sublist">' +
      '      <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="2"> <a class="egNwMbMenu_bdy_menuitems_itm_link egNwMbMenu_bdy_menuitems_itm_link_hassublist">Santé<span class="egNwMbMenu_bdy_menuitems_itm_link_arr">' + arrwIcon + '</span> </a>' +
      '          <ul class="egNwMbMenu_bdy_menuitems_itm_sublist">' + bsnsSubStg1html + '</ul>' +
      '      </li>' +
      '      <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="2"> <a class="egNwMbMenu_bdy_menuitems_itm_link egNwMbMenu_bdy_menuitems_itm_link_hassublist">Bien-être<span class="egNwMbMenu_bdy_menuitems_itm_link_arr">' + arrwIcon + '</span> </a>' +
      '          <ul class="egNwMbMenu_bdy_menuitems_itm_sublist">' + bsnsSubStg2html + '</ul>' +
      '      </li>' +
      '      <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="2"> <a class="egNwMbMenu_bdy_menuitems_itm_link egNwMbMenu_bdy_menuitems_itm_link_hassublist">Beauté<span class="egNwMbMenu_bdy_menuitems_itm_link_arr">' + arrwIcon + '</span> </a>' +
      '          <ul class="egNwMbMenu_bdy_menuitems_itm_sublist">' + bsnsSubStg3html + '</ul>' +
      '      </li>' +
      '      <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="2"> <a class="egNwMbMenu_bdy_menuitems_itm_link egNwMbMenu_bdy_menuitems_itm_link_hassublist">Sport <span class="egNwMbMenu_bdy_menuitems_itm_link_arr">' + arrwIcon + '</span> </a>' +
      '          <ul class="egNwMbMenu_bdy_menuitems_itm_sublist">' + bsnsSubStg4html + '</ul>' +
      '      </li>' +
      '      <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="2"> <a class="egNwMbMenu_bdy_menuitems_itm_link" href="https://www.naturaforce.com/categorie-produit/nutrition/" data-underline>voir tout </a> </li>' +
      '  </ul>';
    var newMenuHTML = '' +
      '  <div class="egNwMbMenu">' +
      '  <div class="egNwMbMenuWpr">' +
      '      <!-- main menu header -->' +
      '      <div class="egNwMbMenu_hdr">' +
      '          <button class="egNwMbMenu_cut">' +
      '              <!-- cut icon -->' + cutIcon +
      '          </button>' +
      '          <!-- banner -->' + menuBnrMobHTML +
      '      </div>' +
      '      <!-- main menu items -->' +
      '      <div class="egNwMbMenu_bdy">' +
      '          <!-- slider -->' +
      '          <div class="egNwMbMenu_bdy_slider">' + mobSliderHTML + '</div>' +
      '          <ul class="egNwMbMenu_bdy_menuitems">' +
      '              <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="1">' +
      '                  <a class="egNwMbMenu_bdy_menuitems_itm_link" href="https://www.naturaforce.com/boutique">' +
      '                      Tous nos produits' +
      '                  </a>' +
      '              </li>' +
      '              <!-- nutrition -->' +
      '              <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="1">' +
      '                  <a class="egNwMbMenu_bdy_menuitems_itm_link egNwMbMenu_bdy_menuitems_itm_link_hassublist">' +
      '                      Nutrition' +
      '                      <span class="egNwMbMenu_bdy_menuitems_itm_link_arr">' + arrwIcon + '</span>' +
      '                  </a>' + nutriSubStg +
      '              </li>' +
      '              <!-- packs -->' +
      '              <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="1">' +
      '                  <a class="egNwMbMenu_bdy_menuitems_itm_link egNwMbMenu_bdy_menuitems_itm_link_hassublist">' +
      '                      Packs' +
      '                      <span class="egNwMbMenu_bdy_menuitems_itm_link_arr">' + arrwIcon + '</span>' +
      '                  </a>' + pcksSubStg +
      '              </li>' +
      '              <!-- besoins -->' +
      '              <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="1">' +
      '                  <a class="egNwMbMenu_bdy_menuitems_itm_link egNwMbMenu_bdy_menuitems_itm_link_hassublist">' +
      '                      Besoins' +
      '                      <span class="egNwMbMenu_bdy_menuitems_itm_link_arr">' + arrwIcon + '</span>' +
      '                  </a>' + bsnsSubStg +
      '              </li>' +
      '              <!-- contact -->' +
      '              <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="1">' +
      '                  <a class="egNwMbMenu_bdy_menuitems_itm_link" href="https://www.naturaforce.com/contact/">' +
      '                      Contact' +
      '                  </a>' +
      '              </li>' +
      '              <!-- notre histoire -->' +
      '              <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="1">' +
      '                  <a class="egNwMbMenu_bdy_menuitems_itm_link" href="https://www.naturaforce.com/a-propos/notre-histoire/">' +
      '                      Notre histoire' +
      '                  </a>' +
      '              </li>' +
      '              <!-- Nous contacter -->' +
      '              <li class="egNwMbMenu_bdy_menuitems_itm" data-stage="1">' +
      '                  <a class="egNwMbMenu_bdy_menuitems_itm_link" href="https://www.naturaforce.com/contact-2/">' +
      '                      Nous contacter' +
      '                  </a>' +
      '              </li>' +
      '              <li class="egNwMbMenu_bdy_menuitems_itm">' +
      '                  <div class="egNwMbMenu_bdy_menuitems_itm_socialwpr">' +
      '                      <p>' +
      '                          <a href="https://fr-fr.facebook.com/naturaforce/" target="_blank">' +
      '                              <img src="https://www.naturaforce.com/wp-content/uploads/2022/03/NAF-pictos-3-reseaux-sociaux-fb.png">' +
      '                          </a>' +
      '                          <a href="https://www.instagram.com/natura_force/" target="_blank">' +
      '                              <img src="https://www.naturaforce.com/wp-content/uploads/2022/03/NAF-pictos-3-reseaux-sociaux-insta.png">' +
      '                          </a>' +
      '                          <a href="https://www.pinterest.fr/naturaforce/" target="_blank">' +
      '                              <img src="https://www.naturaforce.com/wp-content/uploads/2022/03/NAF-pictos-3-reseaux-sociaux-pinterest.png">' +
      '                          </a>' +
      '                      </p>' +
      '                  </div>' +
      '              </li>' +
      '          </ul>' +
      '      </div>' +
      '      <!-- main menu footer -->' +
      '      <div class="egNwMbMenu_ftr">' +
      '          <div class="egNwMbMenu_ftr_wpr">' +
      '              <a class="egNwMbMenu_ftr_accbox_lnk" href="https://www.naturaforce.com/mon-compte/">' +
      '                  <img src="https://www.naturaforce.com/wp-content/themes/lndigital/img/NAF-picto%20compte-small.svg" />' +
      '                  <span>mon compte</span>' +
      '              </a>' +
      '              <!-- search -->' +
      '              <button class="egNwMbMenu_ftr_srch">' +
      '                  <!-- search icon -->' + searchIcon +
      '              </button>' +
      '          </div>' +
      '      </div>' +
      '  </div>' +
      '  </div>';

    var waitForElement = function (selector, trigger, delayInterval, delayTimeout) {
      var interval = setInterval(function () {
        if (
          document &&
          document.querySelector(selector) &&
          document.querySelectorAll(selector).length > 0
        ) {
          clearInterval(interval);
          trigger();
        }
      }, delayInterval);
      setTimeout(function () {
        clearInterval(interval);
      }, delayTimeout);
    }

    var live = function (selector, event, callback, context) {
      var addEvent = function (el, type, handler) {
        if (el.attachEvent) el.attachEvent("on" + type, handler);
        else el.addEventListener(type, handler);
      }
      this.Element &&
        (function (ElementPrototype) {
          ElementPrototype.matches =
            ElementPrototype.matches ||
            ElementPrototype.matchesSelector ||
            ElementPrototype.webkitMatchesSelector ||
            ElementPrototype.msMatchesSelector ||
            function (selector) {
              var node = this,
                nodes = (node.parentNode || node.document).querySelectorAll(selector),
                i = -1;
              while (nodes[++i] && nodes[i] != node);
              return !!nodes[i];
            };
        })(Element.prototype);
      var live = function (selector, event, callback, context) {
        addEvent(context || document, event, function (e) {
          var found,
            el = e.target || e.srcElement;
          while (el && el.matches && el !== context && !(found = el.matches(selector))) el = el.parentElement;
          if (el && found) callback.call(el, e);
        });
      }
      live(selector, event, callback, context);
    }

    var init = function () {
      if (!document.querySelector('.egNwMbMenu')) {
        document.body.insertAdjacentHTML('beforeend', newMenuHTML);
        // test events
        testEvents();
      }
    }

    var testEvents = function () {
      live('.egNwMbMenu_bdy_menuitems_itm_link_hassublist', 'click', function () {
        this.classList.toggle("eg-slide-up");
      });

      live('#nav-mobile-toggle', 'click', function () {
        document.body.classList.add('eg-show-menu');
      });

      live('.egNwMbMenu_cut', 'click', function () {
        document.body.classList.remove('eg-show-menu');
        document.querySelector('.nav-mobile-close-btn').click();
      });

      live('.egNwMbMenu_ftr_srch', 'click', function () {
        document.querySelector("#header-menu-mobile-search").click();
      });
    }

    /* Initialize variation */
    if (window.innerWidth < 767) {
      waitForElement('body', init, 50, 15000);
    }
  } catch (e) {
    if (debug) console.log(e, "error in Test" + variation_name);
  }
})();


Leave a Comment