@kangsicj/nexussync 1.6.7 → 1.6.9
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 +5 -5
- package/dist/NexusSync.meta.js +3 -3
- package/dist/NexusSync.user.js +100 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
## Quick start
|
|
21
21
|
|
|
22
|
-
1. Install [`NexusSync.user.js`](https://
|
|
22
|
+
1. Install [`NexusSync.user.js`](https://unpkg.com/@kangsicj/nexussync@latest/dist/NexusSync.user.js) in Violentmonkey, Tampermonkey or Userscripts.
|
|
23
23
|
2. Open the same video on each device → **⚙️ → 🔗 Connect** → one device taps **Create a room**.
|
|
24
24
|
3. Other devices enter the 6-digit PIN.
|
|
25
25
|
|
|
@@ -32,17 +32,17 @@
|
|
|
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;
|
|
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 |
|
|
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
|
-
| Next episode | Room persists across episodes; *Up next* countdown |
|
|
39
|
-
| Privacy | End-to-end encrypted rooms, PIN to join, rooms deleted after everyone leaves |
|
|
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) |
|
|
39
|
+
| Privacy | End-to-end encrypted rooms, PIN or invite link to join, rooms deleted after everyone leaves |
|
|
40
40
|
|
|
41
41
|
## Installation
|
|
42
42
|
|
|
43
43
|
| Platform | Manager | Steps |
|
|
44
44
|
| --- | --- | --- |
|
|
45
|
-
| Windows · macOS · Linux | [Violentmonkey](https://violentmonkey.github.io/) or [Tampermonkey](https://www.tampermonkey.net/) | Open the [install link](https://
|
|
45
|
+
| Windows · macOS · Linux | [Violentmonkey](https://violentmonkey.github.io/) or [Tampermonkey](https://www.tampermonkey.net/) | Open the [install link](https://unpkg.com/@kangsicj/nexussync@latest/dist/NexusSync.user.js) → **Install** |
|
|
46
46
|
| iPhone · iPad | [Userscripts](https://apps.apple.com/app/userscripts/id1463298887) (Safari) | Open the install link in Safari → **Install** |
|
|
47
47
|
| Android | Violentmonkey or Tampermonkey (Firefox, Edge) | Same as desktop |
|
|
48
48
|
|
package/dist/NexusSync.meta.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
// @homepageURL https://github.com/kangsicj/NexusSync
|
|
7
7
|
// @supportURL https://fairy.hada.io/@kangsicj
|
|
8
8
|
// @icon https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/assets/icon.svg
|
|
9
|
-
// @updateURL https://
|
|
10
|
-
// @downloadURL https://
|
|
11
|
-
// @version 1.6.
|
|
9
|
+
// @updateURL https://unpkg.com/@kangsicj/nexussync@latest/dist/NexusSync.meta.js
|
|
10
|
+
// @downloadURL https://unpkg.com/@kangsicj/nexussync@latest/dist/NexusSync.user.js
|
|
11
|
+
// @version 1.6.9
|
|
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
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
// @homepageURL https://github.com/kangsicj/NexusSync
|
|
7
7
|
// @supportURL https://fairy.hada.io/@kangsicj
|
|
8
8
|
// @icon https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/assets/icon.svg
|
|
9
|
-
// @updateURL https://
|
|
10
|
-
// @downloadURL https://
|
|
11
|
-
// @version 1.6.
|
|
9
|
+
// @updateURL https://unpkg.com/@kangsicj/nexussync@latest/dist/NexusSync.meta.js
|
|
10
|
+
// @downloadURL https://unpkg.com/@kangsicj/nexussync@latest/dist/NexusSync.user.js
|
|
11
|
+
// @version 1.6.9
|
|
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.9';
|
|
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.9';
|
|
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=';
|
|
@@ -747,6 +747,7 @@ async function handle(m) {
|
|
|
747
747
|
hiddenOnSite: '🙈 ⚙️ button hidden on this site · turn it back on in Settings or with Alt+Shift+N', shownOnSite: '⚙️ Button shown on this site',
|
|
748
748
|
roomChat: 'Room Chat', chatLog: 'Chat history', chatCleared: '🧹 Chat history cleared', nickname: 'Nickname (optional)', chatPlaceholder: 'Message…', newMessages: 'New', latest: 'Latest',
|
|
749
749
|
subHistory: 'Subtitle History', export: 'Export', clear: 'Clear', logCleared: '🧹 Subtitle history cleared', logExported: '💾 Subtitle history exported',
|
|
750
|
+
inviteLink: 'Invite link', inviteLinkCopied: 'Invite link copied — send it to your friend', inviteShareText: 'Watch with me on NexusSync', invitedHint: 'You were invited — tap Join.', sleepTitle: 'Sleep timer', sleepNone: 'Off', sleepMin: '{n} min', sleepEnd: 'End of this episode', sleepSet: 'Pauses in {n} min', sleepEndSet: 'Pauses at the end of this episode', sleepOff: 'Sleep timer off', sleepLeft: '{n} min left', sleepSoon: 'Pausing in 10 seconds (sleep timer)', sleepDone: 'Paused by the sleep timer. Good night!',
|
|
750
751
|
createRoom: 'Create a room', copyPin: 'Copy PIN', enterPin: 'Enter PIN', joinRoom: 'Join Room', viewerMode: 'Viewer mode (follow without controlling)',
|
|
751
752
|
aiSubSettings: 'AI Subtitles', debugConsole: 'Debug Console', uiHide: 'Auto-hide', keepOpen: 'Keep open',
|
|
752
753
|
bmLibrary: 'Bookmarks', bmAddHere: 'Bookmark this moment', bmSearch: 'Search bookmarks', bmEmpty: 'No bookmarks yet. Tap “Bookmark this moment” while watching.', bmLive: 'LIVE', bmOpening: '📌 Opening the bookmark…', bmJumped: '📌 Back to {time}', bmLiveOpened: '🔴 Playing the live stream', bmDelete: 'Delete', bmThisPage: 'this page', bmCopy: 'Copy link', bmCopied: '📋 Link copied',
|
|
@@ -867,6 +868,7 @@ async function handle(m) {
|
|
|
867
868
|
hiddenOnSite: '🙈 이 사이트에서 ⚙️ 버튼을 숨겼어요 · 설정이나 Alt+Shift+N으로 다시 켤 수 있어요', shownOnSite: '⚙️ 이 사이트에서 버튼 표시',
|
|
868
869
|
roomChat: '방 채팅', chatLog: '채팅 기록', chatCleared: '🧹 채팅 기록을 지웠어요', nickname: '닉네임 (선택)', chatPlaceholder: '메시지…', newMessages: '새 메시지', latest: '최신',
|
|
869
870
|
subHistory: '자막 기록', export: '내보내기', clear: '지우기', logCleared: '🧹 자막 기록을 지웠습니다', logExported: '💾 자막 기록을 저장했습니다',
|
|
871
|
+
inviteLink: '초대 링크', inviteLinkCopied: '초대 링크를 복사했어요 — 친구에게 보내 주세요', inviteShareText: 'NexusSync로 같이 봐요', invitedHint: '초대받았어요 — 참가를 누르세요.', sleepTitle: '취침 타이머', sleepNone: '끄기', sleepMin: '{n}분', sleepEnd: '이번 화 끝나면', sleepSet: '{n}분 뒤 일시정지해요', sleepEndSet: '이번 화가 끝나면 일시정지해요', sleepOff: '취침 타이머를 껐어요', sleepLeft: '{n}분 남음', sleepSoon: '10초 뒤 일시정지해요 (취침 타이머)', sleepDone: '취침 타이머로 일시정지했어요. 잘 자요!',
|
|
870
872
|
createRoom: '방 만들기', copyPin: 'PIN 복사', enterPin: 'PIN 입력', joinRoom: '방 참여', viewerMode: '시청자 모드 (조작 없이 따라보기)',
|
|
871
873
|
aiSubSettings: 'AI 자막', debugConsole: '디버그 콘솔', uiHide: '자동 숨김', keepOpen: '고정',
|
|
872
874
|
bmLibrary: '북마크', bmAddHere: '지금 장면 북마크', bmSearch: '북마크 검색', bmEmpty: '아직 북마크가 없어요. 보는 중에 “지금 장면 북마크”를 눌러 보세요.', bmLive: '라이브', bmOpening: '📌 북마크를 여는 중…', bmJumped: '📌 {time}(으)로 돌아왔어요', bmLiveOpened: '🔴 라이브 방송을 바로 재생해요', bmDelete: '삭제', bmThisPage: '이 페이지', bmCopy: '링크 복사', bmCopied: '📋 링크를 복사했어요',
|
|
@@ -1433,8 +1435,11 @@ async function handle(m) {
|
|
|
1433
1435
|
else (doc.body || doc.documentElement).appendChild(layer);
|
|
1434
1436
|
root.classList.add('nxu-ambient-on');
|
|
1435
1437
|
this._matchLayerZ(layer, root);
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
+
// Reading a video frame is the costly part (it was almost all of cinema's CPU time at
|
|
1439
|
+
// 16 a second). Six a second with a stronger blend looks the same: the glow eases
|
|
1440
|
+
// between scenes anyway, and a cut still shows within a fraction of a second.
|
|
1441
|
+
const gap = lite ? 220 : 160; // ms between samples (≈4.5 / 6 per second)
|
|
1442
|
+
const blend = lite ? 0.45 : 0.35; // share of the new frame
|
|
1438
1443
|
let last = 0, drawn = false, visible = true;
|
|
1439
1444
|
const draw = (hard) => {
|
|
1440
1445
|
if (!visible || doc.hidden || video.readyState < 2 || !video.videoWidth) return;
|
|
@@ -9075,6 +9080,13 @@ async function handle(m) {
|
|
|
9075
9080
|
pinDisplay.style.display = 'none';
|
|
9076
9081
|
const pinCopyBtn = createEl('button', 'btn subtle', '📋 ' + t('copyPin'));
|
|
9077
9082
|
pinCopyBtn.style.display = 'none';
|
|
9083
|
+
// An invite link: this page with the PIN; opened by someone with NexusSync, the join
|
|
9084
|
+
// window comes up with the PIN filled in (one tap). Same secret as telling the PIN.
|
|
9085
|
+
const pinLinkBtn = createEl('button', 'btn subtle', '🔗 ' + t('inviteLink'), { type: 'button', id: 'nxu-invite-link' });
|
|
9086
|
+
pinLinkBtn.style.display = 'none';
|
|
9087
|
+
new MutationObserver(() => { pinLinkBtn.style.display = pinCopyBtn.style.display; }).observe(pinCopyBtn, { attributes: true, attributeFilter: ['style'] });
|
|
9088
|
+
const pinRow = createEl('div', 'nx-btn-row');
|
|
9089
|
+
pinRow.append(pinCopyBtn, pinLinkBtn);
|
|
9078
9090
|
const guestInput = createEl('input', 'pin-input', '', { placeholder: t('enterPin'), maxlength: '6', type: 'text', inputmode: 'numeric', pattern: '[0-9]*', autocomplete: 'off' });
|
|
9079
9091
|
guestInput.addEventListener('keydown', e => { if (e.key === 'Enter') connectBtn.click(); });
|
|
9080
9092
|
const connectBtn = createEl('button', 'btn primary', '🚀 ' + t('joinRoom'));
|
|
@@ -9085,7 +9097,7 @@ async function handle(m) {
|
|
|
9085
9097
|
pinError.setAttribute('role', 'alert');
|
|
9086
9098
|
guestInput.addEventListener('input', () => { pinError.textContent = ''; guestInput.classList.remove('bad'); });
|
|
9087
9099
|
const pinHint = createEl('div', 'pin-hint');
|
|
9088
|
-
manualBody.append(hostBtn, pinHint, pinDisplay,
|
|
9100
|
+
manualBody.append(hostBtn, pinHint, pinDisplay, pinRow, createEl('hr', 'divider'), guestInput, pinError, connectBtn, viewerRow);
|
|
9089
9101
|
manualModal.append(manualHeader, manualBody);
|
|
9090
9102
|
|
|
9091
9103
|
// AI subtitles settings
|
|
@@ -9312,6 +9324,22 @@ async function handle(m) {
|
|
|
9312
9324
|
else fallback();
|
|
9313
9325
|
};
|
|
9314
9326
|
|
|
9327
|
+
pinLinkBtn.onclick = async () => {
|
|
9328
|
+
const pin = pinDisplay.textContent;
|
|
9329
|
+
if (!/^\d{6}$/.test(pin)) return;
|
|
9330
|
+
const link = location.href.split('#')[0] + '#nxu-join=' + pin;
|
|
9331
|
+
try {
|
|
9332
|
+
if (IS_TOUCH && navigator.share) { await navigator.share({ title: 'NexusSync', text: t('inviteShareText'), url: link }); return; }
|
|
9333
|
+
await navigator.clipboard.writeText(link);
|
|
9334
|
+
showToast('🔗 ' + t('inviteLinkCopied'));
|
|
9335
|
+
} catch (err) {
|
|
9336
|
+
if (err?.name === 'AbortError') return;
|
|
9337
|
+
const ta = document.createElement('textarea'); ta.value = link; document.body.appendChild(ta); ta.select();
|
|
9338
|
+
try { document.execCommand('copy'); showToast('🔗 ' + t('inviteLinkCopied')); } catch (_) { }
|
|
9339
|
+
ta.remove();
|
|
9340
|
+
}
|
|
9341
|
+
};
|
|
9342
|
+
|
|
9315
9343
|
// Invite more people (any participant): a new PIN for the same room.
|
|
9316
9344
|
btnInvite.onclick = async () => {
|
|
9317
9345
|
if (!STATE.handshakeVerified && STATE.role !== 'HOST') return;
|
|
@@ -9438,6 +9466,18 @@ async function handle(m) {
|
|
|
9438
9466
|
updateDockMenuState();
|
|
9439
9467
|
installFullscreenRedirect();
|
|
9440
9468
|
logDebug(`NexusSync v${NXU_VERSION} ready.`, 'success');
|
|
9469
|
+
// Opened from an invite link: the join window with the PIN filled in.
|
|
9470
|
+
const invited = IS_TOP && /^#nxu-join=(\d{6})$/.exec(location.hash || '');
|
|
9471
|
+
if (invited) {
|
|
9472
|
+
try { history.replaceState(history.state, '', location.href.split('#')[0]); } catch (_) { }
|
|
9473
|
+
if (!STATE.handshakeVerified && STATE.role !== 'HOST') {
|
|
9474
|
+
openPanel(manualModal);
|
|
9475
|
+
guestInput.value = invited[1];
|
|
9476
|
+
pinHint.textContent = t('invitedHint');
|
|
9477
|
+
setTimeout(() => connectBtn.focus(), 200);
|
|
9478
|
+
logDebug('Opened from an invite link; the PIN is filled in.', 'info');
|
|
9479
|
+
}
|
|
9480
|
+
}
|
|
9441
9481
|
if (MANAGER_VERSION && MANAGER_VERSION !== NXU_VERSION) logDebug(`Userscript manager reports v${MANAGER_VERSION} (loader or stale metadata); running code is v${NXU_VERSION}.`, 'info');
|
|
9442
9482
|
}
|
|
9443
9483
|
|
|
@@ -11018,6 +11058,49 @@ async function handle(m) {
|
|
|
11018
11058
|
// button. Near the end of an episode in cinema mode a small card offers it, and when the
|
|
11019
11059
|
// episode ends it counts down and moves on (in a room: everyone is invited along, and
|
|
11020
11060
|
// this device comes back into the same room on the next page).
|
|
11061
|
+
// 😴 Sleep timer: pauses after a while or at the end of this episode (and then does not
|
|
11062
|
+
// start the next one). The pause goes to everyone in the room like any pause.
|
|
11063
|
+
const SLEEP = {
|
|
11064
|
+
at: 0, endOfEp: false, _warned: false,
|
|
11065
|
+
set(minutes) {
|
|
11066
|
+
this.endOfEp = minutes === 'end';
|
|
11067
|
+
this.at = typeof minutes === 'number' && minutes > 0 ? Date.now() + minutes * 60000 : 0;
|
|
11068
|
+
this._warned = false;
|
|
11069
|
+
if (minutes) showToast('😴 ' + (this.endOfEp ? t('sleepEndSet') : t('sleepSet', { n: minutes })));
|
|
11070
|
+
else showToast('😴 ' + t('sleepOff'));
|
|
11071
|
+
},
|
|
11072
|
+
active() { return this.endOfEp || this.at > 0; },
|
|
11073
|
+
label() {
|
|
11074
|
+
if (this.endOfEp) return t('sleepEnd');
|
|
11075
|
+
if (!this.at) return '';
|
|
11076
|
+
const m = Math.max(0, Math.ceil((this.at - Date.now()) / 60000));
|
|
11077
|
+
return t('sleepLeft', { n: m });
|
|
11078
|
+
},
|
|
11079
|
+
blocksNext() { return this.endOfEp; },
|
|
11080
|
+
_fire() {
|
|
11081
|
+
const info = currentMediaInfo();
|
|
11082
|
+
if (info?.el && !info.el.paused) { try { info.el.pause(); } catch (_) { } }
|
|
11083
|
+
showToast('😴 ' + t('sleepDone'));
|
|
11084
|
+
logDebug('Sleep timer: paused.', 'info');
|
|
11085
|
+
this.at = 0; this.endOfEp = false; this._warned = false;
|
|
11086
|
+
},
|
|
11087
|
+
tick() {
|
|
11088
|
+
if (!this.active()) return;
|
|
11089
|
+
if (this.at) {
|
|
11090
|
+
const left = this.at - Date.now();
|
|
11091
|
+
if (left <= 10000 && !this._warned) { this._warned = true; showToast('😴 ' + t('sleepSoon')); }
|
|
11092
|
+
if (left <= 0) this._fire();
|
|
11093
|
+
return;
|
|
11094
|
+
}
|
|
11095
|
+
const info = currentMediaInfo();
|
|
11096
|
+
if (!info || !Number.isFinite(info.duration) || info.duration < 60) return;
|
|
11097
|
+
const left = info.duration - info.time;
|
|
11098
|
+
if (left <= 10 && left > 1.2 && !this._warned) { this._warned = true; showToast('😴 ' + t('sleepSoon')); }
|
|
11099
|
+
if (left <= 1.2 || (info.kind === 'video' && info.el.ended)) this._fire();
|
|
11100
|
+
}
|
|
11101
|
+
};
|
|
11102
|
+
setInterval(() => { try { SLEEP.tick(); } catch (_) { } }, 1000);
|
|
11103
|
+
|
|
11021
11104
|
const NEXT_EP = {
|
|
11022
11105
|
_card: null,
|
|
11023
11106
|
_target: null,
|
|
@@ -11115,7 +11198,7 @@ async function handle(m) {
|
|
|
11115
11198
|
requestAnimationFrame(() => card.classList.add('in'));
|
|
11116
11199
|
}
|
|
11117
11200
|
this._card.querySelector('.nx-next-l').textContent = target.label && target.label.length > 2 ? target.label : t('nextEpGo');
|
|
11118
|
-
if (ended && !this._count && this.enabled()) {
|
|
11201
|
+
if (ended && !this._count && this.enabled() && !SLEEP.blocksNext()) {
|
|
11119
11202
|
let left = 8;
|
|
11120
11203
|
const ring = this._card.querySelector('.nx-next-ring');
|
|
11121
11204
|
this._card.classList.add('counting');
|
|
@@ -12770,11 +12853,18 @@ async function handle(m) {
|
|
|
12770
12853
|
menu.dataset.kind = 'rate';
|
|
12771
12854
|
if (!open) return;
|
|
12772
12855
|
const current = currentPlaybackRate();
|
|
12856
|
+
const sleepItem = (label, value, sel) => {
|
|
12857
|
+
const b = createEl('button', sel ? 'sel' : '', label, { type: 'button', role: 'menuitemradio' });
|
|
12858
|
+
b.onclick = (ev) => { ev.stopPropagation(); SLEEP.set(value); this.toggleRateMenu(false); this._poke(); };
|
|
12859
|
+
return b;
|
|
12860
|
+
};
|
|
12773
12861
|
menu.replaceChildren(createEl('div', 'cc-menu-title', t('ccSpeed')), ...[0.5, 0.75, 1, 1.25, 1.5, 1.75, 2].map(r => {
|
|
12774
12862
|
const item = createEl('button', Math.abs(r - current) < 0.01 ? 'sel' : '', r === 1 ? t('ccNormal') : `${r}x`, { type: 'button', role: 'menuitemradio' });
|
|
12775
12863
|
item.onclick = () => { setSharedRate(r); this.toggleRateMenu(false); this._poke(); };
|
|
12776
12864
|
return item;
|
|
12777
|
-
}))
|
|
12865
|
+
}), createEl('div', 'cc-menu-title', '😴 ' + t('sleepTitle') + (SLEEP.active() ? ' · ' + SLEEP.label() : '')),
|
|
12866
|
+
sleepItem(t('sleepNone'), 0, !SLEEP.active()), sleepItem(t('sleepMin', { n: 15 }), 15, false), sleepItem(t('sleepMin', { n: 30 }), 30, false),
|
|
12867
|
+
sleepItem(t('sleepMin', { n: 60 }), 60, false), sleepItem(t('sleepEnd'), 'end', SLEEP.endOfEp));
|
|
12778
12868
|
resetIdleTimer(true);
|
|
12779
12869
|
},
|
|
12780
12870
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kangsicj/nexussync",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.9",
|
|
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",
|