From 46b00b1ce1821d0d68edf8cf82a343e3c586c36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tron=C3=AD=C4=8Dek?= Date: Mon, 8 Feb 2021 17:14:27 +0100 Subject: [PATCH 1/3] First ES6 refactor - Eqeqeq - const and let - arrow functions --- devices.html | 53 ++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/devices.html b/devices.html index bcb0331..99ae4f5 100644 --- a/devices.html +++ b/devices.html @@ -47,45 +47,46 @@ From 8338573c108c083f5be7f721c7dedf9e2a79f51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tron=C3=AD=C4=8Dek?= Date: Mon, 8 Feb 2021 17:19:28 +0100 Subject: [PATCH 2/3] Template string output --- devices.html | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/devices.html b/devices.html index 99ae4f5..3aea201 100644 --- a/devices.html +++ b/devices.html @@ -146,18 +146,13 @@ Object.entries(json) .sort() .forEach(([key, value]) => { - output += "
"; - - output += - "" + - value.label + - "" + - value.deviceId + - ""; - - output += "
"; + output += ` +
+ ${value.label} + + ${value.deviceId} + +
`; }); output += ""; document.getElementById(element).innerHTML = output; From 9cc109c254da6c06cdcd6b44583938753aa2296b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tron=C3=AD=C4=8Dek?= Date: Mon, 8 Feb 2021 17:21:40 +0100 Subject: [PATCH 3/3] Update target because of the arrow function --- devices.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devices.html b/devices.html index 3aea201..49a254c 100644 --- a/devices.html +++ b/devices.html @@ -158,8 +158,8 @@ document.getElementById(element).innerHTML = output; } - document.getElementById("devicesUrl").onclick = () => { - this.select(); + document.getElementById("devicesUrl").onclick = (e) => { + e.target.select(); document.execCommand("copy"); };