class Controller { constructor(presenter) { this.presenter = presenter; }…
- User
class Controller { constructor(presenter) { this.presenter = presenter; }
codehandleEvent(layoutType) { this.presenter.setLayout(layoutType); }}
class Presenter { constructor(containerId) { this.container = document.getElementById(containerId); this.divs = this.container.querySelectorAll('.inner-div'); }
codesetLayout(layoutType) { this.divs.forEach(div => { div.style.display = 'none'; div.style.removeProperty('left'); div.style.removeProperty('top'); div.style.removeProperty('right'); div.style.removeProperty('bottom'); div.textContent = ''; }); switch (layoutType) { case 'A': this.divs[0].style.display = 'block'; this.divs[0].style.left = '0'; this.divs[0].style.top = '0'; this.divs[0].textContent = 'Michal'; this.divs[1].style.display = 'block'; this.divs[1].style.left = '45%'; this.divs[1].style.top = '45%'; this.divs[1].textContent = 'Zwolinski'; this.divs[2].style.display = 'block'; this.divs[2].style.right = '0'; this.divs[2].style.bottom = '0'; this.divs[2].textContent = '3'; break; case 'B': this.divs.forEach((div, index) => { if (index < 3) { div.style.display = 'block'; div.style.left = `${index * 40}%`; div.style.top = '45%'; div.textContent = index === 0 ? 'Michal' : (index === 1 ? 'Zwolinski' : ''); this.divs[0].style.left = '12%'; this.divs[2].style.right = '60%'; this.divs[1].style.left = '46%'; this.divs[2].textContent = '3'; } else { div.style.display = 'none'; } }); break; case 'C': this.divs[0].style.display = 'block'; this.divs[0].style.left = '0'; this.divs[0].style.top = '0'; this.divs[1].style.display = 'block'; this.divs[1].style.left = '6.71%'; this.divs[1].style.top = '0'; this.divs[2].style.display = 'block'; this.divs[2].style.right = '0'; this.divs[2].style.bottom = '0'; this.divs[0].textContent = 'Michal'; this.divs[1].textContent = 'Zwolinski'; this.divs[2].textContent = '4'; this.divs[3].style.display = 'block'; this.divs[3].style.right = '6.71%'; this.divs[3].style.bottom = '0'; this.divs[3].textContent = '3'; break; } } - Assistant