Corentin NELHOMME пре 1 година
родитељ
комит
284221a0f7
3 измењених фајлова са 335 додато и 21 уклоњено
  1. 12 1
      index.css
  2. 284 5
      index.html
  3. 39 15
      index.js

+ 12 - 1
index.css

@@ -59,4 +59,15 @@ img {
   #cropper-actions {
     margin-top: 10px;
     text-align: right;
-  }
+  }
+
+  .imageeditor {
+    transition: 300ms ease-in-out;
+  }
+
+  .imageeditor.selected-img{
+    filter: saturate(250%);
+    box-sizing: border-box;
+  }
+
+  /* Background image editor  */

+ 284 - 5
index.html

@@ -13,6 +13,7 @@
     rel="stylesheet"
     href="https://releases.transloadit.com/uppy/v4.12.2/uppy.min.css"
   />
+  <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
   <script src="https://releases.transloadit.com/uppy/v4.12.2/uppy.min.js"></script>
     <link
       href="https://cdn.jsdelivr.net/npm/tinymce@7.8.0/skins/ui/oxide/skin.min.css"
@@ -23,10 +24,272 @@
 
   </head>
   <body>
-    <img
-      class="imageeditor"
-      src="https://letsenhance.io/static/73136da51c245e80edc6ccfe44888a99/1015f/MainBefore.jpg"
-    />
+    <div class="swiper-slide rounded-medium theme-purple swiper-slide-next" role="group" aria-label="2 / 4" style="
+  --color-gray-400: oklch(0.707 0.022 261.325);
+  --color-gray-900: oklch(0.21 0.034 264.665);
+  --color-neutral-100: oklch(0.97 0 0);
+  --color-neutral-200: oklch(0.922 0 0);
+  --color-neutral-300: oklch(0.87 0 0);
+  --color-neutral-400: oklch(0.708 0 0);
+  --color-black: #000;
+  --color-white: #fff;
+  --spacing: 0.25rem;
+  --container-sm: 24rem;
+  --container-md: 28rem;
+  --container-xl: 36rem;
+  --container-2xl: 42rem;
+  --container-4xl: 56rem;
+  --container-5xl: 64rem;
+  --container-6xl: 72rem;
+  --container-7xl: 80rem;
+  --text-sm: 0.875rem;
+  --text-5xl: 3rem;
+  --text-5xl--line-height: 1;
+  --font-weight-thin: 100;
+  --font-weight-normal: 400;
+  --font-weight-medium: 500;
+  --font-weight-semibold: 600;
+  --font-weight-bold: 700;
+  --font-weight-black: 900;
+  --leading-tight: 1.25;
+  --leading-snug: 1.375;
+  --radius-md: 0.375rem;
+  --radius-2xl: 1rem;
+  --ease-in: cubic-bezier(0.4, 0, 1, 1);
+  --blur-md: 12px;
+  --default-transition-duration: 150ms;
+  --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
+  --default-font-family: var(--font-sans);
+  --default-font-feature-settings: var(--font-sans--font-feature-settings);
+  --default-font-variation-settings: var(
+    --font-sans--font-variation-settings
+  );
+  --default-mono-font-family: var(--font-mono);
+  --default-mono-font-feature-settings: var(
+    --font-mono--font-feature-settings
+  );
+  --default-mono-font-variation-settings: var(
+    --font-mono--font-variation-settings
+  );
+  -webkit-text-size-adjust: 100%;
+  tab-size: 4;
+  font-feature-settings: var(--default-font-feature-settings, normal);
+  font-variation-settings: var( --default-font-variation-settings, normal );
+  -webkit-tap-highlight-color: transparent;
+  --swiper-navigation-size: 44px;
+  --theme-red: #E94A2D;
+  --theme-purple: #9453D5;
+  --theme-yellow: #FFAC4A;
+  --theme-green: #42B5A3;
+  --swiper-theme-color: #666666;
+  --color--primary: 30deg 10.34% 54.51%;
+  --color--primary-light: #ccc5be;
+  --color--primary-lighter: #edeceb;
+  --color--primary-lightest: 30deg 11% 96%;
+  --color--primary-dark: 13.71deg 85.37% 8.04%;
+  --color--primary-inverse: 30deg 20% 39.22%;
+  --color--black: 0deg 0% 0%;
+  --color--white: 0deg 0% 100%;
+  --color--slate: 210deg 73% 15%;
+  --color--purple: 243deg 100% 68%;
+  --color--red: 0deg 100% 45%;
+  --color--tan: 39deg 42% 74%;
+  --color--success: 130.67deg 58.8% 42.24%;
+  --color--error: 10deg 60% 50%;
+  --color--warning: 34deg 100% 71%;
+  --color--help: 261deg 79% 36%;
+  --color--grey-surface: 30deg 2% 49%;
+  --color--master-detail: 36deg 16% 94%;
+  --color--bento: 0deg 0% 11%;
+  --color--primary-disabled: 33deg 12% 85%;
+  --text--color: var(--color--black);
+  --link--color: hsl(var(--color--black));
+  --bg--color: #e6e6e6;
+  --header--height: 127px;
+  --content--max-width: 620px;
+  --section--padding-y: 3rem;
+  --container--max-width: 1440px;
+  --container--md-max-width: 1226px;
+  --container--sm-max-width: 972px;
+  --container--xsm-max-width: 738px;
+  --table--strip-color: hsla(33, 12%, 85%, .16);
+  --border--light: var(--border-size--s) solid rgba(175, 184, 193, .2);
+  --color--neutral--100: #1e1e1e;
+  --color--neutral--200: #2f2f2f;
+  --color--neutral--300: #757575;
+  --color--neutral--400: #9e9e9e;
+  --color--neutral--600: #ccc;
+  --color--neutral--700: #ddd;
+  --color--neutral--800: #e0e0e0;
+  --color--neutral--900: #f0f0f0;
+  --font-weight--extra-light: 200;
+  --font-weight--light: 300;
+  --font-weight--regular: 400;
+  --font-weight--medium: 500;
+  --font-weight--semi-bold: 600;
+  --font-weight--bold: 700;
+  --body-xxs: 8px;
+  --body-xs: 12px;
+  --body-s: 14px;
+  --body: 16px;
+  --body-ms: 18px;
+  --body-m: 20px;
+  --body-l: 24px;
+  --body-xl: 30px;
+  --quote: 40px;
+  --heading-xs: 24px;
+  --heading-s: 30px;
+  --heading-m: 40px;
+  --heading-l: 64px;
+  --heading-xl: 80px;
+  --heading-mobile: 36px;
+  --border-radius--none: 0;
+  --border-radius--soft: 4px;
+  --border-radius--medium: 16px;
+  --border-radius--large: 24px;
+  --border-radius--rounded: 100px;
+  --border-radius--circle: 100%;
+  --border-size--none: 0;
+  --border-size--s: 1px;
+  --border-size--m: 2px;
+  --border-size--l: 3px;
+  --grid-unit-2: 2px;
+  --grid-unit-4: 4px;
+  --grid-unit-7: 7px;
+  --grid-unit-8: 8px;
+  --grid-unit-10: 10px;
+  --grid-unit-12: 12px;
+  --grid-unit-11: 11px;
+  --grid-unit-13: 13px;
+  --grid-unit-14: 14px;
+  --grid-unit-16: 16px;
+  --grid-unit-20: 20px;
+  --grid-unit-24: 24px;
+  --grid-unit-28: 28px;
+  --grid-unit-30: 30px;
+  --grid-unit-32: 32px;
+  --grid-unit-36: 36px;
+  --grid-unit-40: 40px;
+  --grid-unit-44: 44px;
+  --grid-unit-42: 42px;
+  --grid-unit-48: 48px;
+  --grid-unit-52: 52px;
+  --grid-unit-56: 56px;
+  --grid-unit-60: 60px;
+  --grid-unit-64: 64px;
+  --grid-unit-75: 75px;
+  --grid-unit-80: 80px;
+  --grid-unit-84: 84px;
+  --grid-unit-88: 88px;
+  --grid-unit-93: 93px;
+  --grid-unit-96: 96px;
+  --grid-unit-104: 104px;
+  --grid-unit-108: 108px;
+  --grid-unit-110: 110px;
+  --grid-unit-112: 112px;
+  --grid-unit-114: 114px;
+  --grid-unit-116: 116px;
+  --grid-unit-117: 117px;
+  --grid-unit-120: 120px;
+  --grid-unit-124: 124px;
+  --grid-unit-127: 127px;
+  --grid-unit-128: 128px;
+  --grid-unit-131: 131px;
+  --grid-unit-132: 132px;
+  --grid-unit-136: 136px;
+  --grid-unit-137: 137px;
+  --grid-unit-140: 140px;
+  --grid-unit-144: 144px;
+  --grid-unit-148: 148px;
+  --grid-unit-157: 157px;
+  --grid-unit-180: 180px;
+  --grid-unit-456: 456px;
+  --color-act: #FFAC4A;
+  --color-prevent: #E94A2D;
+  --color-protect: #009DF7;
+  --color-support: #9453D5;
+  --color-onehealth: #42b8a4;
+  line-height: inherit;
+  font-family: var(--font--renault-group);
+  font-size: 16px;
+  text-align: center;
+  color: var(--color-white);
+  list-style: none;
+  box-sizing: border-box;
+  margin: 0;
+  padding: 0;
+  border: 0 solid;
+  flex-shrink: 0;
+  position: relative;
+  transition-property: transform;
+  --theme-color: var(--theme-purple);
+  border-radius: var(--border-radius--medium);
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  height: auto;
+  min-height: 514px;
+  overflow: hidden;
+  flex-grow: 1;
+  transform: translateZ(0);
+  backface-visibility: hidden;
+  max-width: 48rem;
+  width: 496px;
+  margin-right: 32px;">
+
+      <img class="imageeditor" style="position: absolute;
+      height: 100%;
+      width: 100%;
+      object-fit: cover;
+      object-position: center top;" src="https://onehealth-dev.livinweb.fr/assets/websiteFiles/cache/image-cache/websiteFiles/images/RG_img/tronquee-anais-temoignage-img-20250417-wa0001.5caa399d.webp" alt="">
+    
+      <div class="content">
+        <div class="quote">
+          <p><span class="text-accessibility"></span></p><div id="siteeditor-description-15748-rte" href="/rest/newsiteeditor/field/15748" field="description" method="PUT" class="siteeditor " data-resourceid="15748" data-successmsg="Modification effectuée" data-data="{&quot;description&quot;:&quot;<p>Un jour, par curiosité, j’ai décidé de faire le bilan digital de OneHealth.</p>&quot;,&quot;syncsite&quot;:1}"><p>Un jour, par curiosité, j’ai décidé de faire le bilan digital de OneHealth.</p></div><p></p>
+          <p class="author"><span class="text-accessibility"><span id="siteeditor-longtitle-15748-rte" href="/rest/newsiteeditor/longtitle/15748" field="longtitle" method="PUT" class="siteeditor " data-resourceid="15748" data-successmsg="Modification effectuée" data-data="{&quot;longtitle&quot;:&quot;Anaïs, France&quot;,&quot;syncsite&quot;:1}">Anaïs, France</span></span></p>
+        </div>
+    
+        <div class="additional text-white py-6 border-t-white" aria-expanded="false" id="tsw-additional-13486-15748">
+          <p>Je n’avais jamais vraiment pris le temps de m’intéresser à certains aspects de ma santé et je ne pensais pas avoir besoin d’un bilan. Après avoir répondu aux questions, j’ai été surprise de découvrir des facteurs de risque concernant ma santé physique et mon bien-être psychologique. Grâce à cet outil de prévention, j’ai pris conscience de l’importance de réaliser des bilans réguliers. Un grand merci à OneHealth de nous offrir de tels outils !&nbsp;</p>
+        </div>
+        <div class="flex flex-row justify-center box-border">
+    
+              
+                <button onclick="window.dataLayer.push({
+                                &quot;event&quot;:&quot;navigationClick&quot;,
+                                &quot;brand&quot;: &quot;Renault&quot;,
+                                &quot;countryCode&quot;: &quot;FR&quot;,
+                                &quot;languageCode&quot;: &quot;fr&quot;,
+                                &quot;pageType&quot;: &quot;homepage&quot;, 
+                                &quot;pageName&quot;:&quot;homepage&quot;,
+                                &quot;buttonText&quot;: &quot;En savoir plus +&quot;,
+                                &quot;componentId&quot;:&quot;card_checkup&quot;, 
+                                &quot;virtualPageName&quot;:&quot;homepage&quot;
+                                });" class="font-bold hidden lg:inline-block rounded-large bg-white text-black hover:bg-black hover:text-white duration-150 p-4 items-center gap-4 open-popin" aria-controls="testimoniesSwiperPopIn-13486-15636" data-slideto="1">
+                    En savoir plus +
+                </button>
+              
+            
+              <!-- Bouton mobile toujours affiché -->
+            <button onclick="window.dataLayer.push({
+                                &quot;event&quot;:&quot;navigationClick&quot;,
+                                &quot;brand&quot;: &quot;Renault&quot;,
+                                &quot;countryCode&quot;: &quot;FR&quot;,
+                                &quot;languageCode&quot;: &quot;fr&quot;,
+                                &quot;pageType&quot;: &quot;homepage&quot;, 
+                                &quot;pageName&quot;:&quot;homepage&quot;,
+                                &quot;buttonText&quot;: &quot;En savoir plus +&quot;,
+                                &quot;componentId&quot;:&quot;card_checkup&quot;, 
+                                &quot;virtualPageName&quot;:&quot;homepage&quot;
+                                });" class="font-bold inline-block lg:hidden rounded-large bg-white text-black hover:bg-black hover:text-white duration-150 p-4 items-center gap-4 expand-additional" aria-controls="tsw-additional-13486-15748">
+                    En savoir plus +
+              </button>
+    
+        </div>
+    
+      </div> 
+    
+    </div>
     <img
       class="imageeditor"
       src="https://images.unsplash.com/photo-1604311795833-25e1d5c128c6?fm=jpg&q=60&w=3000&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8OSUzQTE2fGVufDB8fDB8fHww"
@@ -103,6 +366,22 @@
         </div>
       </div>
     </div>
-  </body>
+
+    <div style="height: 200vh;">
+
+      <section id="section_RG_topBannerImage15641" class="pagehead bgimageeditor hidden lg:block h-[32rem] lg:py-12 lg:px-12 bg-white text-black bg-cover bg-center lg:text-white text-center relative" style="background-image: url('https://onehealth-dev.livinweb.fr/assets/websiteFiles/cache/image-cache/websiteFiles/images/RG_img/j-agis-pour-une-vie-saine-v5-lw.1981c32b.webp');background-position-y: 38%;" data-resourceid="15641">
+        <div class="absolute bottom-0 left-0 right-0 pb-12 flex flex-col items-center">
+
+<h2 class="text-accessibility px-8 lg:px-0 mt-8 lg:mt-0"><p id="siteeditor-longtitle-15641-rte" href="/rest/newsiteeditor/longtitle/15641" field="longtitle" method="PUT" class="siteeditor " data-resourceid="15641" data-successmsg="Modification effectuée" data-data="{&quot;longtitle&quot;:&quot;J’agis pour une vie saine&quot;,&quot;syncsite&quot;:1}">J’agis pour une vie saine</p></h2>
+<h3 class="text-bold text-[29px] pt-6 text-accessibility px-8 lg:px-0">  <div id="siteeditor-content-15641-rte" href="/rest/newsiteeditor/field/15641" field="content" method="PUT" class="siteeditor " data-resourceid="15641" data-successmsg="Modification effectuée" data-data="{&quot;content&quot;:&quot;<p>Je mets en place des habitudes saines au quotidien</p>&quot;,&quot;syncsite&quot;:1}"><p>Je mets en place des habitudes saines au quotidien</p></div> </h3>
+</div>
+
+</section>
+
+
+
+
+
+    </div>  </body>
   <script defer src="./index.js" type="module"></script>
 </html>

+ 39 - 15
index.js

@@ -163,6 +163,7 @@ let NEWSITEEDITOR = (function () {
       onClickManager(false);
       sidebar(false);
       linkEnabled(true);
+      nseImageEditor(false);
     });
   }
 
@@ -234,6 +235,7 @@ let NEWSITEEDITOR = (function () {
       preventClickEnabled(true);
       sidebar(true);
       linkEnabled(false);
+      nseImageEditor(true);
     });
   }
 
@@ -702,15 +704,20 @@ let NEWSITEEDITOR = (function () {
     });
   }
 
+  //nseImageEditor
   let cropper = null;
   let pendingFile = null;
   let aspectRatio;
 
-  function nseImageEditor() {
+  function nseImageEditor(active) {
+    if (!active) {
+      return;
+    }
+
     const uppy = new Uppy({
       restrictions: {
         maxNumberOfFiles: 1,
-        allowedFileTypes: ['.jpg', '.jpeg', '.png', '.gif', '.webp']
+        allowedFileTypes: [".jpg", ".jpeg", ".png", ".gif", ".webp"],
       },
     });
 
@@ -735,7 +742,8 @@ let NEWSITEEDITOR = (function () {
       showNseModal(false);
       uppy.cancelAll();
       console.log(file);
-      current.element.src = "http://localhost/php/uploads/"+file.successful[0].meta.name;
+      current.element.src =
+        "http://localhost/php/uploads/" + file.successful[0].meta.name;
     });
 
     //Initialiser l'endpoint pour l'upload des fichiers
@@ -755,24 +763,37 @@ let NEWSITEEDITOR = (function () {
     modal.addEventListener("click", (e) => {
       if (e.target === modal) {
         showNseModal(false);
-        closedModal();
+      }
+    });
+
+    document.addEventListener("click", (event) => {
+      if (!event.target.classList.contains("imageeditor")) {
+        customButton.style.display = "none";
+        document.querySelectorAll(".imageeditor").forEach((el) => {
+          el.classList.remove("selected-img");
+        });
       }
     });
 
     document.querySelectorAll(".imageeditor").forEach((el) => {
+      el.style.cursor = "pointer";
+
       el.addEventListener("click", (e) => {
-        el.style.border = "5px solid pink";
+        const prev = document.querySelector(".imageeditor.selected-img");
+        if (prev) prev.classList.remove("selected-img");
+
+        el.classList.add("selected-img");
 
         if (el.naturalHeight === 0) {
-            current.aspectRatio = 1;
+          current.aspectRatio = 1;
         } else {
-            current.aspectRatio = el.naturalWidth / el.naturalHeight;
+          current.aspectRatio = el.naturalWidth / el.naturalHeight;
         }
 
         current.element = el;
 
-        customButton.style.top = e.clientY + 10 + "px";
-        customButton.style.left = e.clientX + 10 + "px";
+        customButton.style.top = e.pageY + 10 + "px";
+        customButton.style.left = e.pageX + 10 + "px";
         customButton.style.display = "block";
       });
     });
@@ -792,14 +813,13 @@ let NEWSITEEDITOR = (function () {
       cropper.getCroppedCanvas().toBlob((blob) => {
         uppy.removeFile(pendingFile.id);
 
-
         const ts = new Date()
-        .toISOString()
-        .replace(/[-:.]/g, '')       
-        .replace('Z', '');          
+          .toISOString()
+          .replace(/[-:.]/g, "")
+          .replace("Z", "");
 
         uppy.addFile({
-          name: ts+'.png',
+          name: ts + ".png",
           type: pendingFile.type,
           data: blob,
           meta: {
@@ -841,6 +861,7 @@ let NEWSITEEDITOR = (function () {
     const modal = document.getElementById("modalNseBackground");
     modal.style.display = shouldShow ? "flex" : "none";
   }
+  //Fin du nseImageEditor
 
   // to set data-data for every element when opening the page
   $(".siteeditor").each(function () {
@@ -861,10 +882,13 @@ let NEWSITEEDITOR = (function () {
   putNbColumn();
   putWidth();
   putPadding();
-  nseImageEditor();
+
   //$('#body').off('click');
   //$('section').off('click');
 
+  //nseFileEditor
+  //nseImageEditor(false);
+
   // define the public API
   var API = {};
   API.version = version;