改HUNK_SIZE 200
Browse files- youtube_sub.js +8 -3
youtube_sub.js
CHANGED
|
@@ -354,6 +354,7 @@ GM_addStyle(`
|
|
| 354 |
<div class="markdown"></div>
|
| 355 |
</div>
|
| 356 |
`;
|
|
|
|
| 357 |
|
| 358 |
// Apply main styles
|
| 359 |
GM_addStyle(styles);
|
|
@@ -1192,10 +1193,11 @@ GM_addStyle(`
|
|
| 1192 |
|
| 1193 |
debugger;
|
| 1194 |
// Get video URL as cache key
|
|
|
|
| 1195 |
const videoUrl = window.location.href;
|
| 1196 |
-
const cacheKey = `translations_${videoUrl}`;
|
| 1197 |
const CACHE_EXPIRY = 365 * 24 * 60 * 60 * 1000; // 7 days
|
| 1198 |
-
|
| 1199 |
const chunks = [];
|
| 1200 |
let translations = [];
|
| 1201 |
const DELAY_BETWEEN_CHUNKS = 1000; // 1 second delay
|
|
@@ -1354,7 +1356,10 @@ GM_addStyle(`
|
|
| 1354 |
if (this.subtitles.english.length > 0 && !this.subtitles.chinese.length) {
|
| 1355 |
|
| 1356 |
const videoUrl = window.location.href;
|
| 1357 |
-
|
|
|
|
|
|
|
|
|
|
| 1358 |
|
| 1359 |
// Try cache first
|
| 1360 |
try {
|
|
|
|
| 354 |
<div class="markdown"></div>
|
| 355 |
</div>
|
| 356 |
`;
|
| 357 |
+
const CHUNK_SIZE = 200;
|
| 358 |
|
| 359 |
// Apply main styles
|
| 360 |
GM_addStyle(styles);
|
|
|
|
| 1193 |
|
| 1194 |
debugger;
|
| 1195 |
// Get video URL as cache key
|
| 1196 |
+
|
| 1197 |
const videoUrl = window.location.href;
|
| 1198 |
+
const cacheKey = `translations_${CHUNK_SIZE}_${videoUrl}`;
|
| 1199 |
const CACHE_EXPIRY = 365 * 24 * 60 * 60 * 1000; // 7 days
|
| 1200 |
+
|
| 1201 |
const chunks = [];
|
| 1202 |
let translations = [];
|
| 1203 |
const DELAY_BETWEEN_CHUNKS = 1000; // 1 second delay
|
|
|
|
| 1356 |
if (this.subtitles.english.length > 0 && !this.subtitles.chinese.length) {
|
| 1357 |
|
| 1358 |
const videoUrl = window.location.href;
|
| 1359 |
+
|
| 1360 |
+
|
| 1361 |
+
const cacheKey = `translations_${CHUNK_SIZE}_${videoUrl}`;
|
| 1362 |
+
|
| 1363 |
|
| 1364 |
// Try cache first
|
| 1365 |
try {
|