From 06f4cd420cbe26b2cdb510ad57ab913d9b836172 Mon Sep 17 00:00:00 2001 From: math-gh <> Date: Mon, 4 Sep 2023 22:31:35 +0200 Subject: [PATCH] fixed stickyfeeds --- xExtension-StickyFeeds/static/script.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xExtension-StickyFeeds/static/script.js b/xExtension-StickyFeeds/static/script.js index 6986ca4..b0a4ffc 100644 --- a/xExtension-StickyFeeds/static/script.js +++ b/xExtension-StickyFeeds/static/script.js @@ -1,12 +1,13 @@ -"use strict"; +/* globals $ */ +'use strict'; -var sticky_feeds = { +const sticky_feeds = { aside: null, tree: null, window: null, - init: function() { - if (window.matchMedia("(max-width: 840px)").matches) { + init: function () { + if (window.matchMedia('(max-width: 840px)').matches) { return; } @@ -34,14 +35,14 @@ var sticky_feeds = { } }, - scroller: function() { - var pos_top_window = sticky_feeds.window.scrollTop(); + scroller: function () { + const pos_top_window = sticky_feeds.window.scrollTop(); if (pos_top_window < sticky_feeds.aside.initial_pos.top + sticky_feeds.tree.initial_pos.top) { // scroll top has not reached the top of the sticky tree yet so it // stays in place but its height must adapted: // window height - sticky tree pos top + actual scroll top - var real_tree_pos_top = sticky_feeds.aside.initial_pos.top + sticky_feeds.tree.initial_pos.top; + const real_tree_pos_top = sticky_feeds.aside.initial_pos.top + sticky_feeds.tree.initial_pos.top; sticky_feeds.tree.css('top', sticky_feeds.tree.initial_pos.top); sticky_feeds.tree.css('height', sticky_feeds.window.height - real_tree_pos_top + pos_top_window); } else { @@ -55,5 +56,4 @@ var sticky_feeds = { }, }; - window.onload = sticky_feeds.init;