Summary Files Commits Branches @commit @diff @stats
path: root / src / scripts / page-width.js
blob: 353dc4d92cc52d9a74a21972342e119f9f48c100 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const widthBtn = document.getElementById('changeWidthBtn');
const widthLabel = widthBtn.childNodes[0];
const articleElem = document.getElementsByTagName('article')[0];

if (localStorage.getItem('width') === 'wide') {
	widthLabel.innerText = 'Narrow';
	articleElem.classList.add('article-wide');
}

widthBtn.onclick = function() {
	articleElem.classList.toggle('article-wide');

	if (localStorage.getItem('width') !== 'norm') {
		widthLabel.innerText = 'Wide';
		localStorage.setItem('width', 'norm');
	}
	else {
		widthLabel.innerText = 'Narrow';
		localStorage.setItem('width', 'wide');
	}

	fixAbsoluteSlideScale(); // From presentation.js
}