mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-05-31 17:39:37 +00:00
Fix help tab content duplication on language change
Problem: Help tab content was growing/duplicating every time the language was changed because the code was trying to dynamically insert "How It Works" sections that couldn't be found after translation. Solution: Remove the dynamic content insertion logic for help sections. Now only updates existing header text instead of creating new elements. This prevents duplicate sections from appearing when switching languages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1115,23 +1115,9 @@ function applyTranslations(t) {
|
||||
aboutP.textContent = t.help.about_text;
|
||||
}
|
||||
|
||||
// Add how it works section if it exists in translations
|
||||
if (t.help.how_it_works_text) {
|
||||
// Find or create the how it works section
|
||||
let howItWorksH3 = Array.from(helpContent.querySelectorAll('h3')).find(h => h.textContent.includes('How It Works') || h.textContent === t.help.how_it_works);
|
||||
if (!howItWorksH3) {
|
||||
// Insert How It Works section after the first list
|
||||
const firstList = helpContent.querySelector('ol');
|
||||
if (firstList) {
|
||||
howItWorksH3 = document.createElement('h3');
|
||||
howItWorksH3.textContent = t.help.how_it_works;
|
||||
const howItWorksP = document.createElement('p');
|
||||
howItWorksP.textContent = t.help.how_it_works_text;
|
||||
firstList.parentNode.insertBefore(howItWorksP, firstList.nextSibling);
|
||||
firstList.parentNode.insertBefore(howItWorksH3, howItWorksP);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Note: "How It Works" section from translations is not shown
|
||||
// to avoid dynamically inserting/removing content which causes duplication issues
|
||||
// The static help content above is sufficient for the web UI
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user