Add version number to home drawer
This commit is contained in:
parent
d6b84ce2cc
commit
e7b42dbbf1
@ -9,6 +9,7 @@ import JadefinUtils from "./JadefinUtils.js";
|
|||||||
export default JadefinIntegrity("Jadefin", import.meta.url, () => window["Jadefin"] = new (class Jadefin extends JadefinMod {
|
export default JadefinIntegrity("Jadefin", import.meta.url, () => window["Jadefin"] = new (class Jadefin extends JadefinMod {
|
||||||
modUrl = import.meta.url;
|
modUrl = import.meta.url;
|
||||||
root = this.modUrl.substring(0, this.modUrl.lastIndexOf("/"));
|
root = this.modUrl.substring(0, this.modUrl.lastIndexOf("/"));
|
||||||
|
version = this.root.substring(this.root.lastIndexOf("/") + 1);
|
||||||
|
|
||||||
/** @type {{[id: string]: JadefinMod}} */
|
/** @type {{[id: string]: JadefinMod}} */
|
||||||
mods = {};
|
mods = {};
|
||||||
|
@ -237,4 +237,12 @@ export default JadefinIntegrity("JadefinModules", import.meta.url, () => window[
|
|||||||
return this._.events ??= this.Jadefin.findWebpackRawLoad(e => e.Events?.on && e.Events?.off && e.Events?.trigger && 1)[0]?.Events;
|
return this._.events ??= this.Jadefin.findWebpackRawLoad(e => e.Events?.on && e.Events?.off && e.Events?.trigger && 1)[0]?.Events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// index.jsx
|
||||||
|
/**
|
||||||
|
@return {any}
|
||||||
|
*/
|
||||||
|
get index() {
|
||||||
|
return this._.index ??= this.Jadefin.findWebpackRawLoad(e => JadefinUtils.findDeep(e, 1, (_, o) => o._minServerVersion))[0];
|
||||||
|
}
|
||||||
|
|
||||||
})());
|
})());
|
||||||
|
@ -12,3 +12,11 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.extrasVersion {
|
||||||
|
cursor: default;
|
||||||
|
user-select: none;
|
||||||
|
line-height: 2em;
|
||||||
|
opacity: 0.5;
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import JadefinIntegrity from '../JadefinIntegrity.js';
|
import JadefinIntegrity from '../JadefinIntegrity.js';
|
||||||
|
|
||||||
|
import Jadefin from "../Jadefin.js";
|
||||||
import JadefinMod from "../JadefinMod.js";
|
import JadefinMod from "../JadefinMod.js";
|
||||||
import JadefinModules from "../JadefinModules.js";
|
import JadefinModules from "../JadefinModules.js";
|
||||||
import JadefinUtils from "../JadefinUtils.js";
|
import JadefinUtils from "../JadefinUtils.js";
|
||||||
@ -48,6 +49,13 @@ export default JadefinIntegrity("ExtrasMenu", import.meta.url, () => new (class
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
drawerVersionEl = rd$()`
|
||||||
|
<div class="sidebarHeader extrasVersion">
|
||||||
|
Jellyfin <span id="extrasVersionJellyfin"></span><br>
|
||||||
|
Jadefin <span id="extrasVersionJadefin"></span>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -106,6 +114,17 @@ export default JadefinIntegrity("ExtrasMenu", import.meta.url, () => new (class
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawer?.insertBefore(this.drawerExtrasEl, userMenuOptions);
|
drawer?.insertBefore(this.drawerExtrasEl, userMenuOptions);
|
||||||
|
drawer?.appendChild(this.drawerVersionEl);
|
||||||
|
|
||||||
|
const versionJellyfinEl = this.drawerVersionEl.querySelector("#extrasVersionJellyfin");
|
||||||
|
if (versionJellyfinEl) {
|
||||||
|
versionJellyfinEl.textContent = JadefinModules.ApiClient.appVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
const versionJadefinEl = this.drawerVersionEl.querySelector("#extrasVersionJadefin");
|
||||||
|
if (versionJadefinEl) {
|
||||||
|
versionJadefinEl.textContent = Jadefin.version;
|
||||||
|
}
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
@ -159,7 +178,6 @@ export default JadefinIntegrity("ExtrasMenu", import.meta.url, () => new (class
|
|||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
if (this.drawerExtrasEl) {
|
|
||||||
this.drawerExtrasEl.innerHTML = `<h3 class="sidebarHeader">Extras</h3>`;
|
this.drawerExtrasEl.innerHTML = `<h3 class="sidebarHeader">Extras</h3>`;
|
||||||
|
|
||||||
for (let item of this._items) {
|
for (let item of this._items) {
|
||||||
@ -184,7 +202,6 @@ export default JadefinIntegrity("ExtrasMenu", import.meta.url, () => new (class
|
|||||||
this.drawerExtrasEl.appendChild(itemEl);
|
this.drawerExtrasEl.appendChild(itemEl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} current
|
* @param {number} current
|
||||||
|
Loading…
Reference in New Issue
Block a user