function updateRegexValue () { tgRegex = document.getElementById('tgRegexInput').value; } function applyRegexValue () { abc.update(); } class TGRegexController { constructor () { this.div = document.getElementById('tgRegexDiv'); this.regexEntryDiv = undefined; this.initHtml(); this.expanded = false; this.regexEntryDiv.addEventListener('input', updateRegexValue); } initHtml () { this.div.style.display = 'grid'; this.div.style.gridTemplateColumns = 'auto'; this.div.style.gridTemplateRows = 'auto auto'; this.headerDiv = document.createElement('div'); this.headerDiv.innerHTML = 'TG Regex '; this.headerDiv.style.display = 'grid'; this.headerDiv.style.gridColumn = '1'; this.div.appendChild(this.headerDiv); this.div.style.gap = '5px'; this.regexEntryDiv = document.createElement('div'); this.regexEntryDiv.style.display = 'none'; this.regexEntryDiv.innerHTML = '   Apply '; this.div.appendChild(this.regexEntryDiv); } toggleExpand () { if (this.expanded) { this.collapse(); this.expanded = false; } else { this.expand(); this.expanded = true; } } collapse () { this.regexEntryDiv.style.display = 'none'; } expand () { this.regexEntryDiv.style.display = 'block'; } }