Actualiser test.html
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
This commit is contained in:
@@ -2,63 +2,62 @@
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>⚡ Sandbox - Test Raccourci EverShelf</title>
|
||||
<title>⚡ Sandbox - Test Récupération ID</title>
|
||||
<style>
|
||||
body { font-family: sans-serif; background: #333; color: #fff; padding: 50px; }
|
||||
.modal-preview { background: #fff; color: #000; padding: 20px; border-radius: 12px; width: 500px; margin: 0 auto; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }
|
||||
.button-container { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; }
|
||||
|
||||
/* Styles originaux d'EverShelf simulés */
|
||||
/* Les styles que tu as inspectés */
|
||||
.btn { padding: 12px; border-radius: 8px; border: none; font-weight: bold; cursor: pointer; flex: 1; margin: 0 5px; text-align: center; text-decoration: none; }
|
||||
.btn-danger { background-color: #d32f2f; color: white; }
|
||||
.btn-success { background-color: #2e7d32; color: white; }
|
||||
.btn-danger { background-color: #d32f2f; color: white; }
|
||||
.btn-purple { background-color: #7b1fa2; color: white; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2 style="text-align: center;">Zone de Test de l'Injecteur</h2>
|
||||
<h2 style="text-align: center;">Test de Capture d'attribut HTML</h2>
|
||||
|
||||
<div class="modal-preview">
|
||||
<h3>Jus ananas</h3>
|
||||
<p>Emplacement : 🍷 Cave</p>
|
||||
<p>Quantité : 1 pcs</p>
|
||||
|
||||
<div class="button-container">
|
||||
<button class="btn btn-danger">Utiliser</button>
|
||||
<button class="btn btn-success">Modifier</button>
|
||||
|
||||
<button class="btn btn-success" data-id="145">Modifier</button>
|
||||
|
||||
<button class="btn btn-purple">Recette</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
console.log("Page de test initialisée. Le script injecteur va tourner ici sans risque.");
|
||||
|
||||
setInterval(() => {
|
||||
const buttons = document.querySelectorAll('button, .btn');
|
||||
const greenBtn = document.querySelector('.btn-success');
|
||||
|
||||
buttons.forEach(btn => {
|
||||
// On cherche le bouton "Modifier" vert
|
||||
if (btn.offsetWidth > 0 && btn.textContent.trim() === 'Modifier' && !btn.parentNode.querySelector('.btn-catalog-shortcut')) {
|
||||
const container = btn.parentNode;
|
||||
if (greenBtn && !greenBtn.parentNode.querySelector('.btn-catalog-shortcut')) {
|
||||
const container = greenBtn.parentNode;
|
||||
|
||||
// Création de notre bouton de test bleu
|
||||
const testBtn = document.createElement('button');
|
||||
testBtn.type = 'button';
|
||||
testBtn.className = 'btn btn-catalog-shortcut';
|
||||
testBtn.innerText = '✏️ Modifier la fiche';
|
||||
testBtn.style.cssText = 'background-color: #1976d2; color: white; font-size: 12px;';
|
||||
// Extraction chirurgicale de l'attribut "data-id"
|
||||
let pId = greenBtn.getAttribute('data-id');
|
||||
|
||||
// Action de simulation au clic
|
||||
testBtn.onclick = function() {
|
||||
alert("Clic réussi ! Dans l'application, ce clic redirigera vers le catalogue.");
|
||||
};
|
||||
const blueBtn = document.createElement('button');
|
||||
blueBtn.type = 'button';
|
||||
blueBtn.className = 'btn btn-catalog-shortcut';
|
||||
blueBtn.style.cssText = 'background-color: #1976d2; color: white; font-size: 11px;';
|
||||
blueBtn.innerText = '✏️ Modifier la fiche';
|
||||
|
||||
// Injection
|
||||
container.insertBefore(testBtn, btn);
|
||||
console.log("Bouton injecté avec succès dans le bac à sable !");
|
||||
}
|
||||
});
|
||||
blueBtn.onclick = function() {
|
||||
if (pId) {
|
||||
alert("ID extrait avec succès du bouton vert ! Valeur : " + pId);
|
||||
} else {
|
||||
alert("Aïe ! Le bouton vert n'a pas d'attribut 'data-id'.");
|
||||
}
|
||||
};
|
||||
|
||||
container.insertBefore(blueBtn, greenBtn);
|
||||
}
|
||||
}, 1000);
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user