templates/layouts/layouts_front/common/script/custom_scripts_top.html.twig line 1

Open in your IDE?
  1. <script> WEBSITEROOT = "{{ websiteroot }}";</script>
  2. <script>
  3.     //Vérification d'accès à la DEV
  4.     fetch('https://api.ipify.org/?format=json')
  5.         .then(response => response.json())  // Récupérer l'IP du client
  6.         .then(data => {
  7.             const clientIp = data.ip;
  8.     
  9.             fetch('/check-ip', {
  10.                 method: 'POST',
  11.                 headers: {
  12.                     'Content-Type': 'application/json',
  13.                 },
  14.                 body: JSON.stringify({ip: clientIp})
  15.             })
  16.                 .then(response => response.json())
  17.                 .then(data => {
  18.                     if (data.status === 'false') {
  19.                         // Si le statut est 'false', rediriger vers l'URL spécifiée
  20.                         window.location.href = 'https://www.cieleo-bareges.com/';
  21.                     }
  22.                 })
  23.                 .catch(error => console.error('Erreur lors de l\'envoi au serveur:', error));
  24.         })
  25.         .catch(error => console.error('Erreur lors de la récupération de l\'IP:', error));
  26. </script>
  27. <script type="application/ld+json">
  28.     {
  29.     "@context": "http://schema.org",
  30.     "@type": "Corporation",
  31.     "name" : "{{ nomDuSite }}",
  32.             "url" : "{{ urlPage }}",
  33.             "description": "{{ block('metaDescription')|default(descriptionSite) }}",
  34.             "image": "{{ websiteroot }}{{ asset("medias_front/"~mediaTmpOg|default(mediaDefaultOg)) }}",
  35.             "logo": "{{ websiteroot }}/media_front/common/logoHeader.png",
  36.             "telephone": "{{ siteCoord.coordTelFixe }}",
  37.             "sameAs": [
  38.     {% for resSoc in accReseaux %}
  39.                 "{{ resSoc.accResLink }}"{% if not loop.last %}
  40.     {% endif %}
  41.     {% endfor %}
  42.     ],
  43.     "address": {
  44.     "@type": "PostalAddress",
  45.     "streetAddress": "{{ siteCoord.coordAdresse }}",
  46.             "addressLocality": "{{ siteCoord.coordVille }}",
  47.             "postalCode": "{{ siteCoord.coordCp }}",
  48.             "addressCountry": "{{ siteCoord.coordPays }}"
  49.             }
  50.             }
  51. </script>
  52. <script src="{{ asset('assets/boostrap-datepicker/js/bootstrap-datepicker.js') }}"></script>
  53. <script>
  54.     $(document).ready(function () {
  55.         // you may need to change this code if you are not using Bootstrap Datepicker
  56.         $('.js-datepicker').datepicker({
  57.             format: 'yyyy-mm-dd'
  58.         });
  59.     });
  60. </script>