about summary refs log tree commit diff
path: root/served/home.js
blob: b81417bc27e1f264e9eeeaa919f9976cc9117587 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
let domId = document.getElementById.bind(document);
let domNew = document.createElement.bind(document);

function init() {
	let contactPeriod = document.getElementById('contact-period');
	contactPeriod.addEventListener('click', displayLogin);
}

function displayLogin() {
	let contact = document.getElementById('contact');
	let width = contact.offsetWidth;
	let height = contact.offsetHeight;
	console.log(`conact ${width}x${height}`);

	contact.style.width = `${width}px`;
	contact.style.height = `${height}px`;

	while (contact.firstChild) {
		contact.removeChild(contact.firstChild);
	}

	makeLogin(contact);
}

function makeLogin(parent) {
	const template = domId('logintemplate');
	const clone = document.importNode(template.content, true);

	parent.appendChild(clone);
}

window.addEventListener('DOMContentLoaded', init)