@kangsicj/nexussync 1.2.1 โ 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/NexusSync.meta.js +1 -1
- package/dist/NexusSync.user.js +207 -55
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<br>
|
|
6
6
|
|
|
7
|
-
[](./CHANGELOG.md)
|
|
8
8
|
[](https://www.tampermonkey.net/)
|
|
9
9
|
[](https://apps.apple.com/app/userscripts/id1463298887)
|
|
10
10
|
[](https://fairy.hada.io/@jinny)
|
|
@@ -61,7 +61,7 @@ Draw a quick circle around that actor and it glows on everyone's screen โ on t
|
|
|
61
61
|
<td valign="top">
|
|
62
62
|
|
|
63
63
|
### ๐ง Live AI subtitles
|
|
64
|
-
No subtitles on that video?
|
|
64
|
+
No subtitles on that video? Pick your language, choose **video sound** and press Start โ NexusSync listens to the video itself and writes live, translated subtitles, with a glossary so names are always spelled right.
|
|
65
65
|
|
|
66
66
|
</td>
|
|
67
67
|
</tr>
|
package/dist/NexusSync.meta.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// @icon https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/assets/icon.svg
|
|
9
9
|
// @updateURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.meta.js
|
|
10
10
|
// @downloadURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.user.js
|
|
11
|
-
// @version 1.
|
|
11
|
+
// @version 1.3.0
|
|
12
12
|
// @description Watch any web video together in perfect sync: cinema mode, live AI subtitles & translation, chat bubbles with auto-translation, quick ink, cover, go-together to the next episode.
|
|
13
13
|
// @description:ko ์ด๋ค ์น ์์์ด๋ ์๋ฒฝํ ์ฑํฌ๋ก ํจ๊ป ๋ณด๊ธฐ: ์๋ค๋ง ๋ชจ๋, ์ค์๊ฐ AI ์๋งยท๋ฒ์ญ, ์๋ ๋ฒ์ญ ๋งํ์ ์ฑํ
, ์ ๊น ๊ทธ๋ฆฌ๊ธฐ, ๊ฐ๋ฆฌ๊ธฐ, ๋ค์ ํ๋ ํจ๊ป.
|
|
14
14
|
// @match *://*/*
|
package/dist/NexusSync.user.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// @icon https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/assets/icon.svg
|
|
9
9
|
// @updateURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.meta.js
|
|
10
10
|
// @downloadURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.user.js
|
|
11
|
-
// @version 1.
|
|
11
|
+
// @version 1.3.0
|
|
12
12
|
// @description Watch any web video together in perfect sync: cinema mode, live AI subtitles & translation, chat bubbles with auto-translation, quick ink, cover, go-together to the next episode.
|
|
13
13
|
// @description:ko ์ด๋ค ์น ์์์ด๋ ์๋ฒฝํ ์ฑํฌ๋ก ํจ๊ป ๋ณด๊ธฐ: ์๋ค๋ง ๋ชจ๋, ์ค์๊ฐ AI ์๋งยท๋ฒ์ญ, ์๋ ๋ฒ์ญ ๋งํ์ ์ฑํ
, ์ ๊น ๊ทธ๋ฆฌ๊ธฐ, ๊ฐ๋ฆฌ๊ธฐ, ๋ค์ ํ๋ ํจ๊ป.
|
|
14
14
|
// @match *://*/*
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
|
|
44
44
|
// The version of the code that is actually running (the manager's metadata can lag
|
|
45
45
|
// behind when an old copy is still installed).
|
|
46
|
-
const NXU_VERSION = '1.
|
|
46
|
+
const NXU_VERSION = '1.3.0';
|
|
47
47
|
// Rank used by the one-instance guard below and to tell newer builds apart in a room.
|
|
48
48
|
// It is independent of the public version (1.0.0 is the first public release, after
|
|
49
49
|
// private builds that reached ranks up to 10.2.0), so every older copy still installed
|
|
50
50
|
// steps aside instead of this release.
|
|
51
|
-
const NXU_RANK = '11.
|
|
51
|
+
const NXU_RANK = '11.3.0';
|
|
52
52
|
const NXU_SESSION = Math.random().toString(36).slice(2, 10); // this page load // raise with every release
|
|
53
53
|
// App icon (same artwork as assets/icon.svg / @icon), inlined so it shows offline too.
|
|
54
54
|
const NXU_ICON = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiByb2xlPSJpbWciIGFyaWEtbGFiZWw9Ik5leHVzU3luYyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJueGJnIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjNWIyZWZmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmY0ZmEzIi8+PC9saW5lYXJHcmFkaWVudD48cmFkaWFsR3JhZGllbnQgaWQ9Im54Z2xvdyIgY3g9IjAuODIiIGN5PSIwLjE0IiByPSIwLjciPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzdjZjlmZiIgc3RvcC1vcGFjaXR5PSIwLjU1Ii8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjN2NmOWZmIiBzdG9wLW9wYWNpdHk9IjAiLz48L3JhZGlhbEdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0ibnhwbGF5IiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjZmZmZmZmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmZlM2YxIi8+PC9saW5lYXJHcmFkaWVudD48Y2xpcFBhdGggaWQ9Im54ciI+PHJlY3Qgd2lkdGg9IjI1NiIgaGVpZ2h0PSIyNTYiIHJ4PSI1OCIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNueHIpIj48cmVjdCB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgZmlsbD0idXJsKCNueGJnKSIvPjxyZWN0IHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiBmaWxsPSJ1cmwoI254Z2xvdykiLz48ZyBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMTUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0iTTYwIDExNiBBNzAgNzAgMCAwIDEgMTc4IDcyIi8+PHBhdGggZD0iTTE5NiAxNDAgQTcwIDcwIDAgMCAxIDc4IDE4NCIvPjwvZz48cGF0aCBkPSJNMTg2IDUwIEwyMDAgOTIgTDE1NyA4NiBaIiBmaWxsPSIjZmZmZmZmIi8+PHBhdGggZD0iTTcwIDIwNiBMNTYgMTY0IEw5OSAxNzAgWiIgZmlsbD0iI2ZmZmZmZiIvPjxwYXRoIGQ9Ik0xMTAgOTIgUTEwNCA4OCAxMDQgOTYgTDEwNCAxNjAgUTEwNCAxNjggMTEwIDE2NCBMMTYyIDEzMiBRMTY4IDEyOCAxNjIgMTI0IFoiIGZpbGw9InVybCgjbnhwbGF5KSIvPjwvZz48L3N2Zz4=';
|
|
@@ -671,17 +671,28 @@
|
|
|
671
671
|
subtitleLanguage: 'Translate subtitles to', audioSource: 'Audio source', audioAuto: 'Auto (video audio when possible + mic)', audioMic: 'Microphone only',
|
|
672
672
|
audioMedia: 'Video / tab audio only', audioDual: 'Microphone + video audio',
|
|
673
673
|
audioHelp: 'Auto listens to the page video directly when the browser allows it, otherwise through the microphone (turn the speaker volume up).',
|
|
674
|
+
heardSound: 'What to listen to', srcMedia: '๐ฌ Video sound (recommended)', srcMic: '๐ค Microphone',
|
|
675
|
+
srcMediaHelp: 'Listens to the video itself โ no speakers needed. If the browser asks what to share, pick this tab and turn on โShare tab audioโ.',
|
|
676
|
+
srcMicHelp: 'Listens through the microphone: play the video out loud through the speakers (not headphones).',
|
|
677
|
+
srcIosHelp: 'On iPhone and iPad, Safari can only listen through the microphone โ play the video through the speaker.',
|
|
678
|
+
videoLanguage: 'Language spoken in the video', subtitleLanguageReq: 'Subtitle language (required)', chooseLanguage: 'โ Choose a language โ',
|
|
679
|
+
subPickLanguage: 'Choose the subtitle language first.', subAskMic: '๐ค Tap โAllowโ when the browser asks for the microphone.',
|
|
680
|
+
subAskTab: '๐ฌ Choose this tab and turn on โShare tab audioโ, then press Share.',
|
|
681
|
+
subMicBlockedSite: 'This site does not allow the microphone โ listening to the video sound instead.',
|
|
682
|
+
subMicBlockedNoMedia: 'This site does not allow the microphone, and the video sound cannot be captured here.',
|
|
683
|
+
subUsingMicFallback: 'The video sound could not be heard directly โ listening through the microphone (turn the speakers up).',
|
|
684
|
+
subTabShareEnded: 'Tab audio sharing stopped, so subtitles were turned off.',
|
|
674
685
|
subPosition: 'Subtitle position', posVideo: 'Over the video', posScreen: 'Bottom of the screen', subSize: 'Size', subOpacity: 'Opacity',
|
|
675
686
|
advanced: 'Advanced', translationEngine: 'Translation engine', providerAuto: 'Google first, on-device as backup (best quality)', providerBrowser: 'On-device only (private)',
|
|
676
687
|
providerGoogle: 'Google only', providerHelp: 'Online translation reads whole sentences far better; the on-device model shows the live line and steps in when offline.',
|
|
677
688
|
localFirst: 'Prefer on-device speech recognition', localFirstHelp: 'Uses the offline speech model when the browser has it installed.',
|
|
678
689
|
hotkeyHelp: 'Shortcuts: Alt+Shift+T subtitles ยท Alt+Shift+C cinema ยท Alt+Shift+N menu ยท in cinema: Space, โ/โ, โ/โ, M, F',
|
|
679
|
-
subStart: 'Start subtitles', subStop: 'Stop subtitles', subStarting: 'Startingโฆ', subStatusIdle: 'Ready.
|
|
690
|
+
subStart: 'Start subtitles', subStop: 'Stop subtitles', subStarting: 'Startingโฆ', subStatusIdle: 'Ready. Choose the languages, then press Start.',
|
|
680
691
|
subStatusStarting: 'Preparing audio inputโฆ', subListening: 'Listening', auto: 'Auto', inputMic: 'mic', inputMedia: 'video audio',
|
|
681
692
|
engineLocal: 'on-device', engineOnline: 'online', translation: 'Translation', recognition: 'Recognition', speaker: 'Speaker', time: 'Time', confidence: 'Confidence',
|
|
682
693
|
speakerMic: 'Mic', speakerMedia: 'Video', speakerMixed: 'Mixed',
|
|
683
694
|
subOn: '๐๏ธ AI subtitles ON', subOff: '๐ AI subtitles OFF', subUnsupported: 'This browser has no speech recognition. Use Chrome, Edge or Safari.',
|
|
684
|
-
subNeedsHttps: 'Subtitles need a secure (https) page.', subMicDenied: '
|
|
695
|
+
subNeedsHttps: 'Subtitles need a secure (https) page.', subMicDenied: '๐ค Microphone access is off. Click the ๐ icon left of the address bar, set Microphone to โAllowโ, then try again.',
|
|
685
696
|
subMicUnavailable: '๐๏ธ No audio input available.', subNoMic: '๐๏ธ No microphone found.', subServiceBlocked: 'The speech service is not available in this browser.',
|
|
686
697
|
subNetworkFailed: 'Speech service unreachable. Check the connection and start again.', subLangUnsupported: 'This language is not supported for recognition.',
|
|
687
698
|
subStalled: 'Speech recognition keeps failing. Please start again.', subWebAudioUnavailable: 'Video audio unavailable here โ using the microphone.',
|
|
@@ -754,17 +765,28 @@
|
|
|
754
765
|
subtitleLanguage: '์๋ง ๋ฒ์ญ ์ธ์ด', audioSource: '์ค๋์ค ์
๋ ฅ', audioAuto: '์๋ (๊ฐ๋ฅํ๋ฉด ์์ ์๋ฆฌ + ๋ง์ดํฌ)', audioMic: '๋ง์ดํฌ๋ง',
|
|
755
766
|
audioMedia: '์์/ํญ ์๋ฆฌ๋ง', audioDual: '๋ง์ดํฌ + ์์ ์๋ฆฌ',
|
|
756
767
|
audioHelp: '์๋์ ๋ธ๋ผ์ฐ์ ๊ฐ ํ์ฉํ๋ฉด ํ์ด์ง ์์ ์๋ฆฌ๋ฅผ ์ง์ ๋ฃ๊ณ , ์๋๋ฉด ๋ง์ดํฌ๋ก ๋ฃ์ต๋๋ค (์คํผ์ปค ๋ณผ๋ฅจ์ ๋์ฌ ์ฃผ์ธ์).',
|
|
768
|
+
heardSound: '๋ค์ ์๋ฆฌ', srcMedia: '๐ฌ ์์ ์๋ฆฌ (๊ถ์ฅ)', srcMic: '๐ค ๋ง์ดํฌ',
|
|
769
|
+
srcMediaHelp: '์์ ์๋ฆฌ๋ฅผ ์ง์ ๋ค์ด์. ๋ธ๋ผ์ฐ์ ๊ฐ ๊ณต์ ํ ํ๋ฉด์ ๋ฌผ์ผ๋ฉด ์ด ํญ์ ๊ณ ๋ฅด๊ณ โํญ ์ค๋์ค ๊ณต์ โ๋ฅผ ์ผ ์ฃผ์ธ์.',
|
|
770
|
+
srcMicHelp: '๋ง์ดํฌ๋ก ๋ค์ด์. ์์ ์๋ฆฌ๋ฅผ ์ด์ดํฐ์ด ์๋ ์คํผ์ปค๋ก ํฌ๊ฒ ํ์ด ์ฃผ์ธ์.',
|
|
771
|
+
srcIosHelp: '์์ดํฐยท์์ดํจ๋์ Safari๋ ๋ง์ดํฌ๋ก๋ง ๋ค์ ์ ์์ด์. ์์์ ์คํผ์ปค๋ก ์ฌ์ํด ์ฃผ์ธ์.',
|
|
772
|
+
videoLanguage: '์์ ์ ์ธ์ด', subtitleLanguageReq: '์๋ง ์ธ์ด (ํ์)', chooseLanguage: 'โ ์ธ์ด๋ฅผ ์ ํํ์ธ์ โ',
|
|
773
|
+
subPickLanguage: '๋จผ์ ์๋ง ์ธ์ด๋ฅผ ์ ํํด ์ฃผ์ธ์.', subAskMic: '๐ค ๋ธ๋ผ์ฐ์ ๊ฐ ๋ง์ดํฌ ๊ถํ์ ๋ฌผ์ผ๋ฉด โํ์ฉโ์ ๋๋ฌ ์ฃผ์ธ์.',
|
|
774
|
+
subAskTab: '๐ฌ ์ด ํญ์ ๊ณ ๋ฅด๊ณ โํญ ์ค๋์ค ๊ณต์ โ๋ฅผ ์ผ ๋ค ๊ณต์ ๋ฅผ ๋๋ฌ ์ฃผ์ธ์.',
|
|
775
|
+
subMicBlockedSite: '์ด ์ฌ์ดํธ๋ ๋ง์ดํฌ ์ฌ์ฉ์ ๋ง์ ๋์์ด์. ์์ ์๋ฆฌ๋ก ๋ค์๊ฒ์.',
|
|
776
|
+
subMicBlockedNoMedia: '์ด ์ฌ์ดํธ๋ ๋ง์ดํฌ ์ฌ์ฉ์ ๋ง์ ๋์๊ณ , ์์ ์๋ฆฌ๋ ๋ฐ์ ์ ์์ด์.',
|
|
777
|
+
subUsingMicFallback: '์์ ์๋ฆฌ๋ฅผ ์ง์ ๋ค์ ์ ์์ด ๋ง์ดํฌ๋ก ๋ค์ด์. ์คํผ์ปค ์๋ฆฌ๋ฅผ ํค์ ์ฃผ์ธ์.',
|
|
778
|
+
subTabShareEnded: 'ํญ ์ค๋์ค ๊ณต์ ๊ฐ ๋๋์ ์๋ง์ ๊ป์ด์.',
|
|
757
779
|
subPosition: '์๋ง ์์น', posVideo: '์์ ์', posScreen: 'ํ๋ฉด ํ๋จ', subSize: 'ํฌ๊ธฐ', subOpacity: '๋ถํฌ๋ช
๋',
|
|
758
780
|
advanced: '๊ณ ๊ธ', translationEngine: '๋ฒ์ญ ์์ง', providerAuto: 'Google ์ฐ์ , ๊ธฐ๊ธฐ ๋ด ๋ฒ์ญ ๋ณด์กฐ (์ต๊ณ ํ์ง)', providerBrowser: '๊ธฐ๊ธฐ ๋ด ๋ฒ์ญ๋ง (๊ฐ์ธ์ ๋ณด ๋ณดํธ)',
|
|
759
781
|
providerGoogle: 'Google๋ง', providerHelp: '๋ฌธ์ฅ ๋ฒ์ญ ํ์ง์ ์จ๋ผ์ธ(Google)์ด ํจ์ฌ ์ข์ต๋๋ค. ๊ธฐ๊ธฐ ๋ด ๋ชจ๋ธ์ ์ค์๊ฐ ์์ ์ค๊ณผ ์คํ๋ผ์ธ ์ํฉ์ ๋งก์ต๋๋ค.',
|
|
760
782
|
localFirst: '๊ธฐ๊ธฐ ๋ด ์์ฑ ์ธ์ ์ฐ์ ', localFirstHelp: '๋ธ๋ผ์ฐ์ ์ ์คํ๋ผ์ธ ์์ฑ ๋ชจ๋ธ์ด ์ค์น๋์ด ์์ผ๋ฉด ์ฌ์ฉํฉ๋๋ค.',
|
|
761
783
|
hotkeyHelp: '๋จ์ถํค: Alt+Shift+T ์๋ง ยท Alt+Shift+C ์๋ค๋ง ยท Alt+Shift+N ๋ฉ๋ด ยท ์๋ค๋ง ์ค: Space, โ/โ, โ/โ, M, F',
|
|
762
|
-
subStart: '์๋ง ์์', subStop: '์๋ง ์ค์ง', subStarting: '์์ํ๋ ์คโฆ', subStatusIdle: '์ค๋น๋จ.
|
|
784
|
+
subStart: '์๋ง ์์', subStop: '์๋ง ์ค์ง', subStarting: '์์ํ๋ ์คโฆ', subStatusIdle: '์ค๋น๋จ. ์ธ์ด๋ฅผ ๊ณ ๋ฅธ ๋ค ์์์ ๋๋ฅด์ธ์.',
|
|
763
785
|
subStatusStarting: '์ค๋์ค ์
๋ ฅ ์ค๋น ์คโฆ', subListening: '๋ฃ๋ ์ค', auto: '์๋', inputMic: '๋ง์ดํฌ', inputMedia: '์์ ์๋ฆฌ',
|
|
764
786
|
engineLocal: '๊ธฐ๊ธฐ ๋ด', engineOnline: '์จ๋ผ์ธ', translation: '๋ฒ์ญ', recognition: '์ธ์', speaker: 'ํ์', time: '์๊ฐ', confidence: '์ ๋ขฐ๋',
|
|
765
787
|
speakerMic: '๋ง์ดํฌ', speakerMedia: '์์', speakerMixed: 'ํผํฉ',
|
|
766
788
|
subOn: '๐๏ธ AI ์๋ง ์ผ์ง', subOff: '๐ AI ์๋ง ๊บผ์ง', subUnsupported: '์ด ๋ธ๋ผ์ฐ์ ๋ ์์ฑ ์ธ์์ ์ง์ํ์ง ์์ต๋๋ค. Chrome, Edge, Safari๋ฅผ ์ฌ์ฉํ์ธ์.',
|
|
767
|
-
subNeedsHttps: '์๋ง์ ๋ณด์(https) ํ์ด์ง์์๋ง ๋์ํฉ๋๋ค.', subMicDenied: '
|
|
789
|
+
subNeedsHttps: '์๋ง์ ๋ณด์(https) ํ์ด์ง์์๋ง ๋์ํฉ๋๋ค.', subMicDenied: '๐ค ๋ง์ดํฌ ๊ถํ์ด ๊บผ์ ธ ์์ด์. ์ฃผ์์ฐฝ ์ผ์ชฝ ๐(์ฌ์ดํธ ์ ๋ณด)์์ ๋ง์ดํฌ๋ฅผ โํ์ฉโ์ผ๋ก ๋ฐ๊พผ ๋ค ๋ค์ ๋๋ฌ ์ฃผ์ธ์.',
|
|
768
790
|
subMicUnavailable: '๐๏ธ ์ฌ์ฉํ ์ ์๋ ์ค๋์ค ์
๋ ฅ์ด ์์ต๋๋ค.', subNoMic: '๐๏ธ ๋ง์ดํฌ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.', subServiceBlocked: '์ด ๋ธ๋ผ์ฐ์ ์์๋ ์์ฑ ์ธ์ ์๋น์ค๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.',
|
|
769
791
|
subNetworkFailed: '์์ฑ ์ธ์ ์๋ฒ์ ์ฐ๊ฒฐํ ์ ์์ต๋๋ค. ์ฐ๊ฒฐ์ ํ์ธํ๊ณ ๋ค์ ์์ํ์ธ์.', subLangUnsupported: '์ด ์ธ์ด๋ ์์ฑ ์ธ์์ ์ง์ํ์ง ์์ต๋๋ค.',
|
|
770
792
|
subStalled: '์์ฑ ์ธ์์ด ๊ณ์ ์คํจํฉ๋๋ค. ๋ค์ ์์ํด ์ฃผ์ธ์.', subWebAudioUnavailable: '์ด ํ์ด์ง์์๋ ์์ ์๋ฆฌ๋ฅผ ์ง์ ๋ฐ์ ์ ์์ด ๋ง์ดํฌ๋ฅผ ์ฌ์ฉํฉ๋๋ค.',
|
|
@@ -2225,14 +2247,21 @@
|
|
|
2225
2247
|
// โโ settings & language helpers
|
|
2226
2248
|
_settings() {
|
|
2227
2249
|
return {
|
|
2228
|
-
audioMode:
|
|
2250
|
+
audioMode: this._audioMode(),
|
|
2229
2251
|
provider: STORE.get('nxu_translation_provider', 'auto'),
|
|
2230
2252
|
localFirst: STORE.get('nxu_stt_local_first', true) !== false
|
|
2231
2253
|
};
|
|
2232
2254
|
},
|
|
2255
|
+
// Two sources only: the video's own sound (default) or the microphone. Older saved
|
|
2256
|
+
// values (auto / dual) mean "video sound". iPhone/iPad Safari can only use the mic.
|
|
2257
|
+
_audioMode() {
|
|
2258
|
+
if (this._isAppleMobile()) return 'mic';
|
|
2259
|
+
return STORE.get('nxu_audio_mode', 'media') === 'mic' ? 'mic' : 'media';
|
|
2260
|
+
},
|
|
2261
|
+
// The subtitle language is always chosen by the user (no guessing): empty until set.
|
|
2233
2262
|
loadLanguageSettings() {
|
|
2234
|
-
const out = baseLang(STORE.get('nxu_subtitle_language', '') ||
|
|
2235
|
-
this.outLang = LANG_BY_CODE.has(out) ? out :
|
|
2263
|
+
const out = baseLang(STORE.get('nxu_subtitle_language', '') || '');
|
|
2264
|
+
this.outLang = out && LANG_BY_CODE.has(out) ? out : '';
|
|
2236
2265
|
const saved = STORE.get('nxu_speaker_language', '');
|
|
2237
2266
|
this.inLang = this._localeFor(saved) || this._defaultSpeakerLocale();
|
|
2238
2267
|
},
|
|
@@ -2377,11 +2406,66 @@
|
|
|
2377
2406
|
if (!audio.length) throw new Error('no audio was shared');
|
|
2378
2407
|
return new MediaStream(audio);
|
|
2379
2408
|
},
|
|
2409
|
+
// Is the microphone switched off for this page by the site itself (Permissions-Policy)?
|
|
2410
|
+
// Then the browser refuses at once, without ever asking the user.
|
|
2411
|
+
_micBlockedByPolicy() {
|
|
2412
|
+
try {
|
|
2413
|
+
const pp = document.permissionsPolicy || document.featurePolicy;
|
|
2414
|
+
return !!(pp && typeof pp.allowsFeature === 'function' && !pp.allowsFeature('microphone'));
|
|
2415
|
+
} catch (_) { return false; }
|
|
2416
|
+
},
|
|
2417
|
+
async _micPermissionState() {
|
|
2418
|
+
try { return (await withTimeout(navigator.permissions.query({ name: 'microphone' }), 800)).state || 'unknown'; } catch (_) { return 'unknown'; }
|
|
2419
|
+
},
|
|
2420
|
+
// Does a captured stream carry any sound? Cross-origin or protected media gives a
|
|
2421
|
+
// track of pure digital silence. Only judged while the video is audibly playing.
|
|
2422
|
+
async _hasSignal(stream) {
|
|
2423
|
+
const v = STATE.video;
|
|
2424
|
+
if (!v || v.paused || v.muted || !(v.volume > 0) || typeof v.captureStream !== 'function') return true;
|
|
2425
|
+
const Ctx = window.AudioContext || window.webkitAudioContext;
|
|
2426
|
+
if (!Ctx) return true;
|
|
2427
|
+
let ctx = null;
|
|
2428
|
+
try {
|
|
2429
|
+
ctx = new Ctx();
|
|
2430
|
+
const src = ctx.createMediaStreamSource(stream);
|
|
2431
|
+
const an = ctx.createAnalyser();
|
|
2432
|
+
an.fftSize = 512;
|
|
2433
|
+
src.connect(an);
|
|
2434
|
+
if (ctx.state === 'suspended') { try { await ctx.resume(); } catch (_) { } }
|
|
2435
|
+
const buf = new Float32Array(an.fftSize);
|
|
2436
|
+
let peak = 0;
|
|
2437
|
+
for (let i = 0; i < 12 && peak < 0.0008; i++) {
|
|
2438
|
+
await new Promise(r => setTimeout(r, 120));
|
|
2439
|
+
an.getFloatTimeDomainData(buf);
|
|
2440
|
+
for (let j = 0; j < buf.length; j++) { const x = Math.abs(buf[j]); if (x > peak) peak = x; }
|
|
2441
|
+
}
|
|
2442
|
+
return peak >= 0.0008;
|
|
2443
|
+
} catch (_) { return true; } finally { try { ctx?.close(); } catch (_) { } }
|
|
2444
|
+
},
|
|
2445
|
+
// The video's own sound: the element itself when it gives real audio, otherwise (on a
|
|
2446
|
+
// computer) the tab's audio, which the browser lets the user share in one dialog.
|
|
2447
|
+
async _captureMediaAudio(token) {
|
|
2448
|
+
let web = this._captureElementAudio();
|
|
2449
|
+
if (web && !(await this._hasSignal(web))) {
|
|
2450
|
+
web.getTracks().forEach(tr => tr.stop());
|
|
2451
|
+
web = null;
|
|
2452
|
+
logDebug('AI Sub: the video element gives no sound here (protected or cross-origin media).', 'info');
|
|
2453
|
+
}
|
|
2454
|
+
if (web) { this._webFromElement = true; return web; }
|
|
2455
|
+
if (token !== this._startToken) return null;
|
|
2456
|
+
if (this._isAppleMobile() || this._isAndroid() || !navigator.mediaDevices?.getDisplayMedia) return null;
|
|
2457
|
+
showToast(t('subAskTab'));
|
|
2458
|
+
try { return await this._captureDisplayAudio(); } catch (err) {
|
|
2459
|
+
logDebug('AI Sub: tab audio not shared: ' + (err.message || err.name), 'warn');
|
|
2460
|
+
return null;
|
|
2461
|
+
}
|
|
2462
|
+
},
|
|
2380
2463
|
async _startAudioCapture(token) {
|
|
2381
2464
|
this._stopAudioCapture();
|
|
2382
|
-
const mode = this.
|
|
2465
|
+
const mode = this._audioMode();
|
|
2383
2466
|
this.audioMode = mode;
|
|
2384
2467
|
this._webFromElement = false;
|
|
2468
|
+
this._micMixed = false;
|
|
2385
2469
|
this._mediaPeak = 0;
|
|
2386
2470
|
this._trackSince = 0;
|
|
2387
2471
|
this._levels = { mic: 0, media: 0 };
|
|
@@ -2392,36 +2476,36 @@
|
|
|
2392
2476
|
this.captureMode = 'ios-mic';
|
|
2393
2477
|
return;
|
|
2394
2478
|
}
|
|
2479
|
+
const stopAll = (...streams) => streams.forEach(st => st?.getTracks().forEach(tr => tr.stop()));
|
|
2480
|
+
const policyBlocked = this._micBlockedByPolicy();
|
|
2395
2481
|
let web = null, mic = null;
|
|
2396
|
-
if (mode === '
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2482
|
+
if (mode === 'media' || policyBlocked) {
|
|
2483
|
+
if (policyBlocked && mode === 'mic') showToast(t('subMicBlockedSite'));
|
|
2484
|
+
web = await this._captureMediaAudio(token);
|
|
2485
|
+
if (token !== this._startToken) { stopAll(web); throw new Error('cancelled'); }
|
|
2486
|
+
if (!web && policyBlocked) { const e = new Error('microphone blocked by the site'); e.name = 'PolicyBlocked'; throw e; }
|
|
2487
|
+
}
|
|
2488
|
+
// The microphone is asked for explicitly (so the permission prompt shows up right
|
|
2489
|
+
// away): always in mic mode, as the fallback when the video sound is unavailable,
|
|
2490
|
+
// and alongside video sound for browser recognition, which may still need it.
|
|
2491
|
+
if (!policyBlocked && (!web || this._useWebSpeech)) {
|
|
2492
|
+
if (!web && (await this._micPermissionState()) === 'prompt') showToast(t('subAskMic'));
|
|
2493
|
+
try {
|
|
2494
|
+
// Echo cancellation would erase the very speaker sound we want to hear.
|
|
2495
|
+
mic = await this._requestMic(!web);
|
|
2496
|
+
} catch (err) {
|
|
2497
|
+
if (!web) throw err;
|
|
2498
|
+
logDebug('AI Sub: microphone unavailable, using the video sound only.', 'info');
|
|
2404
2499
|
}
|
|
2405
2500
|
}
|
|
2406
|
-
if (token !== this._startToken) { web
|
|
2407
|
-
|
|
2408
|
-
try {
|
|
2409
|
-
mic = await this._requestMic(!trackRecognition);
|
|
2410
|
-
} catch (err) {
|
|
2411
|
-
if (!web) throw err;
|
|
2412
|
-
logDebug('AI Sub: microphone unavailable, using media audio only.', 'warn');
|
|
2413
|
-
}
|
|
2414
|
-
if (token !== this._startToken) {
|
|
2415
|
-
[web, mic].forEach(s => s?.getTracks().forEach(tr => tr.stop()));
|
|
2416
|
-
throw new Error('cancelled');
|
|
2417
|
-
}
|
|
2501
|
+
if (token !== this._startToken) { stopAll(web, mic); throw new Error('cancelled'); }
|
|
2502
|
+
if (mode === 'media' && !web && mic) showToast(t('subUsingMicFallback'));
|
|
2418
2503
|
this.mediaStream = mic;
|
|
2419
2504
|
this.webMediaStream = web;
|
|
2420
|
-
|
|
2421
|
-
this.captureMode = web && mic && mode !== 'media' ? prefix + 'dual' : web ? prefix + 'media' : 'mic';
|
|
2505
|
+
this.captureMode = web ? 'media' : 'mic';
|
|
2422
2506
|
|
|
2423
2507
|
const AudioCtx = window.AudioContext || window.webkitAudioContext;
|
|
2424
|
-
const micForMix =
|
|
2508
|
+
const micForMix = web ? null : mic;
|
|
2425
2509
|
if (!AudioCtx || (!micForMix && !web)) return;
|
|
2426
2510
|
try {
|
|
2427
2511
|
let ctx;
|
|
@@ -2455,7 +2539,8 @@
|
|
|
2455
2539
|
connect(web, 'media');
|
|
2456
2540
|
this.audioContext = ctx;
|
|
2457
2541
|
this.audioNodes = nodes;
|
|
2458
|
-
this
|
|
2542
|
+
// Recognition hears exactly this mix (video sound, or the echo-free microphone).
|
|
2543
|
+
this.recognitionAudioStream = dest.stream;
|
|
2459
2544
|
this._levelTimer = setInterval(() => { if (!document.hidden) this._refreshLevels(); }, 400);
|
|
2460
2545
|
} catch (err) {
|
|
2461
2546
|
logDebug('AI Sub: audio analysis unavailable: ' + (err.message || err.name), 'info');
|
|
@@ -2652,6 +2737,9 @@
|
|
|
2652
2737
|
if (!this.active) return;
|
|
2653
2738
|
if (!document.hidden) this._checkAudio();
|
|
2654
2739
|
if (!this.active) return;
|
|
2740
|
+
// The user stopped sharing the tab's audio from the browser's bar.
|
|
2741
|
+
const shared = this.webMediaStream && !this._webFromElement ? this.webMediaStream.getAudioTracks() : [];
|
|
2742
|
+
if (shared.length && shared.every(tr => tr.readyState === 'ended')) { this.stop(t('subTabShareEnded')); return; }
|
|
2655
2743
|
if (!this._useWebSpeech) { updateAIBtnUX(); return; }
|
|
2656
2744
|
const now = Date.now();
|
|
2657
2745
|
if (!this._restartTimer && !this._waitOnline && now - this._lastEventAt > 25000) {
|
|
@@ -2663,11 +2751,14 @@
|
|
|
2663
2751
|
this._scheduleRestart('watchdog', 100, true);
|
|
2664
2752
|
} else if (this._recognitionInput === 'track' && !this._trackDisabled && this._trackSince && (
|
|
2665
2753
|
// Captured video audio is silent (e.g. cross-origin media) while the video plays,
|
|
2666
|
-
(now - this._trackSince > 6000 && this._mediaPeak < 0.003 && STATE.video && !STATE.video.paused && !STATE.video.muted && STATE.video.volume > 0) ||
|
|
2754
|
+
(this.webMediaStream && !this._micMixed && now - this._trackSince > 6000 && this._mediaPeak < 0.003 && STATE.video && !STATE.video.paused && !STATE.video.muted && STATE.video.volume > 0) ||
|
|
2667
2755
|
// or sound is present but the engine never returns words from the track.
|
|
2668
2756
|
(now - this._trackSince > 12000 && this._lastResultAt < this._trackSince && Math.max(this._levels.media, this._levels.mic) >= SPEECH_LEVEL))) {
|
|
2757
|
+
// First try: keep feeding the recognizer, now from the echo-free microphone.
|
|
2758
|
+
if (this.webMediaStream && !this._micMixed && this._mixInMic()) { updateAIBtnUX(); return; }
|
|
2669
2759
|
this._trackDisabled = true;
|
|
2670
|
-
logDebug('AI Sub: captured
|
|
2760
|
+
logDebug('AI Sub: captured audio unusable, switching to the recognizerโs own microphone.', 'warn');
|
|
2761
|
+
if (!this._micMixed) showToast(t('subUsingMicFallback'));
|
|
2671
2762
|
this._preparePlaybackMic();
|
|
2672
2763
|
this._destroyRecognizer();
|
|
2673
2764
|
this._createRecognizer();
|
|
@@ -2675,6 +2766,27 @@
|
|
|
2675
2766
|
}
|
|
2676
2767
|
updateAIBtnUX();
|
|
2677
2768
|
},
|
|
2769
|
+
_mixInMic() {
|
|
2770
|
+
const ctx = this.audioContext, nodes = this.audioNodes;
|
|
2771
|
+
if (!this.mediaStream || !ctx || !nodes?.mix) return false;
|
|
2772
|
+
try {
|
|
2773
|
+
const src = ctx.createMediaStreamSource(this.mediaStream);
|
|
2774
|
+
const an = ctx.createAnalyser();
|
|
2775
|
+
an.fftSize = 512;
|
|
2776
|
+
an.smoothingTimeConstant = 0.3;
|
|
2777
|
+
src.connect(an);
|
|
2778
|
+
src.connect(nodes.mix);
|
|
2779
|
+
nodes.list.push(src, an);
|
|
2780
|
+
nodes.analysers.mic = an;
|
|
2781
|
+
this._micMixed = true;
|
|
2782
|
+
this._preparePlaybackMic();
|
|
2783
|
+
this._trackSince = Date.now();
|
|
2784
|
+
this.captureMode = 'mic';
|
|
2785
|
+
showToast(t('subUsingMicFallback'));
|
|
2786
|
+
logDebug('AI Sub: the video sound is silent here, listening through the microphone.', 'warn');
|
|
2787
|
+
return true;
|
|
2788
|
+
} catch (_) { return false; }
|
|
2789
|
+
},
|
|
2678
2790
|
_preparePlaybackMic() {
|
|
2679
2791
|
const track = this.mediaStream?.getAudioTracks?.()[0];
|
|
2680
2792
|
if (!track || typeof track.applyConstraints !== 'function') return;
|
|
@@ -3412,6 +3524,8 @@
|
|
|
3412
3524
|
},
|
|
3413
3525
|
async start({ silent = false } = {}) {
|
|
3414
3526
|
if (this.state !== 'idle') return;
|
|
3527
|
+
this.loadLanguageSettings();
|
|
3528
|
+
if (!this.outLang) { this._askLanguage(); return; }
|
|
3415
3529
|
const SR = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
3416
3530
|
this._cloud = AI.asrProvider() !== 'browser' && !!(window.AudioContext || window.webkitAudioContext);
|
|
3417
3531
|
// With cloud recognition on iPhone/iPad, Safari's own recognizer stays off
|
|
@@ -3421,7 +3535,6 @@
|
|
|
3421
3535
|
if (window.isSecureContext === false) { showToast(t('subNeedsHttps')); return; }
|
|
3422
3536
|
const token = ++this._startToken;
|
|
3423
3537
|
this.state = 'starting';
|
|
3424
|
-
this.loadLanguageSettings();
|
|
3425
3538
|
this._resetRuntime();
|
|
3426
3539
|
this._abortCtrl = new AbortController();
|
|
3427
3540
|
this._syncUI();
|
|
@@ -3435,7 +3548,7 @@
|
|
|
3435
3548
|
this._syncUI();
|
|
3436
3549
|
const denied = err?.name === 'NotAllowedError' || err?.name === 'SecurityError';
|
|
3437
3550
|
logDebug('AI Sub: audio input failed: ' + (err?.message || err?.name), 'error');
|
|
3438
|
-
showToast(t(denied ? 'subMicDenied' : 'subMicUnavailable'));
|
|
3551
|
+
showToast(t(err?.name === 'PolicyBlocked' ? 'subMicBlockedNoMedia' : err?.name === 'NotFoundError' ? 'subNoMic' : denied ? 'subMicDenied' : 'subMicUnavailable'));
|
|
3439
3552
|
return;
|
|
3440
3553
|
}
|
|
3441
3554
|
if (token !== this._startToken) return;
|
|
@@ -3516,6 +3629,19 @@
|
|
|
3516
3629
|
if (wasActive && message) showToast(message);
|
|
3517
3630
|
if (wasActive) logDebug('AI Sub stopped.', 'info');
|
|
3518
3631
|
},
|
|
3632
|
+
// No subtitle language yet: open the settings with the language picker highlighted.
|
|
3633
|
+
_askLanguage() {
|
|
3634
|
+
showToast(t('subPickLanguage'));
|
|
3635
|
+
const modal = shadow?.getElementById('trans-modal');
|
|
3636
|
+
if (modal && modal.style.display !== 'flex') openPanel(modal);
|
|
3637
|
+
const sel = shadow?.getElementById('stt-out');
|
|
3638
|
+
if (sel) {
|
|
3639
|
+
sel.classList.remove('need');
|
|
3640
|
+
void sel.offsetWidth;
|
|
3641
|
+
sel.classList.add('need');
|
|
3642
|
+
try { sel.focus({ preventScroll: true }); } catch (_) { }
|
|
3643
|
+
}
|
|
3644
|
+
},
|
|
3519
3645
|
toggle() {
|
|
3520
3646
|
if (this.state === 'idle') this.start();
|
|
3521
3647
|
else this.stop(t('subOff'));
|
|
@@ -3532,7 +3658,7 @@
|
|
|
3532
3658
|
updateAIBtnUX();
|
|
3533
3659
|
},
|
|
3534
3660
|
setOutputLanguage(value) {
|
|
3535
|
-
this.outLang = LANG_BY_CODE.has(value) ? value : '
|
|
3661
|
+
this.outLang = value && LANG_BY_CODE.has(value) ? value : '';
|
|
3536
3662
|
this._recentQueued = [];
|
|
3537
3663
|
if (this.active) this._warmBrowserTranslator(baseLang(this._recognitionLanguage()), this.outLang);
|
|
3538
3664
|
updateAIBtnUX();
|
|
@@ -6331,10 +6457,26 @@
|
|
|
6331
6457
|
const label = text => createEl('div', 'field-label', text);
|
|
6332
6458
|
const help = text => createEl('div', 'trans-help', text);
|
|
6333
6459
|
const speakerSelect = createSelect('stt-in', LANGS.map(l => ({ value: l.locale, label: l.label })));
|
|
6334
|
-
const subtitleSelect = createSelect('stt-out', LANGS.map(l => ({ value: l.code, label: l.label })));
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6460
|
+
const subtitleSelect = createSelect('stt-out', [{ value: '', label: t('chooseLanguage') }, ...LANGS.map(l => ({ value: l.code, label: l.label }))]);
|
|
6461
|
+
// What to listen to: two clear choices instead of a list of capture modes.
|
|
6462
|
+
const ios = TRANSLATOR._isAppleMobile();
|
|
6463
|
+
const sourceRow = createEl('div', 'seg', '', { id: 'stt-source', role: 'radiogroup' });
|
|
6464
|
+
const srcMedia = createEl('button', 'seg-btn', t('srcMedia'), { type: 'button', 'data-mode': 'media', role: 'radio' });
|
|
6465
|
+
const srcMic = createEl('button', 'seg-btn', t('srcMic'), { type: 'button', 'data-mode': 'mic', role: 'radio' });
|
|
6466
|
+
const sourceHelp = help('');
|
|
6467
|
+
sourceRow.append(srcMedia, srcMic);
|
|
6468
|
+
const paintSource = () => {
|
|
6469
|
+
const mode = TRANSLATOR._audioMode();
|
|
6470
|
+
[srcMedia, srcMic].forEach(b => { const on = b.dataset.mode === mode; b.classList.toggle('on', on); b.setAttribute('aria-checked', String(on)); });
|
|
6471
|
+
srcMedia.disabled = ios;
|
|
6472
|
+
sourceHelp.textContent = ios ? t('srcIosHelp') : mode === 'mic' ? t('srcMicHelp') : t('srcMediaHelp');
|
|
6473
|
+
};
|
|
6474
|
+
[srcMedia, srcMic].forEach(b => b.addEventListener('click', () => {
|
|
6475
|
+
if (b.disabled || TRANSLATOR._audioMode() === b.dataset.mode) return;
|
|
6476
|
+
STORE.set('nxu_audio_mode', b.dataset.mode);
|
|
6477
|
+
paintSource();
|
|
6478
|
+
TRANSLATOR.restart('audio source changed');
|
|
6479
|
+
}));
|
|
6338
6480
|
const positionSelect = createSelect('stt-position', [{ value: 'video', label: t('posVideo') }, { value: 'screen', label: t('posScreen') }]);
|
|
6339
6481
|
const asrSelect = createSelect('stt-asr-provider', [
|
|
6340
6482
|
{ value: 'browser', label: t('asrBrowser') }, { value: 'openai', label: t('asrOpenAI') },
|
|
@@ -6411,17 +6553,17 @@
|
|
|
6411
6553
|
const advanced = createEl('div', 'ai-advanced-body');
|
|
6412
6554
|
const offlineBtn = createEl('button', 'btn subtle', 'โฌ๏ธ ' + t('offlineDownload'));
|
|
6413
6555
|
offlineBtn.onclick = () => TRANSLATOR.downloadOfflineModels();
|
|
6414
|
-
advanced.append(label(t('
|
|
6556
|
+
advanced.append(label(t('translationEngine')), providerSelect, engineHint,
|
|
6557
|
+
label(t('asrEngine')), asrSelect,
|
|
6558
|
+
label(t('subPosition')), positionSelect,
|
|
6559
|
+
label(t('glossary')), glossaryInput, help(t('glossaryHelp')), label(t('aiKeys')), keyRows, help(t('aiKeysHelp')), modelRow('anthropic', 'claude-haiku-4-5'), modelRow('openai', 'gpt-4.1-mini'),
|
|
6415
6560
|
help(t('modelHelp')), localRow, help(t('localFirstHelp')), offlineBtn, help(t('offlineHelp')));
|
|
6416
6561
|
details.append(createEl('summary', '', t('advanced')), advanced);
|
|
6417
6562
|
|
|
6418
6563
|
body.append(
|
|
6419
|
-
label(t('
|
|
6420
|
-
label(t('
|
|
6421
|
-
label(t('
|
|
6422
|
-
label(t('asrEngine')), asrSelect,
|
|
6423
|
-
label(t('translationEngine')), providerSelect, engineHint,
|
|
6424
|
-
label(t('subPosition')), positionSelect,
|
|
6564
|
+
label(t('heardSound')), sourceRow, sourceHelp,
|
|
6565
|
+
label(t('videoLanguage')), speakerSelect,
|
|
6566
|
+
label(t('subtitleLanguageReq')), subtitleSelect,
|
|
6425
6567
|
sizeRow, opacityRow,
|
|
6426
6568
|
details,
|
|
6427
6569
|
createEl('div', 'ai-status', t('subStatusIdle'), { id: 'nxu-ai-status' }),
|
|
@@ -6430,8 +6572,8 @@
|
|
|
6430
6572
|
);
|
|
6431
6573
|
|
|
6432
6574
|
speakerSelect.value = TRANSLATOR._recognitionLanguage();
|
|
6433
|
-
subtitleSelect.value = TRANSLATOR.outLang;
|
|
6434
|
-
|
|
6575
|
+
subtitleSelect.value = TRANSLATOR.outLang || '';
|
|
6576
|
+
paintSource();
|
|
6435
6577
|
positionSelect.value = STORE.get('nxu_sub_position', 'video');
|
|
6436
6578
|
providerSelect.value = STORE.get('nxu_translation_provider', 'auto');
|
|
6437
6579
|
asrSelect.value = STORE.get('nxu_asr_provider', 'browser');
|
|
@@ -6441,8 +6583,12 @@
|
|
|
6441
6583
|
opacitySlider.value = SUB_PREFS.opacity; opacityVal.textContent = SUB_PREFS.opacity + '%';
|
|
6442
6584
|
|
|
6443
6585
|
speakerSelect.addEventListener('change', () => { STORE.set('nxu_speaker_language', speakerSelect.value); TRANSLATOR.setSpeakerLanguage(speakerSelect.value); });
|
|
6444
|
-
subtitleSelect.addEventListener('change', () => {
|
|
6445
|
-
|
|
6586
|
+
subtitleSelect.addEventListener('change', () => {
|
|
6587
|
+
if (!subtitleSelect.value) return;
|
|
6588
|
+
subtitleSelect.classList.remove('need');
|
|
6589
|
+
STORE.set('nxu_subtitle_language', subtitleSelect.value);
|
|
6590
|
+
TRANSLATOR.setOutputLanguage(subtitleSelect.value);
|
|
6591
|
+
});
|
|
6446
6592
|
positionSelect.addEventListener('change', () => { STORE.set('nxu_sub_position', positionSelect.value); SUB_LAYOUT.schedule(); });
|
|
6447
6593
|
providerSelect.addEventListener('change', () => { STORE.set('nxu_translation_provider', providerSelect.value); TRANSLATOR._cache.clear(); TRANSLATOR._llmHistory = []; refreshEngineHint(); });
|
|
6448
6594
|
asrSelect.addEventListener('change', () => { STORE.set('nxu_asr_provider', asrSelect.value); refreshEngineHint(); TRANSLATOR.restart('recognition engine changed'); });
|
|
@@ -6597,6 +6743,12 @@
|
|
|
6597
6743
|
.trans-check { width:18px; height:18px; accent-color:var(--accent); }
|
|
6598
6744
|
.trans-help { font-size:11px; line-height:1.45; color:rgba(255,255,255,0.55); }
|
|
6599
6745
|
.trans-help.center { text-align:center; margin-top:4px; }
|
|
6746
|
+
.seg { display:flex; gap:6px; }
|
|
6747
|
+
.seg-btn { flex:1; min-height:38px; padding:8px 6px; border-radius:10px; border:1px solid rgba(255,255,255,0.16); background:rgba(255,255,255,0.06); color:inherit; font:inherit; font-size:13px; font-weight:700; cursor:pointer; }
|
|
6748
|
+
.seg-btn.on { background:rgba(124,77,255,0.38); border-color:rgba(160,130,255,0.95); }
|
|
6749
|
+
.seg-btn:disabled { opacity:0.4; cursor:default; }
|
|
6750
|
+
.trans-select.need { outline:2px solid #ffca28; outline-offset:1px; animation:nxNeed 0.9s ease 3; }
|
|
6751
|
+
@keyframes nxNeed { 50% { outline-color:transparent; } }
|
|
6600
6752
|
.range-row { display:flex; align-items:center; gap:8px; font-size:12px; margin-top:6px; }
|
|
6601
6753
|
.range-row input { flex:1; accent-color:var(--accent); }
|
|
6602
6754
|
.range-val { min-width:42px; text-align:right; color:rgba(255,255,255,0.7); }
|
package/package.json
CHANGED