mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-22 05:32:12 -03:00
- Added i18n support with automatic language detection based on browser settings. - Implemented translations for English (en) and Simplified Chinese (zh-CN). - Created utility functions for text replacement in HTML templates and JavaScript. - Developed a comprehensive translation key structure for various application components. - Added formatting functions for numbers, dates, and file sizes according to locale. - Included RTL language support and dynamic updates for DOM elements. - Created tests to verify the functionality of the i18n system.
159 lines
7.9 KiB
HTML
159 lines
7.9 KiB
HTML
<header class="app-header">
|
|
<div class="header-container">
|
|
<div class="header-branding">
|
|
<a href="/loras" class="logo-link">
|
|
<img src="/loras_static/images/favicon-32x32.png" alt="LoRA Manager" class="app-logo">
|
|
<span class="app-title" data-i18n="header.appTitle">LoRA Manager</span>
|
|
</a>
|
|
</div>
|
|
<nav class="main-nav">
|
|
<a href="/loras" class="nav-item" id="lorasNavItem">
|
|
<i class="fas fa-layer-group"></i> <span data-i18n="header.navigation.loras">LoRAs</span>
|
|
</a>
|
|
<a href="/loras/recipes" class="nav-item" id="recipesNavItem">
|
|
<i class="fas fa-book-open"></i> <span data-i18n="header.navigation.recipes">Recipes</span>
|
|
</a>
|
|
<a href="/checkpoints" class="nav-item" id="checkpointsNavItem">
|
|
<i class="fas fa-check-circle"></i> <span data-i18n="header.navigation.checkpoints">Checkpoints</span>
|
|
</a>
|
|
<a href="/embeddings" class="nav-item" id="embeddingsNavItem">
|
|
<i class="fas fa-code"></i> <span data-i18n="header.navigation.embeddings">Embeddings</span>
|
|
</a>
|
|
<a href="/statistics" class="nav-item" id="statisticsNavItem">
|
|
<i class="fas fa-chart-bar"></i> <span data-i18n="header.navigation.statistics">Stats</span>
|
|
</a>
|
|
</nav>
|
|
|
|
<!-- Context-aware search container -->
|
|
<div class="header-search" id="headerSearch">
|
|
<div class="search-container">
|
|
<input type="text" id="searchInput" data-i18n="header.search.placeholder" data-i18n-target="placeholder" placeholder="Search..." />
|
|
<i class="fas fa-search search-icon"></i>
|
|
<button class="search-options-toggle" id="searchOptionsToggle" data-i18n="header.search.options" data-i18n-target="title" title="Search Options">
|
|
<i class="fas fa-sliders-h"></i>
|
|
</button>
|
|
<button class="search-filter-toggle" id="filterButton" data-i18n="header.filter.title" data-i18n-target="title" title="Filter models">
|
|
<i class="fas fa-filter"></i>
|
|
<span class="filter-badge" id="activeFiltersCount" style="display: none">0</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="header-actions">
|
|
<!-- Integrated corner controls -->
|
|
<div class="header-controls">
|
|
<div class="theme-toggle" data-i18n="header.theme.toggle" data-i18n-target="title" title="Toggle theme">
|
|
<i class="fas fa-moon dark-icon"></i>
|
|
<i class="fas fa-sun light-icon"></i>
|
|
<i class="fas fa-adjust auto-icon"></i>
|
|
</div>
|
|
<div class="settings-toggle" title="Settings">
|
|
<i class="fas fa-cog"></i>
|
|
</div>
|
|
<div class="help-toggle" id="helpToggleBtn" title="Help & Tutorials">
|
|
<i class="fas fa-question-circle"></i>
|
|
<span class="update-badge"></span>
|
|
</div>
|
|
<div class="update-toggle" id="updateToggleBtn" title="Check Updates">
|
|
<i class="fas fa-bell"></i>
|
|
<span class="update-badge"></span>
|
|
</div>
|
|
<div class="support-toggle" id="supportToggleBtn" title="Support">
|
|
<i class="fas fa-heart"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- Add search options panel with context-aware options -->
|
|
<div id="searchOptionsPanel" class="search-options-panel hidden">
|
|
<div class="options-header">
|
|
<h3 data-i18n="header.search.options">Search Options</h3>
|
|
<button class="close-options-btn" id="closeSearchOptions">
|
|
<i class="fas fa-times"></i>
|
|
</button>
|
|
</div>
|
|
<div class="options-section">
|
|
<h4 data-i18n="header.search.searchIn">Search In:</h4>
|
|
<div class="search-option-tags">
|
|
{% if request.path == '/loras/recipes' %}
|
|
<div class="search-option-tag active" data-option="title" data-i18n="header.search.filters.title">Recipe Title</div>
|
|
<div class="search-option-tag active" data-option="tags" data-i18n="header.search.filters.tags">Tags</div>
|
|
<div class="search-option-tag active" data-option="loraName" data-i18n="header.search.filters.loraName">LoRA Filename</div>
|
|
<div class="search-option-tag active" data-option="loraModel" data-i18n="header.search.filters.loraModel">LoRA Model Name</div>
|
|
{% elif request.path == '/checkpoints' %}
|
|
<div class="search-option-tag active" data-option="filename" data-i18n="header.search.filters.filename">Filename</div>
|
|
<div class="search-option-tag active" data-option="modelname" data-i18n="header.search.filters.modelname">Checkpoint Name</div>
|
|
<div class="search-option-tag active" data-option="tags" data-i18n="header.search.filters.tags">Tags</div>
|
|
<div class="search-option-tag" data-option="creator" data-i18n="header.search.filters.creator">Creator</div>
|
|
{% elif request.path == '/embeddings' %}
|
|
<div class="search-option-tag active" data-option="filename" data-i18n="header.search.filters.filename">Filename</div>
|
|
<div class="search-option-tag active" data-option="modelname" data-i18n="header.search.filters.modelname">Embedding Name</div>
|
|
<div class="search-option-tag active" data-option="tags" data-i18n="header.search.filters.tags">Tags</div>
|
|
<div class="search-option-tag" data-option="creator" data-i18n="header.search.filters.creator">Creator</div>
|
|
{% else %}
|
|
<!-- Default options for LoRAs page -->
|
|
<div class="search-option-tag active" data-option="filename" data-i18n="header.search.filters.filename">Filename</div>
|
|
<div class="search-option-tag active" data-option="modelname" data-i18n="header.search.filters.modelname">Model Name</div>
|
|
<div class="search-option-tag active" data-option="tags" data-i18n="header.search.filters.tags">Tags</div>
|
|
<div class="search-option-tag" data-option="creator" data-i18n="header.search.filters.creator">Creator</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add filter panel -->
|
|
<div id="filterPanel" class="filter-panel hidden">
|
|
<div class="filter-header">
|
|
<h3 data-i18n="header.filter.title">Filter Models</h3>
|
|
<button class="close-filter-btn" onclick="filterManager.closeFilterPanel()">
|
|
<i class="fas fa-times"></i>
|
|
</button>
|
|
</div>
|
|
<div class="filter-section">
|
|
<h4 data-i18n="header.filter.baseModel">Base Model</h4>
|
|
<div class="filter-tags" id="baseModelTags">
|
|
<!-- Tags will be dynamically inserted here -->
|
|
</div>
|
|
</div>
|
|
<div class="filter-section">
|
|
<h4 data-i18n="header.filter.modelTags">Tags (Top 20)</h4>
|
|
<div class="filter-tags" id="modelTagsFilter">
|
|
<!-- Top tags will be dynamically inserted here -->
|
|
<div class="tags-loading" data-i18n="common.status.loading">Loading tags...</div>
|
|
</div>
|
|
</div>
|
|
<div class="filter-actions">
|
|
<button class="clear-filters-btn" onclick="filterManager.clearFilters()" data-i18n="header.filter.clearAll">
|
|
Clear All Filters
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Header JavaScript will be handled by the HeaderManager in Header.js -->
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Get the current path from the URL
|
|
const currentPath = window.location.pathname;
|
|
|
|
// Update active nav item (i18n is handled by the HeaderManager)
|
|
const lorasNavItem = document.getElementById('lorasNavItem');
|
|
const recipesNavItem = document.getElementById('recipesNavItem');
|
|
const checkpointsNavItem = document.getElementById('checkpointsNavItem');
|
|
const embeddingsNavItem = document.getElementById('embeddingsNavItem');
|
|
const statisticsNavItem = document.getElementById('statisticsNavItem');
|
|
|
|
if (currentPath === '/loras') {
|
|
lorasNavItem.classList.add('active');
|
|
} else if (currentPath === '/loras/recipes') {
|
|
recipesNavItem.classList.add('active');
|
|
} else if (currentPath === '/checkpoints') {
|
|
checkpointsNavItem.classList.add('active');
|
|
} else if (currentPath === '/embeddings') {
|
|
embeddingsNavItem.classList.add('active');
|
|
} else if (currentPath === '/statistics') {
|
|
statisticsNavItem.classList.add('active');
|
|
}
|
|
});
|
|
</script> |