@kangsicj/nexussync 1.6.10 → 1.6.12
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 +1 -1
- package/dist/NexusSync.meta.js +1 -1
- package/dist/NexusSync.user.js +177 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
| Chat | Floating speech bubbles, quick replies, automatic translation of incoming messages, exportable history |
|
|
33
33
|
| Drawing and reactions | Strokes anchored to the video frame on every screen; emoji bursts; 3-2-1 countdown |
|
|
34
34
|
| Cover | Hides the picture on all screens for a few seconds; audio and subtitles continue; replays the cover on rewind |
|
|
35
|
-
| AI subtitles | Transcribes video audio into translated live subtitles; free offline Whisper on PC (downloaded on request), the browser's engine, or your own API key; glossary for names |
|
|
35
|
+
| AI subtitles | Transcribes video audio into translated live subtitles; free offline Whisper on PC and phone (downloaded on request; on iPhone the way to hear the video itself without a key), the browser's engine, or your own API key; glossary for names |
|
|
36
36
|
| Subtitles | Video tracks, local files or OpenSubtitles; up to 3 tracks at once |
|
|
37
37
|
| Timing sync | Aligns two different releases of the same film (offset by manual mark or automatic detection) |
|
|
38
38
|
| Next episode | Room persists across episodes; *Up next* countdown; sleep timer (pause after 15/30/60 min or at the end of the episode) |
|
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.6.
|
|
11
|
+
// @version 1.6.12
|
|
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.6.
|
|
11
|
+
// @version 1.6.12
|
|
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 *://*/*
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
|
|
47
47
|
// The version of the code that is actually running (the manager's metadata can lag
|
|
48
48
|
// behind when an old copy is still installed).
|
|
49
|
-
const NXU_VERSION = '1.6.
|
|
49
|
+
const NXU_VERSION = '1.6.12';
|
|
50
50
|
// Rank used by the one-instance guard below and to tell newer builds apart in a room.
|
|
51
51
|
// It is independent of the public version (1.0.0 is the first public release, after
|
|
52
52
|
// private builds that reached ranks up to 10.2.0), so every older copy still installed
|
|
53
53
|
// steps aside instead of this release.
|
|
54
|
-
const NXU_RANK = '11.6.
|
|
54
|
+
const NXU_RANK = '11.6.12';
|
|
55
55
|
const NXU_SESSION = Math.random().toString(36).slice(2, 10); // this page load // raise with every release
|
|
56
56
|
// App icon (same artwork as assets/icon.svg / @icon), inlined so it shows offline too.
|
|
57
57
|
const NXU_ICON = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiByb2xlPSJpbWciIGFyaWEtbGFiZWw9Ik5leHVzU3luYyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJueGJnIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjNWIyZWZmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmY0ZmEzIi8+PC9saW5lYXJHcmFkaWVudD48cmFkaWFsR3JhZGllbnQgaWQ9Im54Z2xvdyIgY3g9IjAuODIiIGN5PSIwLjE0IiByPSIwLjciPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzdjZjlmZiIgc3RvcC1vcGFjaXR5PSIwLjU1Ii8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjN2NmOWZmIiBzdG9wLW9wYWNpdHk9IjAiLz48L3JhZGlhbEdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0ibnhwbGF5IiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjZmZmZmZmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmZlM2YxIi8+PC9saW5lYXJHcmFkaWVudD48Y2xpcFBhdGggaWQ9Im54ciI+PHJlY3Qgd2lkdGg9IjI1NiIgaGVpZ2h0PSIyNTYiIHJ4PSI1OCIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNueHIpIj48cmVjdCB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgZmlsbD0idXJsKCNueGJnKSIvPjxyZWN0IHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiBmaWxsPSJ1cmwoI254Z2xvdykiLz48ZyBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMTUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0iTTYwIDExNiBBNzAgNzAgMCAwIDEgMTc4IDcyIi8+PHBhdGggZD0iTTE5NiAxNDAgQTcwIDcwIDAgMCAxIDc4IDE4NCIvPjwvZz48cGF0aCBkPSJNMTg2IDUwIEwyMDAgOTIgTDE1NyA4NiBaIiBmaWxsPSIjZmZmZmZmIi8+PHBhdGggZD0iTTcwIDIwNiBMNTYgMTY0IEw5OSAxNzAgWiIgZmlsbD0iI2ZmZmZmZiIvPjxwYXRoIGQ9Ik0xMTAgOTIgUTEwNCA4OCAxMDQgOTYgTDEwNCAxNjAgUTEwNCAxNjggMTEwIDE2NCBMMTYyIDEzMiBRMTY4IDEyOCAxNjIgMTI0IFoiIGZpbGw9InVybCgjbnhwbGF5KSIvPjwvZz48L3N2Zz4=';
|
|
@@ -686,19 +686,22 @@ async function handle(m) {
|
|
|
686
686
|
}
|
|
687
687
|
_processToastQueue.waits = 0;
|
|
688
688
|
_toastRunning = true;
|
|
689
|
-
|
|
689
|
+
const msg = _toastQueue.shift();
|
|
690
|
+
el.textContent = msg;
|
|
690
691
|
el.style.opacity = '1';
|
|
691
692
|
clearTimeout(el._toastTimer);
|
|
693
|
+
// Long advice stays long enough to be read (about 25 characters a second).
|
|
694
|
+
const readMs = Math.min(9000, 1200 + String(msg).length * 40);
|
|
692
695
|
el._toastTimer = setTimeout(() => {
|
|
693
696
|
el.style.opacity = '0';
|
|
694
697
|
setTimeout(_processToastQueue, 250);
|
|
695
|
-
}, _toastQueue.length ? 1600 : 2400);
|
|
698
|
+
}, Math.max(_toastQueue.length ? 1600 : 2400, readMs));
|
|
696
699
|
}
|
|
697
700
|
// ───────────────────────── UI language (Korean / English)
|
|
698
701
|
const I18N = {
|
|
699
702
|
en: {
|
|
700
703
|
asrEngine: 'Speech recognition engine', asrBrowser: 'Browser built-in (free)', asrOpenAI: 'OpenAI gpt-4o-mini-transcribe (fast, accurate)', asrOpenAIHQ: 'OpenAI gpt-4o-transcribe (best accuracy)',
|
|
701
|
-
asrLocal: 'Whisper offline (this
|
|
704
|
+
asrLocal: 'Whisper offline (on this device, free, no key)', whisperModel_base: 'Whisper base · fast · {mb} MB', whisperModel_small: 'Whisper small · more accurate, slower · {mb} MB', whisperModel_turbo: 'Whisper large-v3 turbo · best · {mb} MB · needs a graphics card (WebGPU)', whisperDownload: 'Download ({mb} MB)', whisperRemove: 'Remove', whisperChecking: 'Checking…', whisperReady: 'Ready (offline)', whisperDownloading: 'Downloading the model — only this once on this site, then it works offline.', whisperDone: 'Offline Whisper is ready', whisperFailed: 'The Whisper download failed — check the connection and try again', whisperHelp: 'Open-source speech recognition that runs on this device: nothing is sent anywhere, no key needed. Downloaded once per site, then it works offline.', whisperReadyHelp: 'Recognition runs on this device. Bigger models are more accurate but slower.', whisperNeedsGpu: 'Needs a graphics card', whisperGpuHelp: 'This model needs WebGPU with 16-bit support, which this browser or PC does not offer. Pick base or small.', whisperBlocked: 'Not available here', whisperBlockedHelp: 'The helper NexusSync needs could not start here (blocked by the site, or the userscript manager does not run in frames). Allow it to run in frames, or use another site.', whisperBlockedHere: '⚠️ Offline Whisper cannot start on this site — using the browser engine.',
|
|
702
705
|
asrGroq: 'Groq Whisper large-v3 turbo (very fast)', providerClaude: 'Claude (context-aware, most natural)', providerGPT: 'GPT (context-aware)', providerDeepL: 'DeepL',
|
|
703
706
|
engineHelp: 'AI engines (OpenAI, Claude, Groq, DeepL) use your own API key and give the best accuracy; without a key the free engines are used.',
|
|
704
707
|
aiNeedKey: 'Enter the {names} API key under Advanced — until then the free engine is used.', aiKeys: 'API keys', aiTest: 'Test',
|
|
@@ -761,7 +764,7 @@ async function handle(m) {
|
|
|
761
764
|
tuneSrcSame: '🟢 Same video on every device — kept in step automatically, frame by frame.', tuneSrcDiff: '🟠 Different versions (length differs by {s}) — the timing is found automatically after a little playing, or set it here.', tuneSrcUnknown: 'Waiting for the others’ video…', tuneSrcShifted: '🟠 Same length, but the scenes differ — the timing is lined up automatically while you play, or set it here.', tuneDiffPicture: 'Same time, but the pictures differ', tuneShiftFound: 'Same length but different scenes: timing set to {s} automatically (tap to undo).',
|
|
762
765
|
tuneSameReset: '⏱ Same video as the others: timing correction removed.', tuneAutoApplied: 'Different version: timing set to {s} automatically (tap to undo).', tuneSuggest: 'Your videos differ by {s}. Tap to line them up.',
|
|
763
766
|
subMenu: 'Subtitles', xsubOff: 'Off', subTrack: 'From the video', subSearch: '🔎 Find subtitles (OpenSubtitles)', subFile: '📂 Open a subtitle file…', subAi: '🧠 AI live subtitles', subDelay: 'Timing', subLater: 'later', subEarlier: 'earlier', xsubSize: 'Size',
|
|
764
|
-
subLoaded: '💬 Subtitles: {name}', subMulti: 'Several subtitles at once — tap one to take it away.', subNone: 'No subtitles found in this video.', subSuggest: '💬 No subtitles? Find them', subLoadFail: 'Could not load these subtitles.',
|
|
767
|
+
subLoaded: '💬 Subtitles: {name}', subMulti: 'Several subtitles at once — tap one to take it away.', subNone: 'No subtitles found in this video.', subMoreLangs: '🌐 {n} more languages', subSiteOnly: 'This site loads that subtitle only from its own menu — switch to the site controls (top right) and pick it there.', subSuggest: '💬 No subtitles? Find them', subLoadFail: 'Could not load these subtitles.',
|
|
765
768
|
osTitle: 'Find subtitles', osTmdbLooking: 'Looking up the English title on TMDB…', osTmdbNone: 'No English title found on TMDB — type it yourself if you know it.', osQuery: 'Title (English titles work best)', osSeason: 'Season', osEpisode: 'Episode', osLang: 'Language', osSearch: 'Search', osSearching: 'Searching…', osNone: 'Nothing found. Try the English title, or remove the year.', osError: 'OpenSubtitles did not answer. Try again in a moment.', osDownloads: '{n} downloads', osLoading: 'Loading…', osHint: 'Subtitles come from OpenSubtitles.org and are shown in NexusSync’s own style; use “Timing” in the subtitle menu if they are early or late.',
|
|
766
769
|
viewMenu: 'Picture', viewAudio: 'Soundtrack', viewBright: 'Brightness', viewBoost: 'Volume boost', viewReset: 'Reset', boostBlocked: 'This video’s sound cannot be boosted here (it comes from another site).',
|
|
767
770
|
settings: 'Settings', setProfile: 'Profile', setAvatar: 'Avatar', setStatus: 'Status message', setStatusPh: 'e.g. Popcorn ready 🍿', setReactions: 'My reactions',
|
|
@@ -777,7 +780,11 @@ async function handle(m) {
|
|
|
777
780
|
heardSound: 'What to listen to', srcMedia: '🎬 Video sound (recommended)', srcMic: '🎤 Microphone',
|
|
778
781
|
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”.',
|
|
779
782
|
srcMicHelp: 'Listens through the microphone: play the video out loud through the speakers (not headphones).',
|
|
780
|
-
srcIosHelp: '
|
|
783
|
+
srcIosHelp: 'Safari\'s built-in engine on iPhone/iPad erases the phone\'s own sound, so it hears only voices in the room. To subtitle the video, pick offline Whisper or Groq/OpenAI as the recognition engine below.',
|
|
784
|
+
srcIosMediaHelp: 'The video is heard through the microphone with echo cancellation off — keep it playing through the speaker (not earphones) with the volume up.',
|
|
785
|
+
subIosSpeaker: 'Listening to the video through the microphone — play it through the speaker with the volume up (not earphones).',
|
|
786
|
+
subIosEngine: 'Safari\'s engine hears only voices in the room, not this phone\'s own sound. To subtitle the video, choose offline Whisper or Groq in AI settings → recognition engine.',
|
|
787
|
+
whisperMobileHelp: 'On a phone only the base model is offered; the first line can take a few seconds.',
|
|
781
788
|
videoLanguage: 'Language spoken in the video', subtitleLanguageReq: 'Subtitle language (required)', chooseLanguage: '— Choose a language —',
|
|
782
789
|
subPickLanguage: 'Choose the subtitle language first.', subAskMic: '🎤 Tap “Allow” when the browser asks for the microphone.',
|
|
783
790
|
subAskTab: '🎬 Choose this tab and turn on “Share tab audio”, then press Share.',
|
|
@@ -819,7 +826,7 @@ async function handle(m) {
|
|
|
819
826
|
},
|
|
820
827
|
ko: {
|
|
821
828
|
asrEngine: '음성 인식 엔진', asrBrowser: '브라우저 내장 (무료)', asrOpenAI: 'OpenAI gpt-4o-mini-transcribe (빠르고 정확)', asrOpenAIHQ: 'OpenAI gpt-4o-transcribe (최고 정확도)',
|
|
822
|
-
asrLocal: 'Whisper 오프라인 (이
|
|
829
|
+
asrLocal: 'Whisper 오프라인 (이 기기에서, 무료, 키 없음)', whisperModel_base: 'Whisper base · 빠름 · {mb}MB', whisperModel_small: 'Whisper small · 더 정확, 느림 · {mb}MB', whisperModel_turbo: 'Whisper large-v3 turbo · 최고 · {mb}MB · 그래픽카드(WebGPU) 필요', whisperDownload: '다운로드 ({mb}MB)', whisperRemove: '삭제', whisperChecking: '확인 중…', whisperReady: '준비됨 (오프라인)', whisperDownloading: '모델을 받는 중이에요 — 이 사이트에서는 이번 한 번만 받고, 이후엔 오프라인으로 동작해요.', whisperDone: '오프라인 Whisper 준비 완료', whisperFailed: 'Whisper 다운로드에 실패했어요 — 연결을 확인하고 다시 시도해 주세요', whisperHelp: '이 기기에서 직접 돌아가는 오픈소스 음성 인식이에요. 어디에도 보내지 않고 키도 필요 없어요. 사이트마다 한 번 받으면 이후엔 오프라인으로 동작해요.', whisperReadyHelp: '음성 인식이 이 기기에서 돌아가요. 큰 모델일수록 정확하지만 더 느려요.', whisperNeedsGpu: '그래픽카드 필요', whisperGpuHelp: '이 모델은 16비트를 지원하는 WebGPU가 필요한데, 이 브라우저나 PC에서는 쓸 수 없어요. base나 small을 골라 주세요.', whisperBlocked: '여기서는 쓸 수 없음', whisperBlockedHelp: 'NexusSync가 쓰는 도우미가 여기서 시작되지 못했어요 (사이트가 막았거나, 유저스크립트 관리자가 프레임 안에서 실행되지 않아요). 프레임 안 실행을 허용하거나 다른 사이트에서 써 주세요.', whisperBlockedHere: '⚠️ 이 사이트에서는 오프라인 Whisper를 시작할 수 없어 브라우저 엔진을 써요.',
|
|
823
830
|
asrGroq: 'Groq Whisper large-v3 turbo (매우 빠름)', providerClaude: 'Claude (문맥 이해, 가장 자연스러움)', providerGPT: 'GPT (문맥 이해)', providerDeepL: 'DeepL',
|
|
824
831
|
engineHelp: 'AI 엔진(OpenAI·Claude·Groq·DeepL)은 본인 API 키로 동작하며 정확도가 가장 높습니다. 키가 없으면 무료 엔진을 사용합니다.',
|
|
825
832
|
aiNeedKey: '고급 설정에서 {names} API 키를 입력하세요 — 그전까지는 무료 엔진을 사용합니다.', aiKeys: 'API 키', aiTest: '확인',
|
|
@@ -882,7 +889,7 @@ async function handle(m) {
|
|
|
882
889
|
tuneSrcSame: '🟢 모두 같은 영상이에요 — 프레임 단위로 자동으로 맞추고 있어요.', tuneSrcDiff: '🟠 서로 다른 버전이에요 (길이 차이 {s}) — 잠시 재생하면 자동으로 맞추고, 여기서 직접 맞출 수도 있어요.', tuneSrcUnknown: '다른 사람의 영상 정보를 기다리는 중…', tuneSrcShifted: '🟠 길이는 같지만 장면이 달라요 — 재생하는 동안 자동으로 맞추고, 여기서 직접 맞출 수도 있어요.', tuneDiffPicture: '시간은 같지만 화면이 달라요', tuneShiftFound: '길이는 같지만 장면이 달라서 타이밍을 {s} 자동 보정했어요 (누르면 되돌리기).',
|
|
883
890
|
tuneSameReset: '⏱ 상대와 같은 영상이라 타이밍 보정을 해제했어요.', tuneAutoApplied: '다른 버전이라 타이밍을 {s} 자동 보정했어요 (누르면 되돌리기).', tuneSuggest: '서로 영상 길이가 {s} 달라요. 눌러서 맞춰 보세요.',
|
|
884
891
|
subMenu: '자막', xsubOff: '끄기', subTrack: '영상에 포함된 자막', subSearch: '🔎 자막 찾기 (OpenSubtitles)', subFile: '📂 자막 파일 열기…', subAi: '🧠 AI 실시간 자막', subDelay: '싱크', subLater: '늦게', subEarlier: '빠르게', xsubSize: '크기',
|
|
885
|
-
subLoaded: '💬 자막: {name}', subMulti: '자막 여러 개를 함께 보는 중 — 누르면 그 자막만 꺼져요.', subNone: '이 영상에는 포함된 자막이 없어요.', subSuggest: '💬 자막이 없나요? 찾아보기', subLoadFail: '자막을 불러오지 못했어요.',
|
|
892
|
+
subLoaded: '💬 자막: {name}', subMulti: '자막 여러 개를 함께 보는 중 — 누르면 그 자막만 꺼져요.', subNone: '이 영상에는 포함된 자막이 없어요.', subMoreLangs: '🌐 다른 언어 {n}개 더 보기', subSiteOnly: '이 사이트는 자기 메뉴에서만 이 자막을 불러와요. 오른쪽 위에서 사이트 컨트롤로 바꾼 뒤 거기서 골라 주세요.', subSuggest: '💬 자막이 없나요? 찾아보기', subLoadFail: '자막을 불러오지 못했어요.',
|
|
886
893
|
osTitle: '자막 찾기', osTmdbLooking: 'TMDB에서 영어 제목을 찾는 중…', osTmdbNone: 'TMDB에서 영어 제목을 찾지 못했어요 — 알고 있다면 직접 입력하세요.', osQuery: '제목 (영어 제목이 가장 잘 찾아져요)', osSeason: '시즌', osEpisode: '회차', osLang: '언어', osSearch: '검색', osSearching: '찾는 중…', osNone: '찾지 못했어요. 영어 제목으로 바꾸거나 연도를 빼 보세요.', osError: 'OpenSubtitles가 응답하지 않아요. 잠시 후 다시 시도하세요.', osDownloads: '다운로드 {n}회', osLoading: '불러오는 중…', osHint: '자막은 OpenSubtitles.org에서 가져와 NexusSync 스타일로 보여 줘요. 빠르거나 늦으면 자막 메뉴의 “싱크”로 맞추세요.',
|
|
887
894
|
viewMenu: '화면', viewAudio: '오디오 트랙', viewBright: '밝기', viewBoost: '볼륨 부스트', viewReset: '초기화', boostBlocked: '이 영상은 다른 사이트에서 오는 소리라 여기서 키울 수 없어요.',
|
|
888
895
|
settings: '설정', setProfile: '프로필', setAvatar: '아바타', setStatus: '상태 메시지', setStatusPh: '예: 팝콘 준비 완료 🍿', setReactions: '내 리액션',
|
|
@@ -898,7 +905,11 @@ async function handle(m) {
|
|
|
898
905
|
heardSound: '들을 소리', srcMedia: '🎬 영상 소리 (권장)', srcMic: '🎤 마이크',
|
|
899
906
|
srcMediaHelp: '영상 소리를 직접 들어요. 브라우저가 공유할 화면을 물으면 이 탭을 고르고 “탭 오디오 공유”를 켜 주세요.',
|
|
900
907
|
srcMicHelp: '마이크로 들어요. 영상 소리를 이어폰이 아닌 스피커로 크게 틀어 주세요.',
|
|
901
|
-
srcIosHelp: '아이폰·아이패드의 Safari
|
|
908
|
+
srcIosHelp: '아이폰·아이패드의 Safari 기본 엔진은 휴대폰 자체 소리를 지워서 주변 사람 목소리만 들어요. 영상 자막을 보려면 아래 음성 인식 엔진을 오프라인 Whisper나 Groq/OpenAI로 골라 주세요.',
|
|
909
|
+
srcIosMediaHelp: '마이크의 에코 제거를 끄고 영상 소리를 들어요. 이어폰 말고 스피커로, 소리를 키워서 재생해 주세요.',
|
|
910
|
+
subIosSpeaker: '마이크로 영상 소리를 듣고 있어요. 이어폰 말고 스피커로, 소리를 키워서 재생해 주세요.',
|
|
911
|
+
subIosEngine: 'Safari 엔진은 이 휴대폰 자체 소리는 못 듣고 주변 목소리만 들어요. 영상 자막은 AI 설정 → 음성 인식 엔진에서 오프라인 Whisper나 Groq를 골라 주세요.',
|
|
912
|
+
whisperMobileHelp: '휴대폰에서는 base 모델만 쓸 수 있어요. 첫 줄은 몇 초 걸릴 수 있어요.',
|
|
902
913
|
videoLanguage: '영상 속 언어', subtitleLanguageReq: '자막 언어 (필수)', chooseLanguage: '— 언어를 선택하세요 —',
|
|
903
914
|
subPickLanguage: '먼저 자막 언어를 선택해 주세요.', subAskMic: '🎤 브라우저가 마이크 권한을 물으면 “허용”을 눌러 주세요.',
|
|
904
915
|
subAskTab: '🎬 이 탭을 고르고 “탭 오디오 공유”를 켠 뒤 공유를 눌러 주세요.',
|
|
@@ -2584,9 +2595,12 @@ async function handle(m) {
|
|
|
2584
2595
|
};
|
|
2585
2596
|
},
|
|
2586
2597
|
// Two sources only: the video's own sound (default) or the microphone. Older saved
|
|
2587
|
-
// values (auto / dual) mean "video sound". iPhone/iPad Safari
|
|
2598
|
+
// values (auto / dual) mean "video sound". On iPhone/iPad, Safari's own recognizer
|
|
2599
|
+
// listens with echo cancellation, which erases the phone's own speaker: there the video
|
|
2600
|
+
// sound needs Whisper or a cloud engine, which hear the speaker with echo cancellation off.
|
|
2601
|
+
_iosNeedsEngine() { return this._isAppleMobile() && AI.asrProvider() === 'browser'; },
|
|
2588
2602
|
_audioMode() {
|
|
2589
|
-
if (this.
|
|
2603
|
+
if (this._iosNeedsEngine()) return 'mic';
|
|
2590
2604
|
return STORE.get('nxu_audio_mode', 'media') === 'mic' ? 'mic' : 'media';
|
|
2591
2605
|
},
|
|
2592
2606
|
// The subtitle language is always chosen by the user (no guessing): empty until set.
|
|
@@ -2853,7 +2867,7 @@ async function handle(m) {
|
|
|
2853
2867
|
}
|
|
2854
2868
|
}
|
|
2855
2869
|
if (token !== this._startToken) { stopAll(web, mic); throw new Error('cancelled'); }
|
|
2856
|
-
if (mode === 'media' && !web && mic) showToast(t('subUsingMicFallback'));
|
|
2870
|
+
if (mode === 'media' && !web && mic) showToast(t(this._isAppleMobile() ? 'subIosSpeaker' : 'subUsingMicFallback'));
|
|
2857
2871
|
this.mediaStream = mic;
|
|
2858
2872
|
this.webMediaStream = web;
|
|
2859
2873
|
this.captureMode = web ? 'media' : 'mic';
|
|
@@ -4168,6 +4182,13 @@ async function handle(m) {
|
|
|
4168
4182
|
this._toldNoTrack = false;
|
|
4169
4183
|
this._toldNoWords = false;
|
|
4170
4184
|
this._startedAt = Date.now();
|
|
4185
|
+
// iPhone/iPad with Safari's own recognizer: it erases the phone's own speaker, so
|
|
4186
|
+
// say once how to subtitle the video itself.
|
|
4187
|
+
if (this._isAppleMobile() && !this._cloud && !this._toldIosEngine) { this._toldIosEngine = true; showToast(t('subIosEngine')); }
|
|
4188
|
+
try {
|
|
4189
|
+
const s = this.mediaStream?.getAudioTracks()[0]?.getSettings?.();
|
|
4190
|
+
if (s) logDebug(`AI Sub: microphone echo cancellation ${s.echoCancellation === false ? 'off' : s.echoCancellation ? 'on' : 'unknown'}.`, 'info');
|
|
4191
|
+
} catch (_) { }
|
|
4171
4192
|
this._soundMs = 0;
|
|
4172
4193
|
this._stageAt = Date.now();
|
|
4173
4194
|
this._stageSoundMs = 0;
|
|
@@ -4956,7 +4977,7 @@ async function handle(m) {
|
|
|
4956
4977
|
// pauses (with 300 ms pre-roll so first syllables are kept) and each utterance is sent
|
|
4957
4978
|
// as a small WAV clip. Results are released strictly in speaking order.
|
|
4958
4979
|
// Offline speech recognition with the open-source Whisper model (transformers.js, run by
|
|
4959
|
-
// the hidden helper frame above).
|
|
4980
|
+
// the hidden helper frame above). Downloaded once, only when the user asks for it.
|
|
4960
4981
|
const LOCAL_WHISPER = {
|
|
4961
4982
|
HELPER: 'https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@1.6.4/package.json',
|
|
4962
4983
|
MODELS: {
|
|
@@ -4965,8 +4986,12 @@ async function handle(m) {
|
|
|
4965
4986
|
turbo: { repo: 'onnx-community/whisper-large-v3-turbo', mb: 536, device: 'webgpu', gpu: true, dtype: { encoder_model: 'q4f16', decoder_model_merged: 'q4f16' } }
|
|
4966
4987
|
},
|
|
4967
4988
|
_frame: null, _token: '', _ready: null, _n: 0, _wait: new Map(), _loaded: '', _gpu: null, _queue: 0,
|
|
4968
|
-
|
|
4969
|
-
|
|
4989
|
+
// Phones and tablets too (iPhone Safari cannot hear the video any other way without a
|
|
4990
|
+
// key); there only the small base model, which fits in a phone's memory.
|
|
4991
|
+
available() { return typeof Worker === 'function' && typeof WebAssembly === 'object'; },
|
|
4992
|
+
mobile() { return IS_IOS || /Android/i.test(navigator.userAgent); },
|
|
4993
|
+
ids() { return this.mobile() ? ['base'] : Object.keys(this.MODELS); },
|
|
4994
|
+
model() { const m = STORE.get('nxu_whisper_model', 'base'); return this.ids().includes(m) ? m : 'base'; },
|
|
4970
4995
|
files(id) {
|
|
4971
4996
|
const M = this.MODELS[id], base = `https://huggingface.co/${M.repo}/resolve/main/`;
|
|
4972
4997
|
const sfx = (d) => (d === 'q8' ? '_quantized' : d === 'fp32' ? '' : '_' + d);
|
|
@@ -7428,6 +7453,7 @@ async function handle(m) {
|
|
|
7428
7453
|
wrapper?.classList.toggle('touch-peek', IS_TOUCH && STATE.isCinema);
|
|
7429
7454
|
getContainer()?.classList.remove('chrome-idle');
|
|
7430
7455
|
if (CUE_MIRROR.box) CUE_MIRROR.render();
|
|
7456
|
+
if (IS_TOP && STATE.isCinema) { try { CINEMA_UI.placeSiteBar(); } catch (_) { } }
|
|
7431
7457
|
getOpenPanels().forEach(panel => {
|
|
7432
7458
|
panel.style.opacity = '1';
|
|
7433
7459
|
panel.style.pointerEvents = 'auto';
|
|
@@ -8082,8 +8108,10 @@ async function handle(m) {
|
|
|
8082
8108
|
const paintSource = () => {
|
|
8083
8109
|
const mode = TRANSLATOR._audioMode();
|
|
8084
8110
|
[srcMedia, srcMic].forEach(b => { const on = b.dataset.mode === mode; b.classList.toggle('on', on); b.setAttribute('aria-checked', String(on)); });
|
|
8085
|
-
|
|
8086
|
-
|
|
8111
|
+
const iosLocked = TRANSLATOR._iosNeedsEngine();
|
|
8112
|
+
srcMedia.disabled = iosLocked;
|
|
8113
|
+
sourceHelp.textContent = iosLocked ? t('srcIosHelp') : ios ? t(mode === 'mic' ? 'srcMicHelp' : 'srcIosMediaHelp') : mode === 'mic' ? t('srcMicHelp') : t('srcMediaHelp');
|
|
8114
|
+
sourceHelp.classList.toggle('warn', iosLocked);
|
|
8087
8115
|
};
|
|
8088
8116
|
[srcMedia, srcMic].forEach(b => b.addEventListener('click', () => {
|
|
8089
8117
|
if (b.disabled || TRANSLATOR._audioMode() === b.dataset.mode) return;
|
|
@@ -8099,7 +8127,7 @@ async function handle(m) {
|
|
|
8099
8127
|
{ value: 'openai-hq', label: t('asrOpenAIHQ') }, { value: 'groq', label: t('asrGroq') }]);
|
|
8100
8128
|
// Offline Whisper: pick a model, download it once (explicitly), remove it again.
|
|
8101
8129
|
const whisperBox = createEl('div', 'whisper-box');
|
|
8102
|
-
const whisperModel = createSelect('stt-whisper-model',
|
|
8130
|
+
const whisperModel = createSelect('stt-whisper-model', LOCAL_WHISPER.ids().map(id => ({ value: id, label: t('whisperModel_' + id, { mb: LOCAL_WHISPER.MODELS[id].mb }) })));
|
|
8103
8131
|
whisperModel.value = LOCAL_WHISPER.model();
|
|
8104
8132
|
const whisperBtn = createEl('button', 'btn subtle', '', { type: 'button', id: 'nxu-whisper-btn' });
|
|
8105
8133
|
const whisperDel = createEl('button', 'btn subtle', '🗑️ ' + t('whisperRemove'), { type: 'button', id: 'nxu-whisper-del' });
|
|
@@ -8120,7 +8148,8 @@ async function handle(m) {
|
|
|
8120
8148
|
whisperBtn.disabled = !!st.cached;
|
|
8121
8149
|
whisperBtn.textContent = st.cached ? '✓ ' + t('whisperReady') : '⬇️ ' + t('whisperDownload', { mb: LOCAL_WHISPER.MODELS[id].mb });
|
|
8122
8150
|
whisperDel.style.display = st.cached ? '' : 'none';
|
|
8123
|
-
whisperInfo.textContent = t(st.cached ? 'whisperReadyHelp' : 'whisperHelp');
|
|
8151
|
+
whisperInfo.textContent = t(st.cached ? 'whisperReadyHelp' : 'whisperHelp') + (LOCAL_WHISPER.mobile() ? ' ' + t('whisperMobileHelp') : '');
|
|
8152
|
+
paintSource();
|
|
8124
8153
|
} catch (err) {
|
|
8125
8154
|
whisperBtn.textContent = '⚠️ ' + t('whisperBlocked');
|
|
8126
8155
|
whisperInfo.textContent = t('whisperBlockedHelp');
|
|
@@ -8276,7 +8305,7 @@ async function handle(m) {
|
|
|
8276
8305
|
});
|
|
8277
8306
|
positionSelect.addEventListener('change', () => { STORE.set('nxu_sub_position', positionSelect.value); SUB_LAYOUT.schedule(); });
|
|
8278
8307
|
providerSelect.addEventListener('change', () => { STORE.set('nxu_translation_provider', providerSelect.value); TRANSLATOR._cache.clear(); TRANSLATOR._llmHistory = []; refreshEngineHint(); });
|
|
8279
|
-
asrSelect.addEventListener('change', () => { STORE.set('nxu_asr_provider', asrSelect.value); refreshEngineHint(); paintWhisper(); TRANSLATOR.restart('recognition engine changed'); });
|
|
8308
|
+
asrSelect.addEventListener('change', () => { STORE.set('nxu_asr_provider', asrSelect.value); refreshEngineHint(); paintWhisper(); paintSource(); TRANSLATOR.restart('recognition engine changed'); });
|
|
8280
8309
|
localCheck.addEventListener('change', () => STORE.set('nxu_stt_local_first', !!localCheck.checked));
|
|
8281
8310
|
sizeSlider.addEventListener('input', () => {
|
|
8282
8311
|
STORE.set('nxu_sub_size', +sizeSlider.value);
|
|
@@ -8572,7 +8601,7 @@ async function handle(m) {
|
|
|
8572
8601
|
.key-input { flex:1; min-width:0; background:rgba(0,0,0,0.35); color:#fff; border:1px solid rgba(255,255,255,0.2); border-radius:6px; padding:5px 7px; font:12px ui-monospace, monospace; outline:none; }
|
|
8573
8602
|
.key-test { width:auto !important; flex:0 0 auto; padding:5px 8px !important; }
|
|
8574
8603
|
.key-status { width:18px; text-align:center; font-size:12px; }
|
|
8575
|
-
.engine-hint.warn { color:#ffcc80; }
|
|
8604
|
+
.engine-hint.warn, .trans-help.warn { color:#ffcc80; }
|
|
8576
8605
|
.ai-status { font-size:11px; line-height:1.45; color:rgba(255,255,255,0.75); background:rgba(0,0,0,0.25); border:1px solid rgba(255,255,255,0.08); border-radius:8px; padding:8px 10px; margin-top:8px; }
|
|
8577
8606
|
.debug-content { flex:1; padding:10px; overflow-y:auto; background:rgba(0,0,0,0.25); font-family:ui-monospace, Menlo, Consolas, monospace; font-size:11px; }
|
|
8578
8607
|
.debug-line { margin-bottom:3px; word-break:break-all; color:#ddd; }
|
|
@@ -10442,6 +10471,21 @@ async function handle(m) {
|
|
|
10442
10471
|
},
|
|
10443
10472
|
active() { return this.layers.length > 0; },
|
|
10444
10473
|
hasTrack(tr) { return this.layers.some(l => l.track === tr); },
|
|
10474
|
+
// 1 = your subtitle language, 2 = English, 3 = anything else (labels or codes like "kor").
|
|
10475
|
+
langRank(tr) {
|
|
10476
|
+
const want = baseLang(STORE.get('nxu_subtitle_language', '') || navigator.language || 'en') || 'en';
|
|
10477
|
+
const is = (code) => {
|
|
10478
|
+
const lang = String(tr.language || '').toLowerCase(), label = String(tr.label || '').toLowerCase();
|
|
10479
|
+
if (lang === code || lang.startsWith(code + '-') || lang.startsWith(code + '_')) return true;
|
|
10480
|
+
const three = { ko: ['kor'], en: ['eng'], ja: ['jpn', 'jap'], zh: ['chi', 'zho'], es: ['spa'], fr: ['fre', 'fra'], de: ['ger', 'deu'], pt: ['por'], ru: ['rus'], it: ['ita'], vi: ['vie'], th: ['tha'], id: ['ind'] }[code] || [];
|
|
10481
|
+
if (three.includes(lang)) return true;
|
|
10482
|
+
try {
|
|
10483
|
+
const names = [new Intl.DisplayNames(['en'], { type: 'language' }).of(code), new Intl.DisplayNames([code], { type: 'language' }).of(code)].map(s => String(s).toLowerCase());
|
|
10484
|
+
return names.some(n => n && label.startsWith(n));
|
|
10485
|
+
} catch (_) { return false; }
|
|
10486
|
+
};
|
|
10487
|
+
return is(want) ? 1 : want !== 'en' && is('en') ? 2 : 3;
|
|
10488
|
+
},
|
|
10445
10489
|
_ensureBox() {
|
|
10446
10490
|
const c = getContainer();
|
|
10447
10491
|
if (!c) return null;
|
|
@@ -10482,6 +10526,44 @@ async function handle(m) {
|
|
|
10482
10526
|
tr.mode = 'hidden'; // cues still arrive, the browser does not draw them itself
|
|
10483
10527
|
tr.addEventListener('cuechange', this._onCue);
|
|
10484
10528
|
this._add({ kind: 'track', track: tr, label: tr.label || tr.language || t('subTrack') });
|
|
10529
|
+
this._askSite(tr);
|
|
10530
|
+
},
|
|
10531
|
+
// Some players list every language as an empty track and fetch the cues only when the
|
|
10532
|
+
// language is picked in their own menu (meowtv). Picked here, such a track stays empty:
|
|
10533
|
+
// pick it in the site's menu too, the same entry (the n-th one of that name), then close it.
|
|
10534
|
+
_askSite(tr) {
|
|
10535
|
+
const v = STATE.video;
|
|
10536
|
+
if (!v || tr._nxuAsked) return;
|
|
10537
|
+
setTimeout(async () => {
|
|
10538
|
+
if (!this.hasTrack(tr) || tr.cues?.length) return;
|
|
10539
|
+
// A <track src> loads its own file: nothing to ask the site for.
|
|
10540
|
+
if ([...v.querySelectorAll('track')].some(el => el.track === tr && el.src)) return;
|
|
10541
|
+
tr._nxuAsked = true;
|
|
10542
|
+
const label = (tr.label || '').trim();
|
|
10543
|
+
const same = this.tracks().filter(x => (x.label || '').trim() === label);
|
|
10544
|
+
const nth = Math.max(0, same.indexOf(tr));
|
|
10545
|
+
const wait = (ms) => new Promise(r => setTimeout(r, ms));
|
|
10546
|
+
const isSubBtn = (b) => /subtit|caption|자막|\bcc\b/i.test([b.getAttribute('aria-label'), b.title, b.getAttribute('data-tooltip'), b.textContent.length < 20 ? b.textContent : ''].join(' '));
|
|
10547
|
+
let scope = v.parentElement;
|
|
10548
|
+
for (let i = 0; scope && i < 8 && ![...scope.querySelectorAll('button,[role="button"]')].some(isSubBtn); i++) scope = scope.parentElement;
|
|
10549
|
+
const toggle = scope && [...scope.querySelectorAll('button,[role="button"]')].find(isSubBtn);
|
|
10550
|
+
if (label && toggle) {
|
|
10551
|
+
try {
|
|
10552
|
+
toggle.click();
|
|
10553
|
+
await wait(400);
|
|
10554
|
+
const pick = [...scope.querySelectorAll('button,[role="menuitem"],[role="menuitemradio"],[role="option"],li')]
|
|
10555
|
+
.filter(el => !el.contains(toggle) && (el.innerText || el.textContent || '').trim() === label);
|
|
10556
|
+
const target = pick[Math.min(nth, pick.length - 1)];
|
|
10557
|
+
if (target) target.click();
|
|
10558
|
+
await wait(300);
|
|
10559
|
+
if (target?.isConnected && target.getClientRects().length) toggle.click(); // close the site's menu
|
|
10560
|
+
} catch (_) { }
|
|
10561
|
+
}
|
|
10562
|
+
await wait(2500);
|
|
10563
|
+
if (!this.hasTrack(tr)) return;
|
|
10564
|
+
if (tr.cues?.length) { this.tick(true); logDebug(`Subtitles: "${label}" loaded through the site's own menu.`, 'info'); }
|
|
10565
|
+
else showToast(t('subSiteOnly'));
|
|
10566
|
+
}, 1500);
|
|
10485
10567
|
},
|
|
10486
10568
|
useCues(cues, label) { this._add({ kind: 'cues', cues: cues.sort((a, b) => a.s - b.s), label }); },
|
|
10487
10569
|
_loop() { clearInterval(this._timer); this._timer = setInterval(() => this.tick(), 150); this.tick(true); },
|
|
@@ -10610,16 +10692,21 @@ async function handle(m) {
|
|
|
10610
10692
|
if (this._root === root) return;
|
|
10611
10693
|
this.stop();
|
|
10612
10694
|
this._root = root;
|
|
10613
|
-
|
|
10695
|
+
// Scanned again a little later too: the list of the player's text layers is refreshed
|
|
10696
|
+
// a moment after the player redraws.
|
|
10697
|
+
this._obs = new MutationObserver(() => {
|
|
10698
|
+
if (!this._timer) this._timer = setTimeout(() => { this._timer = 0; this.scan(); }, 80);
|
|
10699
|
+
clearTimeout(this._late); this._late = setTimeout(() => this.scan(), 350);
|
|
10700
|
+
});
|
|
10614
10701
|
this._obs.observe(root, { childList: true, subtree: true, characterData: true });
|
|
10615
10702
|
this.scan();
|
|
10616
10703
|
},
|
|
10617
10704
|
stop() {
|
|
10618
10705
|
this._obs?.disconnect(); this._obs = null; this._root = null;
|
|
10619
|
-
clearTimeout(this._timer); this._timer = 0;
|
|
10706
|
+
clearTimeout(this._timer); this._timer = 0; clearTimeout(this._late);
|
|
10620
10707
|
document.querySelectorAll('.nxu-dsub-src').forEach(n => n.classList.remove('nxu-dsub-src'));
|
|
10621
10708
|
if (this._src && !SUBS.active()) SUBS._render('');
|
|
10622
|
-
this._src = null; this._cands.clear();
|
|
10709
|
+
this._src = null; this._srcSig = null; this._cands.clear();
|
|
10623
10710
|
},
|
|
10624
10711
|
_text(el) { return String(el.innerText || el.textContent || '').replace(/[ \t]+/g, ' ').replace(/\n{2,}/g, '\n').trim().slice(0, 300); },
|
|
10625
10712
|
scan() {
|
|
@@ -10630,16 +10717,27 @@ async function handle(m) {
|
|
|
10630
10717
|
const cands = new Set();
|
|
10631
10718
|
try { root.querySelectorAll(this.SEL).forEach(el => cands.add(el)); } catch (_) { }
|
|
10632
10719
|
(CINEMA._textLayers || []).forEach(el => cands.add(el));
|
|
10720
|
+
// Many players (React and the like) draw each line as a new element: candidates are
|
|
10721
|
+
// followed by their place and look (tag, classes, parent), not by the element itself.
|
|
10722
|
+
const sigOf = (el) => `${el.tagName}|${el.className}|${el.parentElement?.className || ''}|${el.parentElement?.tagName || ''}`;
|
|
10723
|
+
if (this._srcSig) {
|
|
10724
|
+
const tag = this._srcSig.split('|')[0];
|
|
10725
|
+
const again = [...cands, ...root.getElementsByTagName(tag)].find(el => el.isConnected && !el.contains(v) && sigOf(el) === this._srcSig);
|
|
10726
|
+
if (again) { this._src = again; again.classList.add('nxu-dsub-src'); this._show(); return; }
|
|
10727
|
+
if (this._src && !this._src.isConnected) { this._src = null; if (!SUBS.active()) SUBS._render(''); }
|
|
10728
|
+
return;
|
|
10729
|
+
}
|
|
10633
10730
|
const now = Date.now();
|
|
10634
10731
|
for (const el of cands) {
|
|
10635
10732
|
if (!el.isConnected || el.contains(v) || el.closest('.nxu-cue-mirror') || el.querySelector('button, input, svg, [role="slider"]')) continue;
|
|
10636
10733
|
const txt = this._text(el);
|
|
10637
|
-
const
|
|
10734
|
+
const key = sigOf(el);
|
|
10735
|
+
const c = this._cands.get(key) || { last: null, changes: [], };
|
|
10638
10736
|
if (txt !== c.last) { if (c.last !== null) c.changes.push(now); c.last = txt; }
|
|
10639
10737
|
c.changes = c.changes.filter(ts => now - ts < 30000);
|
|
10640
|
-
this._cands.set(
|
|
10738
|
+
this._cands.set(key, c);
|
|
10641
10739
|
// Two changes of its text within half a minute: subtitles, not a title.
|
|
10642
|
-
if (c.changes.length >= 2) { this._src = el; el.classList.add('nxu-dsub-src'); logDebug('Site subtitles shown in the NexusSync layer.', 'info'); this._show(); return; }
|
|
10740
|
+
if (c.changes.length >= 2) { this._src = el; this._srcSig = key; el.classList.add('nxu-dsub-src'); logDebug('Site subtitles shown in the NexusSync layer.', 'info'); this._show(); return; }
|
|
10643
10741
|
}
|
|
10644
10742
|
},
|
|
10645
10743
|
_show() {
|
|
@@ -12535,7 +12633,7 @@ async function handle(m) {
|
|
|
12535
12633
|
root.append(gesture, scrim, rippleL, rippleR, spinner, center, flash, scrub, top, bottom, menu, help);
|
|
12536
12634
|
container.appendChild(root);
|
|
12537
12635
|
this.root = root;
|
|
12538
|
-
this.els = { gesture, scrim, rippleL, rippleR, flash, spinner, spinnerLabel, scrub, title, room, helpBtn, rotateBtn, modeBtn, exitBtn, center, cBack, cPlay, cFwd, bottom, seek, track, bufferBar, progress, pins, thumb, range, hover, playBtn, backBtn, fwdBtn, vol, muteBtn, volume, time, live, rateBtn, subBtn, viewBtn, fitBtn, ambientBtn, pipBtn, fsBtn, menu, help };
|
|
12636
|
+
this.els = { top, gesture, scrim, rippleL, rippleR, flash, spinner, spinnerLabel, scrub, title, room, helpBtn, rotateBtn, modeBtn, exitBtn, center, cBack, cPlay, cFwd, bottom, seek, track, bufferBar, progress, pins, thumb, range, hover, playBtn, backBtn, fwdBtn, vol, muteBtn, volume, time, live, rateBtn, subBtn, viewBtn, fitBtn, ambientBtn, pipBtn, fsBtn, menu, help };
|
|
12539
12637
|
|
|
12540
12638
|
const stop = (e) => e.stopPropagation();
|
|
12541
12639
|
[top, bottom, menu, help, center].forEach(el => el.addEventListener('pointerdown', stop));
|
|
@@ -12876,14 +12974,23 @@ async function handle(m) {
|
|
|
12876
12974
|
this.els.help.classList.remove('open');
|
|
12877
12975
|
menu.classList.toggle('open', open);
|
|
12878
12976
|
menu.dataset.kind = 'sub';
|
|
12879
|
-
if (!open) return;
|
|
12977
|
+
if (!open) { this._subAll = false; return; }
|
|
12880
12978
|
const item = (label, sel, fn) => { const b = createEl('button', sel ? 'sel' : '', label, { type: 'button', role: 'menuitemradio' }); b.onclick = (ev) => { ev.stopPropagation(); fn(); }; return b; };
|
|
12881
12979
|
const tracks = SUBS.tracks();
|
|
12882
12980
|
const nothing = !SUBS.active() && !TRANSLATOR.active && !DOM_SUBS._src;
|
|
12883
12981
|
const kids = [createEl('div', 'cc-menu-title', t('subMenu')),
|
|
12884
12982
|
item(t('xsubOff'), nothing, () => { SUBS.off(); if (TRANSLATOR.active) TRANSLATOR.stop(t('subOff')); this.toggleSubMenu(false); })];
|
|
12885
12983
|
// Several can be on at once (up to three): tap to add, tap again to take away.
|
|
12886
|
-
|
|
12984
|
+
const name = (tr, i) => tr.label || tr.language || t('subTrack') + ' ' + (i + 1);
|
|
12985
|
+
const seen = {}, total = {};
|
|
12986
|
+
tracks.forEach((tr, i) => { const n = name(tr, i); total[n] = (total[n] || 0) + 1; });
|
|
12987
|
+
const rows = tracks.map((tr, i) => { const n = name(tr, i); seen[n] = (seen[n] || 0) + 1; return { tr, label: total[n] > 1 ? `${n} ${seen[n]}` : n, rank: SUBS.hasTrack(tr) ? 0 : SUBS.langRank(tr), i }; });
|
|
12988
|
+
rows.sort((a, b) => a.rank - b.rank || a.i - b.i);
|
|
12989
|
+
// A long list (players offering 100+ tracks) shows your languages first, the rest on request.
|
|
12990
|
+
const fold = rows.length > 12 && !this._subAll;
|
|
12991
|
+
const shown = fold ? rows.filter(r => r.rank < 3) : rows;
|
|
12992
|
+
shown.forEach(r => kids.push(item('🎞 ' + r.label, SUBS.hasTrack(r.tr), () => { SUBS.useTrack(r.tr); this.toggleSubMenu(true); })));
|
|
12993
|
+
if (fold && shown.length < rows.length) kids.push(item(t('subMoreLangs', { n: rows.length - shown.length }), false, () => { this._subAll = true; this.toggleSubMenu(true); }));
|
|
12887
12994
|
SUBS.layers.filter(l => l.kind === 'cues').forEach(l => kids.push(item('💬 ' + l.label, true, () => { SUBS.remove(l.id); this.toggleSubMenu(true); })));
|
|
12888
12995
|
if (SUBS.layers.length > 1) kids.push(createEl('div', 'cc-menu-note', t('subMulti')));
|
|
12889
12996
|
kids.push(item(t('subSearch'), false, () => { this.toggleSubMenu(false); OPENSUBS.open(); }));
|
|
@@ -13008,6 +13115,35 @@ async function handle(m) {
|
|
|
13008
13115
|
return was;
|
|
13009
13116
|
},
|
|
13010
13117
|
|
|
13118
|
+
// With the site's own controls, our two buttons (switch / exit) sit at the top right, where
|
|
13119
|
+
// many players keep theirs (cast, settings…). They step down below any site control there,
|
|
13120
|
+
// so neither covers the other.
|
|
13121
|
+
placeSiteBar() {
|
|
13122
|
+
const top = this.els?.top;
|
|
13123
|
+
if (!top) return;
|
|
13124
|
+
if (!STATE.isCinema || this.controlsMode() === 'nexus') { top.style.top = ''; return; }
|
|
13125
|
+
const now = Date.now();
|
|
13126
|
+
if (now - (this._barAt || 0) < 700) return;
|
|
13127
|
+
this._barAt = now;
|
|
13128
|
+
const boxes = [this.els.modeBtn, this.els.exitBtn].filter(b => b.getClientRects().length).map(b => b.getBoundingClientRect());
|
|
13129
|
+
if (!boxes.length) return;
|
|
13130
|
+
const host = document.getElementById('nxu-host');
|
|
13131
|
+
const from = Math.min(...boxes.map(r => r.left)) - 8, to = Math.max(...boxes.map(r => r.right)) + 8;
|
|
13132
|
+
const band = Math.min(140, innerHeight / 4);
|
|
13133
|
+
let low = 0;
|
|
13134
|
+
for (let x = Math.max(0, from); x <= Math.min(innerWidth - 1, to); x += 16) {
|
|
13135
|
+
for (let y = 2; y <= band; y += 10) {
|
|
13136
|
+
const el = document.elementsFromPoint(x, y).find(n => n !== host && !host?.contains(n));
|
|
13137
|
+
const c = el?.closest?.('button,a[href],[role="button"],select,input');
|
|
13138
|
+
if (!c) continue;
|
|
13139
|
+
const r = c.getBoundingClientRect();
|
|
13140
|
+
if (r.height < 90 && r.width < innerWidth / 2 && r.top < band) low = Math.max(low, r.bottom);
|
|
13141
|
+
}
|
|
13142
|
+
}
|
|
13143
|
+
const base = top.parentElement?.getBoundingClientRect().top || 0;
|
|
13144
|
+
top.style.top = low ? `${Math.round(low - base)}px` : '';
|
|
13145
|
+
},
|
|
13146
|
+
|
|
13011
13147
|
// While paused (or a menu is open) the controls stay up instead of fading out.
|
|
13012
13148
|
keepVisible() {
|
|
13013
13149
|
if (!STATE.isCinema || !this.root || this.controlsMode() !== 'nexus') return false;
|
|
@@ -13041,7 +13177,10 @@ async function handle(m) {
|
|
|
13041
13177
|
this.els.fsBtn.style.display = fullscreenSupported() ? '' : 'none';
|
|
13042
13178
|
this.els.volume.style.display = IS_IOS ? 'none' : '';
|
|
13043
13179
|
this.els.pipBtn.style.display = STATE.video && (document.pictureInPictureEnabled || typeof STATE.video.webkitSetPresentationMode === 'function') ? '' : 'none';
|
|
13044
|
-
|
|
13180
|
+
const msTitle = !MEDIA_SESSION._owned && navigator.mediaSession?.metadata?.title;
|
|
13181
|
+
this.els.title.textContent = msTitle || document.title || HOST;
|
|
13182
|
+
this._barAt = 0;
|
|
13183
|
+
this.placeSiteBar();
|
|
13045
13184
|
if (!on) this._resetGestures();
|
|
13046
13185
|
clearInterval(this._loop);
|
|
13047
13186
|
this._loop = null;
|
|
@@ -13378,8 +13517,13 @@ async function handle(m) {
|
|
|
13378
13517
|
_bridgeHooked: new WeakSet(),
|
|
13379
13518
|
_waiting: new WeakSet(),
|
|
13380
13519
|
|
|
13520
|
+
// A scan already due sooner is kept: on busy pages (ads that keep inserting frames, a
|
|
13521
|
+
// player that keeps changing attributes) a pushed-back timer would never fire at all.
|
|
13381
13522
|
scheduleScan(delay = 80) {
|
|
13523
|
+
const due = Date.now() + delay;
|
|
13524
|
+
if (this._scanTimer && this._scanDue <= due) return;
|
|
13382
13525
|
clearTimeout(this._scanTimer);
|
|
13526
|
+
this._scanDue = due;
|
|
13383
13527
|
this._scanTimer = setTimeout(() => { this._scanTimer = null; this.scan(); }, delay);
|
|
13384
13528
|
},
|
|
13385
13529
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kangsicj/nexussync",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.12",
|
|
4
4
|
"description": "Watch-together userscript: media sync, cinema mode, live AI subtitles, chat bubbles and quick ink for Violentmonkey, Tampermonkey and iOS Userscripts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"userscript",
|