emoji.php
· 13 KiB · PHP
Originalformat
<?php
// ✨ Simple script to find emoji . need emoji.json (don't panic it will downloading it automaticly)
// Made with coffee 🍵 and 🩷 by Erreur32 - 2025
// Script PHP pour télécharger le fichier emoji.json depuis
// https://github.com/amio/emoji.json
$url = 'https://raw.githubusercontent.com/amio/emoji.json/refs/heads/master/emoji.json';
$localFile = 'emoji.json';
if (!file_exists($localFile)) {
// Télécharger le fichier JSON seulement s'il n'existe pas
$emojiJson = file_get_contents($url);
if ($emojiJson !== false) {
file_put_contents($localFile, $emojiJson);
// check if json is valid
$decodedJson = json_decode($emojiJson, true);
if (json_last_error() !== JSON_ERROR_NONE) {
die('Le fichier téléchargé n\'est pas un JSON valide.');
}
echo "<div id='popup-info' style='position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background-color: #4CAF50; color: white; padding: 15px; border-radius: 8px; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); z-index: 1000;'>Fichier emoji.json téléchargé avec succès depuis : ".htmlspecialchars($url, ENT_QUOTES, 'UTF-8')."</div>";
} else {
echo "<div id='popup-info' style='position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background-color: #e74c3c; color: white; padding: 15px; border-radius: 8px; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); z-index: 1000;'>Erreur : Impossible de télécharger le fichier emoji.json.</div>";
}
} else {
echo "<div id='popup-info' style='position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background-color: #4CAF50; color: white; padding: 15px; border-radius: 8px; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); z-index: 1000;'>Le fichier emoji.json existe déjà localement.</div>";
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>📜 Liste Emojis</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
background-color: #ffffff;
color: #000000;
transition: background-color 0.3s, color 0.3s;
}
body.dark-mode {
background-color: #2c2c2c;
color: #e0e0e0;
}
#controls {
display: flex;
gap: 10px;
margin-bottom: 20px;
}
#search {
flex: 1;
padding: 10px;
font-size: 16px;
box-sizing: border-box;
}
#category {
padding: 10px;
font-size: 16px;
}
#reset {
padding: 10px 15px;
font-size: 16px;
cursor: pointer;
background-color: #007BFF;
color: #fff;
border: none;
border-radius: 5px;
}
#reset:hover {
background-color: #0056b3;
}
#dark-mode-toggle {
padding: 10px;
font-size: 16px;
cursor: pointer;
background-color: #333;
color: #fff;
border: none;
border-radius: 5px;
display: flex;
align-items: center;
gap: 5px;
}
#dark-mode-toggle:hover {
background-color: #555;
}
.group-title {
font-size: 1.5em;
margin: 20px 0 10px;
text-decoration: underline;
}
.emoji-group {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.emoji-item {
display: flex;
align-items: center;
justify-content: flex-start;
gap: 10px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
background-color: #f9f9f9;
cursor: pointer;
transition: background-color 0.3s, color 0.3s;
}
.emoji-item:hover {
background-color: #e6e6e6;
}
body.dark-mode .emoji-item {
background-color: #3a3a3a;
border-color: #555;
}
body.dark-mode .emoji-item:hover {
background-color: #4a4a4a;
}
.emoji {
font-size: 32px;
flex-shrink: 0;
}
.name {
text-align: left;
word-wrap: break-word;
flex: 1;
}
#confirmation {
display: none;
background-color: #4CAF50;
color: white;
padding: 10px;
margin-top: 20px;
border-radius: 5px;
text-align: center;
font-size: 16px;
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
z-index: 1000;
opacity: 0;
transition: opacity 0.3s ease-in-out;
}
#custom-block, #custom-block-2 {
background-color: #f3f4f6;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ddd;
border-radius: 10px;
font-size: 18px;
text-align: center;
white-space: pre-wrap;
font-family: "Courier New", Courier, monospace;
word-wrap: break-word;
}
body.dark-mode #custom-block, body.dark-mode #custom-block-2 {
background-color: #3a3a3a;
border-color: #555;
color: #e0e0e0;
}
</style>
</head>
<body>
<button id="dark-mode-toggle">
🌙 Mode Sombre
</button>
<h1>📜 Liste Emojis</h1>
<!-- Bloc personnalisé 1 -->
<div id="custom-block">
🆓🅴🅲🅷🅾️🆂🆈🆂🆃🅴🅼
🅴🆁🆁🅴🆄🆁32
</div>
<!-- Bloc personnalisé 2 (nouveau bloc) -->
<div id="custom-block-2">
🧑💻 🧑🎓 🧑🏫 🧑🔬 👨💻 👨🎓 👨🏫 👨🔬 👩💻 👩🎓 👩🏫 👩🔬 📱 🖥️ ⌨️ 🖱️ 🔧🧠
💻🖥️⌨️🖱️📚🎓🔍🧠🔧🌐📈📊🔄🛠️📦🔗🚀🔒🔐🔑👩💻👨💻👨🎓👩🎓🎯🎲📲💡🌟💫⭐🚦🔀🛡️🔔🔨🔩⏱️🏆🧩📝📖🗂️🗄️📋🗒️💼📁📂📆📉🌍🔖📜🔬🧮🧪📡📟📢📣🔌🌡️🧲🔋🔌🔑💾💽📀📼📹📷📸📲🔌🔋💬🔠🔡🔢🔣🔤🔼🔽⏪⏩⏫⏬🔂🔁🔄⏹️⏸️⏩🔚🔛🔜🔝💯🆒🔥🌈💪🤖✨👏🙌🎉🎊💀 ☠️
</div>
<br />
<div id="controls">
<input type="text" id="search" placeholder="Rechercher un emoji...">
<select id="category">
<option value="">Sélectionner une catégorie</option>
</select>
<button id="reset">Réinitialiser</button>
</div>
<div id="emoji-list"></div>
<div id="confirmation">Emoji copié dans le presse-papiers !</div>
<script>
// Activer le mode sombre par défaut si enregistré dans localStorage
if (localStorage.getItem('theme') === 'dark') {
document.body.classList.add('dark-mode');
document.getElementById('dark-mode-toggle').textContent = '☀️ Mode Clair';
}
// Fonction pour charger le fichier JSON des emojis
async function loadEmojis() {
try {
const response = await fetch('emoji.json');
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Erreur lors du chargement des emojis:', error);
document.getElementById('emoji-list').innerHTML = '<p>Impossible de charger la liste des emojis.</p>';
return [];
}
}
// Fonction pour afficher les emojis
function displayEmojis(emojis, filter = "", category = "") {
const emojiList = document.getElementById('emoji-list');
emojiList.innerHTML = '';
const filteredEmojis = emojis.filter(item =>
(item.name.toLowerCase().includes(filter.toLowerCase()) || item.char.includes(filter)) &&
(category ? item.category === category : true)
);
const groups = {};
filteredEmojis.forEach(item => {
const group = item.group || 'Autres';
if (!groups[group]) {
groups[group] = [];
}
groups[group].push(item);
});
if (filteredEmojis.length === 0) {
emojiList.innerHTML = '<p>Aucun emoji trouvé.</p>';
return;
}
Object.entries(groups).forEach(([group, items]) => {
const groupTitle = document.createElement('h2');
groupTitle.classList.add('group-title');
groupTitle.textContent = group;
emojiList.appendChild(groupTitle);
const emojiGroup = document.createElement('div');
emojiGroup.classList.add('emoji-group');
items.forEach(item => {
const emojiItem = document.createElement('div');
emojiItem.classList.add('emoji-item');
const emojiSpan = document.createElement('span');
emojiSpan.classList.add('emoji');
emojiSpan.textContent = item.char;
const nameSpan = document.createElement('span');
nameSpan.classList.add('name');
nameSpan.textContent = item.name;
emojiItem.appendChild(emojiSpan);
emojiItem.appendChild(nameSpan);
emojiGroup.appendChild(emojiItem);
emojiItem.addEventListener('click', () => {
navigator.clipboard.writeText(item.char).then(() => {
const confirmation = document.getElementById('confirmation');
confirmation.style.display = 'block';
confirmation.style.opacity = 1;
setTimeout(() => {
confirmation.style.opacity = 0;
}, 2000);
}).catch(err => {
console.error('Erreur lors de la copie dans le presse-papiers: ', err);
});
});
});
emojiList.appendChild(emojiGroup);
});
}
document.addEventListener('DOMContentLoaded', async () => {
const emojis = await loadEmojis();
if (!emojis) return;
// Afficher par défaut la catégorie "Objects"
displayEmojis(emojis, "", "");
const categorySelect = document.getElementById('category');
const categories = [...new Set(emojis.map(item => item.category))].sort();
categories.forEach(category => {
const option = document.createElement('option');
option.value = category;
option.textContent = category;
categorySelect.appendChild(option);
});
const searchInput = document.getElementById('search');
searchInput.addEventListener('input', (e) => {
const query = e.target.value;
const category = categorySelect.value;
displayEmojis(emojis, query, category);
});
categorySelect.addEventListener('change', (e) => {
const category = e.target.value;
const query = searchInput.value;
displayEmojis(emojis, query, category);
});
const resetButton = document.getElementById('reset');
resetButton.addEventListener('click', () => {
searchInput.value = "";
categorySelect.value = "Objects";
displayEmojis(emojis, "", "Objects");
});
});
document.getElementById('dark-mode-toggle').addEventListener('click', () => {
const body = document.body;
const button = document.getElementById('dark-mode-toggle');
body.classList.toggle('dark-mode');
const theme = body.classList.contains('dark-mode') ? 'dark' : 'light';
localStorage.setItem('theme', theme);
button.textContent = theme === 'dark' ? '☀️ Mode Clair' : '🌙 Mode Sombre';
});
// Supprimer le pop-up après 3 secondes
setTimeout(() => {
const popup = document.getElementById('popup-info');
if (popup) popup.style.display = 'none';
}, 3000);
</script>
</body>
</html>
| 1 | <?php |
| 2 | |
| 3 | // ✨ Simple script to find emoji . need emoji.json (don't panic it will downloading it automaticly) |
| 4 | // Made with coffee 🍵 and 🩷 by Erreur32 - 2025 |
| 5 | |
| 6 | |
| 7 | // Script PHP pour télécharger le fichier emoji.json depuis |
| 8 | // https://github.com/amio/emoji.json |
| 9 | |
| 10 | $url = 'https://raw.githubusercontent.com/amio/emoji.json/refs/heads/master/emoji.json'; |
| 11 | $localFile = 'emoji.json'; |
| 12 | |
| 13 | if (!file_exists($localFile)) { |
| 14 | // Télécharger le fichier JSON seulement s'il n'existe pas |
| 15 | $emojiJson = file_get_contents($url); |
| 16 | |
| 17 | if ($emojiJson !== false) { |
| 18 | file_put_contents($localFile, $emojiJson); |
| 19 | // check if json is valid |
| 20 | $decodedJson = json_decode($emojiJson, true); |
| 21 | if (json_last_error() !== JSON_ERROR_NONE) { |
| 22 | die('Le fichier téléchargé n\'est pas un JSON valide.'); |
| 23 | } |
| 24 | |
| 25 | echo "<div id='popup-info' style='position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background-color: #4CAF50; color: white; padding: 15px; border-radius: 8px; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); z-index: 1000;'>Fichier emoji.json téléchargé avec succès depuis : ".htmlspecialchars($url, ENT_QUOTES, 'UTF-8')."</div>"; |
| 26 | } else { |
| 27 | echo "<div id='popup-info' style='position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background-color: #e74c3c; color: white; padding: 15px; border-radius: 8px; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); z-index: 1000;'>Erreur : Impossible de télécharger le fichier emoji.json.</div>"; |
| 28 | } |
| 29 | } else { |
| 30 | echo "<div id='popup-info' style='position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background-color: #4CAF50; color: white; padding: 15px; border-radius: 8px; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); z-index: 1000;'>Le fichier emoji.json existe déjà localement.</div>"; |
| 31 | } |
| 32 | |
| 33 | |
| 34 | ?> |
| 35 | |
| 36 | <!DOCTYPE html> |
| 37 | <html lang="fr"> |
| 38 | <head> |
| 39 | <meta charset="UTF-8"> |
| 40 | <title>📜 Liste Emojis</title> |
| 41 | <style> |
| 42 | body { |
| 43 | font-family: Arial, sans-serif; |
| 44 | padding: 20px; |
| 45 | background-color: #ffffff; |
| 46 | color: #000000; |
| 47 | transition: background-color 0.3s, color 0.3s; |
| 48 | } |
| 49 | |
| 50 | body.dark-mode { |
| 51 | background-color: #2c2c2c; |
| 52 | color: #e0e0e0; |
| 53 | } |
| 54 | |
| 55 | #controls { |
| 56 | display: flex; |
| 57 | gap: 10px; |
| 58 | margin-bottom: 20px; |
| 59 | } |
| 60 | #search { |
| 61 | flex: 1; |
| 62 | padding: 10px; |
| 63 | font-size: 16px; |
| 64 | box-sizing: border-box; |
| 65 | } |
| 66 | #category { |
| 67 | padding: 10px; |
| 68 | font-size: 16px; |
| 69 | } |
| 70 | #reset { |
| 71 | padding: 10px 15px; |
| 72 | font-size: 16px; |
| 73 | cursor: pointer; |
| 74 | background-color: #007BFF; |
| 75 | color: #fff; |
| 76 | border: none; |
| 77 | border-radius: 5px; |
| 78 | } |
| 79 | #reset:hover { |
| 80 | background-color: #0056b3; |
| 81 | } |
| 82 | |
| 83 | #dark-mode-toggle { |
| 84 | padding: 10px; |
| 85 | font-size: 16px; |
| 86 | cursor: pointer; |
| 87 | background-color: #333; |
| 88 | color: #fff; |
| 89 | border: none; |
| 90 | border-radius: 5px; |
| 91 | display: flex; |
| 92 | align-items: center; |
| 93 | gap: 5px; |
| 94 | } |
| 95 | |
| 96 | #dark-mode-toggle:hover { |
| 97 | background-color: #555; |
| 98 | } |
| 99 | |
| 100 | .group-title { |
| 101 | font-size: 1.5em; |
| 102 | margin: 20px 0 10px; |
| 103 | text-decoration: underline; |
| 104 | } |
| 105 | .emoji-group { |
| 106 | display: grid; |
| 107 | grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); |
| 108 | gap: 20px; |
| 109 | margin-bottom: 30px; |
| 110 | } |
| 111 | .emoji-item { |
| 112 | display: flex; |
| 113 | align-items: center; |
| 114 | justify-content: flex-start; |
| 115 | gap: 10px; |
| 116 | padding: 10px; |
| 117 | border: 1px solid #ddd; |
| 118 | border-radius: 5px; |
| 119 | background-color: #f9f9f9; |
| 120 | cursor: pointer; |
| 121 | transition: background-color 0.3s, color 0.3s; |
| 122 | } |
| 123 | .emoji-item:hover { |
| 124 | background-color: #e6e6e6; |
| 125 | } |
| 126 | body.dark-mode .emoji-item { |
| 127 | background-color: #3a3a3a; |
| 128 | border-color: #555; |
| 129 | } |
| 130 | body.dark-mode .emoji-item:hover { |
| 131 | background-color: #4a4a4a; |
| 132 | } |
| 133 | |
| 134 | .emoji { |
| 135 | font-size: 32px; |
| 136 | flex-shrink: 0; |
| 137 | } |
| 138 | .name { |
| 139 | text-align: left; |
| 140 | word-wrap: break-word; |
| 141 | flex: 1; |
| 142 | } |
| 143 | #confirmation { |
| 144 | display: none; |
| 145 | background-color: #4CAF50; |
| 146 | color: white; |
| 147 | padding: 10px; |
| 148 | margin-top: 20px; |
| 149 | border-radius: 5px; |
| 150 | text-align: center; |
| 151 | font-size: 16px; |
| 152 | position: fixed; |
| 153 | bottom: 20px; |
| 154 | left: 50%; |
| 155 | transform: translateX(-50%); |
| 156 | z-index: 1000; |
| 157 | opacity: 0; |
| 158 | transition: opacity 0.3s ease-in-out; |
| 159 | } |
| 160 | #custom-block, #custom-block-2 { |
| 161 | background-color: #f3f4f6; |
| 162 | padding: 10px; |
| 163 | margin-bottom: 10px; |
| 164 | border: 1px solid #ddd; |
| 165 | border-radius: 10px; |
| 166 | font-size: 18px; |
| 167 | text-align: center; |
| 168 | white-space: pre-wrap; |
| 169 | font-family: "Courier New", Courier, monospace; |
| 170 | word-wrap: break-word; |
| 171 | } |
| 172 | body.dark-mode #custom-block, body.dark-mode #custom-block-2 { |
| 173 | background-color: #3a3a3a; |
| 174 | border-color: #555; |
| 175 | color: #e0e0e0; |
| 176 | } |
| 177 | </style> |
| 178 | </head> |
| 179 | <body> |
| 180 | <button id="dark-mode-toggle"> |
| 181 | 🌙 Mode Sombre |
| 182 | </button> |
| 183 | <h1>📜 Liste Emojis</h1> |
| 184 | |
| 185 | <!-- Bloc personnalisé 1 --> |
| 186 | <div id="custom-block"> |
| 187 | 🆓🅴🅲🅷🅾️🆂🆈🆂🆃🅴🅼 |
| 188 | 🅴🆁🆁🅴🆄🆁32 |
| 189 | |
| 190 | </div> |
| 191 | |
| 192 | <!-- Bloc personnalisé 2 (nouveau bloc) --> |
| 193 | <div id="custom-block-2"> |
| 194 | 🧑💻 🧑🎓 🧑🏫 🧑🔬 👨💻 👨🎓 👨🏫 👨🔬 👩💻 👩🎓 👩🏫 👩🔬 📱 🖥️ ⌨️ 🖱️ 🔧🧠 |
| 195 | 💻🖥️⌨️🖱️📚🎓🔍🧠🔧🌐📈📊🔄🛠️📦🔗🚀🔒🔐🔑👩💻👨💻👨🎓👩🎓🎯🎲📲💡🌟💫⭐🚦🔀🛡️🔔🔨🔩⏱️🏆🧩📝📖🗂️🗄️📋🗒️💼📁📂📆📉🌍🔖📜🔬🧮🧪📡📟📢📣🔌🌡️🧲🔋🔌🔑💾💽📀📼📹📷📸📲🔌🔋💬🔠🔡🔢🔣🔤🔼🔽⏪⏩⏫⏬🔂🔁🔄⏹️⏸️⏩🔚🔛🔜🔝💯🆒🔥🌈💪🤖✨👏🙌🎉🎊💀 ☠️ |
| 196 | </div> |
| 197 | |
| 198 | <br /> |
| 199 | <div id="controls"> |
| 200 | <input type="text" id="search" placeholder="Rechercher un emoji..."> |
| 201 | <select id="category"> |
| 202 | <option value="">Sélectionner une catégorie</option> |
| 203 | </select> |
| 204 | <button id="reset">Réinitialiser</button> |
| 205 | </div> |
| 206 | |
| 207 | <div id="emoji-list"></div> |
| 208 | <div id="confirmation">Emoji copié dans le presse-papiers !</div> |
| 209 | |
| 210 | <script> |
| 211 | // Activer le mode sombre par défaut si enregistré dans localStorage |
| 212 | if (localStorage.getItem('theme') === 'dark') { |
| 213 | document.body.classList.add('dark-mode'); |
| 214 | document.getElementById('dark-mode-toggle').textContent = '☀️ Mode Clair'; |
| 215 | } |
| 216 | |
| 217 | // Fonction pour charger le fichier JSON des emojis |
| 218 | async function loadEmojis() { |
| 219 | try { |
| 220 | const response = await fetch('emoji.json'); |
| 221 | if (!response.ok) { |
| 222 | throw new Error(`HTTP error! Status: ${response.status}`); |
| 223 | } |
| 224 | const data = await response.json(); |
| 225 | return data; |
| 226 | } catch (error) { |
| 227 | console.error('Erreur lors du chargement des emojis:', error); |
| 228 | document.getElementById('emoji-list').innerHTML = '<p>Impossible de charger la liste des emojis.</p>'; |
| 229 | return []; |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | // Fonction pour afficher les emojis |
| 234 | function displayEmojis(emojis, filter = "", category = "") { |
| 235 | const emojiList = document.getElementById('emoji-list'); |
| 236 | emojiList.innerHTML = ''; |
| 237 | |
| 238 | const filteredEmojis = emojis.filter(item => |
| 239 | (item.name.toLowerCase().includes(filter.toLowerCase()) || item.char.includes(filter)) && |
| 240 | (category ? item.category === category : true) |
| 241 | ); |
| 242 | |
| 243 | const groups = {}; |
| 244 | filteredEmojis.forEach(item => { |
| 245 | const group = item.group || 'Autres'; |
| 246 | if (!groups[group]) { |
| 247 | groups[group] = []; |
| 248 | } |
| 249 | groups[group].push(item); |
| 250 | }); |
| 251 | |
| 252 | if (filteredEmojis.length === 0) { |
| 253 | emojiList.innerHTML = '<p>Aucun emoji trouvé.</p>'; |
| 254 | return; |
| 255 | } |
| 256 | |
| 257 | Object.entries(groups).forEach(([group, items]) => { |
| 258 | const groupTitle = document.createElement('h2'); |
| 259 | groupTitle.classList.add('group-title'); |
| 260 | groupTitle.textContent = group; |
| 261 | emojiList.appendChild(groupTitle); |
| 262 | |
| 263 | const emojiGroup = document.createElement('div'); |
| 264 | emojiGroup.classList.add('emoji-group'); |
| 265 | |
| 266 | items.forEach(item => { |
| 267 | const emojiItem = document.createElement('div'); |
| 268 | emojiItem.classList.add('emoji-item'); |
| 269 | |
| 270 | const emojiSpan = document.createElement('span'); |
| 271 | emojiSpan.classList.add('emoji'); |
| 272 | emojiSpan.textContent = item.char; |
| 273 | |
| 274 | const nameSpan = document.createElement('span'); |
| 275 | nameSpan.classList.add('name'); |
| 276 | nameSpan.textContent = item.name; |
| 277 | |
| 278 | emojiItem.appendChild(emojiSpan); |
| 279 | emojiItem.appendChild(nameSpan); |
| 280 | emojiGroup.appendChild(emojiItem); |
| 281 | |
| 282 | emojiItem.addEventListener('click', () => { |
| 283 | navigator.clipboard.writeText(item.char).then(() => { |
| 284 | const confirmation = document.getElementById('confirmation'); |
| 285 | confirmation.style.display = 'block'; |
| 286 | confirmation.style.opacity = 1; |
| 287 | setTimeout(() => { |
| 288 | confirmation.style.opacity = 0; |
| 289 | }, 2000); |
| 290 | }).catch(err => { |
| 291 | console.error('Erreur lors de la copie dans le presse-papiers: ', err); |
| 292 | }); |
| 293 | }); |
| 294 | }); |
| 295 | |
| 296 | emojiList.appendChild(emojiGroup); |
| 297 | }); |
| 298 | } |
| 299 | |
| 300 | document.addEventListener('DOMContentLoaded', async () => { |
| 301 | const emojis = await loadEmojis(); |
| 302 | if (!emojis) return; |
| 303 | |
| 304 | // Afficher par défaut la catégorie "Objects" |
| 305 | displayEmojis(emojis, "", ""); |
| 306 | |
| 307 | const categorySelect = document.getElementById('category'); |
| 308 | const categories = [...new Set(emojis.map(item => item.category))].sort(); |
| 309 | categories.forEach(category => { |
| 310 | const option = document.createElement('option'); |
| 311 | option.value = category; |
| 312 | option.textContent = category; |
| 313 | categorySelect.appendChild(option); |
| 314 | }); |
| 315 | |
| 316 | const searchInput = document.getElementById('search'); |
| 317 | searchInput.addEventListener('input', (e) => { |
| 318 | const query = e.target.value; |
| 319 | const category = categorySelect.value; |
| 320 | displayEmojis(emojis, query, category); |
| 321 | }); |
| 322 | |
| 323 | categorySelect.addEventListener('change', (e) => { |
| 324 | const category = e.target.value; |
| 325 | const query = searchInput.value; |
| 326 | displayEmojis(emojis, query, category); |
| 327 | }); |
| 328 | |
| 329 | const resetButton = document.getElementById('reset'); |
| 330 | resetButton.addEventListener('click', () => { |
| 331 | searchInput.value = ""; |
| 332 | categorySelect.value = "Objects"; |
| 333 | displayEmojis(emojis, "", "Objects"); |
| 334 | }); |
| 335 | }); |
| 336 | |
| 337 | document.getElementById('dark-mode-toggle').addEventListener('click', () => { |
| 338 | const body = document.body; |
| 339 | const button = document.getElementById('dark-mode-toggle'); |
| 340 | body.classList.toggle('dark-mode'); |
| 341 | const theme = body.classList.contains('dark-mode') ? 'dark' : 'light'; |
| 342 | localStorage.setItem('theme', theme); |
| 343 | button.textContent = theme === 'dark' ? '☀️ Mode Clair' : '🌙 Mode Sombre'; |
| 344 | }); |
| 345 | |
| 346 | // Supprimer le pop-up après 3 secondes |
| 347 | setTimeout(() => { |
| 348 | const popup = document.getElementById('popup-info'); |
| 349 | if (popup) popup.style.display = 'none'; |
| 350 | }, 3000); |
| 351 | </script> |
| 352 | |
| 353 | |
| 354 | </body> |
| 355 | </html> |
| 356 |