2024-03-01 21:01:22 +01:00
|
|
|
//@ts-check
|
|
|
|
|
|
|
|
import JadefinIntegrity from '../../JadefinIntegrity.js';
|
|
|
|
|
|
|
|
import Jadefin from "../../Jadefin.js";
|
|
|
|
import JadefinMod from "../../JadefinMod.js";
|
|
|
|
import JadefinModules from "../../JadefinModules.js";
|
|
|
|
|
|
|
|
import { rd, rdom, rd$, RDOMListHelper } from "../../utils/rdom.js";
|
|
|
|
|
|
|
|
export default JadefinIntegrity("Shortcuts", import.meta.url, () => new (class Shortcuts extends JadefinMod {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
async init(name, url) {
|
|
|
|
await super.init(name, url);
|
|
|
|
|
|
|
|
this.initStyle();
|
|
|
|
|
|
|
|
const ExtrasMenu = /** @type {import("../ExtrasMenu.js").default} */ (Jadefin.getMod("ExtrasMenu"));
|
|
|
|
|
|
|
|
ExtrasMenu.items.push({
|
|
|
|
name: "Jellyseerr",
|
|
|
|
secondaryText: "Add new movies or series",
|
|
|
|
icon: "playlist_add_circle",
|
|
|
|
in: ExtrasMenu.IN_DRAWER,
|
2024-05-13 20:48:11 +02:00
|
|
|
cbEl: (/** @type {HTMLElement} */ el, current, alive) => {
|
|
|
|
el.setAttribute("href", "https://jellyseerr.0x0a.de/");
|
|
|
|
},
|
2024-03-01 21:01:22 +01:00
|
|
|
cb: () => {
|
|
|
|
window.open("https://jellyseerr.0x0a.de/", "_blank");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
ExtrasMenu.items.push({
|
|
|
|
name: "Scan All Libraries",
|
|
|
|
secondaryText: "Rescan all libraries",
|
|
|
|
icon: "sync",
|
|
|
|
in: ExtrasMenu.IN_CUSTOM,
|
|
|
|
inCustom: (current, item) => current == ExtrasMenu.IN_LIBRARY && (JadefinModules.ApiClient._currentUser?.Policy.IsAdministrator ?? false),
|
|
|
|
cbEl: (/** @type {HTMLElement} */ el, current, alive) => {
|
|
|
|
this.log.i(`Injecting library scan task button into extras popup: ${alive}`);
|
|
|
|
this.log.dir(el);
|
|
|
|
|
|
|
|
if (alive) {
|
|
|
|
el.classList.add("refreshButton");
|
|
|
|
|
|
|
|
el.querySelector(".listItemBody")?.appendChild(rd$()`
|
|
|
|
<progress min="0" max="100" class="refreshProgress"></progress>
|
|
|
|
`);
|
|
|
|
}
|
|
|
|
|
|
|
|
JadefinModules.taskButton({
|
|
|
|
mode: alive ? "on" : "off",
|
|
|
|
taskKey: "RefreshLibrary",
|
|
|
|
button: el,
|
|
|
|
progressElem: el.querySelector(".refreshProgress")
|
|
|
|
});
|
|
|
|
},
|
|
|
|
cb: () => {
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
})());
|