mirror of
https://git.sanhost.net/sanasol/hytale-f2p.git
synced 2026-02-27 07:11:47 -03:00
v2.4.4: Rename Profiles to Configurations, add Identity Switcher
- Rename "Profiles" to "Configurations" in all UI text and 11 locale files - Add identity switcher dropdown in header (green accent, fa-id-badge icon) - Quick-switch player identity without opening Settings - "Manage" action opens UUID Management modal - Header tooltips explaining what each dropdown does - Config dropdown icon changed from fa-user-circle to fa-sliders-h - Global Escape key handler for closing modals and dropdowns - Fix identity selector not clickable (missing -webkit-app-region: no-drag) - Sync header identity name after all identity-changing operations - XSS protection in identity list rendering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
55
GUI/js/ui.js
55
GUI/js/ui.js
@@ -79,12 +79,18 @@ function setupWindowControls() {
|
||||
const header = document.querySelector('.header');
|
||||
|
||||
const profileSelector = document.querySelector('.profile-selector');
|
||||
const identitySelector = document.querySelector('.identity-selector');
|
||||
|
||||
if (profileSelector) {
|
||||
profileSelector.style.pointerEvents = 'auto';
|
||||
profileSelector.style.zIndex = '10000';
|
||||
}
|
||||
|
||||
if (identitySelector) {
|
||||
identitySelector.style.pointerEvents = 'auto';
|
||||
identitySelector.style.zIndex = '10000';
|
||||
}
|
||||
|
||||
if (windowControls) {
|
||||
windowControls.style.pointerEvents = 'auto';
|
||||
windowControls.style.zIndex = '10000';
|
||||
@@ -98,6 +104,9 @@ function setupWindowControls() {
|
||||
if (profileSelector) {
|
||||
profileSelector.style.webkitAppRegion = 'no-drag';
|
||||
}
|
||||
if (identitySelector) {
|
||||
identitySelector.style.webkitAppRegion = 'no-drag';
|
||||
}
|
||||
}
|
||||
|
||||
if (window.electronAPI) {
|
||||
@@ -1109,4 +1118,50 @@ window.openDiscordExternal = function() {
|
||||
|
||||
window.toggleMaximize = toggleMaximize;
|
||||
|
||||
// Global Escape key handler for closing popups/modals/dropdowns
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.key !== 'Escape') return;
|
||||
|
||||
// Custom confirm dialogs handle their own Escape — skip if one is open
|
||||
if (document.querySelector('.custom-confirm-modal')) return;
|
||||
|
||||
// Close modals (highest priority)
|
||||
const profileModal = document.getElementById('profileManagerModal');
|
||||
if (profileModal && profileModal.style.display !== 'none') {
|
||||
if (window.closeProfileManager) window.closeProfileManager();
|
||||
return;
|
||||
}
|
||||
|
||||
const uuidModal = document.getElementById('uuidModal');
|
||||
if (uuidModal && uuidModal.style.display !== 'none') {
|
||||
if (window.closeUuidModal) window.closeUuidModal();
|
||||
return;
|
||||
}
|
||||
|
||||
const discordModal = document.getElementById('discordPopupModal');
|
||||
if (discordModal && discordModal.style.display !== 'none') {
|
||||
discordModal.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
|
||||
const versionModal = document.getElementById('versionSelectModal');
|
||||
if (versionModal && versionModal.style.display !== 'none') {
|
||||
versionModal.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
|
||||
// Close dropdowns (lower priority)
|
||||
const identityDropdown = document.getElementById('identityDropdown');
|
||||
if (identityDropdown && identityDropdown.classList.contains('show')) {
|
||||
identityDropdown.classList.remove('show');
|
||||
return;
|
||||
}
|
||||
|
||||
const profileDropdown = document.getElementById('profileDropdown');
|
||||
if (profileDropdown && profileDropdown.classList.contains('show')) {
|
||||
profileDropdown.classList.remove('show');
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', setupUI);
|
||||
|
||||
Reference in New Issue
Block a user