Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
Fix more code consistency in weekly-view
Browse files Browse the repository at this point in the history
  • Loading branch information
sisi-sh committed Mar 21, 2022
1 parent 76dd99b commit 7fde281
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions weekly-view/client.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ export default async function ({ web }, db) {
document.querySelectorAll(viewSelector).forEach(async ($view) => {
let currentText;
// Get view controls children nodes, convert to array, filter out non-text
const viewNodes = []
const $viewNodes = []
.slice.call($view.querySelector(viewControlSelector).children)
.filter(node => node.tagName.toLowerCase().match(/(div|span)/g));

// Find current view by analyzing children (which changes on viewport)
if (viewNodes.length === 1)
if ($viewNodes.length === 1)
{
// Mobile: Simple dropdown button (like legacy), text is current view
currentText = viewNodes[0].innerText.toLowerCase();
currentText = $viewNodes[0].innerText.toLowerCase();
} else {
// Wide/Desktop: Tabs listed, current view indicated by border style
currentText = viewNodes
currentText = $viewNodes
// Find selected view by border style (possibly fragile)
.filter((e) => e.children[0].style.borderBottomWidth.toString() === '2px')[0]
.filter(($e) => $e.children[0].style.borderBottomWidth.toString() === '2px')[0]
.innerText.toLowerCase();
}

Expand Down

0 comments on commit 7fde281

Please sign in to comment.