diff --git a/ext/view/script.js b/ext/view/script.js index ed459c01..734e7276 100644 --- a/ext/view/script.js +++ b/ext/view/script.js @@ -6,10 +6,19 @@ function joinUrlSegments(base, query) { return base + separatorChar + query; } +function autosize(el) { + setTimeout(function() { + el.style.cssText = 'height:' + el.scrollHeight + 'px'; + }, 0); +} + function clearViewMode() { document.querySelectorAll('.image_info').forEach((element) => { element.classList.remove('infomode-view'); }); + document.querySelectorAll('.image_info textarea').forEach((el) => { + autosize(el); + }); } function updateAttr(selector, attr, value) { @@ -28,6 +37,11 @@ document.addEventListener('DOMContentLoaded', () => { element.classList.add('infomode-view'); }); + document.querySelectorAll('.image_info textarea').forEach((el) => { + el.addEventListener('keydown', () => autosize(el)); + autosize(el); + }); + if(document.location.hash.length > 3) { var query = document.location.hash.substring(1);