From 7272d305cf94515965e6ad593ba6bd5e867f3d71 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Wed, 6 Mar 2019 07:43:12 +0700 Subject: [PATCH] Add basic badge generation --- index.html | 5 +++++ script.js | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/index.html b/index.html index 91816e3..4254950 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,11 @@ +
+ +
+
+ diff --git a/script.js b/script.js index e69de29..d5b3dd3 100644 --- a/script.js +++ b/script.js @@ -0,0 +1,17 @@ +const badgeLinkUrl = username => `https://tippin.me/@${username}`; +const badgeImageUrl = username => `https://badgen.net/badge/%E2%9A%A1%EF%B8%8Ftippin.me/@${username}/F0918E`; + +const badgeHtml = username => ` + + @${username} on tippin.me + +`; + +const username = document.querySelector('input[name="username"]'); +const badgePreview = document.querySelector('.badge-preview'); + +const generateBadge = () => { + badgePreview.innerHTML = badgeHtml(username.value); +}; + +username.addEventListener('change', generateBadge);