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

Method display

jsHelper/spicetifyWrapper.js:2554–2588  ·  view source on GitHub ↗
({ title, content, isLarge = false })

Source from the content-addressed store, hash-verified

2552 }
2553
2554 display({ title, content, isLarge = false }) {
2555 this.innerHTML = `
2556<div class="GenericModal__overlay" style="z-index: 100;">
2557 <div class="GenericModal" tabindex="-1" role="dialog" aria-label="${title}" aria-modal="true">
2558 <div class="${isLarge ? "main-embedWidgetGenerator-container" : "main-trackCreditsModal-container"}">
2559 <div class="main-trackCreditsModal-header">
2560 <h1 class="main-type-alto" as="h1">${title}</h1>
2561 <button aria-label="Close" class="main-trackCreditsModal-closeBtn"><svg width="18" height="18" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><title>Close</title><path d="M31.098 29.794L16.955 15.65 31.097 1.51 29.683.093 15.54 14.237 1.4.094-.016 1.508 14.126 15.65-.016 29.795l1.414 1.414L15.54 17.065l14.144 14.143" fill="currentColor" fill-rule="evenodd"></path></svg></button>
2562 </div>
2563 <div class="main-trackCreditsModal-mainSection">
2564 <main class="main-trackCreditsModal-originalCredits"></main>
2565 </div>
2566 </div>
2567 </div>
2568</div>`;
2569
2570 this.querySelector("button").onclick = this.hide.bind(this);
2571 const main = this.querySelector("main");
2572
2573 const hidePopup = this.hide.bind(this);
2574
2575 // Listen for click events on Overlay
2576 this.querySelector(".GenericModal__overlay").addEventListener("click", (event) => {
2577 if (!this.querySelector(".GenericModal").contains(event.target)) hidePopup();
2578 });
2579
2580 if (Spicetify.React.isValidElement(content)) {
2581 Spicetify.ReactDOM.render(content, main);
2582 } else if (typeof content === "string") {
2583 main.innerHTML = content;
2584 } else {
2585 main.append(content);
2586 }
2587 document.body.append(this);
2588 }
2589}
2590customElements.define("generic-modal", _HTMLGenericModal);
2591Spicetify.PopupModal = new _HTMLGenericModal();

Callers 9

expFeatures.jsFile · 0.80
openConfigFunction · 0.80
trashbin.jsFile · 0.80
settingsPageFunction · 0.80
openConfigFunction · 0.80
openConfigFunction · 0.80
openConfigFunction · 0.80
openConfigFunction · 0.80

Calls 1

renderMethod · 0.45

Tested by

no test coverage detected