From a2cf4228528a08968f80188a2968307aa008902f Mon Sep 17 00:00:00 2001 From: Sowgro <69283684+Sowgro@users.noreply.github.com> Date: Mon, 11 Sep 2023 16:03:52 -0400 Subject: First Commit --- app/betterlibrary.js | 21 +++++++++++++++++++ app/index.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ app/manifest.json | 6 ++++++ app/style.css | 3 +++ 4 files changed, 87 insertions(+) create mode 100644 app/betterlibrary.js create mode 100644 app/index.js create mode 100644 app/manifest.json create mode 100644 app/style.css (limited to 'app') diff --git a/app/betterlibrary.js b/app/betterlibrary.js new file mode 100644 index 0000000..9649bea --- /dev/null +++ b/app/betterlibrary.js @@ -0,0 +1,21 @@ +var a; + +function betterlibrary() { + if (a == undefined) + try { + a = document.getElementsByClassName("main-yourLibraryX-libraryContainer")[0]; + console.log("setting a"); + } catch (error) { + + } + try { + setTimeout(() => { + document.getElementsByClassName("betterlibheader")[0].prepend(a); + // document.getElementsByClassName("main-yourLibraryX-entryPoints")[0].appendChild(a); + }, 100); + console.log("did not catch"); + } catch (error) { + console.log("catch!!"); + console.error(error); + } +} \ No newline at end of file diff --git a/app/index.js b/app/index.js new file mode 100644 index 0000000..b6f1a9b --- /dev/null +++ b/app/index.js @@ -0,0 +1,57 @@ +// Grab any variables you need +const react = Spicetify.React; +const reactDOM = Spicetify.ReactDOM; +const { + URI, + React: { useState, useEffect, useCallback }, + Platform: { History }, +} = Spicetify; + +// The main custom app render function. The component returned is what is rendered in Spotify. +function render() { + betterlibrary(); + return react.createElement(Grid, { title: "loading..." }); +} + +// Our main component +class Grid extends react.Component { + constructor(props) { + super(props); + Object.assign(this, props); + this.state = { + foo: "bar", + data: "etc" + }; + // console.log("test"); + } + + render() { + return react.createElement("section", { + className: "contentSpacing", + }, + react.createElement("div", { + className: "betterlibheader", + }, react.createElement("h1", null, this.props.title), + ), + ); + // ), react.createElement("div", { + // id: "marketplace-grid", + // className: "main-gridContainer-gridContainer", + // "data-tab": CONFIG.activeTab, + // style: { + // "--minimumColumnWidth": "180px", + // }, + // }, [...cardList]), + // react.createElement("footer", { + // style: { + // margin: "auto", + // textAlign: "center", + // }, + // }, !this.state.endOfList && (this.state.rest ? react.createElement(LoadMoreIcon, { onClick: this.loadMore.bind(this) }) : react.createElement(LoadingIcon)), + // ), react.createElement(TopBarContent, { + // switchCallback: this.switchTo.bind(this), + // links: CONFIG.tabs, + // activeLink: CONFIG.activeTab, + // }); + } +} \ No newline at end of file diff --git a/app/manifest.json b/app/manifest.json new file mode 100644 index 0000000..2431a42 --- /dev/null +++ b/app/manifest.json @@ -0,0 +1,6 @@ +{ + "name": "betterlibrary", + "icon": "", + "active-icon": "", + "subfiles_extension": ["betterlibrary.js"] +} \ No newline at end of file diff --git a/app/style.css b/app/style.css new file mode 100644 index 0000000..d6d155b --- /dev/null +++ b/app/style.css @@ -0,0 +1,3 @@ +.betterlibheader{ + margin: 0 calc(-.5 * var(--content-spacing)); +} \ No newline at end of file -- cgit v1.2.3