MCPcopy Index your code
hub / github.com/spicetify/cli / waitForTopbarMounted

Function waitForTopbarMounted

jsHelper/spicetifyWrapper.js:2704–2734  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2702 }
2703
2704 function waitForTopbarMounted() {
2705 const globalHistoryButtons = document.querySelector(".main-globalNav-historyButtons");
2706 leftGeneratedClassName = document.querySelector(
2707 ".main-topBar-historyButtons .main-topBar-button, .main-globalNav-historyButtons .main-globalNav-icon, .main-globalNav-historyButtons [data-encore-id='buttonTertiary']"
2708 )?.className;
2709 rightGeneratedClassName = document.querySelector(
2710 ".main-topBar-container .main-topBar-buddyFeed, .main-actionButtons .main-topBar-buddyFeed, .main-actionButtons .main-globalNav-buddyFeed"
2711 )?.className;
2712 leftContainer = document.querySelector(".main-topBar-historyButtons") ?? globalHistoryButtons;
2713 rightContainer = document.querySelector(".main-actionButtons");
2714 if (!leftContainer || !rightContainer || !leftGeneratedClassName || !rightGeneratedClassName) {
2715 setTimeout(waitForTopbarMounted, 100);
2716 return;
2717 }
2718
2719 if (globalHistoryButtons) globalHistoryButtons.style = "gap: 4px; padding-inline: 4px 4px";
2720 for (const button of leftButtonsStash) {
2721 if (button.parentNode) button.parentNode.removeChild(button);
2722
2723 const buttonElement = button.querySelector("button");
2724 buttonElement.className = leftGeneratedClassName;
2725 }
2726 leftContainer.append(...leftButtonsStash);
2727 for (const button of rightButtonsStash) {
2728 if (button.parentNode) button.parentNode.removeChild(button);
2729
2730 const buttonElement = button.querySelector("button");
2731 buttonElement.className = rightGeneratedClassName;
2732 }
2733 rightContainer.prepend(...rightButtonsStash);
2734 }
2735
2736 waitForTopbarMounted();
2737 (function waitForPlatform() {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected