Skip to content

Commit 28782e1

Browse files
author
Homebrew Games Website
committed
fixed branding
1 parent f48e865 commit 28782e1

File tree

4 files changed

+118
-123
lines changed

4 files changed

+118
-123
lines changed

app.js

Lines changed: 111 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class HomebrewGamesApp {
107107
this.currentPage = 'home';
108108
document.getElementById('home-page').classList.add('active');
109109
document.getElementById('games-page').classList.remove('active');
110-
document.title = 'Homebrew Games Archive';
110+
document.title = 'Homebrew Games';
111111
}
112112

113113
showGamesPage(system, status) {
@@ -299,12 +299,116 @@ class HomebrewGamesApp {
299299
this.loadMoreGames();
300300
}
301301
}
302-
}
303302

304-
// Initialize the app when DOM is loaded
305-
document.addEventListener('DOMContentLoaded', () => {
306-
new HomebrewGamesApp();
307-
});
303+
// Settings management
304+
loadSettings() {
305+
this.currentLanguage = localStorage.getItem('language') || 'en';
306+
this.currentTheme = localStorage.getItem('theme') || 'dark';
307+
}
308+
309+
saveSettings() {
310+
localStorage.setItem('language', this.currentLanguage);
311+
localStorage.setItem('theme', this.currentTheme);
312+
}
313+
314+
// Translation functionality
315+
async loadTranslations() {
316+
try {
317+
const response = await fetch(`translations/${this.currentLanguage}.json`);
318+
if (!response.ok) throw new Error('Failed to load translations');
319+
this.translations = await response.json();
320+
} catch (error) {
321+
console.error('Error loading translations:', error);
322+
// Fallback to English if current language fails
323+
if (this.currentLanguage !== 'en') {
324+
try {
325+
const fallbackResponse = await fetch('translations/en.json');
326+
this.translations = await fallbackResponse.json();
327+
} catch (fallbackError) {
328+
console.error('Error loading fallback translations:', fallbackError);
329+
this.translations = {};
330+
}
331+
}
332+
}
333+
}
334+
335+
async changeLanguage(lang) {
336+
if (lang === this.currentLanguage) return;
337+
338+
this.currentLanguage = lang;
339+
this.saveSettings();
340+
341+
// Update language button states
342+
document.querySelectorAll('.lang-btn').forEach(btn => {
343+
btn.classList.toggle('active', btn.getAttribute('data-lang') === lang);
344+
});
345+
346+
// Load new translations
347+
await this.loadTranslations();
348+
this.updateLanguage();
349+
}
350+
351+
updateLanguage() {
352+
// Update all elements with data-translate attribute
353+
document.querySelectorAll('[data-translate]').forEach(element => {
354+
const key = element.getAttribute('data-translate');
355+
if (this.translations[key]) {
356+
element.textContent = this.translations[key];
357+
}
358+
});
359+
360+
// Update dynamic content
361+
this.updateDynamicTranslations();
362+
}
363+
364+
updateDynamicTranslations() {
365+
// Update loading text
366+
const loadingElement = document.querySelector('#loading p');
367+
if (loadingElement && this.translations['loading-text']) {
368+
loadingElement.textContent = this.translations['loading-text'];
369+
}
370+
371+
// Update no more games text
372+
const noMoreGamesElement = document.querySelector('#no-more-games p');
373+
if (noMoreGamesElement && this.translations['no-more-games']) {
374+
noMoreGamesElement.textContent = this.translations['no-more-games'];
375+
}
376+
377+
// Update all dropdown links
378+
document.querySelectorAll('.dropdown-link').forEach(link => {
379+
const href = link.getAttribute('href');
380+
if (href.includes('/new-games')) {
381+
link.textContent = this.translations['nav-new-games'] || 'New Games';
382+
} else if (href.includes('/ports')) {
383+
link.textContent = this.translations['nav-ports'] || 'Ports';
384+
} else if (href.includes('/re-releases')) {
385+
link.textContent = this.translations['nav-re-releases'] || 'Re-Releases';
386+
} else if (href.includes('/in-development')) {
387+
link.textContent = this.translations['nav-in-development'] || 'In Development';
388+
}
389+
});
390+
}
391+
392+
// Theme functionality
393+
toggleTheme() {
394+
this.currentTheme = this.currentTheme === 'dark' ? 'light' : 'dark';
395+
this.saveSettings();
396+
this.updateTheme();
397+
}
398+
399+
updateTheme() {
400+
const body = document.body;
401+
const themeIcon = document.querySelector('.theme-icon');
402+
403+
if (this.currentTheme === 'light') {
404+
body.setAttribute('data-theme', 'light');
405+
if (themeIcon) themeIcon.textContent = '☀️';
406+
} else {
407+
body.removeAttribute('data-theme');
408+
if (themeIcon) themeIcon.textContent = '🌙';
409+
}
410+
}
411+
}
308412

309413
// GitHub API integration (for future use)
310414
class GitHubDataManager {
@@ -353,114 +457,5 @@ document.addEventListener('DOMContentLoaded', () => {
353457
new HomebrewGamesApp();
354458
});
355459

356-
// Homebrew Games App - Additional methods
357-
HomebrewGamesApp.prototype.loadSettings = function() {
358-
this.currentLanguage = localStorage.getItem('language') || 'en';
359-
this.currentTheme = localStorage.getItem('theme') || 'dark';
360-
};
361-
362-
HomebrewGamesApp.prototype.saveSettings = function() {
363-
localStorage.setItem('language', this.currentLanguage);
364-
localStorage.setItem('theme', this.currentTheme);
365-
};
366-
367-
HomebrewGamesApp.prototype.loadTranslations = async function() {
368-
try {
369-
const response = await fetch(`translations/${this.currentLanguage}.json`);
370-
if (!response.ok) throw new Error('Failed to load translations');
371-
this.translations = await response.json();
372-
} catch (error) {
373-
console.error('Error loading translations:', error);
374-
// Fallback to English if current language fails
375-
if (this.currentLanguage !== 'en') {
376-
try {
377-
const fallbackResponse = await fetch('translations/en.json');
378-
this.translations = await fallbackResponse.json();
379-
} catch (fallbackError) {
380-
console.error('Error loading fallback translations:', fallbackError);
381-
this.translations = {};
382-
}
383-
}
384-
}
385-
};
386-
387-
HomebrewGamesApp.prototype.changeLanguage = async function(lang) {
388-
if (lang === this.currentLanguage) return;
389-
390-
this.currentLanguage = lang;
391-
this.saveSettings();
392-
393-
// Update language button states
394-
document.querySelectorAll('.lang-btn').forEach(btn => {
395-
btn.classList.toggle('active', btn.getAttribute('data-lang') === lang);
396-
});
397-
398-
// Load new translations
399-
await this.loadTranslations();
400-
this.updateLanguage();
401-
};
402-
403-
HomebrewGamesApp.prototype.updateLanguage = function() {
404-
// Update all elements with data-translate attribute
405-
document.querySelectorAll('[data-translate]').forEach(element => {
406-
const key = element.getAttribute('data-translate');
407-
if (this.translations[key]) {
408-
element.textContent = this.translations[key];
409-
}
410-
});
411-
412-
// Update dynamic content
413-
this.updateDynamicTranslations();
414-
};
415-
416-
HomebrewGamesApp.prototype.updateDynamicTranslations = function() {
417-
// Update loading text
418-
const loadingElement = document.querySelector('#loading p');
419-
if (loadingElement && this.translations['loading-text']) {
420-
loadingElement.textContent = this.translations['loading-text'];
421-
}
422-
423-
// Update no more games text
424-
const noMoreGamesElement = document.querySelector('#no-more-games p');
425-
if (noMoreGamesElement && this.translations['no-more-games']) {
426-
noMoreGamesElement.textContent = this.translations['no-more-games'];
427-
}
428-
429-
// Update all dropdown links
430-
document.querySelectorAll('.dropdown-link').forEach(link => {
431-
const href = link.getAttribute('href');
432-
if (href.includes('/new-games')) {
433-
link.textContent = this.translations['nav-new-games'] || 'New Games';
434-
} else if (href.includes('/ports')) {
435-
link.textContent = this.translations['nav-ports'] || 'Ports';
436-
} else if (href.includes('/re-releases')) {
437-
link.textContent = this.translations['nav-re-releases'] || 'Re-Releases';
438-
} else if (href.includes('/in-development')) {
439-
link.textContent = this.translations['nav-in-development'] || 'In Development';
440-
}
441-
});
442-
};
443-
444-
HomebrewGamesApp.prototype.toggleTheme = function() {
445-
this.currentTheme = this.currentTheme === 'dark' ? 'light' : 'dark';
446-
this.saveSettings();
447-
this.updateTheme();
448-
};
449-
450-
HomebrewGamesApp.prototype.updateTheme = function() {
451-
const body = document.body;
452-
const themeIcon = document.querySelector('.theme-icon');
453-
454-
if (this.currentTheme === 'light') {
455-
body.setAttribute('data-theme', 'light');
456-
themeIcon.textContent = '☀️';
457-
} else {
458-
body.removeAttribute('data-theme');
459-
themeIcon.textContent = '🌙';
460-
}
461-
};
462-
463-
}
464-
465460
// Export for potential use in other modules
466-
window.GitHubDataManager = GitHubDataManager;
461+
window.GitHubDataManager = GitHubDataManager;

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<title>Homebrew Games Archive</title>
6+
<title>Homebrew Archive</title>
77
<link rel="stylesheet" href="styles.css">
88
<link rel="preconnect" href="https://fonts.googleapis.com">
99
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@@ -25,7 +25,7 @@
2525
</div>
2626
</div>
2727
<div class="logo">
28-
<h1><a href="#" id="home-link" data-translate="site-title">Homebrew Games</a></h1>
28+
<h1><a href="#" id="home-link" data-translate="site-title">Homebrew Archive</a></h1>
2929
</div>
3030
<div class="header-spacer"></div>
3131
</div>
@@ -207,7 +207,7 @@ <h2 id="page-title">Games</h2>
207207

208208
<footer class="footer">
209209
<div class="container">
210-
<p data-translate="footer-text">&copy; 2025 Homebrew Games Archive. Built with ❤️ for retro gaming enthusiasts.</p>
210+
<p data-translate="footer-text">&copy; 2025 Homebrew Archive. Built with ❤️ for retro gaming enthusiasts.</p>
211211
</div>
212212
</footer>
213213

translations/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"site-title": "Homebrew Games",
2+
"site-title": "Homebrew Archive",
33
"nav-new-games": "New Games",
44
"nav-ports": "Ports",
55
"nav-re-releases": "Re-Releases",
@@ -22,7 +22,7 @@
2222
"system-sega-saturn-desc": "Dual-CPU powerhouse with unique homebrew scene",
2323
"system-sega-dreamcast": "Sega Dreamcast",
2424
"system-sega-dreamcast-desc": "Internet-ready console with thriving indie development",
25-
"footer-text": "© 2025 Homebrew Games Archive. Built with ❤️ for retro gaming enthusiasts.",
25+
"footer-text": "© 2025 Homebrew Archive. Built with ❤️ for retro gaming enthusiasts.",
2626
"loading-text": "Loading more games...",
2727
"no-more-games": "No more games to load",
2828
"buy-now": "Buy Now",

translations/pt.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"site-title": "Jogos Homebrew",
2+
"site-title": "Homebrew Archive",
33
"nav-new-games": "Jogos Novos",
44
"nav-ports": "Ports",
55
"nav-re-releases": "Relançamentos",
@@ -22,7 +22,7 @@
2222
"system-sega-saturn-desc": "Potência dual-CPU com cena homebrew única",
2323
"system-sega-dreamcast": "Sega Dreamcast",
2424
"system-sega-dreamcast-desc": "Console conectado à internet com desenvolvimento indie próspero",
25-
"footer-text": "© 2025 Arquivo de Jogos Homebrew. Feito com ❤️ para entusiastas de jogos retrô.",
25+
"footer-text": "© 2025 Homebrew Archive. Feito com ❤️ para entusiastas de jogos retrô.",
2626
"loading-text": "Carregando mais jogos...",
2727
"no-more-games": "Não há mais jogos para carregar",
2828
"buy-now": "Comprar Agora",

0 commit comments

Comments
 (0)