forked from Mapaler/EhTagTranslator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EhTagSyringe.user.js
2092 lines (1863 loc) · 73.9 KB
/
EhTagSyringe.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 EhTagSyringe
// @name:zh-CN E绅士翻译注射器💉
// @name:zh-TW E紳士翻譯注射器💉
// @name:zh-HK E紳士翻譯注射器💉
// @namespace http://www.mapaler.com/
// @homepage https://github.com/Mapaler/EhTagTranslator
// @supportURL https://github.com/Mapaler/EhTagTranslator/issues
// @description Build EhTagTranslater from Wiki.
// @description:zh-CN 从Wiki获取EhTagTranslater数据库,将E绅士TAG翻译为中文,并注射到E站
// @description:zh-TW 從Wiki獲取EhTagTranslater資料庫,將E紳士TAG翻譯為中文,並注射到E站
// @description:zh-HK 從Wiki獲取EhTagTranslater資料庫,將E紳士TAG翻譯為中文,並注射到E站
// @include *://github.com/Mapaler/EhTagTranslator*
// @include *://exhentai.org/*
// @include *://e-hentai.org/*
// @connect raw.githubusercontent.com
// @connect github.com
// @connect localhost
// @connect 127.0.0.1
// @icon http://exhentai.org/favicon.ico
// @require https://cdn.bootcss.com/angular.js/1.4.6/angular.min.js
// @resource template https://raw.githubusercontent.com/Mapaler/EhTagTranslator/master/template/ets-builder-menu.html?v=41
// @resource ets-prompt https://raw.githubusercontent.com/Mapaler/EhTagTranslator/master/template/ets-prompt.html?v=42
// @version 1.3.12
// @run-at document-start
// @inject-into page
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addStyle
// @grant GM_deleteValue
// @grant GM_listValues
// @grant GM_info
// @grant GM_getResourceText
// @grant GM_addValueChangeListener
// @grant GM_setClipboard
// @grant GM_openInTab
// @author xioxin <i@xioxin.com>
// @copyright 2017+, Mapaler <mapaler@163.com> , xioxin <i@xioxin.com>
// ==/UserScript==
// language=CSS
const uiTranslateStyle = `
/** uiTranslateStyle **/
.cs, .cn {
font-size: 0 !important;
text-align: center;
line-height: 0 !important;
}
.cs:after, .cn:after {
font-size: 9pt;
display: block;
text-align: center;
line-height: 20px;
}
.cn:after {
line-height: 35px;
}
.ct1:after{
content: "其他";
}
.ct8:after{
content: "亚洲";
}
.ct7:after{
content: "Cosplay";
}
.ct6:after{
content: "图集";
}
.ct9:after{
content: "非H";
}
.ct2:after{
content: "同人";
}
.ct3:after{
content: "漫画";
}
.ct4:after{
content: "画师集";
}
.ct5:after{
content: "游戏CG";
}
.cta:after{
content: "西方";
}
`;
const baseStyle = {
// language=CSS
'public':`
div.gt:before,div.gtl:before {
font-size: 9pt;
}
#nb {
overflow: visible;
}
div#taglist {
overflow: visible;
min-height: 295px;
height: auto !important;
position: static;
z-index: 10;
}
div#gmid {
min-height: 330px;
height:auto;
}
#taglist a{
background:inherit;
position: relative;
}
#taglist a::before{
font-size:12px;
overflow: hidden;
height: 20px;
line-height: 20px;
}
#taglist a::after{
display: block;
color:#FF8E8E;
font-size:14px;
background: inherit;
border: 1px solid #000;
border-radius:5px;
position:absolute;
float: left;
z-index:999;
padding:8px;
box-shadow: 3px 3px 10px #000;
min-width:150px;
max-width:500px;
white-space:pre-wrap;
opacity: 0;
transition: opacity 0.2s;
transform: translate(-50%,20px);
top:-14px;
left: 50%;
pointer-events:none;
font-weight: 400;
line-height: 20px;
}
#taglist a:hover::after,
#taglist a:focus::after{
opacity: 1;
pointer-events:auto;
}
#taglist a:focus::before,
#taglist a:hover::before {
font-size: 12px;
position: relative;
background-color: inherit;
border: 1px solid #000;
border-bottom-width: 0;
margin: -4px -5px -4px -5px;
padding: 4px 4px 4px 4px;
color:inherit;
border-radius: 5px 5px 0 0;
}
.doubleLang #taglist a{font-size:12px !important;}
.doubleLang #taglist a::before{
margin-right: 8px;
}
.doubleLang #taglist a::after{top:1px;}
.doubleLang #taglist a:focus,
.doubleLang #taglist a:hover {
background-color: inherit;
border: 1px solid #000;
border-width: 1px 1px 0 1px;
margin: -4px -5px;
padding: 4px 4px;
color:inherit;
border-radius: 5px 5px 0 0;
}
.doubleLang #taglist a:focus::before,
.doubleLang #taglist a:hover::before {
border: none;
border-image-source: url(/img/mr.gif);
border-image-slice: 0 5 0 0;
border-image-width: 7px 5px 8px 0;
border-image-outset: 0 1px 0 0;
border-image-repeat: round;
color:inherit;
font-size: inherit;
margin: -4px 3px -4px -4px;
padding: 4px 5px 4px 4px;
}
div.gt,
div.gtw,
div.gtl{
line-height: 20px;
height: 20px;
}
.gl3c div.gt {
line-height: unset;
height: unset;
}
#taglist a:hover { z-index: 60; }
#taglist a:focus { z-index: 50; }
#taglist a::after{ z-index: -1; }
#taglist a::before {
z-index: 1;
white-space:nowrap;
}`,
'ex':`#taglist a::after{ color:#fff; }`,
'eh':`#taglist a::after{ color:#000; }`,
}
var Aria2 = (function (_isGM, _arrFn, _merge, _format, _isFunction) {
var jsonrpc_ver = '2.0';
if (_isGM) {
var doRequest = function ( opts ) {
console.warn ([
'Warning: You are now using an simple implementation of GM_xmlhttpRequest',
'Cross-domain request are not avilible unless configured correctly @ target server.',
'',
'Some of its features are not avilible, such as `username` and `password` field.'
].join('\n'));
var oReq = new XMLHttpRequest ();
var cbCommon = function (cb) {
return (function () {
cb ({
readyState: oReq.readyState,
responseHeaders: opts.getHeader ? oReq.getAllResponseHeaders() : null,
getHeader: oReq.getResponseHeader.bind (oReq),
responseText: oReq.responseText,
status: oReq.status,
statusText: oReq.statusText
});
}).bind (opts);
};
if (opts.onload) oReq.onload = cbCommon (opts.onload);
if (opts.onerror) oReq.onerror = cbCommon (opts.onerror);
oReq.open(opts.method || 'GET', opts.url, !opts.synchronous);
if (opts.headers) {
Object.keys(opts.headers).forEach (function (key) {
oReq.setRequestHeader (key, opts.headers[key]);
});
}
return oReq.send(opts.data || null);
};
} else {
var doRequest = GM_xmlhttpRequest;
}
var AriaBase = function ( options ) {
this.options = _merge ({
auth: {
type: AriaBase.AUTH.noAuth,
user: '',
pass: ''
},
host: '127.0.0.1',
port: 6800
}, options || {});
this.id = parseInt (options, 10) || (+ new Date());
};
// 静态常量
AriaBase.AUTH = {
noAuth: 0,
basic: 1,
secret: 2
};
// public 函数
AriaBase.prototype = {
getBasicAuth: function () {
return btoa (_format('%s:%s', this.options.auth.user, this.options.auth.pass));
},
send: function ( bIsDataBatch, data, cbSuccess, cbError ) {
var srcTaskObj = { jsonrpc: jsonrpc_ver, id: this.id };
var payload = {
method: 'POST',
url: _format('http://%s:%s/jsonrpc', this.options.host, this.options.port),
headers: {
'Content-Type': 'application/json; charset=UTF-8'
},
data: bIsDataBatch
? data.map (function (e) { return _merge ({}, srcTaskObj, e); })
: _merge ({}, srcTaskObj, data),
onload: function (r) {
var repData = JSON.parse (r.responseText);
if (repData.error) {
cbError && cbError (false, repData);
} else {
cbSuccess && cbSuccess (repData);
}
},
onerror: cbError ? cbError.bind(null, false) : null
};
switch ( parseInt (this.options.auth.type, 10) ) {
case AriaBase.AUTH.noAuth:
// DO NOTHING
break;
case AriaBase.AUTH.basic:
payload.headers.Authorization = 'Basic ' + this.getBasicAuth();
break;
case AriaBase.AUTH.secret:
(function (sToken) {
if (bIsDataBatch) {
for (var i = 0; i < payload.data.length; i++) {
payload.data[i].params.splice(0, 0, sToken);
}
} else {
if (!payload.data.params)
payload.data.params = [];
payload.data.params.splice(0, 0, sToken);
}
})(_format('token:%s', this.options.auth.pass));
break;
default:
throw new Error('Undefined auth type: ' + this.options.auth.type);
}
payload.data = JSON.stringify ( payload.data );
return doRequest (payload);
},
// batchAddUri ( foo, { uri: 'http://example.com/xxx', options: { ... } } )
batchAddUri: function (fCallback) {
console.warn (
'This function [%s] has deprecated! Consider use %s instead.',
'batchAddUri', 'AriaBase.BATCH'
);
// { url, name }
var payload = [].slice.call (arguments, 1).map (function (arg) {
return {
method: 'aria2.addUri',
params: [ arg.uri.map ? arg.uri : [ arg.uri ] ].concat (arg.options || [])
};
});
return this.send (true, payload, fCallback, fCallback);
}
};
// 添加各类函数
AriaBase.fn = {};
_arrFn.forEach (function (sMethod) {
// 函数链表
AriaBase.fn[sMethod] = sMethod;
// arg1, arg2, ... , [cbSuccess, [cbError]]
AriaBase.prototype[sMethod] = function ( ) {
var args = [].slice.call (arguments);
var cbSuccess, cbError;
if (args.length && _isFunction(args[args.length - 1])) {
cbSuccess = args[args.length - 1];
args.splice (-1, 1);
if (args.length && _isFunction(args[args.length - 1])) {
cbError = cbSuccess;
cbSuccess = args[args.length - 1];
args.splice (-1, 1);
}
}
return this.send (false, {
method: 'aria2.' + sMethod,
params: args
}, cbSuccess, cbError);
};
});
AriaBase.BATCH = function ( parent, cbSuccess, cbFail ) {
if (!(parent instanceof AriaBase))
throw new Error ('Parent is not AriaBase!');
this.parent = parent;
this.data = [];
this.onSuccess = cbSuccess;
this.onFail = cbFail;
};
AriaBase.BATCH.prototype = {
addRaw: function (fn, args) {
this.data.push ({
method: 'aria2.' + fn,
params: args
});
return this;
},
add: function (fn) {
// People can add more without edit source.
if (!AriaBase.fn[fn])
throw new Error ('Unknown function: ' + fn + ', please check if you had a typo.');
return this.addRaw (fn, [].slice.call(arguments, 1));
},
send: function () {
// bIsDataBatch, data, cbSuccess, cbError
var ret = this.parent.send ( true, this.data, this.onSuccess, this.onFail );
this.reset ();
return ret;
},
getActions: function () {
return this.data.slice();
},
setActions: function (actions) {
if (!actions || !actions.map) return ;
this.data = actions;
},
reset: function () {
this.onSuccess = this.onFail = null;
this.setActions ( [] );
}
};
return AriaBase;
})
// const 变量
('undefined' == typeof GM_xmlhttpRequest, [
"addUri", "addTorrent", "addMetalink", "remove", "forceRemove",
"pause", "pauseAll", "forcePause", "forcePauseAll", "unpause",
"unpauseAll", "tellStatus", "getUris", "getFiles", "getPeers",
"getServers", "tellActive", "tellWaiting", "tellStopped",
"changePosition", "changeUri", "getOption", "changeOption",
"getGlobalOption", "changeGlobalOption", "getGlobalStat",
"purgeDownloadResult", "removeDownloadResult", "getVersion",
"getSessionInfo", "shutdown", "forceShutdown", "saveSession"
],
// private 函数
(function (base) {
var _isObject = function (obj) {
return obj instanceof Object;
};
var _merge = function (base) {
var args = arguments,
argL = args.length;
for ( var i = 1; i < argL; i++ ) {
Object.keys (args[i]).forEach (function (key) {
if (_isObject(args[i][key]) && _isObject(base[key])) {
base[key] = _merge (base[key], args[i][key]);
} else {
base[key] = args[i][key];
}
});
}
return base;
};
return _merge;
})(), function (src) {
var args = arguments,
argL = args.length;
var ret = src.slice ();
for ( var i = 1; i < argL; i++ )
ret = ret.replace ('%s', args[i]);
return ret;
}, function (foo) {
return typeof foo === 'function'
});
(function() {
'use strict';
window.requestAnimationFrame = unsafeWindow.requestAnimationFrame;
unsafeWindow.wikiUpdate = autoUpdate;
MutationObserver = window.MutationObserver;
var wiki_URL="https://github.com/Mapaler/EhTagTranslator/wiki"; //GitHub wiki 的地址
var wiki_raw_URL="https://raw.githubusercontent.com/wiki/Mapaler/EhTagTranslator/database"; //GitHub wiki 的原始文件地址
var rows_filename="rows"; //行名的地址
var lang = (navigator.language||navigator.userLanguage).replace("-","_"); //获取浏览器语言
var pluginVersion = "未获取到版本"; //本程序的默认版本
var pluginName = "EhTagSyringe"; //本程序的默认名称
if (typeof(GM_info)!="undefined")
{
pluginVersion = GM_info.script.version.replace(/(^\s*)|(\s*$)/g, "");
if (GM_info.script.name_i18n)
{
var i18n = (navigator.language||navigator.userLanguage).replace("-","_"); //获取浏览器语言
pluginName = GM_info.script.name_i18n[i18n]; //支持Tampermonkey
}
else
{
pluginName = GM_info.script.localizedName || //支持Greasemonkey 油猴子 3.x
GM_info.script.name; //支持Violentmonkey(暴力猴),和其他
}
}
var rootScope = null;
const headLoaded = new Promise(function (resolve, reject) {
if(unsafeWindow.document.head && unsafeWindow.document.head.nodeName == "HEAD"){
resolve(unsafeWindow.document.head);
}else{
//监听DOM变化
MutationObserver = window.MutationObserver;
var observer = new MutationObserver(function(mutations) {
for(let i in mutations){
let mutation = mutations[i];
//监听到HEAD 结束
if(mutation.target.nodeName == "HEAD"){
observer.disconnect();
resolve(mutation.target);
break;
}
}
});
observer.observe(document, {childList: true, subtree: true, attributes: true});
}
});
function AddGlobalStyle(css) {
//等待head加载完毕
headLoaded.then(function (head) {
GM_addStyle(css);
})
}
AddGlobalStyle(`@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}`);
var defaultConfig = {
'showDescription':true,
'imageLimit':3,
'showIcon':true,
'syringe':true,
'searchHelper':true,
'magnetHelper':true,
'UITranslate':true,
'download2miwifi':false,
'ariaHelper':false,
'doubleLang': false,
'ariaOptions':{
auth:{
type: '0',
user: '',
pass: ''
},
host: 'localhost',
port: 6800
},
'style':{
'public':``,
'ex':``,
'eh':``,
}
};
var etbConfig = GM_getValue('config');
if(!etbConfig){
/*默认配置 json转换是用来深拷贝 切断关联 */
etbConfig = JSON.parse(JSON.stringify(defaultConfig));
// 不用存储 反正是默认的
// GM_setValue('config',etbConfig);
}
var tagsData = [];
if ((/(exhentai\.org|e-hentai\.org)/).test(unsafeWindow.location.href)) {
tagsData = GM_getValue('tags');
}
// 配置自动升级
for(var i in defaultConfig){
if(typeof etbConfig[i] === "undefined"){
etbConfig[i] = JSON.parse(JSON.stringify(defaultConfig[i]));
}
}
console.log('ets config:',etbConfig);
function EhTagUITranslator(){
//完整匹配才替换
function routineReplace(query,dictionaries) {
let elements = document.querySelectorAll(query);
if(elements && elements.length){
elements.forEach(function (element) {
if(element){
for(var i in element.childNodes){
let node = element.childNodes[i];
if(node.nodeName == '#text'){
let key = trim(node.textContent);
if(dictionaries[key]){
node.textContent = node.textContent.replace(key,dictionaries[key]);
}
}
}
}
})
}
}
function routineTextReplace(query,dictionaries) {
let elements = document.querySelectorAll(query);
if(elements && elements.length){
elements.forEach(function (element) {
let key = trim(element.innerText);
if(dictionaries[key]){
element.innerText = dictionaries[key];
}
})
}
}
//不需要完整匹配直接替换
function localRoutineReplace(query,dictionaries) {
let elements = document.querySelectorAll(query);
if(elements && elements.length){
elements.forEach(function (element) {
if(element){
for(var key in dictionaries){
element.innerHTML = element.innerHTML.replace(key,dictionaries[key])
}
}
})
}
}
function inputReplace(query,text) {
let input = document.querySelector(query);
if(input)input.value = text;
}
function inputPlaceholder(query,text) {
let input = document.querySelector(query);
if(input)input.placeholder = text;
}
function titlesReplace(query,dictionaries) {
let elements = document.querySelectorAll(query);
if(elements && elements.length){
elements.forEach(function (element) {
if(element){
if(element.title){
let key = trim(element.title);
if(key&&dictionaries[key]){
element.title = element.title.replace(key,dictionaries[key]);
}
}
}
})
}
}
var className = {
"artistcg" :"画师集",
"cosplay" :"COSPLAY",
"doujinshi":"同人本",
"gamecg" :"游戏CG",
"imageset" :"图集",
"manga" :"漫画",
"misc" :"杂项",
"non-h" :"非H",
"western" :"西方",
"asianporn":"亚洲"
};
var translator = {};
/*公共*/
translator.public = function () {
routineTextReplace('#nb a,.ip a,#frontpage a',{
"Front Page":"首页",
"Torrents":"种子",
"Watched": "关注",
"Popular": "流行",
"Favorites":"收藏",
"My Uploads":"我的上传",
"My Tags":"我的标签",
"Settings":"设置",
"My Galleries":"我的画廊",
"My Home":"我的首页",
"Toplists":"排行榜",
"Bounties":"悬赏",
"News":"新闻",
"Forums":"论坛",
"Wiki":"维基",
"HentaiVerse":"HV游戏",
});
titlesReplace(".ygm",{
"Contact Poster":"联系发帖人",
"Contact Uploader":"联系上传者",
});
localRoutineReplace('#iw p',{
"You do not have any watched tags. You can change your watched tags from ":"你没有任何关注的标签,你可以修改她->"
});
localRoutineReplace('#iw a',{
"My Tags":"我的标签"
});
};
/*画廊页*/
translator.gallery = function () {
routineReplace('.gdt1',{
"Posted:":"添加时间:",
"Parent:":"父级:",
"Visible:":"可见:",
"Language:":"语言:",
"File Size:":"体积:",
"Length:":"页数:",
"Favorited:":"收藏:",
});
routineReplace('.gdt2',{
"Yes":"是",
"No":"否",
"None":"无",
});
localRoutineReplace('.gdt2',{
"times":"次",
"pages":"页",
"Japanese":"日文",
"English":"英文",
"Chinese":"中文",
"Dutch":"荷兰语",
"French":"法语",
"German":"德语",
"Hungarian":"匈牙利",
"Italian":"意呆利",
"Korean":"韩语",
"Polish":"波兰语",
"Portuguese":"葡萄牙语",
"Russian":"俄语",
"Spanish":"西班牙语",
"Thai":"泰语",
"Vietnamese":"越南语",
});
routineReplace('#grt1',{
"Rating:":"评分:",
});
routineReplace('#favoritelink',{
"Add to Favorites":"添加收藏",
});
AddGlobalStyle(`.tc{ white-space:nowrap; }`);
routineReplace('.tc',{
"artist:":"艺术家:",
"character:":"角色:",
"female:":"女性:",
"group:":"团队:",
"language:":"语言:",
"male:":"男性:",
"misc:":"杂项:",
"parody:":"原作:",
"reclass:":"重新分类:"
});
localRoutineReplace('#gd5 p',{
"Report Gallery":"举报画廊",
"Archive Download":"打包下载",
"Petition to Expunge":"请求删除",
"Petition to Rename":"请求重命名",
"Torrent Download":"种子下载",
"Show Gallery Stats":"画廊状态",
});
routineReplace('#gdo4 div',{
"Normal":"小图",
"Large":"大图",
});
localRoutineReplace('#gdo2 div',{
"rows":"行"
});
routineReplace('#cdiv .c4',{
"Uploader Comment":"上传者评论",
});
routineReplace('#cdiv .c4 a',{
"Vote+":"支持",
"Vote-":"反对"
});
localRoutineReplace('.gpc',{
"Showing":"当前页面显示图片为",
"of":"共",
"images":"张"
});
localRoutineReplace('#eventpane p',{
"It is the dawn of a new day!":"新的一天开始啦",
"Reflecting on your journey so far, you find that you are a little wiser."
:"到目前为止,你的旅程展示出了你的聪慧",
"You gain":"你获得了",
"EXP":"经验",
"Credits":"积分(C)",
});
localRoutineReplace('#rating_label',{
"Average:":"平均:"
});
routineReplace('#postnewcomment a',{
"Post New Comment":"发表评论",
});
inputPlaceholder("#newtagfield","新增标签: 输入新的标签,用逗号分隔");
titlesReplace(".gdt2 .halp",{
"This gallery has been translated from the original language text.":"这个画廊已从原文翻译过来了。"
});
let rating_label = document.querySelector('#rating_label');
if(rating_label){
//监听评分显示DOM变化 触发替换内容
let observer = new MutationObserver(function(mutations) {
for(let i in mutations){
for(let n in mutations[i].addedNodes){
let node = mutations[i].addedNodes[n];
if(node.nodeName == "#text"){
node.textContent = node.textContent.replace("Average:","平均:");
node.textContent = node.textContent.replace("Rate as","打分");
node.textContent = node.textContent.replace("stars","星");
}
}
}
});
observer.observe(rating_label, {childList:true});
}
var tagmenu_act = document.querySelector("#tagmenu_act");
if(tagmenu_act){
let linkBoxPlaceObserver = new MutationObserver(function(mutations) {
for(var i in mutations){
let mutation = mutations[i];
if(mutation.type == "childList" && mutation.addedNodes.length>=2){
routineReplace('#tagmenu_act a',{
"Vote Up":"支持标签",
"Vote Down":"反对标签",
"Withdraw Vote":"撤销投票",
"Show Tagged Galleries":"搜索标签",
"Show Tag Definition":"标签简介",
"Add New Tag":"添加新标签",
});
}
}
});
linkBoxPlaceObserver.observe(tagmenu_act, {childList: true});
}
};
/*种子下载页面*/
translator.torrent = function () {
routineReplace('#torrentinfo td span', {
"Posted:" : "上传时间:",
"Size:" : "体积:",
"Seeds:" : "种源数:",
"Peers:" : "下载中:",
"Downloads:": "下载次数:",
"Uploader:" : "上传者:",
});
};
/*用户设置页面*/
translator.settings = function () {
routineReplace('#outer h1',{
"Settings":"设置"
});
routineReplace('#outer h2',{
"Image Load Settings":"图像加载设置",
"Image Size Settings":"图像大小的设置",
"Gallery Name Display":"画廊的名字显示",
"Archiver Settings":"归档设置",
"Front Page Settings":"首页设置",
"Favorites":"收藏",
"Ratings":"评分",
"Tag Namespaces":"标签组",
"Excluded Languages":"排除语言",
"Search Result Count":"搜索结果数",
"Thumbnail Settings":"缩略图设置",
"Gallery Comments":"画廊评论",
"Gallery Tags":"画廊标签",
"Gallery Page Numbering":"画廊页面页码",
"Hentai@Home Local Network Host":"Hentai@Home本地网络服务器"
});
routineReplace('.optmain p',{
"Do you wish to load images through the Hentai@Home Network, if available?"
:"是否希望通过 Hentai@Home 网路加载资源, 如果可以?",
"Normally, images are resampled to 1280 pixels of horizontal resolution for online viewing. You can alternatively select one of the following resample resolutions."
:"通常情况,图像将重采样到1280像素宽度以用于在线浏览,您也可以选择以下重新采样分辨率。",
"To avoid murdering the staging servers, resolutions above 1280x are temporarily restricted to donators, people with any hath perk, and people with a UID below 3,000,000."
:"但是为了避免负载过高,高于1280像素将只供给于赞助者、特殊贡献者,以及UID小于3,000,000的用户",
"While the site will automatically scale down images to fit your screen width, you can also manually restrict the maximum display size of an image. Like the automatic scaling, this does not resample the image, as the resizing is done browser-side. (0 = no limit)"
:"虽然图片会自动根据窗口缩小,你也可以手动设置最大大小,图片并没有重新采样(0为不限制)",
"Many galleries have both an English/Romanized title and a title in Japanese script. Which gallery name would you like to see as default?"
:"很多画廊都同时拥有英文或者日文标题,你想默认显示哪一个?",
"The default behavior for the Archiver is to confirm the cost and selection for original or resampled archive, then present a link that can be clicked or copied elsewhere. You can change this behavior here."
:"默认归档下载方式为手动选择(原画质或压缩画质),然后手动改复制或点击下载链接,你可以修改归档下载方式",
"Which display mode would you like to use on the front and search pages?"
:"你想在搜索页面显示哪种样式?",
"What categories would you like to view as default on the front page?"
:"你希望在首页上看到哪些类别?",
"Here you can choose and rename your favorite categories."
:"在这里你可以重命名你得收藏夹",
"You can also select your default sort order for galleries on your favorites page. Note that favorites added prior to the March 2016 revamp did not store a timestamp, and will use the gallery posted time regardless of this setting."
:"你也可以选择收藏夹中默认排序.请注意,2016年3月改版之前加入收藏夹的画册并未保存收藏时间,会以画册发布时间代替.",
"By default, galleries that you have rated will appear with red stars for ratings of 2 stars and below, green for ratings between 2.5 and 4 stars, and blue for ratings of 4.5 or 5 stars. You can customize this by entering your desired color combination below."
:"默认情况,被你评分的画册,2星以下显示红色,2.5星到4星显示绿色,4.5到5星显示蓝色. 你可以在下面输入自己所需的颜色组合.",
"If you want to exclude certain namespaces from a default tag search, you can check those below. Note that this does not prevent galleries with tags in these namespaces from appearing, it just makes it so that when searching tags, it will forego those namespaces."
:"如果要从默认标签搜索中排除某些标签组,可以检查以下内容。 请注意,这不会阻止在这些标签组中的标签的展示区出现,它只是在搜索标签时排除这些标签组。",
"If you wish to hide galleries in certain languages from the gallery list and searches, select them from the list below."
:"如果您希望以图库列表中的某些语言隐藏画廊并进行搜索,请从下面的列表中选择它们。",
"Note that matching galleries will never appear regardless of your search query."
:"请注意,无论搜索查询如何,匹配的图库都不会出现。",
"How many results would you like per page for the index/search page and torrent search pages? (Hath Perk: Paging Enlargement Required)"
:"搜索页面每页显示多少条数据? (Hath Perk:付费扩展)",
"How would you like the mouse-over thumbnails on the front page to load when using List Mode?"
:"你希望鼠标悬停缩略图何时加载?",
"You can set a default thumbnail configuration for all galleries you visit."
:"画廊页面缩略图设置",
"Sort order for gallery comments:"
:"评论排序方式:",
"Show gallery comment votes:"
:"显示评论投票数:",
"Sort order for gallery tags:"
:"图库标签排序方式:",
"Show gallery page numbers:"
:"显示画廊页码:",
"This setting can be used if you have a H@H client running on your local network with the same public IP you browse the site with. Some routers are buggy and cannot route requests back to its own IP; this allows you to work around this problem."
:"如果你本地安装了H@H客户端,本地ip与浏览网站的公共ip相同,一些路由器不支持回流导致无法访问到自己,你可以设置这里来解决",
"If you are running the client on the same PC you browse from, use the loopback address (127.0.0.1:port). If the client is running on another computer on your network, use its local network IP. Some browser configurations prevent external web sites from accessing URLs with local network IPs, the site must then be whitelisted for this to work."
:"如果在同一台电脑上访问网站和运行客户端,请使用本地回环地址(127.0.0.1:端口号). 如果客户端在网络上的其他计算机运行,请使用那台机器的内网ip. 某些浏览器的配置可能阻止外部网站访问本地网络,你必须将网站列入白名单才能工作."
});
routineReplace('.optmain label',{
"Yes (Recommended)"
: "是 (推荐)",
"No (You will not be able to browse as many pages. Enable only if having problems.)"
: "不 (你将无法一次浏览多页,请只有在出问题的时候启动此功能.)",
"Auto": "自动",
"Default Title": "默认标题",
"Japanese Title (if available)": "日文标题 (如果可用)",
"Manual Select, Manual Start (Default)": "手动选择,手动下载 (默认)",
"Manual Select, Auto Start": "手动选择,自动下载",
"Auto Select Original, Manual Start": "自动选择原始画质,手动下载",
"Auto Select Original, Auto Start": "自动选择原始画质,自动下载",
"Auto Select Resample, Manual Start": "自动选择压缩画质,手动下载",
"Auto Select Resample, Auto Start": "自动选择压缩画质,自动下载",
"List View": "列表视图",
"Thumbnail View": "缩略图视图",
"By last gallery update time": "以最新的画册更新时间排序",
"By favorited time": "以收藏时间排序",
"artist":"艺术家",
"character":"角色",
"female":"女性",
"group":"团队",
"language":"语言",
"male":"男性",
"misc":"杂项",
"parody":"原作",
"reclass":"重新分类",
"25 results": "25个",
"50 results": "50个",
"100 results": "100个",
"200 results": "200个",
"On mouse-over (pages load faster, but there may be a slight delay before a thumb appears)"
: "鼠标悬停时 (页面加载快,缩略图加载有延迟)",
"On page load (pages take longer to load, but there is no delay for loading a thumb after the page has loaded)"
: "页面加载时 (页面加载时间更长,但是显示的时候无需等待)",
"Normal": "小图",
"Large": "大图",
"Oldest comments first": "最早的评论",
"Recent comments first": "最新的评论",
"By highest score": "分数最高",
"On score hover or click": "悬停或点击时",
"Always": "总是",
"Alphabetical": "按字母排序",
"By tag power": "按标签权重",
"No": "否",
"Yes": "是"
});
routineReplace('.optmain #ru2',{
"Each letter represents one star. The default RRGGB means R(ed) for the first and second star, G(reen) for the third and fourth, and B(lue) for the fifth. You can also use (Y)ellow for the normal stars. Any five-letter combination of R, G, B and Y will work."