fix(jeu): overlay fonctionnel — CSS complet + URL sanitizée + data-state
All checks were successful
Deploy / Deploy to Production (push) Successful in 22s
All checks were successful
Deploy / Deploy to Production (push) Successful in 22s
- jeu.php : supprime les espaces de l'URL (preg_replace), ajoute data-state="initial" sur l'overlay - Article.svelte : porte le CSS complet depuis l'ancienne app React (background opaque, play icon, hover, deactivate btn, game-active state) - JS : ignore les clics sur overlay ended, remet data-state="initial" au deactivate Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2af4604c08
commit
ddfcf4de70
2 changed files with 119 additions and 10 deletions
|
|
@ -1,17 +1,19 @@
|
||||||
<?php if ($block->url()->isNotEmpty()): ?>
|
<?php if ($block->url()->isNotEmpty()):
|
||||||
|
$iframeUrl = preg_replace('/\s+/', '', $block->url()->value());
|
||||||
|
?>
|
||||||
<div class="iframe-game-container">
|
<div class="iframe-game-container">
|
||||||
<iframe
|
<iframe
|
||||||
loading="eager"
|
loading="eager"
|
||||||
importance="high"
|
importance="high"
|
||||||
width="400"
|
width="400"
|
||||||
height="650"
|
height="650"
|
||||||
style="border: none; overflow: hidden; pointer-events: none; display: block;"
|
style="border: none; overflow: hidden; pointer-events: none; display: block; width: 100%;"
|
||||||
src="<?= $block->url()->html() ?>"
|
src="<?= htmlspecialchars($iframeUrl, ENT_QUOTES, 'UTF-8') ?>"
|
||||||
></iframe>
|
></iframe>
|
||||||
<div class="iframe-click-overlay">
|
<div class="iframe-click-overlay" data-state="initial">
|
||||||
<div class="overlay-content">
|
<div class="overlay-content">
|
||||||
<div class="play-icon">▶</div>
|
<div class="play-icon">▶</div>
|
||||||
<p>Cliquez pour jouer</p>
|
<p class="overlay-message">Cliquez pour jouer</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="iframe-deactivate-btn" title="Deactivate game (restore scrolling)">✕</button>
|
<button class="iframe-deactivate-btn" title="Deactivate game (restore scrolling)">✕</button>
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
const deactivateBtn = container.querySelector('.iframe-deactivate-btn')
|
const deactivateBtn = container.querySelector('.iframe-deactivate-btn')
|
||||||
|
|
||||||
overlay?.addEventListener('click', () => {
|
overlay?.addEventListener('click', () => {
|
||||||
|
if (overlay.getAttribute('data-state') === 'ended') return
|
||||||
overlay.style.display = 'none'
|
overlay.style.display = 'none'
|
||||||
iframe.style.pointerEvents = 'auto'
|
iframe.style.pointerEvents = 'auto'
|
||||||
container.classList.add('game-active')
|
container.classList.add('game-active')
|
||||||
|
|
@ -36,6 +37,7 @@
|
||||||
deactivateBtn?.addEventListener('click', (e) => {
|
deactivateBtn?.addEventListener('click', (e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
overlay.style.display = 'flex'
|
overlay.style.display = 'flex'
|
||||||
|
overlay.setAttribute('data-state', 'initial')
|
||||||
iframe.style.pointerEvents = 'none'
|
iframe.style.pointerEvents = 'none'
|
||||||
container.classList.remove('game-active')
|
container.classList.remove('game-active')
|
||||||
})
|
})
|
||||||
|
|
@ -371,24 +373,129 @@
|
||||||
/* --- Bloc jeu iframe --- */
|
/* --- Bloc jeu iframe --- */
|
||||||
.article-body :global(.iframe-game-container) {
|
.article-body :global(.iframe-game-container) {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 2rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body :global(.iframe-game-container iframe) {
|
||||||
|
border: none;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
transition: filter 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-body :global(.iframe-click-overlay) {
|
.article-body :global(.iframe-click-overlay) {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
z-index: 10;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
background: rgba(13, 14, 34, 0.90);
|
||||||
|
backdrop-filter: blur(5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body :global(.iframe-click-overlay[data-state="initial"]) {
|
||||||
|
background: rgba(13, 14, 34, 0.98);
|
||||||
|
backdrop-filter: blur(5px);
|
||||||
|
border: 1px solid rgba(77, 252, 161, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body :global(.iframe-click-overlay[data-state="initial"]:hover) {
|
||||||
|
border-color: rgba(77, 252, 161, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body :global(.iframe-click-overlay[data-state="ended"]) {
|
||||||
|
background: rgba(13, 14, 34, 0.10);
|
||||||
|
backdrop-filter: none;
|
||||||
|
border: 2px solid #4DFCA1;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body :global(.overlay-content) {
|
||||||
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
user-select: none;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body :global(.play-icon) {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
background: linear-gradient(135deg, #4DFCA1 0%, #04fea0 100%);
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin: 0 auto 16px auto;
|
||||||
|
font-size: 24px;
|
||||||
|
color: black;
|
||||||
|
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||||
|
box-shadow: 0 4px 15px rgba(77, 252, 161, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body :global(.iframe-click-overlay[data-state="initial"]:hover .play-icon) {
|
||||||
|
transform: scale(1.1);
|
||||||
|
box-shadow: 0 6px 20px rgba(77, 252, 161, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body :global(.overlay-message) {
|
||||||
|
font-family: "Danzza", sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 0;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body :global(.iframe-click-overlay[data-state="ended"] .overlay-message) {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #4DFCA1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-body :global(.iframe-deactivate-btn) {
|
.article-body :global(.iframe-deactivate-btn) {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 8px;
|
top: 15px;
|
||||||
right: 8px;
|
right: 15px;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
background: rgba(0, 0, 0, 0.7);
|
||||||
|
color: white;
|
||||||
|
border: 2px solid #04fea0;
|
||||||
|
border-radius: 50%;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
z-index: 11;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body :global(.iframe-deactivate-btn:hover) {
|
||||||
|
background: #4DFCA1;
|
||||||
|
color: black;
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body :global(.iframe-game-container.game-active:hover .iframe-deactivate-btn) {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body :global(.iframe-game-container.game-active) {
|
||||||
|
box-shadow: 0 0 0 2px rgba(77, 252, 161, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- Recommandations --- */
|
/* --- Recommandations --- */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue