Skip to content

Commit db983b9

Browse files
committed
lazy loading and use the right site
1 parent 92ea012 commit db983b9

1 file changed

Lines changed: 3 additions & 14 deletions

File tree

emojis/index.html

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ <h1>PenguinMod Emojis</h1>
145145
const loadingSpinner = document.getElementById('loading');
146146
const errorText = document.getElementById('error');
147147
const emojiContainer = document.getElementById('container');
148-
const emojiHtmlUrl = 'https://library.penguinmod.com/files/emojis';
148+
const emojiHtmlUrl = 'https://gextapi.derpygamer2142.com/emojis';
149149

150150
const emojiElementHTML = `<button class="emoji-card" onclick="copyEmojiName(\`{NAME}\`)">
151-
<img src="../files/emojis/{NAME}.png" alt=":{NAME}:" title=":{NAME}:">
151+
<img src="../files/emojis/{NAME}.png" alt=":{NAME}:" title=":{NAME}:" loading="lazy">
152152
<p>:{NAME}:</p>
153153
</button>`;
154154

@@ -158,18 +158,7 @@ <h1>PenguinMod Emojis</h1>
158158

159159
(async () => {
160160
const response = await fetch(emojiHtmlUrl);
161-
const htmle = await response.text();
162-
const emojis = htmle
163-
.substring(htmle.indexOf('</header><ul id=files>') + 22, htmle.indexOf('</ul></main>'))
164-
.split('\n')
165-
.map(line => line.trim())
166-
.filter(line => line.length > 0) // remove blank lines
167-
.filter(line => line.endsWith('.png</a>')) // remove .txt file
168-
.map(emoji => {
169-
const cut = emoji.substring(22);
170-
const final = cut.substring(cut.indexOf('>') + 1, cut.indexOf('.png</a>'))
171-
return final;
172-
});
161+
const emojis = await response.json();
173162

174163
loadingSpinner.remove();
175164
for (const emoji of emojis) {

0 commit comments

Comments
 (0)