@kangsicj/nexussync 1.6.12 → 1.6.13
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/dist/NexusSync.meta.js +1 -1
- package/dist/NexusSync.user.js +63 -15
- package/package.json +1 -1
package/dist/NexusSync.meta.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// @icon https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/assets/icon.svg
|
|
9
9
|
// @updateURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.meta.js
|
|
10
10
|
// @downloadURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.user.js
|
|
11
|
-
// @version 1.6.
|
|
11
|
+
// @version 1.6.13
|
|
12
12
|
// @description Watch any web video together in perfect sync: cinema mode, live AI subtitles & translation, chat bubbles with auto-translation, quick ink, cover, go-together to the next episode.
|
|
13
13
|
// @description:ko 어떤 웹 영상이든 완벽한 싱크로 함께 보기: 시네마 모드, 실시간 AI 자막·번역, 자동 번역 말풍선 채팅, 잠깐 그리기, 가리기, 다음 화도 함께.
|
|
14
14
|
// @match *://*/*
|
package/dist/NexusSync.user.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// @icon https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/assets/icon.svg
|
|
9
9
|
// @updateURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.meta.js
|
|
10
10
|
// @downloadURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.user.js
|
|
11
|
-
// @version 1.6.
|
|
11
|
+
// @version 1.6.13
|
|
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.13';
|
|
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.13';
|
|
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=';
|
|
@@ -764,7 +764,7 @@ async function handle(m) {
|
|
|
764
764
|
tuneSrcSame: '🟢 Same video on every device — kept in step automatically, frame by frame.', tuneSrcDiff: '🟠 Different versions (length differs by {s}) — the timing is found automatically after a little playing, or set it here.', tuneSrcUnknown: 'Waiting for the others’ video…', tuneSrcShifted: '🟠 Same length, but the scenes differ — the timing is lined up automatically while you play, or set it here.', tuneDiffPicture: 'Same time, but the pictures differ', tuneShiftFound: 'Same length but different scenes: timing set to {s} automatically (tap to undo).',
|
|
765
765
|
tuneSameReset: '⏱ Same video as the others: timing correction removed.', tuneAutoApplied: 'Different version: timing set to {s} automatically (tap to undo).', tuneSuggest: 'Your videos differ by {s}. Tap to line them up.',
|
|
766
766
|
subMenu: 'Subtitles', xsubOff: 'Off', subTrack: 'From the video', subSearch: '🔎 Find subtitles (OpenSubtitles)', subFile: '📂 Open a subtitle file…', subAi: '🧠 AI live subtitles', subDelay: 'Timing', subLater: 'later', subEarlier: 'earlier', xsubSize: 'Size',
|
|
767
|
-
subLoaded: '💬 Subtitles: {name}', subMulti: 'Several subtitles at once — tap one to take it away.', subNone: 'No subtitles found in this video.', subMoreLangs: '🌐 {n} more languages', subSiteOnly: 'This site loads that subtitle only from its own menu — switch to the site controls (top right) and pick it there.', subSuggest: '💬 No subtitles? Find them', subLoadFail: 'Could not load these subtitles.',
|
|
767
|
+
subLoaded: '💬 Subtitles: {name}', subMulti: 'Several subtitles at once — each dot is the colour of its lines on screen; tap one to take it away.', subNone: 'No subtitles found in this video.', subMoreLangs: '🌐 {n} more languages', subSiteOnly: 'This site loads that subtitle only from its own menu — switch to the site controls (top right) and pick it there.', subSuggest: '💬 No subtitles? Find them', subLoadFail: 'Could not load these subtitles.',
|
|
768
768
|
osTitle: 'Find subtitles', osTmdbLooking: 'Looking up the English title on TMDB…', osTmdbNone: 'No English title found on TMDB — type it yourself if you know it.', osQuery: 'Title (English titles work best)', osSeason: 'Season', osEpisode: 'Episode', osLang: 'Language', osSearch: 'Search', osSearching: 'Searching…', osNone: 'Nothing found. Try the English title, or remove the year.', osError: 'OpenSubtitles did not answer. Try again in a moment.', osDownloads: '{n} downloads', osLoading: 'Loading…', osHint: 'Subtitles come from OpenSubtitles.org and are shown in NexusSync’s own style; use “Timing” in the subtitle menu if they are early or late.',
|
|
769
769
|
viewMenu: 'Picture', viewAudio: 'Soundtrack', viewBright: 'Brightness', viewBoost: 'Volume boost', viewReset: 'Reset', boostBlocked: 'This video’s sound cannot be boosted here (it comes from another site).',
|
|
770
770
|
settings: 'Settings', setProfile: 'Profile', setAvatar: 'Avatar', setStatus: 'Status message', setStatusPh: 'e.g. Popcorn ready 🍿', setReactions: 'My reactions',
|
|
@@ -889,7 +889,7 @@ async function handle(m) {
|
|
|
889
889
|
tuneSrcSame: '🟢 모두 같은 영상이에요 — 프레임 단위로 자동으로 맞추고 있어요.', tuneSrcDiff: '🟠 서로 다른 버전이에요 (길이 차이 {s}) — 잠시 재생하면 자동으로 맞추고, 여기서 직접 맞출 수도 있어요.', tuneSrcUnknown: '다른 사람의 영상 정보를 기다리는 중…', tuneSrcShifted: '🟠 길이는 같지만 장면이 달라요 — 재생하는 동안 자동으로 맞추고, 여기서 직접 맞출 수도 있어요.', tuneDiffPicture: '시간은 같지만 화면이 달라요', tuneShiftFound: '길이는 같지만 장면이 달라서 타이밍을 {s} 자동 보정했어요 (누르면 되돌리기).',
|
|
890
890
|
tuneSameReset: '⏱ 상대와 같은 영상이라 타이밍 보정을 해제했어요.', tuneAutoApplied: '다른 버전이라 타이밍을 {s} 자동 보정했어요 (누르면 되돌리기).', tuneSuggest: '서로 영상 길이가 {s} 달라요. 눌러서 맞춰 보세요.',
|
|
891
891
|
subMenu: '자막', xsubOff: '끄기', subTrack: '영상에 포함된 자막', subSearch: '🔎 자막 찾기 (OpenSubtitles)', subFile: '📂 자막 파일 열기…', subAi: '🧠 AI 실시간 자막', subDelay: '싱크', subLater: '늦게', subEarlier: '빠르게', xsubSize: '크기',
|
|
892
|
-
subLoaded: '💬 자막: {name}', subMulti: '자막 여러 개를 함께 보는 중 — 누르면 그 자막만 꺼져요.', subNone: '이 영상에는 포함된 자막이 없어요.', subMoreLangs: '🌐 다른 언어 {n}개 더 보기', subSiteOnly: '이 사이트는 자기 메뉴에서만 이 자막을 불러와요. 오른쪽 위에서 사이트 컨트롤로 바꾼 뒤 거기서 골라 주세요.', subSuggest: '💬 자막이 없나요? 찾아보기', subLoadFail: '자막을 불러오지 못했어요.',
|
|
892
|
+
subLoaded: '💬 자막: {name}', subMulti: '자막 여러 개를 함께 보는 중 — 점 색이 화면 자막 색이에요. 누르면 그 자막만 꺼져요.', subNone: '이 영상에는 포함된 자막이 없어요.', subMoreLangs: '🌐 다른 언어 {n}개 더 보기', subSiteOnly: '이 사이트는 자기 메뉴에서만 이 자막을 불러와요. 오른쪽 위에서 사이트 컨트롤로 바꾼 뒤 거기서 골라 주세요.', subSuggest: '💬 자막이 없나요? 찾아보기', subLoadFail: '자막을 불러오지 못했어요.',
|
|
893
893
|
osTitle: '자막 찾기', osTmdbLooking: 'TMDB에서 영어 제목을 찾는 중…', osTmdbNone: 'TMDB에서 영어 제목을 찾지 못했어요 — 알고 있다면 직접 입력하세요.', osQuery: '제목 (영어 제목이 가장 잘 찾아져요)', osSeason: '시즌', osEpisode: '회차', osLang: '언어', osSearch: '검색', osSearching: '찾는 중…', osNone: '찾지 못했어요. 영어 제목으로 바꾸거나 연도를 빼 보세요.', osError: 'OpenSubtitles가 응답하지 않아요. 잠시 후 다시 시도하세요.', osDownloads: '다운로드 {n}회', osLoading: '불러오는 중…', osHint: '자막은 OpenSubtitles.org에서 가져와 NexusSync 스타일로 보여 줘요. 빠르거나 늦으면 자막 메뉴의 “싱크”로 맞추세요.',
|
|
894
894
|
viewMenu: '화면', viewAudio: '오디오 트랙', viewBright: '밝기', viewBoost: '볼륨 부스트', viewReset: '초기화', boostBlocked: '이 영상은 다른 사이트에서 오는 소리라 여기서 키울 수 없어요.',
|
|
895
895
|
settings: '설정', setProfile: '프로필', setAvatar: '아바타', setStatus: '상태 메시지', setStatusPh: '예: 팝콘 준비 완료 🍿', setReactions: '내 리액션',
|
|
@@ -1419,12 +1419,13 @@ async function handle(m) {
|
|
|
1419
1419
|
nexusControls() { return IS_TOP ? cinemaControlsMode() !== 'site' : this._frameNexus === true; },
|
|
1420
1420
|
_startAmbient(video, root) {
|
|
1421
1421
|
this._stopAmbient();
|
|
1422
|
+
this._ambientPaused = false;
|
|
1422
1423
|
if (!video || !root || !this.ambientEnabled()) return;
|
|
1423
1424
|
try { if (video.mediaKeys || video.webkitKeys) return; } catch (_) { } // DRM video always draws black
|
|
1424
1425
|
const doc = video.ownerDocument;
|
|
1425
1426
|
if (root.getRootNode() !== doc) return; // player inside a site's shadow DOM: our styles can't reach it
|
|
1426
1427
|
const seeThrough = this._seeThrough(video, root);
|
|
1427
|
-
if (seeThrough) { logDebug('Ambient light off for this player: ' + seeThrough, 'info'); return; }
|
|
1428
|
+
if (seeThrough) { logDebug('Ambient light off for this player: ' + seeThrough, 'info'); this._ambientPaused = true; return; }
|
|
1428
1429
|
const view = doc.defaultView || window;
|
|
1429
1430
|
const lite = IS_TOUCH;
|
|
1430
1431
|
const layer = doc.createElement('div');
|
|
@@ -1446,6 +1447,8 @@ async function handle(m) {
|
|
|
1446
1447
|
else (doc.body || doc.documentElement).appendChild(layer);
|
|
1447
1448
|
root.classList.add('nxu-ambient-on');
|
|
1448
1449
|
this._matchLayerZ(layer, root);
|
|
1450
|
+
const cleared = new Map();
|
|
1451
|
+
this._clearBackdrops(video, root, cleared);
|
|
1449
1452
|
// Reading a video frame is the costly part (it was almost all of cinema's CPU time at
|
|
1450
1453
|
// 16 a second). Six a second with a stronger blend looks the same: the glow eases
|
|
1451
1454
|
// between scenes anyway, and a cut still shows within a fraction of a second.
|
|
@@ -1508,7 +1511,26 @@ async function handle(m) {
|
|
|
1508
1511
|
stopped = true;
|
|
1509
1512
|
if (rvfc && frameHandle) { try { video.cancelVideoFrameCallback(frameHandle); } catch (_) { } }
|
|
1510
1513
|
};
|
|
1511
|
-
this._ambient = { layer, root, timer, video, view, onSeek, onMeta, stage, stop, redraw: () => draw(true) };
|
|
1514
|
+
this._ambient = { layer, root, timer, video, view, onSeek, onMeta, stage, stop, cleared, redraw: () => draw(true) };
|
|
1515
|
+
},
|
|
1516
|
+
// Any box between the picture and the cinema root with its own background (a player's
|
|
1517
|
+
// black "bg-black" frame) would cover the glow. Those get a see-through background,
|
|
1518
|
+
// set inline so a site that rewrites its class names (React and the like) keeps it;
|
|
1519
|
+
// re-checked while cinema is on, put back as it was when the glow stops.
|
|
1520
|
+
_clearBackdrops(video, root, cleared) {
|
|
1521
|
+
try {
|
|
1522
|
+
const view = video.ownerDocument.defaultView || window;
|
|
1523
|
+
for (let el = video.parentElement; el && el.nodeType === 1; el = el.parentElement) {
|
|
1524
|
+
const cs = view.getComputedStyle(el);
|
|
1525
|
+
const color = cs.backgroundColor;
|
|
1526
|
+
const opaque = (color && color !== 'transparent' && !/rgba\([^)]*,\s*0\)$/.test(color)) || (cs.backgroundImage && cs.backgroundImage !== 'none');
|
|
1527
|
+
if (opaque && el.style.getPropertyPriority('background') !== 'important') {
|
|
1528
|
+
if (!cleared.has(el)) cleared.set(el, el.style.getPropertyValue('background'));
|
|
1529
|
+
el.style.setProperty('background', 'transparent', 'important');
|
|
1530
|
+
}
|
|
1531
|
+
if (el === root) break;
|
|
1532
|
+
}
|
|
1533
|
+
} catch (_) { }
|
|
1512
1534
|
},
|
|
1513
1535
|
// The glow sits behind the picture, which only works when the picture covers it. A
|
|
1514
1536
|
// player that shows the video see-through (faded, blended, blurred, or hidden while
|
|
@@ -1562,6 +1584,7 @@ async function handle(m) {
|
|
|
1562
1584
|
a.video.removeEventListener('resize', a.onMeta);
|
|
1563
1585
|
a.view.removeEventListener('resize', a.stage);
|
|
1564
1586
|
a.layer.remove();
|
|
1587
|
+
a.cleared?.forEach((was, el) => { if (was) el.style.setProperty('background', was); else el.style.removeProperty('background'); });
|
|
1565
1588
|
a.root.classList.remove('nxu-ambient-on', 'nxu-ambient-stage');
|
|
1566
1589
|
a.root.style.removeProperty('--nxu-stage-x');
|
|
1567
1590
|
a.root.style.removeProperty('--nxu-stage-y');
|
|
@@ -1763,8 +1786,13 @@ async function handle(m) {
|
|
|
1763
1786
|
} else if (a) {
|
|
1764
1787
|
// The site may fade or blur its video later (e.g. once it starts playing).
|
|
1765
1788
|
const why = this._seeThrough(a.video, a.root);
|
|
1766
|
-
if (why) { logDebug('Ambient light off for this player: ' + why, 'info'); this._stopAmbient(); }
|
|
1767
|
-
else this._matchLayerZ(a.layer, a.root);
|
|
1789
|
+
if (why) { logDebug('Ambient light off for this player: ' + why, 'info'); this._stopAmbient(); this._ambientPaused = true; }
|
|
1790
|
+
else { this._matchLayerZ(a.layer, a.root); this._clearBackdrops(a.video, a.root, a.cleared); }
|
|
1791
|
+
} else if (this._ambientPaused && this.ambientEnabled() && this.applied.video && this.applied.chain[0]?.root) {
|
|
1792
|
+
// Turned off only while the site faded or covered its picture (loading,
|
|
1793
|
+
// seeking): back on once the picture shows again, while the setting is on.
|
|
1794
|
+
const v = this.applied.video, root = this.applied.chain[0].root;
|
|
1795
|
+
if (!this._seeThrough(v, root)) { this._ambientPaused = false; this._startAmbient(v, root); if (this._ambient) logDebug('Ambient light back on.', 'info'); }
|
|
1768
1796
|
}
|
|
1769
1797
|
const root = this.applied.chain[0]?.root || this.applied.siteRoot;
|
|
1770
1798
|
if (root && (this.nexusControls() !== root.classList.contains('nxu-site-ui-off') || (this.nexusControls() && this.applied.video?.hasAttribute('controls')))) {
|
|
@@ -8486,6 +8514,8 @@ async function handle(m) {
|
|
|
8486
8514
|
.nx-xsub { position:absolute; left:50%; bottom:9%; transform:translateX(-50%); width:min(92%, 1100px); display:flex; flex-direction:column; align-items:center; gap:4px; z-index:66; pointer-events:none; opacity:0; transition:opacity 0.18s ease, bottom 0.3s ease; --xs:1; }
|
|
8487
8515
|
.nx-xsub.on { opacity:1; }
|
|
8488
8516
|
.nx-xsub-line.l1 { color:#ffe98a; }
|
|
8517
|
+
.cc-menu button .cc-swatch-label { display:inline-flex; align-items:center; margin-right:auto; }
|
|
8518
|
+
.cc-menu button .cc-swatch { display:inline-block; width:12px; height:12px; border-radius:50%; margin-right:6px; vertical-align:-1px; box-shadow:0 0 0 1px rgba(255,255,255,0.4); }
|
|
8489
8519
|
.nx-xsub-line.l2 { color:#9be7ff; font-size:calc(clamp(13px, 2.2cqw, 28px) * var(--xs)); }
|
|
8490
8520
|
.nexus-container.cinema-nexus:not(.chrome-idle) .nx-xsub { bottom:calc(104px + env(safe-area-inset-bottom, 0px)); }
|
|
8491
8521
|
.nx-xsub-line { display:inline-block; max-width:100%; padding:0.12em 0.55em; border-radius:0.35em; background:rgba(8,10,14,0.62); color:#fff; text-align:center; white-space:pre-line; overflow-wrap:anywhere;
|
|
@@ -10510,9 +10540,21 @@ async function handle(m) {
|
|
|
10510
10540
|
this.layers = this.layers.filter(x => x !== l);
|
|
10511
10541
|
if (!this.layers.length) this.off(); else this.tick(true);
|
|
10512
10542
|
},
|
|
10543
|
+
// Each subtitle keeps its colour while it is on (white, yellow, blue), so taking one
|
|
10544
|
+
// away does not repaint the others.
|
|
10545
|
+
COLORS: ['#ffffff', '#ffe98a', '#9be7ff'],
|
|
10546
|
+
colorOf(l) { return this.COLORS[l?.color || 0]; },
|
|
10547
|
+
// "Korean 2" when the video has several tracks of the same name (as in the menu).
|
|
10548
|
+
trackName(tr) {
|
|
10549
|
+
const all = this.tracks();
|
|
10550
|
+
const base = tr.label || tr.language || t('subTrack') + ' ' + (all.indexOf(tr) + 1);
|
|
10551
|
+
const same = all.filter(x => (x.label || x.language || '') === (tr.label || tr.language || ''));
|
|
10552
|
+
return same.length > 1 && (tr.label || tr.language) ? `${base} ${same.indexOf(tr) + 1}` : base;
|
|
10553
|
+
},
|
|
10513
10554
|
_add(layer) {
|
|
10514
10555
|
while (this.layers.length >= this.MAX) { this._drop(this.layers[0]); this.layers.shift(); }
|
|
10515
10556
|
layer.id = Math.random().toString(36).slice(2, 8);
|
|
10557
|
+
layer.color = [0, 1, 2].find(c => !this.layers.some(l => l.color === c)) ?? 0;
|
|
10516
10558
|
this.layers.push(layer);
|
|
10517
10559
|
try { CUE_MIRROR.render(); } catch (_) { }
|
|
10518
10560
|
this._loop();
|
|
@@ -10525,7 +10567,7 @@ async function handle(m) {
|
|
|
10525
10567
|
this._onCue = this._onCue || (() => this.tick());
|
|
10526
10568
|
tr.mode = 'hidden'; // cues still arrive, the browser does not draw them itself
|
|
10527
10569
|
tr.addEventListener('cuechange', this._onCue);
|
|
10528
|
-
this._add({ kind: 'track', track: tr, label:
|
|
10570
|
+
this._add({ kind: 'track', track: tr, label: this.trackName(tr) });
|
|
10529
10571
|
this._askSite(tr);
|
|
10530
10572
|
},
|
|
10531
10573
|
// Some players list every language as an empty track and fetch the cues only when the
|
|
@@ -10595,8 +10637,8 @@ async function handle(m) {
|
|
|
10595
10637
|
const tm = this._now();
|
|
10596
10638
|
if (tm == null) return;
|
|
10597
10639
|
const at = tm - this.delay;
|
|
10598
|
-
const groups = this.layers.map((l, i) => ({ i, text: this._textOf(l, at) }));
|
|
10599
|
-
const sig = groups.map(g => g.text).join('\u0001');
|
|
10640
|
+
const groups = this.layers.map((l, i) => ({ i, c: l.color || 0, text: this._textOf(l, at) }));
|
|
10641
|
+
const sig = groups.map(g => g.text).join('\u0001') + this.layers.map(l => l.id).join();
|
|
10600
10642
|
if (!force && sig === this._last && this._box?.isConnected) return;
|
|
10601
10643
|
this._last = sig;
|
|
10602
10644
|
const any = groups.some(g => g.text);
|
|
@@ -10604,7 +10646,7 @@ async function handle(m) {
|
|
|
10604
10646
|
const box = any ? this._ensureBox() : this._box;
|
|
10605
10647
|
if (!box) return;
|
|
10606
10648
|
const kids = [];
|
|
10607
|
-
groups.forEach(g => { if (g.text) g.text.split('\n').filter(Boolean).slice(0, 3).forEach(line => kids.push(createEl('span', 'nx-xsub-line l' + g.
|
|
10649
|
+
groups.forEach(g => { if (g.text) g.text.split('\n').filter(Boolean).slice(0, 3).forEach(line => kids.push(createEl('span', 'nx-xsub-line l' + g.c, line))); });
|
|
10608
10650
|
box.replaceChildren(...kids);
|
|
10609
10651
|
box.classList.toggle('on', any);
|
|
10610
10652
|
},
|
|
@@ -12989,9 +13031,15 @@ async function handle(m) {
|
|
|
12989
13031
|
// A long list (players offering 100+ tracks) shows your languages first, the rest on request.
|
|
12990
13032
|
const fold = rows.length > 12 && !this._subAll;
|
|
12991
13033
|
const shown = fold ? rows.filter(r => r.rank < 3) : rows;
|
|
12992
|
-
|
|
13034
|
+
const swatch = (layer, label, icon) => { const b = item('', true, () => { }); const s = createEl('span', 'cc-swatch'); s.style.background = SUBS.colorOf(layer); const wrap = createEl('span', 'cc-swatch-label'); wrap.append(s, document.createTextNode(icon + ' ' + label)); b.append(wrap); return b; };
|
|
13035
|
+
shown.forEach(r => {
|
|
13036
|
+
const layer = SUBS.layers.find(l => l.track === r.tr);
|
|
13037
|
+
const b = layer ? swatch(layer, r.label, '🎞') : item('🎞 ' + r.label, false, () => { });
|
|
13038
|
+
b.onclick = (ev) => { ev.stopPropagation(); SUBS.useTrack(r.tr); this.toggleSubMenu(true); };
|
|
13039
|
+
kids.push(b);
|
|
13040
|
+
});
|
|
12993
13041
|
if (fold && shown.length < rows.length) kids.push(item(t('subMoreLangs', { n: rows.length - shown.length }), false, () => { this._subAll = true; this.toggleSubMenu(true); }));
|
|
12994
|
-
SUBS.layers.filter(l => l.kind === 'cues').forEach(l =>
|
|
13042
|
+
SUBS.layers.filter(l => l.kind === 'cues').forEach(l => { const b = swatch(l, l.label, '💬'); b.onclick = (ev) => { ev.stopPropagation(); SUBS.remove(l.id); this.toggleSubMenu(true); }; kids.push(b); });
|
|
12995
13043
|
if (SUBS.layers.length > 1) kids.push(createEl('div', 'cc-menu-note', t('subMulti')));
|
|
12996
13044
|
kids.push(item(t('subSearch'), false, () => { this.toggleSubMenu(false); OPENSUBS.open(); }));
|
|
12997
13045
|
kids.push(item(t('subFile'), false, () => { this.toggleSubMenu(false); SUBS.openFile(); }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kangsicj/nexussync",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.13",
|
|
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",
|