From f598dcbf6283f2c2b81a63d315548c6bc4e943fb Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sun, 29 Sep 2024 15:06:59 +0800 Subject: style: prettier --- src/dumbyUtils.mjs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/dumbyUtils.mjs') diff --git a/src/dumbyUtils.mjs b/src/dumbyUtils.mjs index d30145c..cfac00b 100644 --- a/src/dumbyUtils.mjs +++ b/src/dumbyUtils.mjs @@ -1,16 +1,16 @@ export function focusNextMap(reverse = false) { const renderedList = Array.from( - this.htmlHolder.querySelectorAll("[data-render=fulfilled]"), + this.htmlHolder.querySelectorAll('[data-render=fulfilled]'), ); const mapNum = renderedList.length; if (mapNum === 0) return; // Get current focused map element - const currentFocus = this.container.querySelector(".mapclay.focus"); + const currentFocus = this.container.querySelector('.mapclay.focus'); // Remove class name of focus for ALL candidates // This may trigger animation - renderedList.forEach(ele => ele.classList.remove("focus")); + renderedList.forEach(ele => ele.classList.remove('focus')); // Get next existing map element const padding = reverse ? -1 : 1; @@ -19,18 +19,18 @@ export function focusNextMap(reverse = false) { : 0; nextIndex = (nextIndex + mapNum) % mapNum; const nextFocus = renderedList[nextIndex]; - nextFocus.classList.add("focus"); + nextFocus.classList.add('focus'); return nextFocus; } export function focusDelay() { - return window.getComputedStyle(this.showcase).display === "none" ? 50 : 300; + return window.getComputedStyle(this.showcase).display === 'none' ? 50 : 300; } export function switchToNextLayout(reverse = false) { const layouts = this.layouts; - const currentLayoutName = this.container.getAttribute("data-layout"); + const currentLayoutName = this.container.getAttribute('data-layout'); const currentIndex = layouts.map(l => l.name).indexOf(currentLayoutName); const padding = reverse ? -1 : 1; const nextIndex = @@ -38,7 +38,7 @@ export function switchToNextLayout(reverse = false) { ? 0 : (currentIndex + padding + layouts.length) % layouts.length; const nextLayout = layouts[nextIndex]; - this.container.setAttribute("data-layout", nextLayout.name); + this.container.setAttribute('data-layout', nextLayout.name); } export function focusNextBlock(reverse = false) { @@ -49,7 +49,7 @@ export function focusNextBlock(reverse = false) { visibilityProperty: true, }), ); - const currentBlock = blocks.find(b => b.classList.contains("focus")); + const currentBlock = blocks.find(b => b.classList.contains('focus')); const currentIndex = blocks.indexOf(currentBlock); const padding = reverse ? -1 : 1; const nextIndex = @@ -57,16 +57,16 @@ export function focusNextBlock(reverse = false) { ? 0 : (currentIndex + padding + blocks.length) % blocks.length; const nextBlock = blocks[nextIndex]; - blocks.forEach(b => b.classList.remove("focus")); - nextBlock?.classList?.add("focus"); + blocks.forEach(b => b.classList.remove('focus')); + nextBlock?.classList?.add('focus'); const scrollBlock = nextBlock.getBoundingClientRect().height > nextBlock.parentElement.getBoundingClientRect().height * 0.8 - ? "nearest" - : "center"; - nextBlock.scrollIntoView({ behavior: "smooth", block: scrollBlock }); + ? 'nearest' + : 'center'; + nextBlock.scrollIntoView({ behavior: 'smooth', block: scrollBlock }); } export function removeBlockFocus() { - this.blocks.forEach(b => b.classList.remove("focus")); + this.blocks.forEach(b => b.classList.remove('focus')); } -- cgit v1.2.3-70-g09d2