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 {
|
||||
modUrl = import.meta.url;
|
||||
root = this.modUrl.substring(0, this.modUrl.lastIndexOf("/"));
|
||||
version = this.root.substring(this.root.lastIndexOf("/") + 1);
|
||||
|
||||
/** @type {{[id: string]: JadefinMod}} */
|
||||
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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
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 Jadefin from "../Jadefin.js";
|
||||
import JadefinMod from "../JadefinMod.js";
|
||||
import JadefinModules from "../JadefinModules.js";
|
||||
import JadefinUtils from "../JadefinUtils.js";
|
||||
@ -48,6 +49,13 @@ export default JadefinIntegrity("ExtrasMenu", import.meta.url, () => new (class
|
||||
</div>
|
||||
`;
|
||||
|
||||
drawerVersionEl = rd$()`
|
||||
<div class="sidebarHeader extrasVersion">
|
||||
Jellyfin <span id="extrasVersionJellyfin"></span><br>
|
||||
Jadefin <span id="extrasVersionJadefin"></span>
|
||||
</div>
|
||||
`;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
@ -106,6 +114,17 @@ export default JadefinIntegrity("ExtrasMenu", import.meta.url, () => new (class
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
@ -159,30 +178,28 @@ export default JadefinIntegrity("ExtrasMenu", import.meta.url, () => new (class
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!this.checkVisibility(this.IN_DRAWER, item)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let itemEl = rd$()`
|
||||
<a is="emby-linkbutton" class="navMenuOption emby-button" href="#">
|
||||
<span class=${`material-icons navMenuOptionIcon ${item.icon}`} aria-hidden="true"></span>
|
||||
<div class="navMenuOptionTextBlock">
|
||||
<span class="navMenuOptionText">${item.name}</span><br>
|
||||
<span class="navMenuOptionTextSubtext">${item.secondaryText}</span>
|
||||
</div>
|
||||
</a>
|
||||
`;
|
||||
|
||||
itemEl.addEventListener("click", e => item.cb?.());
|
||||
|
||||
item.cbEl?.(itemEl, this.IN_DRAWER);
|
||||
|
||||
this.drawerExtrasEl.appendChild(itemEl);
|
||||
for (let item of this._items) {
|
||||
if (!this.checkVisibility(this.IN_DRAWER, item)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let itemEl = rd$()`
|
||||
<a is="emby-linkbutton" class="navMenuOption emby-button" href="#">
|
||||
<span class=${`material-icons navMenuOptionIcon ${item.icon}`} aria-hidden="true"></span>
|
||||
<div class="navMenuOptionTextBlock">
|
||||
<span class="navMenuOptionText">${item.name}</span><br>
|
||||
<span class="navMenuOptionTextSubtext">${item.secondaryText}</span>
|
||||
</div>
|
||||
</a>
|
||||
`;
|
||||
|
||||
itemEl.addEventListener("click", e => item.cb?.());
|
||||
|
||||
item.cbEl?.(itemEl, this.IN_DRAWER);
|
||||
|
||||
this.drawerExtrasEl.appendChild(itemEl);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user