@kangsicj/nexussync 1.5.0 → 1.6.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 CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  <br>
6
6
 
7
- [![Version](https://img.shields.io/badge/version-1.5.0-7C4DFF?style=for-the-badge)](./CHANGELOG.md)
7
+ [![Version](https://img.shields.io/badge/version-1.6.0-7C4DFF?style=for-the-badge)](./CHANGELOG.md)
8
8
  [![Tampermonkey](https://img.shields.io/badge/Tampermonkey-PC%20%C2%B7%20Android-00485B?style=for-the-badge&logo=tampermonkey&logoColor=white)](https://www.tampermonkey.net/)
9
9
  [![iOS Safari](https://img.shields.io/badge/Userscripts-iPhone%20%C2%B7%20iPad-0A84FF?style=for-the-badge&logo=safari&logoColor=white)](https://apps.apple.com/app/userscripts/id1463298887)
10
10
  [![Sponsor](https://img.shields.io/badge/Fairy-Sponsor-FF6FB5?style=for-the-badge&logo=githubsponsors&logoColor=white)](https://fairy.hada.io/@jinny)
@@ -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.5.0
11
+ // @version 1.6.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 *://*/*
@@ -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.5.0
11
+ // @version 1.6.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 *://*/*
@@ -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.5.0';
49
+ const NXU_VERSION = '1.6.0';
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.5.0';
54
+ const NXU_RANK = '11.6.0';
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=';
@@ -673,7 +673,7 @@
673
673
  rotateDenied: '📱 Motion access was declined, so tilting cannot switch to landscape. Use the ↻ button in cinema mode.', menuRotate: 'Tilt-to-landscape for videos on/off (iPhone)',
674
674
  canvas: 'Canvas', bookmark: 'Bookmark', bookmarkTitle: 'Bookmark the current position', chat: 'Chat', aiSub: 'AI Sub', aiSubTitle: 'Live subtitles & translation (Alt+Shift+T)',
675
675
  subLog: 'Sub Log', debug: 'Debug', hideOnSite: 'Hide on this site', hideOnSiteTitle: 'Hide the floating button on this site (restore with Alt+Shift+N or the userscript menu)',
676
- hiddenOnSite: '🙈 Hidden on this site · Alt+Shift+N to show', shownOnSite: '⚙️ Button shown on this site',
676
+ hiddenOnSite: '🙈 ⚙️ button hidden on this site · turn it back on in Settings or with Alt+Shift+N', shownOnSite: '⚙️ Button shown on this site',
677
677
  roomChat: 'Room Chat', chatLog: 'Chat history', chatCleared: '🧹 Chat history cleared', nickname: 'Nickname (optional)', chatPlaceholder: 'Message…', newMessages: 'New', latest: 'Latest',
678
678
  subHistory: 'Subtitle History', export: 'Export', clear: 'Clear', logCleared: '🧹 Subtitle history cleared', logExported: '💾 Subtitle history exported',
679
679
  createRoom: 'Create a room', copyPin: 'Copy PIN', enterPin: 'Enter PIN', joinRoom: 'Join Room', viewerMode: 'Viewer mode (follow without controlling)',
@@ -696,6 +696,7 @@
696
696
  setReactionsHint: 'Tap a slot, then pick an emoji (or type any emoji). Add or remove slots (1–16).', setReactionsReset: 'Back to the default reactions', setPlayback: 'Playback', setAutoNext: 'Next episode automatically',
697
697
  setTogether: 'Watching together', setRecvReact: 'Show others’ reactions', setRecvNudge: 'Receive nudges (shake)', setRecvInk: 'Show others’ sketches', setRecvChat: 'Show chat bubbles', setRecvPing: 'Show pointers',
698
698
  setPeople: 'People in this room', setMute: 'Hide', setUnmute: 'Show', setMutedHint: 'Hidden people’s messages, reactions and sketches are not shown on this device (only for this room).',
699
+ setAutoCinemaSw: 'Auto cinema on this site', setAdGuardSw: 'Ad guard', setHideFab: 'Hide the ⚙️ button on this site', setHideFabHelp: 'On: the floating ⚙️ button no longer appears on this site. To bring it back, turn this switch off — or press Alt+Shift+N, or use the userscript manager’s menu.', setAvatarPh: 'Type any emoji not in the list', setAvatarReset: 'No avatar',
699
700
  setAdvanced: 'Advanced', setAvatarCustom: 'Any emoji or initials', setAvatarPhoto: 'Photo', setAvatarClear: 'Remove', setAvatarFail: 'Could not use this picture.', setSlotAdd: '+ Add a slot', setSlotRemove: '- Remove this slot', setEmojiPh: 'Any emoji', setNobody: 'Nobody else is here yet.',
700
701
  speakerLanguage: 'Spoken language', speakerHelp: 'The language spoken in the video or by you. Recognition only understands this language.',
701
702
  subtitleLanguage: 'Translate subtitles to', audioSource: 'Audio source', audioAuto: 'Auto (video audio when possible + mic)', audioMic: 'Microphone only',
@@ -713,6 +714,8 @@
713
714
  subUsingMicFallback: 'The video sound could not be heard directly — listening through the microphone (turn the speakers up).',
714
715
  subTabShareEnded: 'Tab audio sharing stopped, so subtitles were turned off.',
715
716
  subHearVideo: '🎧 Listening to the video', subHearMic: '🎧 Listening through the microphone', subVideoSilent: '🔇 No sound reaches the subtitles from this video',
717
+ subDiagCopy: 'Copy a problem report', subDiagCopied: '🔬 Report copied — paste it in your message', subDiagInDebug: '🔬 Report written to the debug console (Settings → Advanced → Debug)',
718
+ subNoTrackInput: '⚠️ This browser’s speech engine cannot listen to the video sound directly — it only hears the microphone (play the sound through speakers, not headphones), or add a free Groq key in AI Sub → Advanced.', subIssueNoTrack: 'The speech engine only hears the microphone here', subNoService: '⚠️ This browser has no working speech recognition service (it works in Chrome). Add a free Groq or an OpenAI key in AI Sub → Advanced to use AI recognition instead.', subNoServiceKey: '⚠️ This browser has no working speech recognition service — switching to AI recognition with your key.',
716
719
  subIssueNet: '⚠️ Speech service connection is unstable — retrying', subIssueNoResult: '⚠️ Sound arrives but no words are recognised', subSiteBlocksSpeech: 'This site does not allow the browser’s speech recognition. Add an OpenAI or Groq key (AI subtitles → Advanced) to use AI subtitles here.', subSiteBlocksSpeechKey: 'This site blocks the browser’s speech recognition — switching to cloud recognition with your key.', subTryMic: '🎤 Listen through the mic', subTryKey: '🔑 Use an AI recognition key', subShareTab: '🎬 Connect tab sound', subTabNotShared: 'Tab audio was not shared. Choose this tab and turn on “Share tab audio”.',
717
720
  subPosition: 'Subtitle position', posVideo: 'Over the video', posScreen: 'Bottom of the screen', subSize: 'Size', subOpacity: 'Opacity',
718
721
  advanced: 'Advanced', translationEngine: 'Translation engine', providerAuto: 'Google first, on-device as backup (best quality)', providerBrowser: 'On-device only (private)',
@@ -725,7 +728,7 @@
725
728
  speakerMic: 'Mic', speakerMedia: 'Video', speakerMixed: 'Mixed',
726
729
  subOn: '🎙️ AI subtitles ON', subOff: '🔇 AI subtitles OFF', subUnsupported: 'This browser has no speech recognition. Use Chrome, Edge or Safari.',
727
730
  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.',
728
- subMicUnavailable: '🎙️ No audio input available.', subNoMic: '🎙️ No microphone found.', subServiceBlocked: 'The speech service is not available in this browser.',
731
+ subMicUnavailable: '🎙️ No audio input available.', subNoMic: '🎙️ No microphone found.', subServiceBlocked: 'The speech service is not available in this browser. On iPhone/iPad turn on Settings → Siri (and Dictation in Keyboard settings); elsewhere use Chrome, or add a free Groq key in AI Sub → Advanced.',
729
732
  subNetworkFailed: 'Speech service unreachable. Check the connection and start again.', subLangUnsupported: 'This language is not supported for recognition.',
730
733
  subStalled: 'Speech recognition keeps failing. Please start again.', subWebAudioUnavailable: 'Video audio unavailable here — using the microphone.',
731
734
  p2pActive: '⚡ Direct P2P connection active', p2pLost: '⚠️ P2P lost — using relay', roomConnected: '🟢 Room connected', guestJoined: '👋 A guest joined',
@@ -788,7 +791,7 @@
788
791
  rotateDenied: '📱 동작·방향 접근이 거부되어 기울여서 가로 보기를 쓸 수 없습니다. 시네마 화면의 ↻ 버튼으로 돌릴 수 있습니다.', menuRotate: '동영상 기울이면 가로 보기 켜기/끄기 (아이폰)',
789
792
  canvas: '캔버스', bookmark: '북마크', bookmarkTitle: '현재 위치를 북마크', chat: '채팅', aiSub: 'AI 자막', aiSubTitle: '실시간 자막·번역 (Alt+Shift+T)',
790
793
  subLog: '자막 기록', debug: '디버그', hideOnSite: '이 사이트에서 숨기기', hideOnSiteTitle: '이 사이트에서 떠 있는 버튼 숨기기 (Alt+Shift+N 또는 유저스크립트 메뉴로 복원)',
791
- hiddenOnSite: '🙈 이 사이트에서 숨김 · Alt+Shift+N으로 표시', shownOnSite: '⚙️ 이 사이트에서 버튼 표시',
794
+ hiddenOnSite: '🙈 이 사이트에서 ⚙️ 버튼을 숨겼어요 · 설정이나 Alt+Shift+N으로 다시 켤 수 있어요', shownOnSite: '⚙️ 이 사이트에서 버튼 표시',
792
795
  roomChat: '방 채팅', chatLog: '채팅 기록', chatCleared: '🧹 채팅 기록을 지웠어요', nickname: '닉네임 (선택)', chatPlaceholder: '메시지…', newMessages: '새 메시지', latest: '최신',
793
796
  subHistory: '자막 기록', export: '내보내기', clear: '지우기', logCleared: '🧹 자막 기록을 지웠습니다', logExported: '💾 자막 기록을 저장했습니다',
794
797
  createRoom: '방 만들기', copyPin: 'PIN 복사', enterPin: 'PIN 입력', joinRoom: '방 참여', viewerMode: '시청자 모드 (조작 없이 따라보기)',
@@ -811,6 +814,7 @@
811
814
  setReactionsHint: '칸을 누른 뒤 이모지를 고르세요 (아무 이모지나 입력해도 돼요). 칸은 1~16개로 늘리거나 줄일 수 있어요.', setReactionsReset: '기본 리액션으로', setPlayback: '재생', setAutoNext: '다음 화 자동으로 넘기기',
812
815
  setTogether: '함께 보기', setRecvReact: '다른 사람 리액션 보기', setRecvNudge: '찌르기 받기 (흔들림)', setRecvInk: '다른 사람 그림 보기', setRecvChat: '말풍선 보기', setRecvPing: '포인터 보기',
813
816
  setPeople: '이 방의 사람들', setMute: '숨기기', setUnmute: '보이기', setMutedHint: '숨긴 사람의 메시지·리액션·그림은 이 기기에서 보이지 않아요 (이 방에서만).',
817
+ setAutoCinemaSw: '이 사이트에서 자동 시네마', setAdGuardSw: '광고 가리기', setHideFab: '이 사이트에서 ⚙️ 버튼 숨기기', setHideFabHelp: '켜면 이 사이트에서 화면에 떠 있는 ⚙️ 버튼이 보이지 않아요. 다시 보이게 하려면 이 스위치를 끄거나, Alt+Shift+N 또는 유저스크립트 관리자 메뉴를 쓰세요.', setAvatarPh: '목록에 없는 이모지 입력', setAvatarReset: '아바타 없음',
814
818
  setAdvanced: '고급', setAvatarCustom: '이모지나 이니셜 입력', setAvatarPhoto: '사진', setAvatarClear: '지우기', setAvatarFail: '이 사진은 사용할 수 없어요.', setSlotAdd: '+ 칸 추가', setSlotRemove: '- 선택한 칸 삭제', setEmojiPh: '이모지 입력', setNobody: '아직 다른 사람이 없어요.',
815
819
  speakerLanguage: '말하는 언어', speakerHelp: '영상(또는 말하는 사람)의 언어를 선택하세요. 음성 인식은 이 언어만 알아듣습니다.',
816
820
  subtitleLanguage: '자막 번역 언어', audioSource: '오디오 입력', audioAuto: '자동 (가능하면 영상 소리 + 마이크)', audioMic: '마이크만',
@@ -828,6 +832,8 @@
828
832
  subUsingMicFallback: '영상 소리를 직접 들을 수 없어 마이크로 들어요. 스피커 소리를 키워 주세요.',
829
833
  subTabShareEnded: '탭 오디오 공유가 끝나서 자막을 껐어요.',
830
834
  subHearVideo: '🎧 영상 소리 듣는 중', subHearMic: '🎧 마이크로 듣는 중', subVideoSilent: '🔇 이 영상의 소리가 자막에 전달되지 않아요',
835
+ subDiagCopy: '문제 진단 보고서 복사', subDiagCopied: '🔬 진단 보고서를 복사했어요 — 메시지에 붙여 넣어 주세요', subDiagInDebug: '🔬 진단 보고서를 디버그 콘솔에 남겼어요 (설정 → 고급 → 디버그)',
836
+ subNoTrackInput: '⚠️ 이 브라우저의 음성 인식은 영상 소리를 직접 듣지 못하고 마이크로만 들어요. 이어폰 대신 스피커로 소리를 내거나, AI 자막 → 고급에서 무료 Groq 키를 넣어 주세요.', subIssueNoTrack: '이 브라우저는 마이크로만 들을 수 있어요', subNoService: '⚠️ 이 브라우저에는 동작하는 음성 인식 서비스가 없어요 (Chrome에서는 동작해요). AI 자막 → 고급에서 무료 Groq 키나 OpenAI 키를 넣으면 AI 인식으로 쓸 수 있어요.', subNoServiceKey: '⚠️ 이 브라우저에는 동작하는 음성 인식 서비스가 없어 입력한 키로 AI 인식을 시작해요.',
831
837
  subIssueNet: '⚠️ 음성 인식 서버 연결이 불안정해요 — 다시 시도 중', subIssueNoResult: '⚠️ 소리는 들어오는데 말이 인식되지 않아요', subSiteBlocksSpeech: '이 사이트는 브라우저 음성 인식을 막아 두었어요. AI 자막 → 고급에서 OpenAI 또는 Groq 키를 넣으면 여기서도 쓸 수 있어요.', subSiteBlocksSpeechKey: '이 사이트는 브라우저 음성 인식을 막아 두어서, 넣어 둔 키로 클라우드 인식으로 바꿀게요.', subTryMic: '🎤 마이크로 듣기', subTryKey: '🔑 AI 인식 키 사용', subShareTab: '🎬 탭 소리 연결', subTabNotShared: '탭 오디오가 공유되지 않았어요. 이 탭을 고르고 “탭 오디오 공유”를 켜 주세요.',
832
838
  subPosition: '자막 위치', posVideo: '영상 위', posScreen: '화면 하단', subSize: '크기', subOpacity: '불투명도',
833
839
  advanced: '고급', translationEngine: '번역 엔진', providerAuto: 'Google 우선, 기기 내 번역 보조 (최고 품질)', providerBrowser: '기기 내 번역만 (개인정보 보호)',
@@ -840,7 +846,7 @@
840
846
  speakerMic: '마이크', speakerMedia: '영상', speakerMixed: '혼합',
841
847
  subOn: '🎙️ AI 자막 켜짐', subOff: '🔇 AI 자막 꺼짐', subUnsupported: '이 브라우저는 음성 인식을 지원하지 않습니다. Chrome, Edge, Safari를 사용하세요.',
842
848
  subNeedsHttps: '자막은 보안(https) 페이지에서만 동작합니다.', subMicDenied: '🎤 마이크 권한이 꺼져 있어요. 주소창 왼쪽 🔒(사이트 정보)에서 마이크를 “허용”으로 바꾼 뒤 다시 눌러 주세요.',
843
- subMicUnavailable: '🎙️ 사용할 수 있는 오디오 입력이 없습니다.', subNoMic: '🎙️ 마이크를 찾을 수 없습니다.', subServiceBlocked: '이 브라우저에서는 음성 인식 서비스를 사용할 수 없습니다.',
849
+ subMicUnavailable: '🎙️ 사용할 수 있는 오디오 입력이 없습니다.', subNoMic: '🎙️ 마이크를 찾을 수 없습니다.', subServiceBlocked: '이 브라우저에서는 음성 인식 서비스를 쓸 수 없어요. 아이폰·아이패드는 설정 → Siri와 키보드 설정의 받아쓰기를 켜 주세요. 그 밖에는 Chrome을 쓰거나 AI 자막 → 고급에서 무료 Groq 키를 넣어 주세요.',
844
850
  subNetworkFailed: '음성 인식 서버에 연결할 수 없습니다. 연결을 확인하고 다시 시작하세요.', subLangUnsupported: '이 언어는 음성 인식을 지원하지 않습니다.',
845
851
  subStalled: '음성 인식이 계속 실패합니다. 다시 시작해 주세요.', subWebAudioUnavailable: '이 페이지에서는 영상 소리를 직접 받을 수 없어 마이크를 사용합니다.',
846
852
  p2pActive: '⚡ P2P 직접 연결됨', p2pLost: '⚠️ P2P 끊김 — 중계 서버로 전환', roomConnected: '🟢 방에 연결됨', guestJoined: '👋 게스트가 참여했습니다',
@@ -1172,8 +1178,8 @@
1172
1178
  .nxu-cinema-root.nxu-ambient-stage { top: var(--nxu-stage-y, 0px) !important; bottom: auto !important; left: var(--nxu-stage-x, 0px) !important; right: auto !important;
1173
1179
  width: calc(100vw - 2 * var(--nxu-stage-x, 0px)) !important; height: calc(100vh - 2 * var(--nxu-stage-y, 0px)) !important; height: calc(100dvh - 2 * var(--nxu-stage-y, 0px)) !important;
1174
1180
  box-shadow: 0 16px 48px rgba(0,0,0,0.5) !important; }
1175
- .nxu-fit-cover video.nxu-cinema-video, video.nxu-cinema-root.nxu-fit-cover { object-fit: cover !important; }
1176
- .nxu-fit-fill video.nxu-cinema-video, video.nxu-cinema-root.nxu-fit-fill { object-fit: fill !important; }
1181
+ .nxu-fit-cover video.nxu-cinema-video, video.nxu-cinema-root.nxu-fit-cover, video.nxu-cinema-video.nxu-fit-cover { object-fit: cover !important; }
1182
+ .nxu-fit-fill video.nxu-cinema-video, video.nxu-cinema-root.nxu-fit-fill, video.nxu-cinema-video.nxu-fit-fill { object-fit: fill !important; }
1177
1183
  .nxu-site-ui-off :is([class*="control" i], [class*="ctrl" i], [class*="toolbar" i], [class*="progress" i], [class*="seek" i], [class*="big-play" i], [class*="bigplay" i],
1178
1184
  [class*="play-button" i], [class*="playbutton" i], [class*="play-btn" i], [class*="spinner" i], [class*="loading" i], [class*="chrome" i], [class*="gradient" i], [class*="overlay" i],
1179
1185
  [class*="mask" i], [class*="volume" i], [class*="settings" i], [class*="menu" i], [class*="tooltip" i], [class*="watermark" i], .jw-display, .xgplayer-start, .fp-ui, .art-layers, .art-notice):not(video):not(.nxu-cinema-fill):not(.nxu-keep):not([class*="caption" i]):not([class*="subtitle" i]):not([class*="text-track" i]):not([class*="cue" i]):not([class*="sub-" i]):not([class*="danmaku" i]) {
@@ -1203,6 +1209,23 @@
1203
1209
  } catch (_) { }
1204
1210
  }
1205
1211
  function ensureCinemaStyles(doc = document) { ensurePageStyle(doc, 'nxu-cinema-style', CINEMA_CSS); }
1212
+ // Players built from web components keep the <video> inside a shadow root (famelack's
1213
+ // <hlsjs-video>, media-chrome, many live-TV sites): page styles never reach it, so the
1214
+ // cinema styles go into every shadow root on the way from the video to the page.
1215
+ function parentAcross(n) { return n.parentElement || (n.parentNode && n.parentNode.host) || null; }
1216
+ function ensureCinemaStylesIn(node) {
1217
+ const r = node?.getRootNode?.();
1218
+ if (!r || r.nodeType !== 11 || !r.host) return;
1219
+ try {
1220
+ const old = r.querySelector('style[data-nxu-cinema]');
1221
+ if (old && old.dataset.nxuCinema === NXU_RANK) return;
1222
+ old?.remove();
1223
+ const style = (node.ownerDocument || document).createElement('style');
1224
+ style.dataset.nxuCinema = NXU_RANK;
1225
+ style.textContent = CINEMA_CSS;
1226
+ r.appendChild(style);
1227
+ } catch (_) { }
1228
+ }
1206
1229
 
1207
1230
  const PLAYER_CLASS_HINTS = ['html5-video-player', 'video-js', 'jwplayer', 'plyr', 'artplayer', 'dplayer', 'xgplayer', 'shaka-video-container',
1208
1231
  'vjs-fluid', 'mejs__container', 'flowplayer', 'clappr', 'bitmovinplayer-container', 'video-player', 'player-container', 'video-container'];
@@ -1219,26 +1242,26 @@
1219
1242
  try { vr = video.getBoundingClientRect(); } catch (_) { return video; }
1220
1243
  let root = video;
1221
1244
  if (vr.width < 40 || vr.height < 30) {
1222
- let node = video.parentElement;
1245
+ let node = parentAcross(video);
1223
1246
  while (node && node !== doc.body) {
1224
1247
  if (PLAYER_CLASS_HINTS.some(c => node.classList?.contains(c))) root = node;
1225
- node = node.parentElement;
1248
+ node = parentAcross(node);
1226
1249
  }
1227
1250
  return root;
1228
1251
  }
1229
1252
  const maxW = vr.width * 1.12 + 24;
1230
1253
  const maxH = vr.height * 1.3 + 90;
1231
- let node = video.parentElement;
1254
+ let node = parentAcross(video);
1232
1255
  while (node && node !== doc.body && node !== doc.documentElement) {
1233
1256
  let r;
1234
1257
  try { r = node.getBoundingClientRect(); } catch (_) { break; }
1235
1258
  if (r.width > maxW || r.height > maxH) break;
1236
1259
  try {
1237
1260
  const cs = view.getComputedStyle(node);
1238
- if (cs.display === 'contents') { node = node.parentElement; continue; }
1261
+ if (cs.display === 'contents' || node.tagName === 'SLOT') { node = parentAcross(node); continue; }
1239
1262
  } catch (_) { }
1240
1263
  root = node;
1241
- node = node.parentElement;
1264
+ node = parentAcross(node);
1242
1265
  }
1243
1266
  return root;
1244
1267
  },
@@ -1246,8 +1269,10 @@
1246
1269
  _decorate(root, video) {
1247
1270
  const doc = root.ownerDocument;
1248
1271
  ensureCinemaStyles(doc);
1272
+ ensureCinemaStylesIn(root);
1249
1273
  const ancestors = [];
1250
- for (let n = root.parentElement; n; n = n.parentElement) {
1274
+ for (let n = parentAcross(root); n; n = parentAcross(n)) {
1275
+ ensureCinemaStylesIn(n);
1251
1276
  if (!n.classList.contains('nxu-cinema-ancestor')) {
1252
1277
  n.classList.add('nxu-cinema-ancestor');
1253
1278
  ancestors.push(n);
@@ -1255,7 +1280,10 @@
1255
1280
  }
1256
1281
  const fills = [];
1257
1282
  if (video && video !== root) {
1258
- for (let n = video.parentElement; n && n !== root; n = n.parentElement) {
1283
+ ensureCinemaStylesIn(video);
1284
+ for (let n = parentAcross(video); n && n !== root; n = parentAcross(n)) {
1285
+ ensureCinemaStylesIn(n);
1286
+ if (n.tagName === 'SLOT') continue;
1259
1287
  n.classList.add('nxu-cinema-fill');
1260
1288
  fills.push(n);
1261
1289
  }
@@ -1270,7 +1298,7 @@
1270
1298
  if (!link) return;
1271
1299
  try {
1272
1300
  link.root.classList.remove('nxu-cinema-root');
1273
- link.video?.classList.remove('nxu-cinema-video');
1301
+ link.video?.classList.remove('nxu-cinema-video', 'nxu-fit-cover', 'nxu-fit-fill');
1274
1302
  link.fills.forEach(n => n.classList.remove('nxu-cinema-fill'));
1275
1303
  link.ancestors.forEach(n => n.classList.remove('nxu-cinema-ancestor'));
1276
1304
  link.doc.documentElement.classList.remove('nxu-cinema-lock');
@@ -1426,6 +1454,9 @@
1426
1454
  const fit = this.fitMode();
1427
1455
  root.classList.toggle('nxu-fit-cover', fit === 'cover');
1428
1456
  root.classList.toggle('nxu-fit-fill', fit === 'fill');
1457
+ // A video in a shadow root is not a descendant the page's selector can see: mark it too.
1458
+ const v = this.applied?.video || STATE.video;
1459
+ if (v && v.getRootNode?.() !== root.getRootNode?.()) { v.classList.toggle('nxu-fit-cover', fit === 'cover'); v.classList.toggle('nxu-fit-fill', fit === 'fill'); }
1429
1460
  },
1430
1461
  // Cinema controls: hide the site's player UI (and native video controls); site
1431
1462
  // controls: show them again and wake them with a mouse move so they appear at once.
@@ -2387,10 +2418,23 @@
2387
2418
  return /iPad|iPhone|iPod/.test(ua) || (navigator.platform === 'MacIntel' && Number(navigator.maxTouchPoints) > 1);
2388
2419
  },
2389
2420
  _isAndroid() { return /Android/i.test(navigator.userAgent || ''); },
2421
+ // Can the speech engine listen to a given audio track (the video's sound)? Browsers
2422
+ // without it silently ignore the track and listen to the microphone instead — with
2423
+ // headphones that hears nothing at all. Asked once: an engine that knows the argument
2424
+ // refuses a non-track value with a TypeError; one that does not ignores it (and would
2425
+ // start listening, so it is stopped at once).
2390
2426
  _supportsTrackInput() {
2391
- const ua = navigator.userAgent || '';
2392
- const desktopSafari = /Safari\//.test(ua) && !/Chrome|Chromium|CriOS|Edg|OPR|FxiOS|Android/.test(ua);
2393
- return !(this._isAppleMobile() || desktopSafari);
2427
+ if (this._trackInputOk !== undefined) return this._trackInputOk;
2428
+ if (this._isAppleMobile()) return (this._trackInputOk = false);
2429
+ const SR = window.SpeechRecognition || window.webkitSpeechRecognition;
2430
+ if (!SR) return (this._trackInputOk = false);
2431
+ let ok = false;
2432
+ try {
2433
+ const probe = new SR();
2434
+ try { probe.start({}); try { probe.abort(); } catch (_) { } } catch (err) { ok = err?.name === 'TypeError' && /MediaStreamTrack/i.test(err.message || ''); }
2435
+ } catch (_) { }
2436
+ logDebug('AI Sub: speech engine ' + (ok ? 'can' : 'cannot') + ' listen to the video sound directly.', ok ? 'info' : 'warn');
2437
+ return (this._trackInputOk = ok);
2394
2438
  },
2395
2439
 
2396
2440
  // ── text helpers
@@ -2820,6 +2864,10 @@
2820
2864
  this._sessionStartedAt = Date.now();
2821
2865
  this._setAppleSession('play-and-record');
2822
2866
  const track = !this._trackDisabled && this._supportsTrackInput() ? this._liveTrack() : null;
2867
+ if (!track && this.audioMode === 'media' && this.captureMode !== 'ios-mic' && !this._cloud && !this._toldNoTrack) {
2868
+ this._toldNoTrack = true;
2869
+ if (!this._supportsTrackInput()) { this._issue = this._issue || 'notrack'; showToast(t('subNoTrackInput')); }
2870
+ }
2823
2871
  try {
2824
2872
  if (track) this.recognizer.start(track);
2825
2873
  else this.recognizer.start();
@@ -2975,22 +3023,22 @@
2975
3023
  chip.classList.toggle('warn', silent);
2976
3024
  chip.classList.toggle('warn', silent || !!this._issue);
2977
3025
  if (this._issue) chip.classList.remove('hide');
2978
- chip.querySelector('.sub-listen-text').textContent = this._issue === 'noresult' ? t('subIssueNoResult') : this._issue === 'net' ? t('subIssueNet') : silent ? t('subVideoSilent') : this.webMediaStream && !this._micMixed ? t('subHearVideo') : t('subHearMic');
3026
+ chip.querySelector('.sub-listen-text').textContent = this._issue === 'notrack' ? t('subIssueNoTrack') : this._issue === 'noresult' ? t('subIssueNoResult') : this._issue === 'net' ? t('subIssueNet') : silent ? t('subVideoSilent') : this.webMediaStream && !this._micMixed ? t('subHearVideo') : t('subHearMic');
2979
3027
  const level = Math.max(this._levels.media || 0, this._levels.mic || 0);
2980
3028
  chip.querySelector('.sub-listen-meter i').style.width = Math.min(100, Math.round(level * 400)) + '%';
2981
3029
  chip.querySelector('.sub-listen-btn').style.display = offer ? '' : 'none';
2982
3030
  let alt = chip.querySelector('.sub-listen-alt');
2983
- const wantAlt = this._issue === 'noresult';
3031
+ const wantAlt = this._issue === 'noresult' || this._issue === 'notrack';
2984
3032
  if (wantAlt && !alt) {
2985
3033
  alt = createEl('button', 'sub-listen-btn sub-listen-alt', '', { type: 'button' });
2986
3034
  alt.addEventListener('click', (e) => {
2987
3035
  e.stopPropagation();
2988
- if (this.audioMode === 'media') { STORE.set('nxu_audio_mode', 'mic'); this.restart('no words from the video sound'); }
3036
+ if (this.audioMode === 'media' && this._issue !== 'notrack') { STORE.set('nxu_audio_mode', 'mic'); this.restart('no words from the video sound'); }
2989
3037
  else { const m = shadow?.getElementById('trans-modal'); if (m) { openPanel(m); const d = m.querySelector('.ai-advanced'); if (d) d.open = true; } }
2990
3038
  });
2991
3039
  chip.appendChild(alt);
2992
3040
  }
2993
- if (alt) { alt.style.display = wantAlt ? '' : 'none'; alt.textContent = this.audioMode === 'media' ? t('subTryMic') : t('subTryKey'); }
3041
+ if (alt) { alt.style.display = wantAlt ? '' : 'none'; alt.textContent = this.audioMode === 'media' && this._issue !== 'notrack' ? t('subTryMic') : t('subTryKey'); }
2994
3042
  },
2995
3043
  _preparePlaybackMic() {
2996
3044
  const track = this.mediaStream?.getAudioTracks?.()[0];
@@ -3208,6 +3256,19 @@
3208
3256
  case 'network': {
3209
3257
  this._networkErrors++;
3210
3258
  this._issue = this._networkErrors >= 2 ? 'net' : '';
3259
+ // Not one word yet and the service keeps refusing: this browser has no
3260
+ // working speech service (some Chromium browsers and apps ship without
3261
+ // one). Say so plainly instead of retrying for minutes.
3262
+ if (this._networkErrors >= 4 && !this._diag.results && navigator.onLine !== false) {
3263
+ const cloudKey = AI.key('openai') || AI.key('groq');
3264
+ logDebug('AI Sub: the browser speech service is unreachable here.', 'error');
3265
+ this.stop(t(cloudKey ? 'subNoServiceKey' : 'subNoService'));
3266
+ if (cloudKey && STORE.get('nxu_asr_provider', 'browser') === 'browser') {
3267
+ STORE.set('nxu_asr_provider', AI.key('groq') ? 'groq' : 'openai');
3268
+ setTimeout(() => this.start().catch(() => { }), 400);
3269
+ }
3270
+ return;
3271
+ }
3211
3272
  if (this._networkErrors >= 12) { this.stop(t('subNetworkFailed')); return; }
3212
3273
  if (navigator.onLine === false) { this._waitOnline = true; return; }
3213
3274
  this._networkRetryMs = Math.min(15000, Math.max(800, (this._networkRetryMs || 600) * 1.7));
@@ -3797,6 +3858,7 @@
3797
3858
  if (token !== this._startToken) return;
3798
3859
  this.state = 'running';
3799
3860
  this._diag = { sound: 0, results: 0, err: '' };
3861
+ this._toldNoTrack = false;
3800
3862
  this._startedAt = Date.now();
3801
3863
  this._soundMs = 0;
3802
3864
  this.active = true;
@@ -3814,6 +3876,27 @@
3814
3876
  logDebug(`AI Sub started (${this.captureMode}, ${this._recognitionLanguage()} → ${this.outLang}, recognition: ${this._cloud ? AI.asrModel() : this._sttProvider}${this._cloud && this._useWebSpeech ? ' + live preview' : ''}, translation: ${AI.translateProvider()}).`, 'success');
3815
3877
  },
3816
3878
  // Cloud recognition returned a finished utterance (already in speaking order).
3879
+ // Everything needed to tell why AI subtitles stay empty, as plain text the user can paste.
3880
+ async diagReport() {
3881
+ const SR = window.SpeechRecognition || window.webkitSpeechRecognition;
3882
+ const v = STATE.video;
3883
+ let local = '-';
3884
+ try { if (SR && typeof SR.available === 'function') local = await withTimeout(SR.available({ langs: [this._recognitionLanguage()], processLocally: true }), 1500); } catch (_) { local = '?'; }
3885
+ const lines = [
3886
+ 'NexusSync ' + NXU_VERSION + ' · AI subtitle report',
3887
+ 'browser: ' + navigator.userAgent,
3888
+ 'page: ' + location.hostname + (window.isSecureContext ? ' (https)' : ' (NOT secure)'),
3889
+ 'speech API: ' + (SR ? 'yes' : 'NO') + ' · hears video sound directly: ' + (SR ? (this._supportsTrackInput() ? 'yes' : 'NO') : '-') + ' · on-device (' + this._recognitionLanguage() + '): ' + local,
3890
+ 'microphone blocked by site: ' + (this._micBlockedByPolicy() ? 'YES' : 'no') + ' · permission: ' + (await this._micPermissionState()),
3891
+ 'recognition: ' + (this._cloud ? 'cloud ' + AI.asrModel() : (this._useWebSpeech ? this._sttProvider || 'web-speech' : '-')) + ' · state: ' + this.state,
3892
+ 'wanted sound: ' + (this.audioMode || this._audioMode()) + ' · capturing: ' + (this.captureMode || '-') + ' · engine input: ' + (this._recognitionInput || '-') + (this._trackDisabled ? ' (track refused)' : '') + (this._micMixed ? ' · mic mixed in' : ''),
3893
+ 'video: ' + (v ? (v.paused ? 'paused' : 'playing') + (v.muted ? ', muted' : '') + ', volume ' + Math.round((v.volume || 0) * 100) + '%' : 'none') + ' · video sound peak: ' + (this._mediaPeak || 0).toFixed(4),
3894
+ 'levels: video ' + Math.round((this._levels?.media || 0) * 400) + ' · mic ' + Math.round((this._levels?.mic || 0) * 400),
3895
+ 'engine events: sound ' + this._diag.sound + ' · results ' + this._diag.results + ' · last error ' + (this._diag.err || '-') + ' · network errors ' + (this._networkErrors || 0),
3896
+ 'issue: ' + (this._issue || '-')
3897
+ ];
3898
+ return lines.join('\n');
3899
+ },
3817
3900
  onCloudTranscript(text, reason, meta) {
3818
3901
  if (!this.active) return;
3819
3902
  const clean = this._normalize(text);
@@ -6631,7 +6714,7 @@
6631
6714
  viewer: self ? !!STATE.isViewer : !!p?.viewer,
6632
6715
  av: safeAvatar(self ? PROFILE.avatar() : p?.av),
6633
6716
  img: AVATAR_IMG.get(uid),
6634
- st: String((self ? PROFILE.status() : p?.st) || '').slice(0, 40),
6717
+ st: '',
6635
6718
  muted: !self && SAFETY.muted.has(uid),
6636
6719
  away: !self && (!!p?.hid || !!p?._sleep),
6637
6720
  sleeping: !self && !!p?._sleep,
@@ -7127,6 +7210,8 @@
7127
7210
  const margin = 12, w = getW(), h = getH();
7128
7211
  const rect = localBox(panel);
7129
7212
  const rw = Math.min(rect.width, w - margin * 2), rh = Math.min(rect.height, h - margin * 2);
7213
+ if (panel.style.width && rect.width > rw) panel.style.width = Math.max(260, rw) + 'px';
7214
+ if (panel.style.height && rect.height > rh) panel.style.height = Math.max(200, rh) + 'px';
7130
7215
  panel.style.transform = 'none';
7131
7216
  panel.style.left = Math.max(margin, Math.min(rect.left, w - rw - margin)) + 'px';
7132
7217
  panel.style.top = Math.max(margin, Math.min(rect.top, h - rh - margin)) + 'px';
@@ -7138,6 +7223,7 @@
7138
7223
  panel.style.display = 'flex';
7139
7224
  panel.style.opacity = '1';
7140
7225
  panel.style.pointerEvents = 'auto';
7226
+ try { AUTO_CINEMA._hideCard(); } catch (_) { } // the "which player" card would cover the window
7141
7227
  PANEL_SIZE.apply(panel);
7142
7228
  if (panel.dataset.userMoved === 'true') requestAnimationFrame(() => clampPanelToViewport(panel));
7143
7229
  else centerPanel(panel);
@@ -7346,7 +7432,19 @@
7346
7432
  return select;
7347
7433
  }
7348
7434
 
7349
- // ⚙️ Settings: profile, my reactions, playback, what reaches me from others, advanced.
7435
+ // ⚙️ Settings: profile, my reactions, playback, tools. Every list is a grid of the same
7436
+ // number of cells per row (8), and every on/off choice is the same switch.
7437
+ function switchRow(btn, label, get, set) {
7438
+ btn.className = 'btn nx-sw';
7439
+ btn.setAttribute('role', 'switch');
7440
+ const text = createEl('span', 'nx-sw-label', label);
7441
+ const knob = createEl('i', 'nx-sw-track');
7442
+ btn.replaceChildren(text, knob);
7443
+ btn.paint = () => { const on = !!get(); btn.classList.toggle('active', on); btn.setAttribute('aria-checked', String(on)); };
7444
+ btn.onclick = (ev) => { ev.stopPropagation(); triggerHaptic(); set(!get()); btn.paint(); };
7445
+ btn.paint();
7446
+ return btn;
7447
+ }
7350
7448
  function buildSettingsPanel(parts) {
7351
7449
  const body = createEl('div', 'manual-body settings-body nx-settings');
7352
7450
  const section = (icon, title) => {
@@ -7355,106 +7453,74 @@
7355
7453
  body.appendChild(sec);
7356
7454
  return sec;
7357
7455
  };
7358
- const toggle = (label, get, set) => {
7359
- const row = createEl('label', 'trans-row nx-set-row');
7360
- const box = createEl('input', 'trans-check', '', { type: 'checkbox' });
7361
- box.checked = !!get();
7362
- box.addEventListener('change', () => set(!!box.checked));
7363
- row.append(createEl('span', '', label), box);
7364
- return row;
7456
+ const emojiInput = (ph, onEmoji) => {
7457
+ const inp = createEl('input', 'nx-compose-input nx-emoji-input', '', { type: 'text', maxlength: '16', placeholder: ph, autocomplete: 'off', enterkeyhint: 'done' });
7458
+ inp.addEventListener('input', () => { const em = safeEmoji(inp.value); if (em && onEmoji(em)) inp.value = ''; });
7459
+ inp.addEventListener('keydown', (ev) => ev.stopPropagation());
7460
+ return inp;
7365
7461
  };
7366
- // Profile
7462
+ const grid = (list, cls, onPick) => {
7463
+ const g = createEl('div', 'nx-grid8');
7464
+ list.forEach(em => {
7465
+ const b = createEl('button', 'nx-cell ' + cls, em, { type: 'button' });
7466
+ b.dataset.em = em;
7467
+ b.onclick = (ev) => { ev.stopPropagation(); onPick(em, b); };
7468
+ g.appendChild(b);
7469
+ });
7470
+ return g;
7471
+ };
7472
+ // Profile: name, colour, device delay, avatar (pick one, or type any emoji)
7367
7473
  const prof = section('👤', t('setProfile'));
7368
7474
  prof.open = true;
7369
7475
  prof.appendChild(PROFILE.editor());
7370
- const avRow = createEl('div', 'nx-av-row');
7371
- const paintAv = () => avRow.querySelectorAll('.nx-av').forEach(b => b.classList.toggle('on', b.dataset.av === PROFILE.avatar()));
7372
- ['', ...PROFILE.AVATARS].forEach(a => {
7373
- const b = createEl('button', 'nx-av', a || '∅', { type: 'button', 'aria-label': a || 'none' });
7374
- b.dataset.av = a;
7375
- b.onclick = (ev) => { ev.stopPropagation(); PROFILE.setAvatar(a); paintAv(); };
7376
- avRow.appendChild(b);
7377
- });
7378
- paintAv();
7379
- const status = createEl('input', 'nx-compose-input nx-status-input', '', { type: 'text', maxlength: '40', placeholder: t('setStatusPh'), autocomplete: 'off' });
7380
- status.value = PROFILE.status();
7381
- status.addEventListener('input', () => PROFILE.setStatus(status.value));
7382
- const preview = createEl('div', 'nx-av-preview');
7383
- const paintPreview = () => {
7384
- const img = PROFILE.image();
7385
- preview.style.backgroundImage = img ? `url("${img}")` : '';
7386
- preview.textContent = img ? '' : (PROFILE.avatar() || (STATE.nickname || '?').slice(0, 1).toUpperCase());
7387
- paintAv();
7476
+ const avSlot = createEl('button', 'nx-cell nx-av-slot on', '', { type: 'button', 'aria-label': t('setAvatar') });
7477
+ const avGrid = grid(PROFILE.AVATARS, 'nx-av', (em) => { PROFILE.setAvatar(em); paintAv(); });
7478
+ const paintAv = () => {
7479
+ const a = PROFILE.avatar();
7480
+ avSlot.textContent = a || (STATE.nickname || '?').slice(0, 1).toUpperCase();
7481
+ avSlot.classList.toggle('empty', !a);
7482
+ avGrid.querySelectorAll('.nx-av').forEach(b => b.classList.toggle('on', b.dataset.em === a));
7388
7483
  };
7389
- const avCustom = createEl('input', 'nx-compose-input nx-av-input', '', { type: 'text', maxlength: '8', placeholder: t('setAvatarCustom'), autocomplete: 'off' });
7390
- avCustom.value = PROFILE.avatar() && !PROFILE.AVATARS.includes(PROFILE.avatar()) ? PROFILE.avatar() : '';
7391
- avCustom.addEventListener('input', () => { const a = safeAvatar(avCustom.value); if (a || !avCustom.value.trim()) { PROFILE.setImage(''); PROFILE.setAvatar(a); paintPreview(); } });
7392
- avCustom.addEventListener('keydown', (ev) => ev.stopPropagation());
7393
- const photoBtn = createEl('button', 'btn subtle', '🖼 ' + t('setAvatarPhoto'), { type: 'button' });
7394
- photoBtn.onclick = () => { PROFILE._onImage = paintPreview; PROFILE.pickImage(); };
7395
- const clearBtn = createEl('button', 'btn subtle', '✕', { type: 'button', title: t('setAvatarClear') });
7396
- clearBtn.onclick = () => { PROFILE.setImage(''); PROFILE.setAvatar(''); avCustom.value = ''; paintPreview(); };
7397
- const customRow = createEl('div', 'nx-av-custom');
7398
- customRow.append(preview, avCustom, photoBtn, clearBtn);
7399
- avRow.querySelectorAll('.nx-av').forEach(b => b.addEventListener('click', () => { PROFILE.setImage(''); avCustom.value = ''; paintPreview(); }));
7400
- paintPreview();
7401
- prof.append(createEl('div', 'field-label', t('setAvatar')), customRow, avRow, createEl('div', 'field-label', t('setStatus')), status);
7402
- // My reactions
7484
+ const avInput = emojiInput(t('setAvatarPh'), (em) => { PROFILE.setAvatar(em); paintAv(); return true; });
7485
+ const avReset = createEl('button', 'btn subtle', '↺ ' + t('setAvatarReset'), { type: 'button' });
7486
+ avReset.onclick = (ev) => { ev.stopPropagation(); PROFILE.setAvatar(''); paintAv(); };
7487
+ const avHead = createEl('div', 'nx-pick-head');
7488
+ avHead.append(avSlot, avInput);
7489
+ paintAv();
7490
+ prof.append(createEl('div', 'field-label', t('setAvatar')), avHead, avGrid, avReset);
7491
+ // My reactions: slots, then the palette or any emoji
7403
7492
  const reac = section('😀', t('setReactions'));
7404
- const slots = createEl('div', 'nx-react-slots');
7493
+ const slots = createEl('div', 'nx-grid8 nx-react-slots');
7405
7494
  let pick = 0;
7406
- const PALETTE = ['❤️', '🔥', '👏', '🤣', '😱', '😍', '🥺', '🤯', '👀', '💀', '🙏', '👍', '🎉', '💯', '😴', '🤔', '🍿', '😂', '😭', '😡', '💦', '🍪', '☕', '😘'];
7407
7495
  const paintSlots = () => {
7408
7496
  slots.replaceChildren(...REACTIONS.list().map((em, i) => {
7409
- const b = createEl('button', 'nx-react-slot' + (i === pick ? ' on' : ''), em, { type: 'button' });
7497
+ const b = createEl('button', 'nx-cell nx-react-slot' + (i === pick ? ' on' : ''), em, { type: 'button' });
7410
7498
  b.onclick = (ev) => { ev.stopPropagation(); pick = i; paintSlots(); };
7411
7499
  return b;
7412
7500
  }));
7413
7501
  };
7414
- const pal = createEl('div', 'nx-react-pal');
7415
- PALETTE.forEach(em => {
7416
- const b = createEl('button', 'nx-react-pick', em, { type: 'button' });
7417
- b.onclick = (ev) => { ev.stopPropagation(); if (REACTIONS.set(pick, em)) { pick = (pick + 1) % REACTIONS.list().length; paintSlots(); } };
7418
- pal.appendChild(b);
7419
- });
7420
- const custom = createEl('input', 'nx-compose-input nx-react-custom', '', { type: 'text', maxlength: '16', placeholder: t('setEmojiPh'), autocomplete: 'off' });
7421
- custom.addEventListener('input', () => { if (REACTIONS.set(pick, custom.value)) { custom.value = ''; pick = (pick + 1) % REACTIONS.list().length; paintSlots(); } });
7422
- custom.addEventListener('keydown', (ev) => ev.stopPropagation());
7423
- const resetBtn = createEl('button', 'btn subtle', '↺ ' + t('setReactionsReset'), { type: 'button' });
7424
- resetBtn.onclick = () => { REACTIONS.reset(); pick = 0; paintSlots(); };
7425
- const slotRow = createEl('div', 'nx-slot-row');
7502
+ const putEmoji = (em) => { if (!REACTIONS.set(pick, em)) return false; pick = (pick + 1) % REACTIONS.list().length; paintSlots(); return true; };
7503
+ const pal = grid(REACTIONS.PALETTE, 'nx-react-pick', (em) => putEmoji(em));
7504
+ const custom = emojiInput(t('setEmojiPh'), putEmoji);
7426
7505
  const addSlot = createEl('button', 'btn subtle', t('setSlotAdd'), { type: 'button' });
7427
- addSlot.onclick = () => { const i = REACTIONS.add(); if (i >= 0) pick = i; paintSlots(); };
7506
+ addSlot.onclick = (ev) => { ev.stopPropagation(); const i = REACTIONS.add(); if (i >= 0) pick = i; paintSlots(); };
7428
7507
  const delSlot = createEl('button', 'btn subtle', t('setSlotRemove'), { type: 'button' });
7429
- delSlot.onclick = () => { if (REACTIONS.remove(pick)) pick = Math.min(pick, REACTIONS.list().length - 1); paintSlots(); };
7430
- slotRow.append(addSlot, delSlot);
7508
+ delSlot.onclick = (ev) => { ev.stopPropagation(); if (REACTIONS.remove(pick)) pick = Math.min(pick, REACTIONS.list().length - 1); paintSlots(); };
7509
+ const resetBtn = createEl('button', 'btn subtle', '↺ ' + t('setReactionsReset'), { type: 'button' });
7510
+ resetBtn.onclick = (ev) => { ev.stopPropagation(); REACTIONS.reset(); pick = 0; paintSlots(); };
7511
+ const slotRow = createEl('div', 'nx-btn-row nx-slot-row');
7512
+ slotRow.append(addSlot, delSlot, resetBtn);
7431
7513
  paintSlots();
7432
- reac.append(slots, slotRow, createEl('div', 'trans-help', t('setReactionsHint')), pal, custom, resetBtn);
7433
- // Playback
7514
+ reac.append(slots, slotRow, createEl('div', 'trans-help', t('setReactionsHint')), pal, custom);
7515
+ // Playback: the same switch for every on/off choice
7434
7516
  const play = section('🎬', t('setPlayback'));
7435
- play.append(parts.autoCinema, parts.adGuard, toggle(t('setAutoNext'), () => NEXT_EP.enabled(), on => STORE.set('nxu_auto_next', on)));
7436
- // Watching together: what reaches me, and from whom
7437
- const tog = section('🛡️', t('setTogether'));
7438
- [['react', 'setRecvReact'], ['nudge', 'setRecvNudge'], ['ink', 'setRecvInk'], ['chat', 'setRecvChat'], ['ping', 'setRecvPing']].forEach(([k, label]) => tog.appendChild(toggle(t(label), () => SAFETY.receive(k), on => SAFETY.set(k, on))));
7439
- const people = createEl('div', 'nx-people');
7440
- const paintPeople = () => {
7441
- const others = roomRoster().filter(m => !m.self);
7442
- if (!others.length) { people.replaceChildren(createEl('div', 'trans-help', t('setNobody'))); return; }
7443
- people.replaceChildren(...others.map(m => {
7444
- const row = createEl('div', 'nx-person');
7445
- const dot = createEl('i', 'nx-who-dot'); dot.style.background = m.color;
7446
- const b = createEl('button', 'btn subtle', SAFETY.muted.has(m.uid) ? '👁 ' + t('setUnmute') : '🔇 ' + t('setMute'), { type: 'button' });
7447
- b.onclick = (ev) => { ev.stopPropagation(); SAFETY.toggleMute(m.uid); paintPeople(); updatePresenceUI(); };
7448
- row.append(dot, createEl('span', 'nx-person-name', (m.av ? m.av + ' ' : '') + m.name), b);
7449
- return row;
7450
- }));
7451
- };
7452
- tog.addEventListener('toggle', () => { if (tog.open) paintPeople(); });
7453
- tog.append(createEl('div', 'field-label', t('setPeople')), people, createEl('div', 'trans-help', t('setMutedHint')));
7454
- // Advanced
7517
+ const autoNext = switchRow(createEl('button', '', '', { type: 'button' }), '⏭ ' + t('setAutoNext'), () => NEXT_EP.enabled(), on => STORE.set('nxu_auto_next', on));
7518
+ play.append(parts.autoCinema, parts.adGuard, autoNext);
7519
+ // Tools and this site
7455
7520
  const adv = section('🔧', t('setAdvanced'));
7456
- adv.append(parts.chatLog, parts.subLog, parts.debug, parts.idleRow, parts.hideSite);
7457
- body.refreshPeople = paintPeople;
7521
+ const tools = createEl('div', 'nx-btn-row nx-tools');
7522
+ tools.append(parts.chatLog, parts.subLog, parts.debug);
7523
+ adv.append(tools, parts.idleRow, parts.hideSite, createEl('div', 'trans-help', t('setHideFabHelp')), createEl('div', 'nx-set-ver', 'NexusSync v' + NXU_VERSION));
7458
7524
  return body;
7459
7525
  }
7460
7526
 
@@ -7555,6 +7621,17 @@
7555
7621
  const opacityVal = createEl('span', 'range-val');
7556
7622
  opacityRow.append(createEl('span', '', t('subOpacity')), opacitySlider, opacityVal);
7557
7623
 
7624
+ const diagBtn = createEl('button', 'btn subtle', '🔬 ' + t('subDiagCopy'), { type: 'button', id: 'nxu-ai-diag' });
7625
+ diagBtn.onclick = async (ev) => {
7626
+ ev.stopPropagation();
7627
+ const text = await TRANSLATOR.diagReport();
7628
+ logDebug(text, 'info');
7629
+ let ok = false;
7630
+ try { await navigator.clipboard.writeText(text); ok = true; } catch (_) {
7631
+ try { if (typeof GM_setClipboard === 'function') { GM_setClipboard(text); ok = true; } } catch (_) { }
7632
+ }
7633
+ showToast(ok ? t('subDiagCopied') : t('subDiagInDebug'));
7634
+ };
7558
7635
  const details = createEl('details', 'ai-advanced');
7559
7636
  const advanced = createEl('div', 'ai-advanced-body');
7560
7637
  const offlineBtn = createEl('button', 'btn subtle', '⬇️ ' + t('offlineDownload'));
@@ -7574,6 +7651,7 @@
7574
7651
  details,
7575
7652
  createEl('div', 'ai-status', t('subStatusIdle'), { id: 'nxu-ai-status' }),
7576
7653
  createEl('button', 'btn primary', '🎙️ ' + t('subStart'), { id: 'stt-toggle' }),
7654
+ diagBtn,
7577
7655
  createEl('div', 'trans-help center', t('hotkeyHelp'))
7578
7656
  );
7579
7657
 
@@ -7701,14 +7779,10 @@
7701
7779
  .nx-who-tag { font-size:10px; }
7702
7780
  .nx-who-av { font-size:12px; line-height:1; }
7703
7781
  .nx-who-img { width:16px; height:16px; border-radius:50%; object-fit:cover; border:1.5px solid; flex:none; }
7704
- .nx-av-preview { width:44px; height:44px; border-radius:50%; background:rgba(255,255,255,0.1) center/cover; display:grid; place-items:center; font-size:22px; font-weight:800; border:2px solid var(--accent); flex:none; }
7705
- .nx-av-custom { display:flex; gap:6px; align-items:center; }
7706
- .nx-av-custom .nx-compose-input { flex:1; }
7707
- .nx-av-custom .btn { width:auto; }
7708
7782
  .nx-who-st { font-weight:500; opacity:0.7; margin-left:4px; overflow:hidden; text-overflow:ellipsis; }
7709
7783
  .nx-talk-avatar.emoji { background:rgba(255,255,255,0.12) !important; font-size:16px; }
7710
- .dock { position:absolute; background:var(--glass-strong); border-radius:16px; padding:10px; display:flex; flex-direction:column; gap:6px; pointer-events:none; opacity:0; border:1px solid rgba(255,255,255,0.1);
7711
- transition:opacity 0.25s ease, transform 0.25s ease; box-shadow:0 10px 30px rgba(0,0,0,0.35); backdrop-filter:blur(4px); -webkit-backdrop-filter:blur(4px); z-index:90; overflow-y:auto; text-shadow:0 1px 2px rgba(0,0,0,0.8); overflow-x:hidden; width:clamp(150px, 40vw, 190px); width:clamp(150px, 40cqw, 190px); }
7784
+ .dock { position:absolute; max-height:calc(100cqh - 24px); background:var(--glass-strong); border-radius:16px; padding:10px; display:flex; flex-direction:column; gap:6px; pointer-events:none; opacity:0; border:1px solid rgba(255,255,255,0.1);
7785
+ transition:opacity 0.25s ease, transform 0.25s ease; box-shadow:0 10px 30px rgba(0,0,0,0.35); backdrop-filter:blur(4px); -webkit-backdrop-filter:blur(4px); z-index:90; overflow-y:auto; text-shadow:0 1px 2px rgba(0,0,0,0.8); overflow-x:hidden; width:clamp(150px, 40vw, 190px); width:clamp(160px, 22cqw, 240px); }
7712
7786
  .dock.open { opacity:1; pointer-events:auto; border-color:rgba(0,230,118,0.3); }
7713
7787
  .btn { background:rgba(255,255,255,0.06); color:var(--txt); border:1px solid transparent; padding:9px 12px; border-radius:9px; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:8px;
7714
7788
  font-weight:600; font-size:13px; transition:background-color 0.2s, border-color 0.2s; touch-action:manipulation; width:100%; text-align:center; }
@@ -7721,14 +7795,15 @@
7721
7795
  .btn:disabled { opacity:0.5; cursor:wait; }
7722
7796
  .window-frame { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); background:var(--glass-strong); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px); border-radius:16px; display:none; flex-direction:column;
7723
7797
  border:1px solid rgba(255,255,255,0.18); overflow:hidden; box-shadow:0 15px 40px rgba(0,0,0,0.6); z-index:105; transition:opacity 0.4s ease;
7724
- width:min(420px, calc(100vw - 24px)); width:min(420px, calc(100cqw - 24px)); max-height:calc(100vh - 24px); max-height:calc(100cqh - 24px); }
7725
- #chat-panel, #sub-log-panel, #debug-panel { height:min(520px, calc(100vh - 24px)); height:min(520px, calc(100cqh - 24px)); }
7798
+ width:min(420px, calc(100vw - 24px)); width:min(max(340px, 34cqw), 560px, calc(100cqw - 24px)); max-height:calc(100vh - 24px); max-height:calc(100cqh - 24px); }
7799
+ /* Windows follow the screen: wider on big screens, never past the edges on small ones. */
7800
+ #chat-panel, #sub-log-panel, #debug-panel { height:min(520px, calc(100vh - 24px)); height:min(max(360px, 66cqh), 760px, calc(100cqh - 24px)); }
7726
7801
  /* The window stays put and its body scrolls, so the resize grip stays in the corner
7727
7802
  (it used to scroll away with long content, e.g. every Settings section open). */
7728
7803
  #manual-modal, #trans-modal, #settings-modal, #tune-panel, #os-panel { overflow:hidden; }
7729
7804
  #manual-modal > .manual-body, #trans-modal > .manual-body, #settings-modal > .manual-body, #tune-panel > .manual-body, #os-panel > .manual-body { flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; }
7730
7805
  /* Windows you read and fill in stay legible over a busy picture. */
7731
- #manual-modal, #trans-modal, #settings-modal, #tune-panel, #os-panel, #debug-panel { background:rgba(16,20,26,0.9); }
7806
+ #manual-modal, #trans-modal, #settings-modal, #tune-panel, #os-panel, #debug-panel, #chat-panel, #sub-log-panel { background:rgba(16,20,26,0.96); }
7732
7807
  .drag-header { background:rgba(0,0,0,0.3); padding:10px 14px; font-size:13px; color:#eee; font-weight:700; cursor:grab; display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid rgba(255,255,255,0.06); user-select:none; touch-action:none; flex:0 0 auto; }
7733
7808
  .header-controls { display:flex; gap:10px; align-items:center; }
7734
7809
  .pin-btn, .close-btn { background:transparent; border:none; cursor:pointer; color:#fff; font-size:15px; line-height:1; padding:0; opacity:0.6; }
@@ -7795,7 +7870,15 @@
7795
7870
  .cc-adj-val { min-width:46px; text-align:center; font-variant-numeric:tabular-nums; font-weight:700; }
7796
7871
  .cc-slider input { width:110px; accent-color:var(--cc-accent); }
7797
7872
  .cc-menu-note { font-size:11.5px; opacity:0.6; padding:4px 10px 6px; max-width:240px; }
7798
- .os-body { gap:8px; }
7873
+ .os-body { gap:8px; display:flex; flex-direction:column; }
7874
+ .os-body > * { flex:none; }
7875
+ /* The results take whatever room the window has (they used to be squeezed into a
7876
+ small box of their own inside the window, e.g. 120px on a phone in landscape). */
7877
+ #os-panel.has-results { height:min(760px, calc(100vh - 24px)); height:min(max(420px, 80cqh), 760px, calc(100cqh - 24px)); }
7878
+ #os-panel.has-results .os-results { flex:1 1 auto; max-height:none; min-height:96px; }
7879
+ #os-panel.has-results .os-hint { display:none; }
7880
+ /* Short screens (a phone in landscape): one scroll for the whole window, not a small inner box. */
7881
+ @media (max-height:560px) { #os-panel.has-results .os-results { flex:none; overflow:visible; } }
7799
7882
  .os-row { display:grid; grid-template-columns:1fr 1fr 1.4fr; gap:6px; }
7800
7883
  .os-tmdb { display:flex; flex-wrap:wrap; gap:5px; align-items:center; }
7801
7884
  .os-tmdb:empty { display:none; }
@@ -7848,17 +7931,28 @@
7848
7931
  .nx-set-sec[open] > .nx-set-head::after { content:'▴'; }
7849
7932
  .nx-set-sec > :not(summary) { margin-top:6px; }
7850
7933
  .nx-set-row { display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:12.5px; padding:4px 0; }
7851
- .nx-av-row, .nx-react-pal { display:flex; flex-wrap:wrap; gap:4px; }
7852
- .nx-av, .nx-react-pick { width:34px; height:34px; border-radius:9px; border:1px solid rgba(255,255,255,0.12); background:rgba(255,255,255,0.06); font-size:18px; cursor:pointer; padding:0; color:inherit; }
7853
- .nx-av.on { border-color:var(--accent); background:var(--glass-active); }
7854
- .nx-react-slots { display:grid; grid-template-columns:repeat(8, 1fr); gap:4px; }
7855
- .nx-slot-row { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
7856
- .nx-react-slot { height:40px; border-radius:10px; border:1px solid rgba(255,255,255,0.14); background:rgba(255,255,255,0.08); font-size:20px; cursor:pointer; padding:0; }
7857
- .nx-react-slot.on { border-color:var(--accent); box-shadow:0 0 0 2px rgba(0,230,118,0.35); }
7858
- .nx-people { display:flex; flex-direction:column; gap:4px; }
7859
- .nx-person { display:flex; align-items:center; gap:8px; font-size:12.5px; }
7860
- .nx-person .btn { width:auto; margin-left:auto; }
7861
- .nx-person-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
7934
+ /* Every list in Settings: one grid, eight equal cells per row, nothing wraps oddly. */
7935
+ .nx-grid8 { display:grid; grid-template-columns:repeat(8, minmax(0, 1fr)); gap:5px; }
7936
+ .nx-cell { aspect-ratio:1; min-width:0; width:100%; border-radius:10px; border:1px solid rgba(255,255,255,0.12); background:rgba(255,255,255,0.06); font-size:clamp(15px, 4.6cqw, 22px); line-height:1; cursor:pointer; padding:0; color:inherit; display:grid; place-items:center; }
7937
+ .nx-cell:hover { background:rgba(255,255,255,0.14); }
7938
+ .nx-cell.on { border-color:var(--accent); background:var(--glass-active); box-shadow:0 0 0 2px rgba(0,230,118,0.3); }
7939
+ .nx-pick-head { display:grid; grid-template-columns:calc((100% - 35px) / 8) 1fr; gap:5px; align-items:center; }
7940
+ .nx-av-slot { cursor:default; }
7941
+ .nx-av-slot.empty { font-weight:800; font-size:clamp(13px, 3.8cqw, 18px); opacity:0.8; }
7942
+ .nx-emoji-input { display:block; width:100%; box-sizing:border-box; padding:8px 14px; }
7943
+ .nx-btn-row { display:flex; gap:6px; }
7944
+ .nx-btn-row > .btn { flex:1 1 0; width:auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; padding-left:6px; padding-right:6px; }
7945
+ /* One switch for every on/off choice. */
7946
+ .btn.nx-sw { width:100%; justify-content:space-between; text-align:left; font-size:12.5px; font-weight:600; opacity:1; padding:9px 10px; background:rgba(255,255,255,0.04); }
7947
+ .btn.nx-sw.active { background:rgba(255,255,255,0.04) !important; border-color:transparent !important; }
7948
+ .nx-sw-label { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
7949
+ .nx-sw-track { flex:none; position:relative; width:38px; height:22px; border-radius:11px; background:rgba(255,255,255,0.22); transition:background .18s; }
7950
+ .nx-sw-track::after { content:''; position:absolute; top:3px; left:3px; width:16px; height:16px; border-radius:50%; background:#fff; transition:transform .18s; box-shadow:0 1px 3px rgba(0,0,0,0.4); }
7951
+ .nx-sw.active .nx-sw-track { background:var(--accent); }
7952
+ .nx-sw.active .nx-sw-track::after { transform:translateX(16px); }
7953
+ .nx-set-sec > .nx-sw + .nx-sw { margin-top:4px; }
7954
+ .nx-set-ver { font-size:10.5px; opacity:0.45; text-align:right; }
7955
+ .nx-settings { container-type:inline-size; }
7862
7956
  .seg { display:flex; gap:6px; }
7863
7957
  .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; }
7864
7958
  .seg-btn.on { background:rgba(124,77,255,0.38); border-color:rgba(160,130,255,0.95); }
@@ -7998,8 +8092,8 @@
7998
8092
  .nx-me-dot { background:var(--c, #69f0ae) !important; box-shadow:0 0 0 2px rgba(255,255,255,0.25), 0 0 10px var(--c, #69f0ae); }
7999
8093
  .nx-profile { display:flex; flex-direction:column; gap:7px; padding:6px 4px 2px; }
8000
8094
  .nx-profile-title { font-size:11.5px; font-weight:800; color:rgba(255,255,255,0.7); padding-left:4px; }
8001
- .nx-swatches { display:flex; flex-wrap:wrap; gap:7px; padding:0 2px; }
8002
- .nx-swatch { width:26px; height:26px; border-radius:50%; border:2px solid rgba(255,255,255,0.2); background:var(--c); cursor:pointer; padding:0; }
8095
+ .nx-swatches { display:grid; grid-template-columns:repeat(8, minmax(0, 1fr)); gap:5px; padding:0 2px; justify-items:center; }
8096
+ .nx-swatch { width:min(100%, 30px); aspect-ratio:1; height:auto; border-radius:50%; border:2px solid rgba(255,255,255,0.2); background:var(--c); cursor:pointer; padding:0; }
8003
8097
  .nx-swatch.on { border-color:#fff; box-shadow:0 0 0 2px var(--c), 0 0 12px var(--c); transform:scale(1.08); }
8004
8098
  .nx-swatch-custom { -webkit-appearance:none; appearance:none; background:conic-gradient(#ff5252, #ffd740, #69f0ae, #40c4ff, #7c4dff, #ff4fa3, #ff5252); overflow:hidden; }
8005
8099
  .nx-swatch-custom::-webkit-color-swatch-wrapper { padding:0; } .nx-swatch-custom::-webkit-color-swatch { border:none; opacity:0; }
@@ -8181,7 +8275,7 @@
8181
8275
  .cc-hover { position:absolute; bottom:26px; transform:translateX(-50%); background:rgba(12,14,18,0.9); color:#fff; font-size:12px; font-weight:700; font-variant-numeric:tabular-nums; padding:4px 8px; border-radius:6px; opacity:0; pointer-events:none; transition:opacity 0.15s; white-space:nowrap; box-shadow:0 2px 8px rgba(0,0,0,0.4); }
8182
8276
  .cc-hover.show { opacity:1; }
8183
8277
  .cc-hover small { display:block; font-weight:600; opacity:0.75; font-size:11px; max-width:180px; overflow:hidden; text-overflow:ellipsis; }
8184
- .cc-menu { position:absolute; bottom:calc(58px + env(safe-area-inset-bottom, 0px)); right:calc(14px + env(safe-area-inset-right, 0px)); z-index:80; min-width:150px; padding:6px; border-radius:12px; background:rgba(20,22,28,0.94); -webkit-backdrop-filter:blur(14px); backdrop-filter:blur(14px); box-shadow:0 10px 30px rgba(0,0,0,0.5); display:none; pointer-events:auto; }
8278
+ .cc-menu { position:absolute; bottom:calc(58px + env(safe-area-inset-bottom, 0px)); right:calc(14px + env(safe-area-inset-right, 0px)); z-index:80; min-width:150px; max-width:calc(100% - 28px); max-height:calc(100% - 140px - env(safe-area-inset-bottom, 0px)); overflow-y:auto; overscroll-behavior:contain; padding:6px; border-radius:12px; background:rgba(20,22,28,0.94); -webkit-backdrop-filter:blur(14px); backdrop-filter:blur(14px); box-shadow:0 10px 30px rgba(0,0,0,0.5); display:none; pointer-events:auto; }
8185
8279
  .cc-menu.open { display:block; animation:ccMenu 0.14s ease-out; }
8186
8280
  @keyframes ccMenu { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
8187
8281
  .cc-menu-title { font-size:11px; font-weight:700; opacity:0.6; padding:4px 10px 6px; text-transform:uppercase; letter-spacing:0.5px; }
@@ -8308,13 +8402,8 @@
8308
8402
  const btnSyncStatus = mk('nxu-sync-status', '📡 ' + t('sync'));
8309
8403
  const btnInvite = mk('nxu-invite', '👥 ' + t('invite'), t('inviteTitle'));
8310
8404
  const btnCinema = mk('nxu-cinema', '🍿 ' + t('cinema'), t('cinemaTitle'));
8311
- const btnAutoCinema = mk('nxu-auto-cinema', '');
8312
- btnAutoCinema.classList.add('subtle');
8313
- const btnAdGuard = mk('nxu-ad-guard', '');
8314
- btnAdGuard.classList.add('subtle');
8315
- const paintAdGuard = () => { const on = AD_GUARD.enabled(); btnAdGuard.textContent = '🛡️ ' + t(on ? 'adGuardOn' : 'adGuardOff'); btnAdGuard.classList.toggle('active', on); };
8316
- paintAdGuard();
8317
- btnAdGuard.onclick = () => { STORE.set('nxu_ad_guard', !AD_GUARD.enabled()); paintAdGuard(); showToast('🛡️ ' + t(AD_GUARD.enabled() ? 'adGuardOn' : 'adGuardOff')); };
8405
+ const btnAutoCinema = switchRow(mk('nxu-auto-cinema', ''), '✨ ' + t('setAutoCinemaSw'), () => AUTO_CINEMA.enabled(), on => AUTO_CINEMA.setSite(on));
8406
+ const btnAdGuard = switchRow(mk('nxu-ad-guard', ''), '🛡️ ' + t('setAdGuardSw'), () => AD_GUARD.enabled(), on => { STORE.set('nxu_ad_guard', !!on); showToast('🛡️ ' + t(on ? 'adGuardOn' : 'adGuardOff')); });
8318
8407
  const btnPiP = mk('nxu-pip', '📺 PiP');
8319
8408
  const btnRate = mk('nxu-rate', '⏩ 1x', t('rateTitle'));
8320
8409
  // Talking happens in speech bubbles and quick ink now: the menu opens those directly
@@ -8326,10 +8415,11 @@
8326
8415
  const btnSubLog = mk('', '📝 ' + t('subLog'));
8327
8416
  const btnChatLog = mk('nxu-chat-log', '💬 ' + t('chatLog'));
8328
8417
  const btnDebug = mk('', '🐛 ' + t('debug'));
8329
- const btnHideSite = createEl('button', 'btn subtle', '🙈 ' + t('hideOnSite'), { title: t('hideOnSiteTitle') });
8418
+ const btnHideSite = switchRow(createEl('button', '', '', { type: 'button', id: 'nxu-hide-site' }), '🙈 ' + t('setHideFab'), () => !!STORE.get('nxu_hide_fab_' + HOST, false), on => setFabHiddenOnSite(on));
8330
8419
  const btnSettings = mk('nxu-settings', '⚙️ ' + t('settings'));
8331
8420
  [btnLink, btnSyncStatus, btnInvite, btnCinema, btnPiP, btnRate, btnDraw, btnBookmark, btnChat].forEach(b => { b.style.display = 'none'; });
8332
8421
  btnSubLog.style.display = 'none';
8422
+ btnChatLog.style.display = 'none';
8333
8423
 
8334
8424
  // Chat panel
8335
8425
  const chatPanel = createEl('div', 'window-frame');
@@ -8416,13 +8506,13 @@
8416
8506
  const debugContent = createEl('div', 'debug-content');
8417
8507
  const debugJumpBtn = createEl('button', 'jump-btn', '↓ ' + t('latest'));
8418
8508
  debugJumpBtn.id = 'debug-jump-btn';
8419
- const idleRow = createEl('div', 'idle-row');
8420
- const idleSlider = createEl('input', '', '', { type: 'range', min: '3', max: '30', step: '1', style: 'flex:1;' });
8509
+ const idleRow = createEl('div', 'nx-latency nx-idle-row');
8510
+ const idleSlider = createEl('input', 'nx-latency-range', '', { type: 'range', min: '3', max: '30', step: '1' });
8421
8511
  const idleVal = createEl('span', '', '');
8422
8512
  idleSlider.value = CONFIG.idleTimeoutMs / 1000;
8423
8513
  idleVal.textContent = idleSlider.value + 's';
8424
8514
  idleSlider.addEventListener('input', () => { idleVal.textContent = idleSlider.value + 's'; STORE.set('nxu_idle_timeout', +idleSlider.value); });
8425
- idleRow.append(createEl('span', '', '⏱️ ' + t('uiHide')), idleSlider, idleVal, createEl('span', '', 'v' + NXU_VERSION, { style: 'margin-left:6px;opacity:0.6;' }));
8515
+ idleRow.append(createEl('span', 'nx-latency-label', '⏱️ ' + t('uiHide')), idleSlider, idleVal);
8426
8516
  debugPanel.append(debugHeader, debugContent, debugJumpBtn);
8427
8517
 
8428
8518
  // Sync timing (offset between different versions of a movie)
@@ -8468,7 +8558,7 @@
8468
8558
 
8469
8559
  uiElements = {
8470
8560
  uiWrapper, fab, reactPill, dock, btnFindMedia, btnLink, btnSyncStatus, btnTranslate, btnCinema, btnAutoCinema, btnPiP, btnRate, btnDraw, btnBookmark, btnChat, btnSubLog,
8471
- btnDebug, btnHideSite, btnSettings, settingsModal, btnTune, tunePanel, chatPanel, chatMessages, chatInput, chatJumpBtn, subLogPanel, subLogMessages,
8561
+ btnDebug, btnHideSite, btnChatLog, btnSettings, settingsModal, btnTune, tunePanel, chatPanel, chatMessages, chatInput, chatJumpBtn, subLogPanel, subLogMessages,
8472
8562
  subLogJumpBtn, drawCanvas, manualModal, transModal, toast, debugJumpBtn, syncBubble: null,
8473
8563
  pinError, guestInput, pinHint, pinDisplay, pinCopyBtn, hostBtn, connectBtn, btnInvite, typingRow, nickInput
8474
8564
  };
@@ -8724,7 +8814,6 @@
8724
8814
  };
8725
8815
 
8726
8816
  btnCinema.onclick = () => { triggerHaptic(); CINEMA.toggle(); };
8727
- btnAutoCinema.onclick = () => { triggerHaptic(); AUTO_CINEMA.setSite(!AUTO_CINEMA.enabled()); };
8728
8817
  btnPiP.onclick = async () => {
8729
8818
  let video = STATE.video;
8730
8819
  if (!video || video.readyState === 0) {
@@ -8747,7 +8836,6 @@
8747
8836
  INK.start();
8748
8837
  };
8749
8838
  btnBookmark.onclick = () => addBookmark();
8750
- btnHideSite.onclick = () => setFabHiddenOnSite(true);
8751
8839
 
8752
8840
  setupCanvasLogic();
8753
8841
  resetIdleTimer(true);
@@ -8773,6 +8861,7 @@
8773
8861
  if (hidden) UI_GATE.forced = false;
8774
8862
  STORE.set('nxu_hide_fab_' + HOST, !!hidden);
8775
8863
  uiElements.uiWrapper?.classList.toggle('site-hidden', !!hidden);
8864
+ uiElements.btnHideSite?.paint?.();
8776
8865
  try { ROTATE._tick(); } catch (_) { }
8777
8866
  if (hidden) {
8778
8867
  toggleDock(false);
@@ -8940,50 +9029,19 @@
8940
9029
  return first.length <= 16 && /\p{Extended_Pictographic}|\p{Regional_Indicator}/u.test(first) ? first : '';
8941
9030
  }
8942
9031
 
8943
- // An avatar: one emoji, or one or two letters/digits (initials).
8944
- function safeAvatar(s) {
8945
- const e = safeEmoji(s);
8946
- if (e) return e;
8947
- const str = String(s || '').trim();
8948
- return /^[\p{L}\p{N}]{1,2}$/u.test(str) ? str.toUpperCase() : '';
8949
- }
8950
-
8951
- // Photo avatars of the others: announced by a short fingerprint in presence, fetched
8952
- // once by message, kept for the session.
8953
- const AVATAR_IMG = {
8954
- cache: new Map(), // uid → { h, img }
8955
- _asked: new Map(),
8956
- get(uid) {
8957
- if (uid === STATE.userId) return PROFILE.image();
8958
- const want = STATE.presenceMap?.[uid]?.avh || STATE.sleepingMap?.[uid]?.avh || '';
8959
- const c = this.cache.get(uid);
8960
- if (!want) return '';
8961
- if (c && c.h === want) return c.img;
8962
- if (Date.now() - (this._asked.get(uid + want) || 0) > 20000) { this._asked.set(uid + want, Date.now()); SOCIAL.send('avatar', { op: 'req', who: uid }); }
8963
- return '';
8964
- },
8965
- mine() { const img = PROFILE.image(); if (img && SOCIAL.live()) SOCIAL.send('avatar', { op: 'img', h: PROFILE.imageHash(), img }); },
8966
- onRemote(d) {
8967
- if (d.op === 'req' && d.who === STATE.userId) { if (Date.now() - (this._sentAt || 0) > 5000) { this._sentAt = Date.now(); this.mine(); } return; }
8968
- if (d.op === 'img' && typeof d.img === 'string' && /^data:image\/jpeg;base64,[A-Za-z0-9+/=]+$/.test(d.img) && d.img.length < 40000 && typeof d.h === 'string') {
8969
- this.cache.set(d.uid, { h: d.h, img: d.img });
8970
- updatePresenceUI();
8971
- }
8972
- }
8973
- };
9032
+ // An avatar: one emoji.
9033
+ function safeAvatar(s) { return safeEmoji(s); }
8974
9034
 
8975
- // What reaches this device from the others, and from whom: kinds of events can be turned
8976
- // off, a person can be muted for this room, and floods of reactions are thinned out.
9035
+ // Photo avatars were removed (1.6.0): older devices may still announce or send one; it is ignored.
9036
+ const AVATAR_IMG = { get() { return ''; }, mine() { }, onRemote() { } };
9037
+
9038
+ // Everything the others send (reactions, nudges, sketches, bubbles, pointers) always
9039
+ // reaches a connected device — those are the point of watching together. Only floods of
9040
+ // reactions are thinned out.
8977
9041
  const SAFETY = {
8978
- KINDS: ['react', 'nudge', 'ink', 'chat', 'ping'],
8979
9042
  muted: new Set(),
8980
- receive(kind) { return STORE.get('nxu_recv_' + kind, true) !== false; },
8981
- set(kind, on) { STORE.set('nxu_recv_' + kind, !!on); },
8982
- allows(uid, kind) {
8983
- if (uid && this.muted.has(uid)) return false;
8984
- return !kind || this.receive(kind);
8985
- },
8986
- toggleMute(uid) { if (this.muted.has(uid)) this.muted.delete(uid); else this.muted.add(uid); },
9043
+ receive() { return true; },
9044
+ allows() { return true; },
8987
9045
  _rate: new Map(),
8988
9046
  // More than 6 reactions a second from one person: the rest are not shown.
8989
9047
  flood(uid, max = 6) {
@@ -8999,6 +9057,7 @@
8999
9057
  // The eight reaction buttons: the user's own choice (any emoji), or the defaults.
9000
9058
  const REACTIONS = {
9001
9059
  DEFAULT: ['😂', '😭', '😡', '💦', '🍪', '☕', '😘', '🖕'],
9060
+ PALETTE: ['❤️', '🔥', '👏', '🤣', '😱', '😍', '🥺', '🤯', '👀', '💀', '🙏', '👍', '🎉', '💯', '😴', '🤔', '🍿', '😂', '😭', '😡', '💦', '🍪', '☕', '😘'],
9002
9061
  MAX: 16,
9003
9062
  list() {
9004
9063
  const saved = STORE.get('nxu_reactions', null);
@@ -9048,7 +9107,7 @@
9048
9107
  };
9049
9108
 
9050
9109
  const PROFILE = {
9051
- SWATCHES: ['#69f0ae', '#40c4ff', '#7c4dff', '#ff4fa3', '#ff6e40', '#ffd740', '#b2ff59', '#18ffff', '#ea80fc', '#ff8a80'],
9110
+ SWATCHES: ['#69f0ae', '#40c4ff', '#7c4dff', '#ff4fa3', '#ff6e40', '#ffd740', '#ea80fc'],
9052
9111
  color() {
9053
9112
  const c = String(STORE.get('nxu_color', '') || '');
9054
9113
  return /^#[0-9a-f]{6}$/i.test(c) ? c : generateUserColor(STATE.userId);
@@ -9062,41 +9121,14 @@
9062
9121
  },
9063
9122
  // What this device announces in the room (presence): name, colour, avatar, status.
9064
9123
  value() {
9065
- return { ts: Date.now(), color: STATE.color, viewer: !!STATE.isViewer, nick: STATE.nickname || '', av: this.avatar(), avh: this.imageHash(), st: this.status(), md: TUNE.mediaSig(), v: NXU_VERSION, r: NXU_RANK, sess: NXU_SESSION, hid: !!document.hidden };
9124
+ return { ts: Date.now(), color: STATE.color, viewer: !!STATE.isViewer, nick: STATE.nickname || '', av: this.avatar(), md: TUNE.mediaSig(), v: NXU_VERSION, r: NXU_RANK, sess: NXU_SESSION, hid: !!document.hidden };
9066
9125
  },
9067
- AVATARS: ['🙂', '😎', '🦊', '🐱', '🐶', '🐯', '🐵', '🐼', '🐸', '🦄', '🐧', '🍿', '🎧', '🌙', '🔥', '🌸', '👾', '🤖'],
9126
+ AVATARS: ['🙂', '😎', '🥳', '🤠', '👻', '👾', '🤖', '🎃', '🦊', '🐱', '🐶', '🐯', '🐵', '🐼', '🐸', '🐰', '🐻', '🐨', '🦁', '🐧', '🦄', '🐙', '🍿', '🎧'],
9068
9127
  avatar() { return safeAvatar(STORE.get('nxu_avatar', '')); },
9069
- // A photo avatar travels once (and on request), not in every presence note.
9070
- image() { const v = String(STORE.get('nxu_avatar_img', '') || ''); return /^data:image\/jpeg;base64,[A-Za-z0-9+/=]+$/.test(v) && v.length < 40000 ? v : ''; },
9071
- imageHash() { const v = this.image(); if (!v) return ''; let h = 0; for (let i = 0; i < v.length; i += 7) h = (h * 31 + v.charCodeAt(i)) | 0; return (h >>> 0).toString(36) + v.length.toString(36); },
9072
- setImage(dataUrl) { STORE.set('nxu_avatar_img', dataUrl || ''); AVATAR_IMG.mine(); this.publish(); updatePresenceUI(); },
9073
- async pickImage() {
9074
- const input = document.createElement('input');
9075
- input.type = 'file'; input.accept = 'image/*';
9076
- input.onchange = async () => {
9077
- const f = input.files?.[0];
9078
- if (!f) return;
9079
- try {
9080
- const url = URL.createObjectURL(f);
9081
- const img = await new Promise((res, rej) => { const i = new Image(); i.onload = () => res(i); i.onerror = rej; i.src = url; });
9082
- const c = document.createElement('canvas'); c.width = c.height = 96;
9083
- const s = Math.min(img.naturalWidth, img.naturalHeight);
9084
- c.getContext('2d').drawImage(img, (img.naturalWidth - s) / 2, (img.naturalHeight - s) / 2, s, s, 0, 0, 96, 96);
9085
- URL.revokeObjectURL(url);
9086
- let q = 0.82, out = c.toDataURL('image/jpeg', q);
9087
- while (out.length > 30000 && q > 0.4) { q -= 0.12; out = c.toDataURL('image/jpeg', q); }
9088
- this.setImage(out);
9089
- this._onImage?.();
9090
- } catch (_) { showToast(t('setAvatarFail')); }
9091
- };
9092
- input.click();
9093
- },
9094
- status() { return String(STORE.get('nxu_status', '') || '').replace(/\s+/g, ' ').trim().slice(0, 40); },
9128
+ image() { return ''; },
9129
+ imageHash() { return ''; },
9130
+ status() { return ''; },
9095
9131
  setAvatar(a) { STORE.set('nxu_avatar', safeAvatar(a)); this.publish(); updatePresenceUI(); },
9096
- setStatus(s) {
9097
- STORE.set('nxu_status', String(s || '').replace(/\s+/g, ' ').slice(0, 40));
9098
- clearTimeout(this._st); this._st = setTimeout(() => { this.publish(); updatePresenceUI(); }, 600);
9099
- },
9100
9132
  setName(name) {
9101
9133
  STATE.nickname = String(name || '').trim().slice(0, 16);
9102
9134
  STORE.set('nxu_nickname', STATE.nickname);
@@ -10097,9 +10129,13 @@
10097
10129
  const lang = panel.querySelector('.os-lang').value;
10098
10130
  STORE.set('nxu_os_lang', lang);
10099
10131
  out.replaceChildren(createEl('div', 'trans-help', t('osSearching')));
10132
+ const win = panel.closest('#os-panel') || panel;
10100
10133
  try {
10101
10134
  const list = await this.search({ query: q, season: +panel.querySelector('.os-season').value || 0, episode: +panel.querySelector('.os-episode').value || 0, lang });
10102
- if (!list.length) { out.replaceChildren(createEl('div', 'trans-help', t('osNone'))); return; }
10135
+ if (!list.length) { win.classList.remove('has-results'); out.replaceChildren(createEl('div', 'trans-help', t('osNone'))); return; }
10136
+ win.classList.add('has-results');
10137
+ requestAnimationFrame(() => clampPanelToViewport(win));
10138
+ out.scrollTop = 0;
10103
10139
  out.replaceChildren(...list.map(item => {
10104
10140
  const b = createEl('button', 'os-item', '', { type: 'button' });
10105
10141
  b.append(createEl('span', 'os-name', String(item.MovieReleaseName || item.SubFileName || item.MovieName || '').slice(0, 140)),
@@ -10134,7 +10170,7 @@
10134
10170
  go.onclick = () => this.run(body);
10135
10171
  [q, se, ep].forEach(i => i.addEventListener('keydown', (ev) => { ev.stopPropagation(); if (ev.key === 'Enter') this.run(body); }));
10136
10172
  const tm = createEl('div', 'os-tmdb');
10137
- body.append(q, tm, row, go, out, createEl('div', 'trans-help', t('osHint')));
10173
+ body.append(q, tm, row, go, out, createEl('div', 'trans-help os-hint', t('osHint')));
10138
10174
  return body;
10139
10175
  }
10140
10176
  };
@@ -10265,9 +10301,7 @@
10265
10301
  paintButton() {
10266
10302
  const b = uiElements.btnAutoCinema;
10267
10303
  if (!b) return;
10268
- const on = this.enabled();
10269
- b.textContent = '✨ ' + t(on ? 'autoCinemaBtnOn' : 'autoCinemaBtnOff');
10270
- b.classList.toggle('active', on);
10304
+ b.paint?.();
10271
10305
  },
10272
10306
  // One real video on the page, big enough, long enough — not a feed.
10273
10307
  _singleMedia() {
@@ -13240,7 +13274,7 @@
13240
13274
  if (uiElements.btnRate) uiElements.btnRate.style.display = hasMedia ? '' : 'none';
13241
13275
  updateRateButton();
13242
13276
  if (uiElements.btnCinema) uiElements.btnCinema.style.display = hasMedia || STATE.isCinema ? '' : 'none';
13243
- if (uiElements.btnAutoCinema) { uiElements.btnAutoCinema.style.display = hasMedia || STATE.isCinema ? '' : 'none'; AUTO_CINEMA.paintButton(); }
13277
+ if (uiElements.btnAutoCinema) AUTO_CINEMA.paintButton();
13244
13278
  if (uiElements.btnBookmark) uiElements.btnBookmark.style.display = 'none';
13245
13279
  if (uiElements.btnFindMedia) uiElements.btnFindMedia.style.display = hasMedia ? 'none' : '';
13246
13280
  if (uiElements.btnLink) uiElements.btnLink.style.display = hasMedia || connected ? '' : 'none';
@@ -13254,6 +13288,7 @@
13254
13288
  const showSubLog = connected || TRANSLATOR.active || hasHistory;
13255
13289
  ['btnSyncStatus', 'btnDraw', 'btnChat', 'btnInvite', 'btnTune'].forEach(key => { if (uiElements[key]) uiElements[key].style.display = show; });
13256
13290
  if (uiElements.btnSubLog) uiElements.btnSubLog.style.display = showSubLog ? '' : 'none';
13291
+ if (uiElements.btnChatLog) uiElements.btnChatLog.style.display = connected || uiElements.chatMessages?.childElementCount ? '' : 'none';
13257
13292
  if (!connected) {
13258
13293
  if (STATE.chatActive) {
13259
13294
  STATE.chatActive = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kangsicj/nexussync",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Watch-together userscript: media sync, cinema mode, live AI subtitles, chat bubbles and quick ink for Tampermonkey and iOS Userscripts.",
5
5
  "keywords": [
6
6
  "userscript",