mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2025-12-06 00:20:05 +01:00
Add monitor and pick file entry on Elements load
Some checks are pending
Tests / tests (push) Waiting to run
Some checks are pending
Tests / tests (push) Waiting to run
This commit is contained in:
parent
8da541a186
commit
47a6ee1728
|
|
@ -7,6 +7,7 @@ import { loadFiles, viewWidth } from "utils/functions";
|
|||
declare global {
|
||||
interface Window {
|
||||
eruda?: typeof Eruda;
|
||||
erudaMonitor: Parameters<(typeof Eruda)["add"]>[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +21,8 @@ const config: InitOptions = {
|
|||
useShadowDom: false,
|
||||
};
|
||||
|
||||
const FULL_TOOLBAR_WIDTH = 395;
|
||||
const FULL_TOOLBAR_WIDTH = 455;
|
||||
const SOURCES_BUTTON_WIDTH = 62;
|
||||
const RESOURCES_BUTTON_WIDTH = 74;
|
||||
|
||||
const useEruda = ({
|
||||
|
|
@ -42,19 +44,37 @@ const useEruda = ({
|
|||
const vw = viewWidth();
|
||||
|
||||
if (container) {
|
||||
const tool = ["console", "elements", "network"];
|
||||
|
||||
if (vw >= FULL_TOOLBAR_WIDTH - RESOURCES_BUTTON_WIDTH) {
|
||||
tool.push("resources");
|
||||
}
|
||||
|
||||
if (vw >= FULL_TOOLBAR_WIDTH) {
|
||||
tool.push("sources");
|
||||
}
|
||||
|
||||
window.eruda.init({
|
||||
...config,
|
||||
container,
|
||||
tool,
|
||||
});
|
||||
window.eruda.remove("info");
|
||||
window.eruda.remove("snippets");
|
||||
if (vw < FULL_TOOLBAR_WIDTH) {
|
||||
window.eruda.remove("resources");
|
||||
}
|
||||
if (vw < FULL_TOOLBAR_WIDTH - RESOURCES_BUTTON_WIDTH) {
|
||||
window.eruda.remove("sources");
|
||||
|
||||
if (
|
||||
vw >
|
||||
FULL_TOOLBAR_WIDTH - RESOURCES_BUTTON_WIDTH - SOURCES_BUTTON_WIDTH
|
||||
) {
|
||||
window.eruda.add(window.erudaMonitor);
|
||||
}
|
||||
|
||||
window.eruda.show();
|
||||
|
||||
const firstFileEntry = document.querySelector("main > ol > li");
|
||||
|
||||
if (firstFileEntry instanceof HTMLLIElement) {
|
||||
window.eruda.get("elements").select(firstFileEntry);
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,10 @@ const directory: Processes = {
|
|||
width: 545,
|
||||
},
|
||||
icon: "/System/Icons/eruda.webp",
|
||||
libs: ["/Program Files/Eruda/eruda.js"],
|
||||
libs: [
|
||||
"/Program Files/Eruda/eruda.js",
|
||||
"/Program Files/Eruda/eruda-monitor.js",
|
||||
],
|
||||
singleton: true,
|
||||
title: "DevTools",
|
||||
},
|
||||
|
|
|
|||
1
public/Program Files/Eruda/eruda-monitor.js
Normal file
1
public/Program Files/Eruda/eruda-monitor.js
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user