mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-10-11 22:36:35 +08:00
# Requirements Updated - "humanize==4.13.0" - "ruff==0.12.11" # Breaking Changes - **DEPRECATE `QBT_CONFIG` / `--config-file` OPTION** - No longer supporting `QBT_CONFIG` / `--config-file`. Instead please switch over to **`QBT_CONFIG_DIR` / `--config-dir`**. - `QBT_CONFIG` / `--config-file` option will still work for now but is now considered legacy and will be removed in a future release. - **Note**: All yml/yaml files will be treated as valid configuration files and loaded in the `QBT_CONFIG_DIR` path. Please ensure you **remove** any old/unused configurations that you don't want to be loaded prior to using this path. # Improvements - Adds docker support for PUID/PGID environment variables - Dockerfile copies the latest `config.yml.sample` in the config folder - Add `QBT_HOST` / `--host` option to specify webUI host address (#929 Thanks to @QuixThe2nd) - WebUI: Quick action settings persist now # Bug Fixes - WebUI: Fix loading spinner to be centered in the webUI **Full Changelog**: https://github.com/StuffAnThings/qbit_manage/compare/v4.5.5...v4.6.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Fabricio Silva <hi@fabricio.dev> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Parsa Yazdani <parsa@yazdani.au> Co-authored-by: Actionbot <actions@github.com>
84 lines
2.5 KiB
JavaScript
84 lines
2.5 KiB
JavaScript
/**
|
|
* DOM Utility Module
|
|
* Provides centralized functions for DOM element selection and manipulation.
|
|
*/
|
|
|
|
/**
|
|
* Get an element by its ID.
|
|
* @param {string} id - The ID of the element.
|
|
* @returns {HTMLElement|null} The element, or null if not found.
|
|
*/
|
|
export function get(id) {
|
|
return document.getElementById(id);
|
|
}
|
|
|
|
/**
|
|
* Get the first element matching a CSS selector.
|
|
* @param {string} selector - The CSS selector.
|
|
* @param {HTMLElement} [parent=document] - The parent element to search within.
|
|
* @returns {HTMLElement|null} The element, or null if not found.
|
|
*/
|
|
export function query(selector, parent = document) {
|
|
return parent.querySelector(selector);
|
|
}
|
|
|
|
/**
|
|
* Get all elements matching a CSS selector.
|
|
* @param {string} selector - The CSS selector.
|
|
* @param {HTMLElement} [parent=document] - The parent element to search within.
|
|
* @returns {NodeListOf<HTMLElement>} A NodeList of matching elements.
|
|
*/
|
|
export function queryAll(selector, parent = document) {
|
|
return parent.querySelectorAll(selector);
|
|
}
|
|
|
|
/**
|
|
* Show an HTML element by removing the 'hidden' class.
|
|
* @param {HTMLElement} element - The element to show.
|
|
*/
|
|
export function show(element) {
|
|
if (element) {
|
|
element.classList.remove('hidden');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Hide an HTML element by adding the 'hidden' class.
|
|
* @param {HTMLElement} element - The element to hide.
|
|
*/
|
|
export function hide(element) {
|
|
if (element) {
|
|
element.classList.add('hidden');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Displays a loading spinner in the specified container.
|
|
* @param {HTMLElement} container - The container element where the spinner should be displayed.
|
|
* @param {string} [message='Loading...'] - The message to display below the spinner.
|
|
*/
|
|
export function showLoading(container, message = 'Loading...') {
|
|
if (container) {
|
|
// Create a loading overlay element
|
|
const loadingOverlay = document.createElement('div');
|
|
loadingOverlay.id = 'loading-overlay'; // Give it a unique ID
|
|
loadingOverlay.className = 'loading-overlay'; // Add a class for styling
|
|
loadingOverlay.innerHTML = `
|
|
<div class="loading-spinner">
|
|
<div class="spinner spinner-lg"></div>
|
|
<p>${message}</p>
|
|
</div>
|
|
`;
|
|
container.appendChild(loadingOverlay); // Append it to the container
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Hides the loading spinner.
|
|
*/
|
|
export function hideLoading() {
|
|
const loadingOverlay = get('loading-overlay'); // Get the overlay by its ID
|
|
if (loadingOverlay) {
|
|
loadingOverlay.remove(); // Remove it from the DOM
|
|
}
|
|
}
|