Skip to content

Instantly share code, notes, and snippets.

@motyar
Created August 28, 2021 04:10
Show Gist options
  • Save motyar/545398b0bfcde603441ba10b34f9007c to your computer and use it in GitHub Desktop.
Save motyar/545398b0bfcde603441ba10b34f9007c to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://cdn.jsdelivr.net/npm/jsonata/jsonata.min.js"></script>
<script>
let word = "code";
let url = 'https://api.dictionaryapi.dev/api/v2/entries/en/'+word;
let expression = '[word, phonetic, meanings[0].partOfSpeech, meanings[0].definitions[0].definition]';
let results;
fetch(url).then(res => res.json())
.then((json) => {
results = jsonata(expression).evaluate(json);
console.log(results);
document.write(`<img src="https://img.bruzu.com/?bg=white&h=500&w=500&a.tp=textbox&a.ox=center&a.oy=center&a.x=244&a.y=63&a.w=400&a.h=27&a.t=Word%20of%20the%20day&a.ta=left&a.fs=24&a.lh=1&a.fw=700&a.ff=Montserrat&a.fontStyle=normal&a.maxHeight=40&b.tp=textbox&b.ox=center&b.oy=center&b.x=250&b.y=94&b.w=408&b.h=18&b.t=Today&b.ta=left&b.fs=16&b.lh=1&b.fw=200&b.ff=Montserrat&b.fontStyle=normal&b.maxHeight=30&c.tp=textbox&c.ox=center&c.oy=center&c.x=245&c.y=211&c.w=413&c.h=90&c.fill=%230000b3&c.t=flair&c.ta=left&c.fs=80&c.lh=1&c.fw=400&c.ff=Montserrat&c.fontStyle=normal&c.maxHeight=100&e.tp=textbox&e.ox=center&e.x=245&e.y=327&e.w=400&e.h=61&e.fill=%23000&e.t=a%20special%20or%20instinctive%20aptitude%20or%20ability%20for%20doing%20something%20well.&e.ta=left&e.fs=25&e.lh=1&e.fw=200&e.ff=Inter&e.fontStyle=normal&e.oy=top&e.maxHeight=150&f.tp=textbox&f.ox=center&f.x=244&f.y=256&f.w=400&f.h=45&f.fill=%23000&f.t=fl%C9%9B%CB%90&f.ta=left&f.fs=40&f.lh=1&f.fw=200&f.ff=Inter&f.fontStyle=normal&f.oy=top&f.maxHeight=50&g.tp=rect&g.ox=center&g.oy=center&g.x=250&g.y=250&g.w=492&g.h=492&g.fill=transparent&g.sc=%230000b3&g.sw=6`+`&c.t=`+results[0]+`&e.t=`+results[3]+`&f.t=`+results[1]+`">`);
})
.catch(err => { throw err });
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment