initial commit
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
var library;
|
||||
var sidebar;
|
||||
var text;
|
||||
var center;
|
||||
var betterLibIsEnabled;
|
||||
var lastSidebarSize; //
|
||||
var lastSidebarMode; //ylx-sidebar-state 1=collapsed, 0=normal, 2=expanded
|
||||
var lastViewIcons; //items-view 1=icons 2=list
|
||||
var lastViewCompact; //library-row-mode 1=compact 2=normal
|
||||
|
||||
// Disables betterlibrary when the pages is left
|
||||
function startBetterLibListener() {
|
||||
Spicetify.Platform.History.listen((location) => {
|
||||
// console.log("betterlib listener called")
|
||||
if (location.pathname != '/betterlibrary')
|
||||
disableBetterLib();
|
||||
});
|
||||
window.addEventListener(
|
||||
'beforeunload',
|
||||
(event) => {
|
||||
disableBetterLib();
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function enableBetterLib() {
|
||||
waitForElm('.betterLibBox').then((elm) => {
|
||||
if (!betterLibIsEnabled)
|
||||
{
|
||||
//swap elements
|
||||
library = document.getElementsByClassName("main-yourLibraryX-libraryContainer")[0];
|
||||
text = document.getElementsByClassName("betterLibText")[0];
|
||||
sidebar = document.getElementsByClassName("main-yourLibraryX-library")[0];
|
||||
center = document.getElementsByClassName("betterLibBox")[0];
|
||||
center.appendChild(library);
|
||||
sidebar.appendChild(text);
|
||||
|
||||
//store last mode and size
|
||||
lastSidebarMode = Spicetify.Platform.LocalStorageAPI.getItem("ylx-sidebar-state");
|
||||
lastSidebarSize = Spicetify.Platform.LocalStorageAPI.getItem("ylx-expanded-state-nav-bar-width");
|
||||
|
||||
//set new mode and size
|
||||
currentSidebarSize = document.documentElement.style.getPropertyValue("--left-sidebar-width");
|
||||
currentSidebarSize = parseInt(currentSidebarSize, 10);
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("ylx-expanded-state-nav-bar-width",currentSidebarSize);
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("ylx-sidebar-state",2);
|
||||
|
||||
//fix collaped library buttons
|
||||
if (lastSidebarMode == 1) {
|
||||
document.documentElement.style.setProperty("--betterlib-fix-collaped-view","none");
|
||||
document.documentElement.style.setProperty("--betterlib-show-placeholder-text","none");
|
||||
}
|
||||
|
||||
//store last icons mode and compact mode
|
||||
lastViewSize = Spicetify.Platform.LocalStorageAPI.getItem("ylx-grid-scale");
|
||||
lastViewIcons = Spicetify.Platform.LocalStorageAPI.getItem("items-view");
|
||||
lastViewCompact = Spicetify.Platform.LocalStorageAPI.getItem("library-row-mode");
|
||||
|
||||
//get betterlib icons mode and compact mode from storage
|
||||
newViewSize = parseFloat(Spicetify.Platform.LocalStorageAPI.getItem("betterlib-ylx-grid-scale"),10);
|
||||
if (newViewSize == null) {
|
||||
newViewSize = 1;
|
||||
}
|
||||
newViewIcons = parseInt(Spicetify.Platform.LocalStorageAPI.getItem("betterlib-items-view"),10);
|
||||
newViewCompact = parseInt(Spicetify.Platform.LocalStorageAPI.getItem("betterlib-library-row-mode"),10);
|
||||
|
||||
//apply betterlib icons mode and compact mode
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("ylx-grid-scale", newViewSize);
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("items-view", newViewIcons);
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("library-row-mode", newViewCompact);
|
||||
|
||||
betterLibIsEnabled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function disableBetterLib() {
|
||||
if (betterLibIsEnabled)
|
||||
{
|
||||
//undo fix for collaped library buttons
|
||||
if (lastSidebarMode == 1) {
|
||||
document.documentElement.style.setProperty("--betterlib-fix-collaped-view","inherit");
|
||||
document.documentElement.style.setProperty("--betterlib-show-placeholder-text","flex");
|
||||
}
|
||||
|
||||
//get current betterlib icons mode and compact mode
|
||||
currentViewIcons = parseInt(Spicetify.Platform.LocalStorageAPI.getItem("items-view"),10);
|
||||
currentViewCompact = parseInt(Spicetify.Platform.LocalStorageAPI.getItem("library-row-mode"),10);
|
||||
currentViewSize = parseFloat(Spicetify.Platform.LocalStorageAPI.getItem("ylx-grid-scale"),10);
|
||||
|
||||
//save betterlib icons mode and compact mode to storage
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("betterlib-items-view", currentViewIcons);
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("betterlib-library-row-mode", currentViewCompact);
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("betterlib-ylx-grid-scale", currentViewSize);
|
||||
|
||||
//revert icons and compact mode to last
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("items-view", lastViewIcons);
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("library-row-mode", lastViewCompact);
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("ylx-grid-scale", lastViewSize);
|
||||
|
||||
//revert swap
|
||||
sidebar.appendChild(library);
|
||||
center.appendChild(text);
|
||||
|
||||
//reset mode and size to last
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("lx-expanded-state-nav-bar-width",lastSidebarSize);
|
||||
Spicetify.Platform.LocalStorageAPI.setItem("ylx-sidebar-state",lastSidebarMode);
|
||||
|
||||
betterLibIsEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
//source: https://stackoverflow.com/questions/5525071/how-to-wait-until-an-element-exists
|
||||
function waitForElm(selector) {
|
||||
return new Promise(resolve => {
|
||||
if (document.querySelector(selector)) {
|
||||
return resolve(document.querySelector(selector));
|
||||
}
|
||||
|
||||
const observer = new MutationObserver(mutations => {
|
||||
if (document.querySelector(selector)) {
|
||||
observer.disconnect();
|
||||
resolve(document.querySelector(selector));
|
||||
}
|
||||
});
|
||||
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// this part was mostly copied from an example
|
||||
|
||||
// Grab any variables you need
|
||||
const react = Spicetify.React;
|
||||
const reactDOM = Spicetify.ReactDOM;
|
||||
const {
|
||||
URI,
|
||||
React: { useState, useEffect, useCallback },
|
||||
Platform: { History },
|
||||
} = Spicetify;
|
||||
|
||||
// this is called when the page is open
|
||||
function render() {
|
||||
startBetterLibListener(); //I added this
|
||||
enableBetterLib(); //And this
|
||||
return react.createElement(Grid, { title: "Open in the main view" });
|
||||
}
|
||||
|
||||
//builds components of the page
|
||||
class Grid extends react.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
Object.assign(this, props);
|
||||
this.state = {
|
||||
foo: "bar", //dont know what these do but its working so ill leave them be
|
||||
data: "etc"
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return react.createElement("section", {
|
||||
className: "betterLibSection",
|
||||
},
|
||||
react.createElement("div",{
|
||||
className: "betterLibBox"
|
||||
},
|
||||
react.createElement("div", {
|
||||
className: "betterLibText",
|
||||
},
|
||||
react.createElement("h4", null, this.props.title),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
(function loadcss() {
|
||||
document.getElementsByTagName('head')[0].insertAdjacentHTML(
|
||||
'beforeend',`
|
||||
<style>
|
||||
/* remove resize bar while in betterlibrary */
|
||||
.Root__top-container:has(.betterLibBox) .LayoutResizer__resize-bar {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* creates the centered placeholder text on the sidebar where the library was */
|
||||
.betterLibText {
|
||||
display: none;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* makes the text visible only when it is in the sidebar */
|
||||
.main-yourLibraryX-library .betterLibText {
|
||||
display: var(--betterlib-show-placeholder-text,flex);
|
||||
}
|
||||
|
||||
/* makes the "your library" not clickable, expands and styles the text*/
|
||||
button.Button-sc-1dqy6lx-0.main-yourLibraryX-collapseButtonWrapper.main-yourLibraryX-button.main-useDropTarget-base,
|
||||
button.Button-sc-1dqy6lx-0.main-yourLibraryX-collapseButtonWrapper.main-yourLibraryX-button.NxEINIJHGytq4gF1r2N1 {
|
||||
pointer-events: none;
|
||||
font-size: x-large;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* hides the library header when in the sidebar*/
|
||||
.main-yourLibraryX-library .main-yourLibraryX-header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* shows the library header if the user is in a folder*/
|
||||
.main-yourLibraryX-library .main-yourLibraryX-header:has(.WYU7SXdABSulyirnmIYb) {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* hides collapse button (library icon)*/
|
||||
span.IconWrapper__Wrapper-sc-16usrgb-0.Wrapper-medium-leading {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* hides collapse button (library icon) in folder*/
|
||||
button.Button-sc-1dqy6lx-0.main-yourLibraryX-collapseButtonWrapper.main-yourLibraryX-button.main-useDropTarget-base.Button-medium-medium-buttonTertiary-iconOnly-condensed-useBrowserDefaultFocusStyle,
|
||||
button.Button-sc-1dqy6lx-0.main-yourLibraryX-collapseButtonWrapper.main-yourLibraryX-button.main-useDropTarget-base.Button-medium-medium-buttonTertiary-iconOnly-condensed-isUsingKeyboard-useBrowserDefaultFocusStyle,
|
||||
button.Button-sc-1dqy6lx-0.main-yourLibraryX-collapseButtonWrapper.main-yourLibraryX-button.NxEINIJHGytq4gF1r2N1.Button-medium-medium-buttonTertiary-iconOnly-condensed-useBrowserDefaultFocusStyle,
|
||||
button.Button-sc-1dqy6lx-0.main-yourLibraryX-collapseButtonWrapper.main-yourLibraryX-button.NxEINIJHGytq4gF1r2N1.Button-medium-medium-buttonTertiary-iconOnly-condensed-isUsingKeyboard-useBrowserDefaultFocusStyle {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* hides expand/reduce button (<- ->) and also add(+) and more(...)*/
|
||||
button.Button-sc-1dqy6lx-0.main-yourLibraryX-button.main-yourLibraryX-iconOnly.main-useDropTarget-base,
|
||||
button.Button-sc-1dqy6lx-0.main-yourLibraryX-button.main-yourLibraryX-iconOnly.NxEINIJHGytq4gF1r2N1 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* unhides add(+) and more(...)*/
|
||||
span button.Button-sc-1dqy6lx-0.main-yourLibraryX-button.main-yourLibraryX-iconOnly.main-useDropTarget-base,
|
||||
span button.Button-sc-1dqy6lx-0.main-yourLibraryX-button.main-yourLibraryX-iconOnly.NxEINIJHGytq4gF1r2N1 {
|
||||
display: inherit;
|
||||
}
|
||||
|
||||
/* add more top padding to the sidebar */
|
||||
.main-yourLibraryX-library {
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
/* fixes icons on collapsed betterlibrary */
|
||||
span.Type__TypeElement-sc-goli3j-0,
|
||||
.main-yourLibraryX-navItem span.Text__TextElement-sc-if376j-0 {
|
||||
display: var(--betterlib-fix-collaped-view,inherit);
|
||||
}
|
||||
|
||||
/* for future setting */
|
||||
.main-yourLibraryX-entryPoints.main-yourLibraryX-library {
|
||||
display: var(--betterlib-hide-sidebar-library,inherit);
|
||||
}
|
||||
</style>`
|
||||
);
|
||||
})();
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "Your Library",
|
||||
"icon": "<svg role=\"img\" height=\"24\" width=\"24\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" data-encore-id=\"icon\" class=\"Svg-sc-ytk21e-0 Svg-img-24-icon\"><path d=\"M14.5 2.134a1 1 0 0 1 1 0l6 3.464a1 1 0 0 1 .5.866V21a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1V3a1 1 0 0 1 .5-.866zM16 4.732V20h4V7.041l-4-2.309zM3 22a1 1 0 0 1-1-1V3a1 1 0 0 1 2 0v18a1 1 0 0 1-1 1zm6 0a1 1 0 0 1-1-1V3a1 1 0 0 1 2 0v18a1 1 0 0 1-1 1z\"></path></svg>",
|
||||
"active-icon": "<svg role=\"img\" height=\"24\" width=\"24\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" data-encore-id=\"icon\" class=\"Svg-sc-ytk21e-0 Svg-img-24-icon\"><path d=\"M3 22a1 1 0 0 1-1-1V3a1 1 0 0 1 2 0v18a1 1 0 0 1-1 1zM15.5 2.134A1 1 0 0 0 14 3v18a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V6.464a1 1 0 0 0-.5-.866l-6-3.464zM9 2a1 1 0 0 0-1 1v18a1 1 0 1 0 2 0V3a1 1 0 0 0-1-1z\"></path></svg>",
|
||||
"subfiles_extension": ["betterlibrary.js","loadcss.js"]
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,35 @@
|
||||
# Spicetify Marketplace
|
||||
|
||||
<p>
|
||||
<a href="https://github.com/spicetify/spicetify-marketplace/releases/latest">
|
||||
<img src="https://img.shields.io/github/v/release/spicetify/spicetify-marketplace?include_prereleases">
|
||||
</a>
|
||||
<a href="https://github.com/spicetify/spicetify-marketplace/releases">
|
||||
<img src="https://img.shields.io/github/downloads/spicetify/spicetify-marketplace/total.svg">
|
||||
</a>
|
||||
<a href="https://github.com/spicetify/spicetify-marketplace/issues?q=is%3Aissue+is%3Aclosed">
|
||||
<img src="https://img.shields.io/github/issues-closed/spicetify/spicetify-marketplace">
|
||||
</a>
|
||||
<a href="https://github.com/spicetify/spicetify-marketplace/commits/main">
|
||||
<img src="https://img.shields.io/github/commit-activity/m/spicetify/spicetify-marketplace">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
Customize your Spotify client directly from within [Spicetify](https://github.com/spicetify/spicetify-cli)!
|
||||
|
||||
Marketplace allows you to **browse, download, and install** extensions, themes, and CSS snippets with ease. You can also browse custom apps, but will need to do some manual installation to get them working.
|
||||
|
||||
Made with [Spicetify Creator](https://github.com/spicetify/spicetify-creator)
|
||||
|
||||
Head to the [wiki](https://github.com/spicetify/spicetify-marketplace/wiki) to get started!
|
||||
|
||||
---
|
||||
|
||||
## Links
|
||||
- [Overview](https://github.com/spicetify/spicetify-marketplace/wiki)
|
||||
- [Installation](https://github.com/spicetify/spicetify-marketplace/wiki/Installation)
|
||||
- [Publishing to Marketplace](https://github.com/spicetify/spicetify-marketplace/wiki/Publishing-to-Marketplace)
|
||||
- [Contributions](https://github.com/spicetify/spicetify-marketplace/wiki/Contributions)
|
||||
- [Development](https://github.com/spicetify/spicetify-marketplace/wiki/Development)
|
||||
- [Translating/Localizing Marketplace](https://github.com/spicetify/spicetify-marketplace/wiki/Localizing-Marketplace)
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": {
|
||||
"en": "Marketplace",
|
||||
"ru": "Маркетплейс"
|
||||
},
|
||||
"icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 76.465 68.262\"><path d=\"M151.909 72.923v6.5h10.097l8.663 44.567h48.968v-6.5h-43.61l-1.2-6.172h42.974l10.35-33.91h-59.915l-.872-4.485H151.91zm17.59 10.984h49.867l-6.393 20.91h-39.409l-4.064-20.91zm5.626 44.11a6.5 6.5 0 0 0-6.5 6.5 6.5 6.5 0 0 0 6.5 6.501 6.5 6.5 0 0 0 6.5-6.5 6.5 6.5 0 0 0-6.5-6.5zm38.274 0a6.5 6.5 0 0 0-6.5 6.5 6.5 6.5 0 0 0 6.5 6.501 6.5 6.5 0 0 0 6.5-6.5 6.5 6.5 0 0 0-6.5-6.5z\" style=\"fill:currentColor;stroke-width:.264583\" transform=\"translate(-151.909 -72.923)\"/></svg>\n",
|
||||
"active-icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 76.465 68.262\"><path d=\"M151.909 72.923v6.5h10.097l8.663 44.567h48.968v-6.5h-43.61l-1.2-6.172h42.974l10.35-33.91h-59.915l-.872-4.485H151.91zm23.216 55.095a6.5 6.5 0 0 0-6.5 6.5 6.5 6.5 0 0 0 6.5 6.5 6.5 6.5 0 0 0 6.5-6.5 6.5 6.5 0 0 0-6.5-6.5zm38.274 0a6.5 6.5 0 0 0-6.5 6.5 6.5 6.5 0 0 0 6.5 6.5 6.5 6.5 0 0 0 6.5-6.5 6.5 6.5 0 0 0-6.5-6.5z\" style=\"fill:currentColor;stroke-width:.264583\" transform=\"translate(-151.909 -72.923)\"/></svg>\n",
|
||||
"subfiles": [],
|
||||
"subfiles_extension": [
|
||||
"extension.js"
|
||||
]
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user