aboutsummaryrefslogtreecommitdiff
path: root/p/scripts
diff options
context:
space:
mode:
authorGravatar maTh <math-home@web.de> 2022-08-18 11:13:56 +0200
committerGravatar GitHub <noreply@github.com> 2022-08-18 11:13:56 +0200
commitea0d924985dc0c5aa089ed59c15282ea7e84c7a4 (patch)
treec62134cf025c650a79392a2d99c04924c2ed10e0 /p/scripts
parente27eb1ca9198119ea1b0bd79be5f1aead45d615a (diff)
Swage theme cleanup (#4493)
* some general.prompt styles now in template.css * login button * same layout for login and register form * improve input and select * legend with dark background instead grey * fix config icon z-index * remove unused code * improve .prompt * set header also on login and register page * fix: show passwort button * improve login button on login and register screen * dropdown menu: smaller line height * improve layout sidebar closer * remove double code * swage.css * fix nits * fix nits * nits nits nits * nits are all around us.... * better position of config button * show header in mobile view + beauty the login button * CSS files * style the about FreshRSS link * delete unused import.svg * fix config sidebar padding * fix position of user query button in mobile view * improve config button in user query dropdown * fix global view overlay * fix close button aside bar in reader view * generated CSS files * Update swage.scss * fix nav_menu icon color of unread and favorite * improve search bar positioning in mobile view * read-all dropdown menu opens to left side in mobile view * restyle the new-article banner * improve big read button * make the header fixed while scrolling * fix search input while scrolling * improve config icons layout in .box * fix scrollbar:hover in template.css * improve article footer dropdowns * swage.css * Update main.js * Update main.js * fix (S)CSS * config navigation improved * left feed navigation: hover color added * CSS files * Update swage.scss * New Article banner improved margin * textarea: removed grey background * remove unnecessary line * Revert new-article banner layout * Remove :hover in slider * fix select height in sharing config * Fix scrollbar for slider with white background * fix: slider close button with theme color * fixed scrollbar CSS
Diffstat (limited to 'p/scripts')
-rw-r--r--p/scripts/main.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 37984513d..1619993c4 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -426,10 +426,17 @@ function toggleContent(new_active, old_active, skipping) {
if (context.sticky_post) { // Stick the article to the top when opened
const prev_article = new_active.previousElementSibling;
- let new_pos = new_active.offsetParent.offsetTop + new_active.offsetTop;
+ const nav_menu = document.querySelector('.nav_menu');
+ let nav_menu_height = 0;
+
+ if (getComputedStyle(nav_menu).position === 'fixed' || getComputedStyle(nav_menu).position === 'sticky') {
+ nav_menu_height = nav_menu.offsetHeight;
+ }
+
+ let new_pos = new_active.offsetParent.offsetTop + new_active.offsetTop - nav_menu_height;
if (prev_article && new_active.offsetTop - prev_article.offsetTop <= 150) {
- new_pos = prev_article.offsetParent.offsetTop + prev_article.offsetTop;
+ new_pos = prev_article.offsetParent.offsetTop + prev_article.offsetTop - nav_menu_height;
if (relative_move) {
new_pos -= box_to_move.offsetTop;
}
@@ -1213,7 +1220,13 @@ function init_nav_entries() {
const windowTop = document.scrollingElement.scrollTop;
const item_top = active_item.offsetParent.offsetTop + active_item.offsetTop;
- document.scrollingElement.scrollTop = windowTop > item_top ? item_top : 0;
+ const nav_menu = document.querySelector('.nav_menu');
+ let nav_menu_height = 0;
+
+ if (getComputedStyle(nav_menu).position === 'fixed' || getComputedStyle(nav_menu).position === 'sticky') {
+ nav_menu_height = nav_menu.offsetHeight;
+ }
+ document.scrollingElement.scrollTop = windowTop > item_top ? item_top - nav_menu_height : 0 - nav_menu_height;
return false;
};
}