MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / updateFloatingButton

Function updateFloatingButton

src/lib/editorManager.js:2720–2755  ·  view source on GitHub ↗

* Updates the floating button visibility based on the provided show parameter. * @param {boolean} [show=false] - Indicates whether to show the floating button.

(show = false)

Source from the content-addressed store, hash-verified

2718 * @param {boolean} [show=false] - Indicates whether to show the floating button.
2719 */
2720 function updateFloatingButton(show = false) {
2721 const { $headerToggler } = acode;
2722 const { $toggler } = quickTools;
2723
2724 if (show) {
2725 if (scrollBarVisibilityCount) --scrollBarVisibilityCount;
2726
2727 if (!scrollBarVisibilityCount) {
2728 clearTimeout(timeoutHeaderToggler);
2729 clearTimeout(timeoutQuicktoolsToggler);
2730
2731 if (appSettings.value.floatingButton) {
2732 $toggler.classList.remove("hide");
2733 root.appendOuter($toggler);
2734 }
2735
2736 $headerToggler.classList.remove("hide");
2737 root.appendOuter($headerToggler);
2738 }
2739
2740 return;
2741 }
2742
2743 if (!scrollBarVisibilityCount) {
2744 if ($toggler.isConnected) {
2745 $toggler.classList.add("hide");
2746 timeoutQuicktoolsToggler = setTimeout(() => $toggler.remove(), 300);
2747 }
2748 if ($headerToggler.isConnected) {
2749 $headerToggler.classList.add("hide");
2750 timeoutHeaderToggler = setTimeout(() => $headerToggler.remove(), 300);
2751 }
2752 }
2753
2754 ++scrollBarVisibilityCount;
2755 }
2756
2757 /**
2758 * Toggles the visibility of the problem button based on the presence of annotations in the files.

Callers

nothing calls this directly

Calls 2

addMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected