From 4d4a58361b009af4544d8072099a32aa8ef2d276 Mon Sep 17 00:00:00 2001 From: Bat Date: Sat, 1 Sep 2018 21:42:53 +0100 Subject: [PATCH] Use Standard JS for JS code --- static/js/autoExpand.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/static/js/autoExpand.js b/static/js/autoExpand.js index 33fb32e..fbc25e8 100644 --- a/static/js/autoExpand.js +++ b/static/js/autoExpand.js @@ -1,14 +1,9 @@ -function autosize(){ - const el = this; - el.style.height = 'auto'; - el.style.height = (el.scrollHeight ) + 'px'; +function autosize () { + const el = this + el.style.height = 'auto' + el.style.height = `${el.scrollHeight}px` } -const articleContent = document.querySelector('#content'); -let offset = 0; -let style = window.getComputedStyle(articleContent, null); - -offset += parseInt(style['paddingTop']) + parseInt(style['paddingBottom']); -autosize.bind(articleContent)(); -articleContent.addEventListener('keyup', autosize); - +const articleContent = document.querySelector('#content') +autosize.bind(articleContent)() +articleContent.addEventListener('keyup', autosize)