mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Autoformat javascript
This commit is contained in:
@@ -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);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user