diff --git a/.changeset/hip-squids-ask.md b/.changeset/hip-squids-ask.md new file mode 100644 index 0000000..2dfa08a --- /dev/null +++ b/.changeset/hip-squids-ask.md @@ -0,0 +1,5 @@ +--- +'elden-ring-github': minor +--- + +feat: add lost grace discovered support diff --git a/README.md b/README.md index 0540b0b..84ed011 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,9 @@ Access settings by clicking the extension icon: - **๐ Show on PR creation**: Toggle banner display when PRs are created - **โ Show on PR approve**: Toggle banner display when PRs are approved - **๐ Play sound effect**: Toggle the iconic Elden Ring achievement sound +- **๐ต Sound Type**: Choose between different celebration sounds: + - **You Died** - The classic defeat sound + - **Lost Grace Discovered** - The grace discovery sound - **โฑ๏ธ Banner Duration**: Choose how long celebrations last (3-10 seconds) - **๐ Page Status**: See if you're currently on a GitHub page - **๐งช Test Banner**: Preview the banner effect anytime @@ -99,7 +102,8 @@ src/ โ โโโ settings.ts # Settings interface โ โโโ global.d.ts # Global type declarations โโโ assets/ # Static resources - โโโ elden_ring_sound.mp3 + โโโ you-die-sound.mp3 # "You Died" sound effect + โโโ lost-grace-discovered.mp3 # Lost Grace discovery sound โโโ pull-request-created.png # PR creation banner โโโ pull-request-merged.png # PR merge banner โโโ approve-pull-request.webp # PR approval banner diff --git a/src/assets/lost-grace-discovered.mp3 b/src/assets/lost-grace-discovered.mp3 new file mode 100644 index 0000000..ffeee02 Binary files /dev/null and b/src/assets/lost-grace-discovered.mp3 differ diff --git a/src/assets/elden_ring_sound.mp3 b/src/assets/you-die-sound.mp3 similarity index 100% rename from src/assets/elden_ring_sound.mp3 rename to src/assets/you-die-sound.mp3 diff --git a/src/content/content.test.ts b/src/content/content.test.ts index b543709..537e7b6 100644 --- a/src/content/content.test.ts +++ b/src/content/content.test.ts @@ -153,7 +153,8 @@ describe('EldenRingMerger', () => { global.Audio = vi.fn().mockImplementation(() => mockAudio); global.chrome.runtime.getURL = vi.fn(() => 'chrome-extension://mock/sound.mp3'); - const audio = new Audio(chrome.runtime.getURL('assets/elden_ring_sound.mp3')); + const soundType = 'you-die-sound'; + const audio = new Audio(chrome.runtime.getURL(`assets/${soundType}.mp3`)); audio.volume = 0.35; audio.play(); @@ -162,6 +163,21 @@ describe('EldenRingMerger', () => { expect(mockAudio.volume).toBe(0.35); }); + it('should support sound type selection', () => { + const soundTypes: Array<'you-die-sound' | 'lost-grace-discovered'> = [ + 'you-die-sound', + 'lost-grace-discovered', + ]; + + soundTypes.forEach((soundType) => { + const expectedPath = `assets/${soundType}.mp3`; + expect(expectedPath).toContain('.mp3'); + expect(expectedPath).toContain(soundType); + }); + + expect(soundTypes.length).toBe(2); + }); + it('should add event listeners to merge buttons', () => { // Setup DOM with merge button document.body.innerHTML = ` diff --git a/src/content/content.ts b/src/content/content.ts index f0b4bc3..07f8fb6 100644 --- a/src/content/content.ts +++ b/src/content/content.ts @@ -4,27 +4,39 @@ class EldenRingMerger { private showOnPRMerged: boolean = true; private showOnPRCreate: boolean = true; private showOnPRApprove: boolean = true; + private soundType: 'you-die-sound' | 'lost-grace-discovered' = 'you-die-sound'; private soundUrl: string; constructor() { - this.soundUrl = chrome.runtime.getURL('assets/elden_ring_sound.mp3'); + this.soundUrl = this.getSoundUrl(); this.loadSettings(); this.init(); } + private getSoundUrl(): string { + return chrome.runtime.getURL(`assets/${this.soundType}.mp3`); + } + + private updateSoundUrl(): void { + this.soundUrl = this.getSoundUrl(); + } + private loadSettings(): void { chrome.storage.sync.get( - ['soundEnabled', 'showOnPRMerged', 'showOnPRCreate', 'showOnPRApprove'], + ['soundEnabled', 'showOnPRMerged', 'showOnPRCreate', 'showOnPRApprove', 'soundType'], (result: { soundEnabled?: boolean; showOnPRMerged?: boolean; showOnPRCreate?: boolean; showOnPRApprove?: boolean; + soundType?: 'you-die-sound' | 'lost-grace-discovered'; }) => { this.soundEnabled = result.soundEnabled !== false; // default true this.showOnPRMerged = result.showOnPRMerged !== false; // default true this.showOnPRCreate = result.showOnPRCreate !== false; // default true this.showOnPRApprove = result.showOnPRApprove !== false; // default true + this.soundType = result.soundType || 'you-die-sound'; // default you-die-sound + this.updateSoundUrl(); }, ); @@ -43,6 +55,10 @@ class EldenRingMerger { if (changes.showOnPRApprove) { this.showOnPRApprove = changes.showOnPRApprove.newValue; } + if (changes.soundType) { + this.soundType = changes.soundType.newValue; + this.updateSoundUrl(); + } }, ); } diff --git a/src/popup/popup.html b/src/popup/popup.html index 0b41326..cec8bd9 100644 --- a/src/popup/popup.html +++ b/src/popup/popup.html @@ -57,6 +57,15 @@ Play sound effect +