Skip to content
Snippets Groups Projects
Commit e6333ec4 authored by Thomas Hackl's avatar Thomas Hackl
Browse files

Revert "Resolve "Forum: Schreiben von Beiträgen kaputt""

This reverts commit 6f56f684.
parent d782b7e1
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ import eventBus from '../lib/event-bus.ts'; ...@@ -3,6 +3,7 @@ import eventBus from '../lib/event-bus.ts';
STUDIP.ready(() => { STUDIP.ready(() => {
// Manually nudge sidebar under main header. // Manually nudge sidebar under main header.
STUDIP.Sidebar.place(); STUDIP.Sidebar.place();
STUDIP.Sidebar.observeBody(); STUDIP.Sidebar.observeBody();
STUDIP.Sidebar.observeFooter(); STUDIP.Sidebar.observeFooter();
STUDIP.Sidebar.observeSidebar(); STUDIP.Sidebar.observeSidebar();
...@@ -10,5 +11,4 @@ STUDIP.ready(() => { ...@@ -10,5 +11,4 @@ STUDIP.ready(() => {
document.defaultView.addEventListener('resize',() => { document.defaultView.addEventListener('resize',() => {
STUDIP.Sidebar.reset(); STUDIP.Sidebar.reset();
}); });
}); });
...@@ -22,7 +22,7 @@ const Sidebar = { ...@@ -22,7 +22,7 @@ const Sidebar = {
const sidebar = document.getElementById('sidebar'); const sidebar = document.getElementById('sidebar');
if (sidebar) { if (sidebar) {
const sObserver = new IntersectionObserver(STUDIP.Sidebar.fits, options); const sObserver = new IntersectionObserver(STUDIP.Sidebar.fits, options);
sObserver.observe(sidebar, options); sObserver.observe();
} }
}, },
...@@ -36,11 +36,11 @@ const Sidebar = { ...@@ -36,11 +36,11 @@ const Sidebar = {
for (const mutation of mutations) { for (const mutation of mutations) {
if ((!mutation.oldValue || mutation.oldValue.indexOf('fixed') === -1) if ((!mutation.oldValue || mutation.oldValue.indexOf('fixed') === -1)
&& mutation.target.classList.contains('fixed')) { && mutation.target.classList.contains('fixed')) {
sidebar.style.top = '';
sidebar.classList.add('fixed'); sidebar.classList.add('fixed');
sidebar.style.top = '';
} else if (mutation.oldValue && mutation.oldValue.indexOf('fixed') !== -1 } else if (mutation.oldValue && mutation.oldValue.indexOf('fixed') !== -1
&& !mutation.target.classList.contains('fixed')) { && !mutation.target.classList.contains('fixed')) {
STUDIP.Sidebar.reset(); sidebar.classList.remove('fixed');
} }
} }
}); });
...@@ -64,18 +64,17 @@ const Sidebar = { ...@@ -64,18 +64,17 @@ const Sidebar = {
* Observe if the footer is visible in viewport. * Observe if the footer is visible in viewport.
*/ */
const fObserver = new IntersectionObserver(STUDIP.Sidebar.footerVisible, options); const fObserver = new IntersectionObserver(STUDIP.Sidebar.footerVisible, options);
fObserver.observe(document.getElementById('main-footer'), options); fObserver.observe(document.getElementById('main-footer'));
}, },
reset() { reset() {
const sidebar = document.getElementById('sidebar'); const sidebar = document.getElementById('sidebar');
if (sidebar) { if (sidebar) {
sidebar.classList.remove('oversized', 'was-oversized', 'fixed'); sidebar.classList.remove('oversized', 'adjusted', 'fixed');
sidebar.style.top = ''; sidebar.style.top = '';
STUDIP.Sidebar.place();
STUDIP.Sidebar.observeSidebar();
} }
STUDIP.Sidebar.observe();
}, },
fits(entries, observer) { fits(entries, observer) {
...@@ -86,7 +85,7 @@ const Sidebar = { ...@@ -86,7 +85,7 @@ const Sidebar = {
if (entry.isIntersecting) { if (entry.isIntersecting) {
sidebar.classList.remove('oversized'); sidebar.classList.remove('oversized');
} else { } else {
sidebar.classList.add('oversized', 'was-oversized'); sidebar.classList.add('oversized', 'adjusted');
} }
}); });
} }
...@@ -98,9 +97,13 @@ const Sidebar = { ...@@ -98,9 +97,13 @@ const Sidebar = {
entries.forEach(entry => { entries.forEach(entry => {
// Footer is visible on current page. // Footer is visible on current page.
if (entry.isIntersecting) { if (entry.isIntersecting) {
sidebar.classList.remove('no-footer'); if (sidebar.classList.contains('no-footer')) {
sidebar.classList.remove('no-footer');
}
} else { } else {
sidebar.classList.add('no-footer'); if (!sidebar.classList.contains('no-footer')) {
sidebar.classList.add('no-footer');
}
} }
}); });
} }
......
#sidebar { #sidebar {
background: $white;
border-left: 0; border-left: 0;
display: inline-block; display: inline-block;
height: max-content;
margin-bottom: $page-margin + 35px; margin-bottom: $page-margin + 35px;
margin-top: 15px; margin-top: 15px;
padding: 0 5px 7px 15px; padding: 0 5px 7px 15px;
...@@ -11,11 +11,7 @@ ...@@ -11,11 +11,7 @@
width: $sidebar-width; width: $sidebar-width;
z-index: 2; z-index: 2;
&.fixed { &.adjusted {
top: 55px;
}
&.was-oversized {
height: calc(100vh - 265px); height: calc(100vh - 265px);
position: fixed; position: fixed;
overflow-x: hidden; overflow-x: hidden;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment