Skip to content

Commit a12a9bf

Browse files
authored
Update ntl-ruyadorno.html
1 parent 1e16fe8 commit a12a9bf

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

projects/ntl-ruyadorno.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,5 +596,38 @@ <h5>Metadata</h5>
596596
<!-- Bootstrap Bundle JS -->
597597
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
598598
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
599+
600+
601+
<script>
602+
// URL to the hosted emoji.json file
603+
const gemojiURL = "https://codehimblog.github.io/emoji.json";
604+
605+
async function replaceEmojis() {
606+
try {
607+
// Fetch the Gemoji JSON data
608+
const response = await fetch(gemojiURL);
609+
const emojis = await response.json();
610+
611+
// Create a map for quick lookup
612+
const emojiMap = emojis.reduce((map, emoji) => {
613+
emoji.names.forEach((name) => {
614+
map[name] = emoji.emoji;
615+
});
616+
return map;
617+
}, {});
618+
619+
// Replace emoji shortcodes in text
620+
const contentElement = document.getElementById("content");
621+
contentElement.innerHTML = contentElement.innerHTML.replace(/:([a-zA-Z0-9_+-]+):/g, (match, shortcode) => {
622+
return emojiMap[shortcode] || match; // Replace or keep original if not found
623+
});
624+
} catch (error) {
625+
console.error("Failed to fetch emojis:", error);
626+
}
627+
}
628+
629+
// Call the function to replace emojis
630+
replaceEmojis();
631+
</script>
599632
</body>
600633
</html>

0 commit comments

Comments
 (0)