mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-07-29 18:25:47 +02:00
refactor: add full documentation and fix theme loading robustness
- Add JSDoc comments across frontend and backend modules - Improve code readability and maintainability with consistent documentation style - Document Electron IPC handlers, UI utilities, and theme system - Add missing function/class documentation in theme loader and app services - Minor structural improvements and cleanup across Electron main process modules - Minor fixes on variable names
This commit is contained in:
@@ -1,16 +1,22 @@
|
||||
// Ajout des listeners pour la topbar
|
||||
/**
|
||||
* Initializes topbar button event listeners and binds them
|
||||
* to the Electron preload API exposed in `window.topbarAPI`.
|
||||
*
|
||||
* This function is safe to call once DOM is ready.
|
||||
* It silently aborts if the API or elements are missing.
|
||||
*/
|
||||
function setupTopbarListeners() {
|
||||
const { topbarAPI } = window;
|
||||
if (!topbarAPI) return;
|
||||
|
||||
const minBtn = document.getElementById('minimize-btn');
|
||||
const maxBtn = document.getElementById('maximize-btn');
|
||||
const closeBtn = document.getElementById('close-btn');
|
||||
const devtoolsBtn = document.getElementById('devtools-btn');
|
||||
const logsBtn = document.getElementById('logs-btn');
|
||||
const websiteBtn = document.getElementById('website-btn');
|
||||
const wikiBtn = document.getElementById('wiki-btn');
|
||||
const workshopBtn = document.getElementById('workshop-btn');
|
||||
|
||||
const minBtn = document.getElementById("minimize-btn");
|
||||
const maxBtn = document.getElementById("maximize-btn");
|
||||
const closeBtn = document.getElementById("close-btn");
|
||||
const devtoolsBtn = document.getElementById("devtools-btn");
|
||||
const logsBtn = document.getElementById("logs-btn");
|
||||
const websiteBtn = document.getElementById("website-btn");
|
||||
const wikiBtn = document.getElementById("wiki-btn");
|
||||
const workshopBtn = document.getElementById("workshop-btn");
|
||||
|
||||
if (minBtn) minBtn.onclick = () => topbarAPI.minimize();
|
||||
if (maxBtn) maxBtn.onclick = () => topbarAPI.maximize();
|
||||
@@ -22,12 +28,30 @@ function setupTopbarListeners() {
|
||||
if (workshopBtn) workshopBtn.onclick = () => topbarAPI.openWorkshop();
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', setupTopbarListeners);
|
||||
/**
|
||||
* Registers topbar event listeners after DOM is fully loaded.
|
||||
*/
|
||||
document.addEventListener("DOMContentLoaded", setupTopbarListeners);
|
||||
|
||||
const features = await window.electronAPI.getFeatures();
|
||||
/**
|
||||
* Applies UI layout adjustments depending on feature flags
|
||||
* provided by the Electron backend.
|
||||
*
|
||||
* Specifically handles:
|
||||
* - hiding custom topbar
|
||||
* - adjusting layout spacing
|
||||
* - repositioning theme switcher
|
||||
*/
|
||||
(async function applyFeatureLayout() {
|
||||
const features = await window.electronAPI.getFeatures();
|
||||
|
||||
if(!features.customTopBar){
|
||||
document.getElementById("topbar").style.display = "none";
|
||||
document.getElementById("container").style.marginTop = "0";
|
||||
document.getElementById("theme-switcher").style.top = "30px";
|
||||
}
|
||||
if (!features.customTopBar) {
|
||||
const topbar = document.getElementById("topbar");
|
||||
const container = document.getElementById("container");
|
||||
const themeSwitcher = document.getElementById("theme-switcher");
|
||||
|
||||
if (topbar) topbar.style.display = "none";
|
||||
if (container) container.style.marginTop = "0";
|
||||
if (themeSwitcher) themeSwitcher.style.top = "30px";
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user