-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathComicRead.user.js
8856 lines (8389 loc) · 348 KB
/
ComicRead.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ==UserScript==
// @name ComicRead
// @namespace ComicRead
// @version 8.2.3
// @description 为漫画站增加双页阅读、翻译等优化体验的增强功能。百合会——「记录阅读历史,体验优化」、百合会新站、动漫之家——「解锁隐藏漫画」、ehentai——「匹配 nhentai 漫画」、nhentai——「彻底屏蔽漫画,自动翻页」、PonpomuYuri、明日方舟泰拉记事社、禁漫天堂、拷贝漫画(copymanga)、漫画柜(manhuagui)、漫画DB(manhuadb)、动漫屋(dm5)、绅士漫画(wnacg)、mangabz、komiic、hitomi、kemono、welovemanga
// @description:en Add enhanced features to the comic site for optimized experience, including dual-page reading and translation.
// @description:ru Добавляет расширенные функции для удобства на сайт, такие как двухстраничный режим и перевод.
// @author hymbz
// @license AGPL-3.0-or-later
// @noframes
// @match *://*/*
// @connect cdn.jsdelivr.net
// @connect yamibo.com
// @connect dmzj.com
// @connect idmzj.com
// @connect exhentai.org
// @connect e-hentai.org
// @connect hath.network
// @connect nhentai.net
// @connect hypergryph.com
// @connect mangabz.com
// @connect copymanga.site
// @connect copymanga.info
// @connect copymanga.net
// @connect copymanga.org
// @connect copymanga.tv
// @connect mangacopy.com
// @connect xsskc.com
// @connect self
// @connect 127.0.0.1
// @connect *
// @grant GM_addElement
// @grant GM_getResourceText
// @grant GM_xmlhttpRequest
// @grant GM.addValueChangeListener
// @grant GM.removeValueChangeListener
// @grant GM.getResourceText
// @grant GM.addStyle
// @grant GM.getValue
// @grant GM.setValue
// @grant GM.listValues
// @grant GM.deleteValue
// @grant GM.registerMenuCommand
// @grant GM.unregisterMenuCommand
// @grant unsafeWindow
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAACBUExURUxpcWB9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i2B9i////198il17idng49DY3PT297/K0MTP1M3X27rHzaCxupmstbTByK69xOfr7bfFy3WOmqi4wPz9/X+XomSBjqW1vZOmsN/l6GmFkomeqe7x8vn6+kv+1vUAAAAOdFJOUwDsAoYli9zV+lIqAZEDwV05SQAAAUZJREFUOMuFk+eWgjAUhGPBiLohjZACUqTp+z/gJkqJy4rzg3Nn+MjhwB0AANjv4BEtdITBHjhtQ4g+CIZbC4Qb9FGb0J4P0YrgCezQqgIA14EDGN8fYz+f3BGMASFkTJ+GDAYMUSONzrFL7SVvjNQIz4B9VERRmV0rbJWbrIwidnsd6ACMlEoip3uad3X2HJmqb3gCkkJELwk5DExRDxA6HnKaDEPSsBnAsZoANgJaoAkg12IJqBiPACImXQKF9IDULIHUkOk7kDpeAMykHqCEWACy8ACdSM7LGSg5F3HtAU1rrkaK9uGAshXS2lZ5QH/nVhmlD8rKlmbO3ZsZwLe8qnpdxJRnLaci1X1V5R32fjd5CndVkfYdGpy3D+htU952C/ypzPtdt3JflzZYBy7fi/O1euvl/XH1Pp+Cw3/1P1xOZwB+AWMcP/iw0AlKAAAAV3pUWHRSYXcgcHJvZmlsZSB0eXBlIGlwdGMAAHic4/IMCHFWKCjKT8vMSeVSAAMjCy5jCxMjE0uTFAMTIESANMNkAyOzVCDL2NTIxMzEHMQHy4BIoEouAOoXEXTyQjWVAAAAAElFTkSuQmCC
// @resource solid-js https://unpkg.com/[email protected]/dist/solid.cjs
// @resource solid-js/store https://unpkg.com/[email protected]/store/dist/store.cjs
// @resource solid-js/web https://unpkg.com/[email protected]/web/dist/web.cjs
// @resource fflate https://unpkg.com/[email protected]/umd/index.js
// @resource dmzjDecrypt https://greasyfork.org/scripts/467177-dmzjdecrypt/code/dmzjDecrypt.js?version=1207199
// @supportURL https://github.com/hymbz/ComicReadScript/issues
// @updateURL https://github.com/hymbz/ComicReadScript/raw/master/ComicRead.user.js
// @downloadURL https://github.com/hymbz/ComicReadScript/raw/master/ComicRead.user.js
// ==/UserScript==
/**
* 虽然在打包的时候已经尽可能保持代码格式不变了,但因为脚本代码比较多的缘故
* 所以真对脚本代码感兴趣的话,推荐还是直接上 github 仓库来看
* <https://github.com/hymbz/ComicReadScript>
* 对站点逻辑感兴趣的,结合 `src\index.ts` 看 `src\site` 下的对应文件即可
*/
const gmApi = {
GM,
GM_addElement,
GM_getResourceText,
GM_xmlhttpRequest,
unsafeWindow
};
const gmApiList = Object.keys(gmApi);
const crsLib = {
// 有些 cjs 模块会检查这个,所以在这里声明下
process: {
env: {
NODE_ENV: 'production'
}
},
...gmApi
};
const tempName = Math.random().toString(36).slice(2);
/**
* 通过 Resource 导入外部模块
* @param name \@resource 引用的资源名
*/
const selfImportSync = name => {
const code = name !== 'main' ? GM_getResourceText(name) :`
const solidJs = require('solid-js');
const web = require('solid-js/web');
const store$2 = require('solid-js/store');
const fflate = require('fflate');
const main = require('main');
const sleep = ms => new Promise(resolve => {
window.setTimeout(resolve, ms);
});
const clamp = (min, val, max) => Math.max(Math.min(max, val), min);
/** 判断两个数是否在指定误差范围内相等 */
const isEqual = (val, target, range) => Math.abs(target - val) <= range;
/** 根据传入的条件列表的真假,对 val 进行取反 */
const ifNot = (val, ...conditions) => {
let res = !!val;
conditions.forEach(v => {
if (v) res = !res;
});
return res;
};
/**
* 对 document.querySelector 的封装
* 将默认返回类型改为 HTMLElement
*/
const querySelector = selector => document.querySelector(selector);
/**
* 对 document.querySelector 的封装
* 将默认返回类型改为 HTMLElement
*/
const querySelectorAll = selector => [...document.querySelectorAll(selector)];
/**
* 添加元素
* @param node 被添加元素
* @param textnode 添加元素
* @param referenceNode 参考元素,添加元素将插在参考元素前
*/
const insertNode = (node, textnode, referenceNode = null) => {
const temp = document.createElement('div');
temp.innerHTML = textnode;
const frag = document.createDocumentFragment();
while (temp.firstChild) frag.appendChild(temp.firstChild);
node.insertBefore(frag, referenceNode);
};
/** 返回 Dom 的点击函数 */
const querySelectorClick = selector => {
const getDom = () => typeof selector === 'string' ? querySelector(selector) : selector();
if (getDom()) return () => getDom()?.click();
};
/** 判断两个列表中包含的值是否相同 */
const isEqualArray = (a, b) => a.length === b.length && !a.some(t => !b.includes(t));
/** 找出数组中出现最多次的元素 */
const getMostItem = list => {
const counts = list.reduce((map, val) => {
map.set(val, map.get(val) ?? 0 + 1);
return map;
}, new Map());
return [...counts.entries()].reduce((maxItem, item) => maxItem[1] > item[1] ? maxItem : item)[0];
};
/** 将数组扩充到指定长度,不足项用空字符串补足 */
const createFillImgList = (imgList, length) => [...imgList, ...Array(length - imgList.length).fill('')];
/** 将对象转为 URLParams 类型的字符串 */
const dataToParams = data => Object.entries(data).map(([key, val]) => \`\${key}=\${val}\`).join('&');
/** 将 blob 数据作为文件保存至本地 */
const saveAs = (blob, name = 'download') => {
const a = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
a.download = name;
a.rel = 'noopener';
a.href = URL.createObjectURL(blob);
setTimeout(() => a.dispatchEvent(new MouseEvent('click')));
};
/** 监听键盘事件 */
const linstenKeyup = handler => window.addEventListener('keyup', e => {
// 跳过输入框的键盘事件
switch (e.target.tagName) {
case 'INPUT':
case 'TEXTAREA':
return;
}
handler(e);
});
/** 滚动页面到指定元素的所在位置 */
const scrollIntoView = (selector, behavior = 'instant') => querySelector(selector)?.scrollIntoView({
behavior
});
/** 循环执行指定函数 */
const loop = async (fn, ms = 0) => {
await fn();
setTimeout(loop, ms, fn);
};
/** 使指定函数延迟运行期间的多次调用直到运行结束 */
const singleThreaded = callback => {
const state = {
running: false,
continueRun: false
};
const fn = async (...args) => {
if (state.continueRun) return;
if (state.running) {
state.continueRun = true;
return;
}
try {
state.running = true;
await callback(state, ...args);
} catch (error) {
state.continueRun = false;
await sleep(100);
throw error;
} finally {
state.running = false;
}
if (state.continueRun) {
state.continueRun = false;
setTimeout(fn);
} else state.running = false;
};
return fn;
};
/**
* 限制 Promise 并发
* @param fnList 任务函数列表
* @param callBack 成功执行一个 Promise 后调用,主要用于显示进度
* @param limit 限制数
* @returns 所有 Promise 的返回值
*/
const plimit = async (fnList, callBack = undefined, limit = 10) => {
let doneNum = 0;
const totalNum = fnList.length;
const resList = [];
const execPool = new Set();
const taskList = fnList.map((fn, i) => {
let p;
return () => {
p = (async () => {
resList[i] = await fn();
doneNum += 1;
execPool.delete(p);
callBack?.(doneNum, totalNum, resList, i);
})();
execPool.add(p);
};
});
while (doneNum !== totalNum) {
while (taskList.length && execPool.size < limit) {
taskList.shift()();
}
await Promise.race(execPool);
}
return resList;
};
/**
* 判断使用参数颜色作为默认值时是否需要切换为黑暗模式
* @param hexColor 十六进制颜色。例如 #112233
*/
const needDarkMode = hexColor => {
// by: https://24ways.org/2010/calculating-color-contrast
const r = parseInt(hexColor.substring(1, 3), 16);
const g = parseInt(hexColor.substring(3, 5), 16);
const b = parseInt(hexColor.substring(5, 7), 16);
const yiq = (r * 299 + g * 587 + b * 114) / 1000;
return yiq < 128;
};
/** 等到传入的函数返回 true */
const wait = async (fn, timeout = Infinity) => {
let res = await fn();
let _timeout = timeout;
while (_timeout > 0 && !res) {
await sleep(10);
_timeout -= 10;
res = await fn();
}
return res;
};
/** 等到指定的 dom 出现 */
const waitDom = selector => wait(() => querySelector(selector));
/** 等待指定的图片元素加载完成 */
const waitImgLoad = (img, timeout = 1000 * 10) => new Promise(resolve => {
const id = window.setTimeout(() => resolve(new ErrorEvent('timeout')), timeout);
img.addEventListener('load', () => {
resolve(null);
window.clearTimeout(id);
});
img.addEventListener('error', e => {
resolve(e);
window.clearTimeout(id);
});
});
/** 将指定的布尔值转换为字符串或未定义 */
const boolDataVal = val => val ? '' : undefined;
/**
*
* 通过滚动到指定图片元素位置并停留一会来触发图片的懒加载,返回图片 src 是否发生变化
*
* 会在触发后重新滚回原位,当 time 为 0 时,因为滚动速度很快所以是无感的
*/
const triggerEleLazyLoad = async (e, time, isLazyLoaded) => {
const nowScroll = window.scrollY;
e.scrollIntoView({
behavior: 'instant'
});
e.dispatchEvent(new Event('scroll', {
bubbles: true
}));
try {
if (isLazyLoaded && time) return await wait(isLazyLoaded, time);
} finally {
window.scroll({
top: nowScroll,
behavior: 'auto'
});
}
};
/** 获取图片尺寸 */
const getImgSize = async (url, breakFn) => {
let error = false;
const image = new Image();
try {
image.onerror = () => {
error = true;
};
image.src = url;
await wait(() => !error && (image.naturalWidth || image.naturalHeight) && (breakFn ? !breakFn() : true));
if (error) return null;
return [image.naturalWidth, image.naturalHeight];
} catch (_) {
return null;
} finally {
image.src = '';
}
};
/** 测试图片 url 能否正确加载 */
const testImgUrl = url => new Promise(resolve => {
const img = new Image();
img.onload = () => resolve(true);
img.onerror = () => resolve(false);
img.src = url;
});
const canvasToBlob = (canvas, type, quality = 1) => new Promise((resolve, reject) => {
canvas.toBlob(blob => blob ? resolve(blob) : reject(new Error('Canvas toBlob failed')), type, quality);
});
/**
* 求 a 和 b 的差集,相当于从 a 中删去和 b 相同的属性
*
* 不会修改参数对象,返回的是新对象
*/
const difference = (a, b) => {
const res = {};
const keys = Object.keys(a);
for (let i = 0; i < keys.length; i += 1) {
const key = keys[i];
if (typeof a[key] === 'object' && typeof b[key] === 'object') {
const _res = difference(a[key], b[key]);
if (Object.keys(_res).length) res[key] = _res;
} else if (a[key] !== b?.[key]) res[key] = a[key];
}
return res;
};
/**
* Object.assign 的深拷贝版,不会导致 a 子对象属性的缺失
*
* 不会修改参数对象,返回的是新对象
*/
const assign = (a, b) => {
const res = JSON.parse(JSON.stringify(a));
const keys = Object.keys(b);
for (let i = 0; i < keys.length; i += 1) {
const key = keys[i];
if (res[key] === undefined) res[key] = b[key];else if (typeof b[key] === 'object') {
const _res = assign(res[key], b[key]);
if (Object.keys(_res).length) res[key] = _res;
} else if (res[key] !== b[key]) res[key] = b[key];
}
return res;
};
/** 根据路径获取对象下的指定值 */
const byPath = (obj, path, handleVal) => {
const keys = path.split('.');
let target = obj;
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
// 兼容含有「.」的 key
while (!Reflect.has(target, key) && i < keys.length) {
i += 1;
if (keys[i] === undefined) break;
key += \`.\${keys[i]}\`;
}
if (handleVal && i > keys.length - 2 && Reflect.has(target, key)) {
const res = handleVal(target, key);
while (i < keys.length - 1) {
target = target[key];
i += 1;
key = keys[i];
}
if (res !== undefined) target[key] = res;
break;
}
target = target[key];
}
if (target === obj) return null;
return target;
};
const requestIdleCallback = (callback, timeout) => {
if (Reflect.has(window, 'requestIdleCallback')) return window.requestIdleCallback(callback, {
timeout
});
return window.setTimeout(callback, 1);
};
/**
* 通过监视点击等会触发动态加载的事件,在触发动态加载后更新图片列表等
* @param update 动态加载后的重新加载
*/
const autoUpdate = update => {
let running = false;
const refresh = async () => {
running = true;
try {
await update();
} finally {
running = false;
}
};
['click', 'popstate'].forEach(eventName => {
window.addEventListener(eventName, () => setTimeout(() => {
if (running) return;
refresh();
}, 100));
});
refresh();
};
/** 获取键盘事件的编码 */
const getKeyboardCode = e => {
let {
key
} = e;
switch (key) {
case 'Shift':
case 'Control':
case 'Alt':
return key;
}
if (e.ctrlKey) key = \`Ctrl + \${key}\`;
if (e.altKey) key = \`Alt + \${key}\`;
if (e.shiftKey) key = \`Shift + \${key}\`;
return key;
};
/** 将快捷键的编码转换成更易读的形式 */
const keyboardCodeToText = code => code.replace('Control', 'Ctrl').replace('ArrowUp', '↑').replace('ArrowDown', '↓').replace('ArrowLeft', '←').replace('ArrowRight', '→').replace(/^\\s$/, 'Space');
const prefix = ['%cComicRead', 'background-color: #607d8b; color: white; padding: 2px 4px; border-radius: 4px;'];
const log = (...args) =>
// eslint-disable-next-line no-console
console.log.apply(null, [...prefix, ...args]);
log.warn = (...args) =>
// eslint-disable-next-line no-console
console.warn.apply(null, [...prefix, ...args]);
log.error = (...args) =>
// eslint-disable-next-line no-console
console.error.apply(null, [...prefix, ...args]);
const langList = ['zh', 'en', 'ru'];
/** 判断传入的字符串是否是支持的语言类型代码 */
const isLanguages = lang => !!lang && langList.includes(lang);
/** 返回浏览器偏好语言 */
const getBrowserLang = () => {
let newLang;
for (let i = 0; i < navigator.languages.length; i++) {
const language = navigator.languages[i];
const matchLang = langList.find(l => l === language || l === language.split('-')[0]);
if (matchLang) {
newLang = matchLang;
break;
}
}
return newLang;
};
const getSaveLang = () => typeof GM !== 'undefined' ? GM.getValue('Languages') : localStorage.getItem('Languages');
const setSaveLang = val => typeof GM !== 'undefined' ? GM.setValue('Languages', val) : localStorage.setItem('Languages', val);
const getInitLang = async () => {
const saveLang = await getSaveLang();
if (isLanguages(saveLang)) return saveLang;
const lang = getBrowserLang() ?? 'zh';
setSaveLang(lang);
return lang;
};
const zh = {
alert: {
comic_load_error: "漫画加载出错",
download_failed: "下载失败",
fetch_comic_img_failed: "获取漫画图片失败",
img_load_failed: "图片加载失败",
repeat_load: "加载图片中,请稍候",
server_connect_failed: "无法连接到服务器"
},
button: {
close_current_page_translation: "关闭当前页的翻译",
download: "下载",
download_completed: "下载完成",
downloading: "下载中",
exit: "退出",
grid_mode: "网格模式",
packaging: "打包中",
page_fill: "页面填充",
page_mode_double: "双页模式",
page_mode_single: "单页模式",
scroll_mode: "卷轴模式",
setting: "设置",
translate_current_page: "翻译当前页",
zoom_in: "放大"
},
description: "为漫画站增加双页阅读、翻译等优化体验的增强功能。",
end_page: {
next_button: "下一话",
prev_button: "上一话",
tip: {
end_jump: "已到结尾,继续向下翻页将跳至下一话",
exit: "已到结尾,继续翻页将退出",
start_jump: "已到开头,继续向上翻页将跳至上一话"
}
},
hotkeys: {
enter_read_mode: "进入阅读模式",
exit: "退出",
jump_to_end: "跳至尾页",
jump_to_home: "跳至首页",
switch_auto_enlarge: "切换图片自动放大选项",
switch_dir: "切换阅读方向",
switch_grid_mode: "切换网格模式",
switch_page_fill: "切换页面填充",
switch_scroll_mode: "切换卷轴模式",
switch_single_double_page_mode: "切换单双页模式",
turn_page_down: "向下翻页",
turn_page_left: "向左翻页",
turn_page_right: "向右翻页",
turn_page_up: "向上翻页"
},
img_status: {
error: "加载出错",
loading: "正在加载",
wait: "等待加载"
},
other: {
auto_enter_read_mode: "自动进入阅读模式",
"default": "默认",
disable: "禁用",
enter_comic_read_mode: "进入漫画阅读模式",
fab_hidden: "隐藏悬浮按钮",
fab_show: "显示悬浮按钮",
fill_page: "填充页",
img_loading: "图片加载中",
loading_img: "加载图片中",
read_mode: "阅读模式"
},
pwa: {
alert: {
img_data_error: "图片数据错误",
img_not_found: "找不到图片",
img_not_found_files: "请选择图片文件或含有图片文件的压缩包",
img_not_found_folder: "文件夹下没有图片文件或含有图片文件的压缩包",
repeat_load: "正在加载其他文件中……",
unzip_error: "解压出错",
unzip_password_error: "解压密码错误",
userscript_not_installed: "未安装 ComicRead 脚本"
},
button: {
enter_url: "输入 URL",
install: "安装",
no_more_prompt: "不再提示",
resume_read: "恢复阅读",
select_files: "选择文件",
select_folder: "选择文件夹"
},
install_md: "### 每次都要打开这个网页很麻烦?\\n如果你希望\\n1. 能有独立的窗口,像是在使用本地软件一样\\n1. 加入本地压缩文件的打开方式之中,方便直接打开\\n1. 离线使用~~(主要是担心国内网络抽风无法访问这个网页~~\\n### 欢迎将本页面作为 PWA 应用安装到电脑上😃👍",
message: {
enter_password: "请输入密码",
unzipping: "解压缩中"
},
tip_enter_url: "请输入压缩包 URL",
tip_md: "# ComicRead PWA\\n使用 [ComicRead](https://github.com/hymbz/ComicReadScript) 的阅读模式阅读**本地**漫画\\n---\\n### 将图片文件、文件夹、压缩包直接拖入即可开始阅读\\n*也可以选择输入压缩包 URL 下载阅读*"
},
setting: {
hotkeys: {
add: "添加新快捷键",
restore: "恢复默认快捷键"
},
language: "语言",
option: {
always_load_all_img: "始终加载所有图片",
background_color: "背景颜色",
click_page_turn_area: "点击区域",
click_page_turn_enabled: "点击翻页",
click_page_turn_swap_area: "左右点击区域交换",
click_page_turn_vertical: "上下翻页",
dark_mode: "夜间模式",
dir_ltr: "从左到右(美漫)",
dir_rtl: "从右到左(日漫)",
disable_auto_enlarge: "禁止图片自动放大",
first_page_fill: "默认启用首页填充",
jump_to_next_chapter: "翻页至上/下一话",
paragraph_dir: "阅读方向",
paragraph_display: "显示",
paragraph_hotkeys: "快捷键",
paragraph_operation: "操作",
paragraph_other: "其他",
paragraph_scrollbar: "滚动条",
paragraph_translation: "翻译",
preload_page_num: "预加载页数",
scroll_mode_img_scale: "卷轴图片缩放",
scroll_mode_img_spacing: "卷轴图片间距",
scrollbar_auto_hidden: "自动隐藏",
scrollbar_easy_scroll: "快捷滚动",
scrollbar_position: "位置",
scrollbar_position_auto: "自动",
scrollbar_position_bottom: "底部",
scrollbar_position_hidden: "隐藏",
scrollbar_position_right: "右侧",
scrollbar_position_top: "顶部",
scrollbar_show_img_status: "显示图片加载状态",
show_clickable_area: "显示点击区域",
show_comments: "在结束页显示评论",
swap_page_turn_key: "左右翻页键交换"
},
translation: {
cotrans_tip: "<p>将使用 <a href=\\"https://cotrans.touhou.ai\\" target=\\"_blank\\">Cotrans</a> 提供的接口翻译图片,该服务器由其维护者用爱发电自费维护</p>\\n<p>多人同时使用时需要排队等待,等待队列达到上限后再上传新图片会报错,需要过段时间再试</p>\\n<p>所以还请 <b>注意用量</b></p>\\n<p>更推荐使用自己本地部署的项目,既不占用服务器资源也不需要排队</p>",
options: {
detection_resolution: "文本扫描清晰度",
direction: "渲染字体方向",
direction_auto: "原文一致",
direction_horizontal: "仅限水平",
direction_vertical: "仅限垂直",
forceRetry: "忽略缓存强制重试",
localUrl: "自定义服务器 URL",
target_language: "目标语言",
text_detector: "文本扫描器",
translator: "翻译服务"
},
server: "翻译服务器",
server_selfhosted: "本地部署",
translate_after_current: "翻译当前页至结尾",
translate_all_img: "翻译全部图片"
}
},
site: {
add_feature: {
associate_nhentai: "关联nhentai",
auto_page_turn: "自动翻页",
block_totally: "彻底屏蔽漫画",
hotkeys_page_turn: "快捷键翻页",
open_link_new_page: "在新页面中打开链接",
remember_current_site: "记住当前站点"
},
ehentai: {
fetch_img_page_source_failed: "获取图片页源码失败",
fetch_img_page_url_failed: "从详情页获取图片页地址失败",
fetch_img_url_failed: "从图片页获取图片地址失败",
html_changed_load_failed: "页面结构发生改变,无法加载漫画",
html_changed_nhentai_failed: "页面结构发生改变,关联 nhentai 漫画功能无法正常生效",
ip_banned: "IP地址被禁",
nhentai_error: "nhentai 匹配出错",
nhentai_failed: "匹配失败,请在确认登录 {{nhentai}} 后刷新"
},
nhentai: {
fetch_next_page_failed: "获取下一页漫画数据失败",
tag_blacklist_fetch_failed: "标签黑名单获取失败"
},
settings_tip: "设置",
show_settings_menu: "显示设置菜单",
simple: {
auto_read_mode_message: "已默认开启「自动进入阅读模式」",
simple_read_mode: "使用简易阅读模式"
}
},
touch_area: {
menu: "菜单",
next: "下页",
prev: "上页",
type: {
edge: "边缘",
l: "L",
left_right: "左右",
up_down: "上下"
}
},
translation: {
status: {
"default": "未知状态",
detection: "正在检测文本",
downscaling: "正在缩小图片",
error: "翻译出错",
"error-lang": "你选择的翻译服务不支持你选择的语言",
"error-translating": "翻译服务没有返回任何文本",
"error-with-id": "翻译出错",
finished: "正在整理结果",
inpainting: "正在修补图片",
"mask-generation": "正在生成文本掩码",
ocr: "正在识别文本",
pending: "正在等待",
"pending-pos": "正在等待",
rendering: "正在渲染",
saved: "保存结果",
textline_merge: "正在整合文本",
translating: "正在翻译文本",
upscaling: "正在放大图片"
},
tip: {
check_img_status_failed: "检查图片状态失败",
download_img_failed: "下载图片失败",
error: "翻译出错",
get_translator_list_error: "获取可用翻译服务列表时出错",
id_not_returned: "未返回 id",
img_downloading: "正在下载图片",
img_not_fully_loaded: "图片未加载完毕",
pending: "正在等待,列队还有 {{pos}} 张图片",
resize_img_failed: "缩放图片失败",
translation_completed: "翻译完成",
upload_error: "图片上传出错",
upload_return_error: "服务器翻译出错",
wait_translation: "等待翻译"
},
translator: {
baidu: "百度",
deepl: "DeepL",
google: "谷歌",
"gpt3.5": "GPT-3.5",
none: "删除文本",
offline: "离线模型",
original: "原文",
youdao: "有道"
}
}
};
const en = {
alert: {
comic_load_error: "Comic loading error",
download_failed: "Download failed",
fetch_comic_img_failed: "Failed to fetch comic images",
img_load_failed: "Image loading failed",
repeat_load: "Loading image, please wait",
server_connect_failed: "Unable to connect to the server"
},
button: {
close_current_page_translation: "Close translation of the current page",
download: "Download",
download_completed: "Download completed",
downloading: "Downloading",
exit: "Exit",
grid_mode: "Grid mode",
packaging: "Packaging",
page_fill: "Page fill",
page_mode_double: "Double page mode",
page_mode_single: "Single page mode",
scroll_mode: "Scroll mode",
setting: "Settings",
translate_current_page: "Translate current page",
zoom_in: "Zoom in"
},
description: "Add enhanced features to the comic site for optimized experience, including dual-page reading and translation.",
end_page: {
next_button: "Next chapter",
prev_button: "Prev chapter",
tip: {
end_jump: "Reached the last page, scrolling down will jump to the next chapter",
exit: "Reached the last page, scrolling down will exit",
start_jump: "Reached the first page, scrolling up will jump to the previous chapter"
}
},
hotkeys: {
enter_read_mode: "Enter reading mode",
exit: "Exit",
jump_to_end: "Jump to the last page",
jump_to_home: "Jump to the first page",
switch_auto_enlarge: "Switch auto image enlarge option",
switch_dir: "Switch reading direction",
switch_grid_mode: "Switch grid mode",
switch_page_fill: "Switch page fill",
switch_scroll_mode: "Switch scroll mode",
switch_single_double_page_mode: "Switch single/double page mode",
turn_page_down: "Turn the page to the down",
turn_page_left: "Turn the page to the left",
turn_page_right: "Turn the page to the right",
turn_page_up: "Turn the page to the up"
},
img_status: {
error: "Load Error",
loading: "Loading",
wait: "Waiting for load"
},
other: {
auto_enter_read_mode: "Auto enter reading mode",
"default": "Default",
disable: "Disable",
enter_comic_read_mode: "Enter comic reading mode",
fab_hidden: "Hide floating button",
fab_show: "Show floating button",
fill_page: "Fill Page",
img_loading: "Image loading",
loading_img: "Loading image",
read_mode: "Reading mode"
},
pwa: {
alert: {
img_data_error: "Image data error",
img_not_found: "Image not found",
img_not_found_files: "Please select an image file or a compressed file containing image files",
img_not_found_folder: "No image files or compressed files containing image files in the folder",
repeat_load: "Loading other files…",
unzip_error: "Decompression error",
unzip_password_error: "Decompression password error",
userscript_not_installed: "ComicRead userscript not installed"
},
button: {
enter_url: "Enter URL",
install: "Install",
no_more_prompt: "Do not prompt again",
resume_read: "Restore reading",
select_files: "Select File",
select_folder: "Select folder"
},
install_md: "### Tired of opening this webpage every time?\\nIf you wish to:\\n1. Have an independent window, as if using local software\\n1. Add to the local compressed file opening method for easy direct opening\\n1. Use offline\\n### Welcome to install this page as a PWA app on your computer😃👍",
message: {
enter_password: "Please enter your password",
unzipping: "Unzipping"
},
tip_enter_url: "Please enter the URL of the compressed file",
tip_md: "# ComicRead PWA\\nRead **local** comics using [ComicRead](https://github.com/hymbz/ComicReadScript) reading mode.\\n---\\n### Drag and drop image files, folders, or compressed files directly to start reading\\n*You can also choose to enter the URL of the compressed file for downloading and reading*"
},
setting: {
hotkeys: {
add: "Add new hotkeys",
restore: "Restore default hotkeys"
},
language: "Language",
option: {
always_load_all_img: "Always load all images",
background_color: "Background Color",
click_page_turn_area: "Touch area",
click_page_turn_enabled: "Click to turn page",
click_page_turn_swap_area: "Swap LR clickable areas",
click_page_turn_vertical: "Vertically arranged clickable areas",
dark_mode: "Dark mode",
dir_ltr: "LTR (American comics)",
dir_rtl: "RTL (Japanese manga)",
disable_auto_enlarge: "Disable automatic image enlarge",
first_page_fill: "Enable first page fill by default",
jump_to_next_chapter: "Turn to the next/previous chapter",
paragraph_dir: "Reading direction",
paragraph_display: "Display",
paragraph_hotkeys: "Hotkeys",
paragraph_operation: "Operation",
paragraph_other: "Other",
paragraph_scrollbar: "Scrollbar",
paragraph_translation: "Translation",
preload_page_num: "Preload page number",
scroll_mode_img_scale: "Scroll mode image zoom ratio",
scroll_mode_img_spacing: "Scroll mode image spacing",
scrollbar_auto_hidden: "Auto hide",
scrollbar_easy_scroll: "Easy scroll",
scrollbar_position: "position",
scrollbar_position_auto: "Auto",
scrollbar_position_bottom: "Bottom",
scrollbar_position_hidden: "Hidden",
scrollbar_position_right: "Right",
scrollbar_position_top: "Top",
scrollbar_show_img_status: "Show image loading status",
show_clickable_area: "Show clickable areas",
show_comments: "Show comments on the end page",
swap_page_turn_key: "Swap LR page-turning keys"
},
translation: {
cotrans_tip: "<p>Using the interface provided by <a href=\\"https://cotrans.touhou.ai\\" target=\\"_blank\\">Cotrans</a> to translate images, which is maintained by its maintainer at their own expense.</p>\\n<p>When multiple people use it at the same time, they need to queue and wait. If the waiting queue reaches its limit, uploading new images will result in an error. Please try again after a while.</p>\\n<p>So please <b>mind the frequency of use</b>.</p>\\n<p>It is highly recommended to use your own locally deployed project, as it does not consume server resources and does not require queuing.</p>",
options: {
detection_resolution: "Text detection resolution",
direction: "Render text orientation",
direction_auto: "Follow source",
direction_horizontal: "Horizontal only",
direction_vertical: "Vertical only",
forceRetry: "Force retry (ignore cache)",
localUrl: "customize server URL",
target_language: "Target language",
text_detector: "Text detector",
translator: "Translator"
},
server: "Translation server",
server_selfhosted: "Selfhosted",
translate_after_current: "Translate the current page to the end",
translate_all_img: "Translate all images"
}
},
site: {
add_feature: {
associate_nhentai: "Associate nhentai",
auto_page_turn: "Auto page turning",
block_totally: "Totally block comics",
hotkeys_page_turn: "Page turning with hotkeys",
open_link_new_page: "Open links in a new page",
remember_current_site: "Remember the current site"
},
ehentai: {
fetch_img_page_source_failed: "Failed to get the source code of the image page",
fetch_img_page_url_failed: "Failed to get the image page address from the detail page",
fetch_img_url_failed: "Failed to get the image address from the image page",
html_changed_load_failed: "The web page structure has changed, unable to load comics",
html_changed_nhentai_failed: "The web page structure has changed, the function to associate nhentai comics is not working properly",
ip_banned: "IP address is banned",
nhentai_error: "Error in nhentai matching",
nhentai_failed: "Matching failed, please refresh after confirming login to {{nhentai}}"
},
nhentai: {
fetch_next_page_failed: "Failed to get next page of comic data",
tag_blacklist_fetch_failed: "Failed to fetch tag blacklist"
},
settings_tip: "Settings",
show_settings_menu: "Show settings menu",
simple: {
auto_read_mode_message: "\\"Auto enter reading mode\\" is enabled by default",
simple_read_mode: "Enter simple reading mode"
}
},
touch_area: {
menu: "Menu",
next: "Next Page",
prev: "Prev Page",
type: {
edge: "Edge",
l: "L",
left_right: "Left Right",
up_down: "Up Down"
}
},
translation: {
status: {
"default": "Unknown status",
detection: "Detecting text",
downscaling: "Downscaling",
error: "Error during translation",
"error-lang": "The target language is not supported by the chosen translator",
"error-translating": "Did not get any text back from the text translation service",
"error-with-id": "Error during translation",
finished: "Finishing",
inpainting: "Inpainting",
"mask-generation": "Generating mask",
ocr: "Scanning text",
pending: "Pending",
"pending-pos": "Pending",
rendering: "Rendering",
saved: "Saved",
textline_merge: "Merging text lines",
translating: "Translating",
upscaling: "Upscaling"
},
tip: {
check_img_status_failed: "Failed to check image status",
download_img_failed: "Failed to download image",
error: "Translation error",
get_translator_list_error: "Error occurred while getting the list of available translation services",
id_not_returned: "No id returned",
img_downloading: "Downloading images",
img_not_fully_loaded: "Image has not finished loading",
pending: "Pending, {{pos}} in queue",
resize_img_failed: "Failed to resize image",
translation_completed: "Translation completed",
upload_error: "Image upload error",
upload_return_error: "Error during server translation",
wait_translation: "Waiting for translation"
},
translator: {
baidu: "baidu",
deepl: "DeepL",
google: "Google",
"gpt3.5": "GPT-3.5",
none: "Remove texts",
offline: "offline translator",
original: "Original",
youdao: "youdao"
}
}
};
const ru = {