Skip to content

Commit f124c95

Browse files
committed
Focus in setttings menu
1 parent 1460cc9 commit f124c95

File tree

9 files changed

+49
-16
lines changed

9 files changed

+49
-16
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "emulsion",
3-
"version": "0.9.52",
3+
"version": "0.9.53",
44
"summary": "Better gaming throught chemistry",
5-
"description": "Emulsion is a modern, responsive game launcher that organizes platforms into galleries, manages game metadata and cover art, and launches titles through configured emulators.",
5+
"description": "Display your games collection into responsive galleries and manages game metadata, cover art, and emulator configuration. Launch your games in style.",
66
"homepage": "https://yphil.gitlab.io/emulsion",
77
"license": "GPLv3",
88
"author": {

src/css/form.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ button {
6565
outline: 2px solid var(--color-selected);
6666
}
6767

68+
.input-ctn.focused {
69+
outline: 2px solid var(--color-selected);
70+
}
71+
6872
.button:active {
6973
transform: translateY(1px);
7074
}

src/css/gallery.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,14 @@ div.dummy-game-container {
234234
padding: 1em;
235235
}
236236

237+
div.empty-platform-game-container {
238+
margin-top: 10vh;
239+
}
240+
241+
div.empty-platform-game-container p {
242+
color: var(--color-text-2);
243+
}
244+
237245
.page-content.grid .loading {
238246
border: 3px solid var(--color-border-on);
239247
animation: pulse-glow 1s infinite ease-in-out;

src/css/init.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ svg.big {
250250
svg.huge {
251251
width: 12em;
252252
height: 12em;
253+
fill: var(--color-selected);
254+
}
255+
256+
svg.icon.disabled {
257+
fill: #555;
253258
}
254259

255260
svg.help {

src/js/dialog.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,8 @@ export async function downloadMetaDialog(imagesCount, metaCount) {
542542
setupButton.addEventListener('click', () => {
543543
closeDialog();
544544
resolve(null);
545-
openPlatformMenu('settings', 'gallery', sourceName);
545+
const eltToFocus = sourceName === 'GiantBomb' ? 'giantBombAPIKey' : 'steamGridAPIKey';
546+
openPlatformMenu('settings', 'gallery', eltToFocus);
546547
});
547548

548549
if (!isEnabled) {

src/js/gallery.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,13 +504,13 @@ export function buildEmptyPageGameContainer({
504504
`Configure ${getPlatformInfo(platform).vendor} ${getPlatformInfo(platform).name}`;
505505
confButton.addEventListener('click', () => openPlatformMenu(platform));
506506
} else if (context === "no-favorites") {
507-
titleP.textContent = 'No favorites yet — go add some!';
507+
titleP.innerHTML = 'No <span class="accent">Favorites</span> yet — go add some!';
508508
subTitleP.textContent = 'Press □ to add the selected game to favorites';
509509

510510
const icon = buildIcon("like", "huge");
511511
iconP.appendChild(icon);
512512
} else {
513-
titleP.textContent = 'No recents yet — go play!';
513+
titleP.innerHTML = 'No <span class="accent">Recents</span> yet — go play!';
514514

515515
const icon = buildIcon("clock", "huge");
516516
iconP.appendChild(icon);

src/js/menu.js

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ function buildPrefsFormItem(name, iconName, type, description, shortDescription,
196196
const types = type;
197197

198198
const inputCtn = document.createElement('div');
199-
inputCtn.classList.add('input-ctn');
199+
inputCtn.classList.add('input-ctn', name);
200200

201201
const radiosContainer = document.createElement('div');
202202
radiosContainer.classList.add('radio-container');
@@ -956,9 +956,13 @@ function buildPlatformMenuForm(platformName) {
956956
}
957957

958958
export function openPlatformMenu(platformName, context, eltToFocus) {
959-
960959
console.log("platformName, context, eltToFocus: ", platformName, context, eltToFocus);
961960

961+
if (platformName === 'favorites' || platformName === 'recents') {
962+
eltToFocus = platformName === 'recents' ? 'recentlyPlayedPolicy' : 'favoritesPolicy';
963+
platformName = 'settings';
964+
}
965+
962966
LB.mode = 'menu';
963967
LB.currentPlatform = platformName;
964968

@@ -989,11 +993,29 @@ export function openPlatformMenu(platformName, context, eltToFocus) {
989993
toggleHeaderNavLinks('hide');
990994

991995
if (platformName === 'settings' && eltToFocus) {
992-
const fieldToFocus = document.getElementById(eltToFocus === 'GiantBomb' ? 'giantBombAPIKey' : 'steamGridAPIKey');
993-
if (fieldToFocus) {
996+
setTimeout(() => focusElement(eltToFocus, menu), 50);
997+
}
998+
}
999+
1000+
function focusElement(eltToFocus, menu) {
1001+
let fieldToFocus = document.getElementById(eltToFocus);
1002+
1003+
if (fieldToFocus) {
1004+
console.log("Found by ID:", fieldToFocus);
1005+
if (fieldToFocus.tagName === 'INPUT' ||
1006+
fieldToFocus.tagName === 'TEXTAREA' ||
1007+
fieldToFocus.tagName === 'SELECT') {
9941008
fieldToFocus.focus();
1009+
return;
9951010
}
9961011
}
1012+
1013+
fieldToFocus = menu.querySelector('.' + eltToFocus);
1014+
if (fieldToFocus) {
1015+
console.log("Found by class:", fieldToFocus);
1016+
fieldToFocus.classList.add('focused');
1017+
if (fieldToFocus.focus) fieldToFocus.focus();
1018+
}
9971019
}
9981020

9991021
async function closeSettingsOrPlatformMenu() {

src/js/slideshow.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,6 @@ export function initGallery(platformNameOrIndex, focusIndex = null) {
480480
}
481481

482482
if (pageDataset.platform === 'recents' || pageDataset.platform === 'favorites') {
483-
configPlatformButton.classList.add('disabled');
484483
metaDataButton.classList.add('disabled');
485484
}
486485
}
@@ -938,8 +937,6 @@ export function initGamepad() {
938937

939938
async function setGalleryViewMode(viewMode, save) {
940939

941-
console.log("viewMode, save: ", viewMode, save);
942-
943940
const toggleIcon = document.getElementById('view-mode-toggle-button');
944941
const page = document.querySelector('.page.active');
945942
const pageContent = page.querySelector('.page-content');

src/js/utils.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,6 @@ export function updateHeader(platformName, gameName) {
443443
const header = document.getElementById("header");
444444
const headerControls = document.getElementById("header-controls");
445445

446-
console.log("LB.mode: ", LB.mode);
447-
448446
const showHeader = platformName !== 'hide';
449447
const showControls = !(LB.mode === 'gameMenu' || LB.mode === 'menu' || platformName === 'settings');
450448

@@ -500,8 +498,6 @@ export function toggleFullScreen(elem = document.documentElement) {
500498

501499
export async function scanDirectory(gamesDir, extensions, recursive = true, ignoredDirs = ['PS3_EXTRA', 'PKGDIR', 'freezer', 'tmp']) {
502500

503-
console.log("gamesDir: ", gamesDir);
504-
505501
if (!gamesDir || typeof gamesDir !== 'string') {
506502
console.warn("scanDirectory: Invalid directory path provided:", gamesDir);
507503
return [];

0 commit comments

Comments
 (0)