From 342e352e7701add9026216671efafc48d53956d8 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Wed, 6 Mar 2019 08:04:25 +0700 Subject: [PATCH] Make sure badge always defaults to @username --- index.html | 2 +- script.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 51234f2..1ce41be 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@

⚡️ tippin.me Badge Generator

Enter your Twitter username

- +
diff --git a/script.js b/script.js index 09e8343..5d56be3 100644 --- a/script.js +++ b/script.js @@ -13,7 +13,8 @@ const username = document.querySelector('input[name="username"]'); const badgePreview = document.querySelector('.badge-preview'); const generateBadge = () => { - badgePreview.innerHTML = badgeHtml(escape(username.value)); + badgePreview.innerHTML = badgeHtml(escape(username.value) || 'username'); }; +generateBadge(); username.addEventListener('input', generateBadge);