2020-06-04 04:23:40 +02:00
|
|
|
var dashboard = document.getElementById("rightDashboard");
|
2020-06-04 04:29:12 +02:00
|
|
|
var dashboardOverlay = document.getElementById("dashboardOverlay");
|
2020-06-04 04:23:40 +02:00
|
|
|
|
|
|
|
let rightDashboardVisibility = false;
|
|
|
|
|
|
|
|
const showDashboard = () => {
|
|
|
|
dashboard.classList.add('showRightDashboard');
|
|
|
|
|
2020-06-04 04:29:12 +02:00
|
|
|
// Show overlay
|
|
|
|
dashboardOverlay.classList.add('showDashboardOverlay');
|
|
|
|
|
2020-06-04 04:23:40 +02:00
|
|
|
rightDashboardVisibility = !rightDashboardVisibility;
|
|
|
|
}
|
|
|
|
|
|
|
|
const hideDashboard = () => {
|
|
|
|
dashboard.classList.remove('showRightDashboard');
|
|
|
|
dashboard.scrollTop = 0;
|
|
|
|
|
2020-06-04 04:29:12 +02:00
|
|
|
// Hide overlay
|
|
|
|
dashboardOverlay.classList.remove('showDashboardOverlay');
|
|
|
|
|
2020-06-04 04:23:40 +02:00
|
|
|
rightDashboardVisibility = !rightDashboardVisibility;
|
|
|
|
}
|
|
|
|
|
|
|
|
const toggleDashboard = () => {
|
|
|
|
|
|
|
|
if (rightDashboardVisibility) {
|
|
|
|
// Hide search box
|
|
|
|
hideDashboard();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// Show search box
|
|
|
|
showDashboard();
|
|
|
|
}
|
|
|
|
|
2020-06-04 04:29:12 +02:00
|
|
|
console.log('toggle dashboard');
|
|
|
|
}
|
2020-06-04 04:23:40 +02:00
|
|
|
|
2020-06-04 04:29:12 +02:00
|
|
|
dashboardOverlay.addEventListener(
|
|
|
|
"mouseup",
|
|
|
|
() => {
|
|
|
|
if (rightDashboardVisibility) {
|
|
|
|
toggleDashboard();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|