Autoformat javascript

This commit is contained in:
Philipp Oppermann
2020-12-28 20:47:32 +01:00
parent 300a6f452a
commit 4a86515a8d

View File

@@ -1,17 +1,17 @@
window.onload = function() { window.onload = function () {
var container = document.querySelector('#toc-aside'); var container = document.querySelector('#toc-aside');
if (container != null) { if (container != null) {
resize_toc(container); resize_toc(container);
toc_scroll_position(container); toc_scroll_position(container);
window.onscroll = function() { toc_scroll_position(container) }; window.onscroll = function () { toc_scroll_position(container) };
} }
} }
function resize_toc(container) { function resize_toc(container) {
var containerHeight = container.clientHeight; var containerHeight = container.clientHeight;
var resize = function() { var resize = function () {
if (containerHeight > document.documentElement.clientHeight - 100) { if (containerHeight > document.documentElement.clientHeight - 100) {
container.classList.add('coarse'); container.classList.add('coarse');
} else { } else {
@@ -21,7 +21,7 @@ function resize_toc(container) {
resize(); resize();
var resizeId; var resizeId;
window.onresize = function() { window.onresize = function () {
clearTimeout(resizeId); clearTimeout(resizeId);
resizeId = setTimeout(resize, 300); resizeId = setTimeout(resize, 300);
}; };