templates/post-cmp/post-cmp.html.twig line 1

Open in your IDE?
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>{% block title %}Welcome!{% endblock %}</title>
  6.     <link rel="icon"
  7.           href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
  8.     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css"
  9.           integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
  10.     <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
  11.             integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
  12.             crossorigin="anonymous"></script>
  13.     <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"
  14.             integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF"
  15.             crossorigin="anonymous"></script>
  16.     {# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}
  17.     {#
  18.     {% block stylesheets %}
  19.         {{ encore_entry_link_tags('app') }}
  20.     {% endblock %}
  21.     {% block javascripts %}
  22.         {{ encore_entry_script_tags('app') }}
  23.     {% endblock %}
  24.     #}
  25.     {# Axeptio TCF API #}
  26.     <script>
  27.         window.axeptioSettings = {
  28.             clientId: "66137db6ae83de5e566cfc53",
  29.             cookiesVersion: "first-id sandbox-fr-EU",
  30.         };
  31.         (function (d, s) {
  32.             var t = d.getElementsByTagName(s)[0],
  33.                 e = d.createElement(s);
  34.             e.async = false;
  35.             e.src = "//static.axept.io/tcf/sdk.js";
  36.             e.type = "module";
  37.             t.parentNode.insertBefore(e, t);
  38.         })(document, "script");
  39.     </script>
  40.     {# End Axeptio TCF API #}
  41. </head>
  42. <body>
  43. <nav class="navbar navbar-expand-lg navbar-light bg-light">
  44.     <a class="navbar-brand" href="{{ path('app_index') }}">{{ site_name }}</a>
  45.     <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
  46.             aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
  47.         <span class="navbar-toggler-icon"></span>
  48.     </button>
  49. </nav>
  50. <div class="container">
  51.     <div class="row">
  52.         <div class="col-md-12">
  53.             <h3>First ID : <span id="firstid"></span></h3>
  54.         </div>
  55.     </div>
  56.     {% block body %}{% endblock %}
  57. </div>
  58. </body>
  59. <script>
  60.     function getCookieValueFromCookieName(cookieName) {
  61.         let cookieArr = document.cookie.split(";");
  62.         for (let i = 0; i < cookieArr.length; i++) {
  63.             let cookiePair = cookieArr[i].split("=");
  64.             if (cookieName === cookiePair[0].trim()) {
  65.                 return decodeURIComponent(cookiePair[1]);
  66.             }
  67.         }
  68.         return null;
  69.     }
  70.     function checkFirstidCookie() {
  71.         let firstidCookieValue = getCookieValueFromCookieName("firstid");
  72.         if (firstidCookieValue) {
  73.             console.log(`First ID : ${firstidCookieValue}`)
  74.         } else {
  75.             console.log('No First ID cookie find.')
  76.         }
  77.         if (firstidCookieValue) {
  78.         $('#firstid').text(firstidCookieValue)
  79.     } else {
  80.         $('#firstid').text('No First ID cookie find.')
  81.     }
  82.     }
  83.     function loadFirstIdSdk() {
  84.         var script = document.createElement('script');
  85.         script.src = "https://cdn.preprod.first-id.fr/sdk/loader/loader.min.js";
  86.         script.defer = true;
  87.         document.head.appendChild(script);
  88.         script.onload = function () {
  89.             window.firstId = window.firstId || {
  90.                 callbacks: [],
  91.                 debug: true,
  92.                 cookieName: 'firstid'
  93.             };
  94.             window.firstId.callbacks.push(() => {
  95.                 console.log('FirstID SDK loaded and initialized after user consent.');
  96.                 // Additional FirstID SDK logic here
  97.             });
  98.             window.firstId.callbacks.push(() => {
  99.                 console.log(FIRSTID.get)
  100.             });
  101.         };
  102.     }
  103.     checkFirstidCookie();
  104.     loadFirstIdSdk()
  105.     setInterval(checkFirstidCookie, 500)
  106.     // let fid = getCookieValueFromCookieName('firstid')
  107.     // if (fid) {
  108.     //     $('#firstid').text(fid)
  109.     // } else {
  110.     //     $('#firstid').text('No First ID cookie find.')
  111.     // }
  112. </script>
  113. </html>