2 Commits 2b3e9c7989 ... 4fce2696e7

Author SHA1 Message Date
  Loquicom 4fce2696e7 Meilleur placement btn close fs 6 months ago
  Loquicom 5be3777db0 Amélioration splash 6 months ago
2 changed files with 27 additions and 10 deletions
  1. 5 6
      index.php
  2. 22 4
      js/splash.js

+ 5 - 6
index.php

@@ -15,6 +15,7 @@
 <body>
 
     <?= file_get_contents('src/splash.html') ?>
+    <span id="close-fs" role="button" class="hide" onclick="fullscreen()">X</span>
 
     <div id="header">
         <h1>Hello</h1>
@@ -28,7 +29,6 @@
             <div><span role="button" data-tooltip="Télécharger les CV en CMD"><span class="iconify" data-icon="mdi-console"></span></span></div>
         </div>
         <div class="window">
-            <span id="close-fs" role="button" class="hide" onclick="fullscreen()">X</span>
             <div class="window-toolbar">
                 <div class="window-toolbar-left">
                     <span class="iconify" data-icon="mdi-console-line"></span>
@@ -60,26 +60,25 @@
     <script src="js/konami.js"></script>
     <script src="js/loaded.js"></script>
     <script type="text/javascript">
-        
 
-        //fullscreen();
-
-        function fullscreen() {
+        function fullscreen(closeBtn = true) {
             const pos = $('#' + windowMode).position();
             if (!$('#' + windowMode).hasClass('fullscreen')) {
                 $('#' + windowMode).css('top', Math.trunc(pos.top) + 'px');
                 $('#' + windowMode).css('left', Math.trunc(pos.left) + 'px');
                 $('#' + windowMode).css('position', 'fixed');
+                localStorage.setItem('show-page', false);
             } else {
                 $('#' + windowMode).one('transitionend', function() {
                     $('#' + windowMode).css('top', '');
                     $('#' + windowMode).css('left', '');
                     $('#' + windowMode).css('position', '');
                 });
+                localStorage.setItem('show-page', true);
             }
             
             $('#' + windowMode).toggleClass('fullscreen');
-            $('#close-fs').toggleClass('hide');
+            if (closeBtn) $('#close-fs').toggleClass('hide');
         }
 
         function show() {

+ 22 - 4
js/splash.js

@@ -1,10 +1,12 @@
 $(() => {
     const skip = localStorage.getItem('skip-splash');
     if (skip && skip == 'true') {
-        setTimeout(() => {
-            $('#splash').addClass('none');
-        }, 200);
+        unsplash();
     } else {
+        if (skip == null) {
+            localStorage.setItem('skip-splash', true);
+        }
+
         $('#splash-logo').removeClass('hide');
 
         const loaderInterval = loader();
@@ -21,7 +23,7 @@ $(() => {
         });
         $('#splash-line-3').one('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', function() {
             clearInterval(loaderInterval);
-            $('#splash').addClass('none');
+            unsplash();
         });
     }
 });
@@ -70,3 +72,19 @@ function loader() {
     }, spinner.interval);
 }
 
+function unsplash() {
+    const showPage = localStorage.getItem('show-page');
+    if (showPage && showPage == 'true') {
+        $('#splash').addClass('none');
+    } else {
+        if (showPage == null) {
+            localStorage.setItem('show-page', false);
+        }
+
+        fullscreen(false);
+        setTimeout(() => {
+            $('#splash').addClass('none');
+            $('#close-fs').toggleClass('hide');
+        }, 200);
+    }
+}