-
Notifications
You must be signed in to change notification settings - Fork 3
/
473830-greasyfork++.user.js
2338 lines (1908 loc) · 87.6 KB
/
473830-greasyfork++.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 Greasy Fork++
// @namespace https://github.com/iFelix18
// @version 3.2.52
// @author CY Fung <https://greasyfork.org/users/371179> & Davide <iFelix18@protonmail.com>
// @icon https://www.google.com/s2/favicons?domain=https://greasyfork.org
// @description Adds various features and improves the Greasy Fork experience
// @description:de Fügt verschiedene Funktionen hinzu und verbessert das Greasy Fork-Erlebnis
// @description:es Agrega varias funciones y mejora la experiencia de Greasy Fork
// @description:fr Ajoute diverses fonctionnalités et améliore l'expérience Greasy Fork
// @description:it Aggiunge varie funzionalità e migliora l'esperienza di Greasy Fork
// @description:ru Добавляет различные функции и улучшает работу с Greasy Fork
// @description:zh-CN 添加各种功能并改善 Greasy Fork 体验
// @description:zh-TW 加入多種功能並改善Greasy Fork的體驗
// @description:ja Greasy Forkの体験を向上させる様々な機能を追加
// @description:ko Greasy Fork 경험을 향상시키고 다양한 기능을 추가
// @copyright 2023, CY Fung (https://greasyfork.org/users/371179); 2021, Davide (https://github.com/iFelix18)
// @license MIT
// @require https://fastly.jsdelivr.net/gh/sizzlemctwizzle/GM_config@06f2015c04db3aaab9717298394ca4f025802873/gm_config.min.js
// @require https://fastly.jsdelivr.net/npm/@violentmonkey/shortcut@1.4.1/dist/index.min.js
// @require https://fastly.jsdelivr.net/gh/cyfung1031/userscript-supports@3fa07109efca28a21094488431363862ccd52d7c/library/WinComm.min.js
// @match *://greasyfork.org/*
// @match *://sleazyfork.org/*
// @connect greasyfork.org
// @compatible chrome
// @compatible edge
// @compatible firefox
// @compatible safari
// @compatible brave
// @grant GM.deleteValue
// @grant GM.getValue
// @grant GM.notification
// @grant GM.registerMenuCommand
// @grant GM.setValue
// @grant unsafeWindow
// @run-at document-start
// @inject-into content
// ==/UserScript==
/* global GM_config, VM, GM, WinComm */
/**
* @typedef { typeof import("./library/WinComm.js") } WinComm
*/
// console.log(GM)
/** @type {WinComm} */
const WinComm = this.WinComm;
// -------- UU Fucntion - original code: https://fastly.jsdelivr.net/npm/@ifelix18/utils@6.5.0/lib/index.min.js --------
// optimized by CY Fung to remove $ dependency and observe creation
const UU = (function () {
const scriptName = GM.info.script.name; // not name_i18n
const scriptVersion = GM.info.script.version;
const authorMatch = /^(.*?)\s<\S[^\s@]*@\S[^\s.]*\.\S+>$/.exec(GM.info.script.author);
const author = authorMatch ? authorMatch[1] : GM.info.script.author;
let scriptId = scriptName.toLowerCase().replace(/\s/g, "-");
let loggingEnabled = false;
const log = (message) => {
if (loggingEnabled) {
console.log(`${scriptName}:`, message);
}
};
const error = (message) => {
console.error(`${scriptName}:`, message);
};
const warn = (message) => {
console.warn(`${scriptName}:`, message);
};
const alert = (message) => {
window.alert(`${scriptName}: ${message}`);
};
/** @param {string} text */
const short = (text, length) => {
const s = text.split(" ");
const l = Number(length);
return s.length > l
? `${s.slice(0, l).join(" ")} [...]`
: text;
};
const addStyle = (css) => {
const head = document.head || document.querySelector("head");
const style = document.createElement("style");
style.textContent = css;
head.appendChild(style);
};
const init = async (options = {}) => {
scriptId = options.id || scriptId;
loggingEnabled = typeof options.logging === "boolean" ? options.logging : false;
console.info(
`%c${scriptName}\n%cv${scriptVersion}${author ? ` by ${author}` : ""} is running!`,
"color:red;font-weight:700;font-size:18px;text-transform:uppercase",
""
);
};
return {
init,
log,
error,
warn,
alert,
short,
addStyle
};
})();
// -------- UU Fucntion - original code: https://fastly.jsdelivr.net/npm/@ifelix18/utils@6.5.0/lib/index.min.js --------
const mWindow = (() => {
const fields = {
hideBlacklistedScripts: {
label: 'Hide blacklisted scripts:<br><span>Choose which lists to activate in the section below, press <b>Ctrl + Alt + B</b> to show Blacklisted scripts</span>',
section: ['Features'],
labelPos: 'right',
type: 'checkbox',
default: true
},
hideHiddenScript: {
label: 'Hide scripts:<br><span>Add a button to hide the script<br>See and edit the list of hidden scripts below, press <b>Ctrl + Alt + H</b> to show Hidden script',
labelPos: 'right',
type: 'checkbox',
default: true
},
showInstallButton: {
label: 'Install button:<br><span>Add to the scripts list a button to install the script directly</span>',
labelPos: 'right',
type: 'checkbox',
default: true
},
showTotalInstalls: {
label: 'Installations:<br><span>Shows the number of daily and total installations on the user profile</span>',
labelPos: 'right',
type: 'checkbox',
default: true
},
milestoneNotification: {
label: 'Milestone notifications:<br><span>Get notified whenever your total installs got over any of these milestone<br>Separate milestones with a comma, leave blank to turn off notifications</span>',
labelPos: 'left',
type: 'text',
title: 'Separate milestones with a comma!',
size: 150,
default: '10, 100, 500, 1000, 2500, 5000, 10000, 100000, 1000000'
},
nonLatins: {
label: 'Non-Latin:<br><span>This list blocks all scripts with non-Latin characters in the title/description</span>',
section: ['Lists'],
labelPos: 'right',
type: 'checkbox',
default: false // not true
},
blacklist: {
label: 'Blacklist:<br><span>A "non-opinionable" list that blocks all scripts with specific words in the title/description, references to "bots", "cheats" and some online game sites, and other "bullshit"</span>',
labelPos: 'right',
type: 'checkbox',
default: true
},
customBlacklist: {
label: 'Custom Blacklist:<br><span>Personal blacklist defined by a set of unwanted words<br>Separate unwanted words with a comma (example: YouTube, Facebook, pizza), leave blank to disable this list</span>',
labelPos: 'left',
type: 'text',
title: 'Separate unwanted words with a comma!',
size: 150,
default: ''
},
hiddenList: {
label: 'Hidden Scripts:<br><span>Block individual undesired scripts by their unique IDs<br>Separate IDs with a comma</span>',
labelPos: 'left',
type: 'textarea',
title: 'Separate IDs with a comma!',
default: '',
save: false
},
logging: {
label: 'Logging',
section: ['Developer options'],
labelPos: 'right',
type: 'checkbox',
default: false
},
debugging: {
label: 'Debugging',
labelPos: 'right',
type: 'checkbox',
default: false
}
}
const logo = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAASFBMVEVHcEwBAQEDAwMAAAACAgIBAQEAAAAREREDAwMBAQH///8WFhYuLi7U1NSdnZ1bW1vExMTq6uqtra309PRERETf399ycnKGhoaVOQEOAAAACnRSTlMAg87/rjLgE1rzhWrqxgAABexJREFUaN61WouSpCAMVPEJKCqi//+nF4IKKig6e1SduzfupEkT8oIkiRlVVdRpnmdlQ0hTZnme1kVV4Zvk96Fla8nH0ZSI8rP0Ks2uwi1Ilv4EURW5K5xS0slhMb/BkD0hrMk/q1HVeSP6QVILMFIY8wagn6ojTV5Xn8RnbFZaoAPQc9bR3gXQ/yaWvYYA8VfKKeXACZVnAE1V9o4on/izWPsb/q9Ji3j5OcrjhiCXohsAQso6lh6QL9qOEd6GAAbKYAInAFAiiqYC5LMeLIaFKeppR3h/BiAkj6CpLuEPmbbHngUBhFZsdAGiaUL5xLBzRrAAZBlk5wpnVJEohHTbuZoAD0uhMUu+uY/bLZHaryBCH4vQCuugbnSoYf5sk+llKWaEETT/Qu2TecmSHaF1KPT6gmkM4hNLLkIR2l/guAZK1fQrS3kVXmChEX5mKb0xICH/gKXrQtf2pbhlyfqFoL/1LUOVEbFwcsuSs5GfAcjJ8dVkknbafpYUfUXSQYWqRP81THcs8fbVMmTVaQU6ENNOdyxNgGRYmFsp2/mQaFiKzGeC1IcVmAjrDjq4LAF9RgdF13CAo3cTDRcAP2OOCjX6UAwCPpbWyGZsCWTMAM0YTGF2Eg0XAD8bramue9jocGVpi5y7LbUUVRO0dRINF2D9bN/PBSqgAizt8gHByJAUddEyTqa7rYF57oZkkgiYj48lYeVTuuh4Hw1A8pWhxr68snQYioOxHSm6A2gq1wuZz68suUMKELst8oCLfAew+rzMecmOLO251wYwa4CDmd4B8GyPM1YDlyXeUp8Gx412A9Chy6vP9cXO0kW+5e6N104vH68sXeW/jwzptss8OihFf1UAY2dVkgDCdQz8dfiv1m3sZek62rcIsJlr/5uADv1bhNqzxrcIb3VIkzz06m9YykMAM39kidIoAG+5R7icHlm6BViUVDqSZknpfd8NZh2MO1Xz+JKlcYsfZeK3UqjBTDRexn680PVoSxMFBiCST6RJJmXzg2FTegaPzyRWRWu9cERAHW4o6jANmPU0Ewwqe36wa8j1wyQLADHyk1FphM760H1sBY/+PtS5ECQTvucHynoapYPiZJKFDoSNnFxZYl0QYG2gQExtcJFN8LNl1voHOA++5yQelh5yVPhRopma8M3OALMO8p0GhgDT+lgKDatBhhvN5gcuRWaZJeQ8CzVBLmBLd2tgdrLND9xFxh9CW8JABYRSNQVYugJYK8rB2bn5gWOmaM4dzmXQVjvuidMzS3YfpEm9uPnBtp5yNFRJLRUTb9OaiN1x+06uk0q4+cG+U+SqCeoKLmMwrYkp1pYWRbUvgoDjDZng7EScG3/wSxAyK7+/Xvrgl974JZ1gp69r1Bc7LvUlXhEIsSxh4lWU5Ecdwixh6lhlhPwvlkyZlpIvCFEspW4B8h9YWguQYOZynzZEsJTvRWBPxwDABnKuXWJY2ovAKu8H9h7gkSXblqqFIB8AHlhyekbGUk2PYUbXtvgAXGnYjfWwNA+QcDHN3+x2Q2rngENgiSeeAUZfjDMVHkSn1m2GGBVwCh0d8NlfhJ4owiyE+VjiPV0WKQ7tHCxD1h6DeQ7PAMKWvUcERtt2PDakkio9f/1pkdcsxMOSLq7ldD5LAJf3BeCaCfQmDl57s/Xak4sHEJiPjOcdN4f61+n8CDDQaX/iIk8KcrOTDqCC4Km3tdw9AeBM1+dq1IqRE0stI8LbWk6K7AmAjYPeX/jEdF/qJtgpX+pDzfH9eCVunFyt1UEQUt8dUHwE2BE6b2f8A8I1WMxqGLQfyqu7I8zmOwBh08TJrfy36+ANw1XcQdrHEXOeWeTf5edRJ7JV+t/o+UKTc+hRxx8oF+lLaxKCvTmw1vcRshcAbGFZ8eFUv4kF4NnHewn5pM91sauv7z9gumDPPNgoobBq54/XHraLGyAZXPLqaFrnzIMpKoeR/3BxY7t6woWY2hYqZZ0u2DOPeZzZr1dP7OUZbk4MVE+wecrmqcn+5vLMevsneP3ncfwDNtu0vRpuz80AAAAASUVORK5CYII='
const locales = { /* cSpell: disable */
de: {
downgrade: 'Auf zurückstufen',
hide: '❌ Dieses skript ausblenden',
install: 'Installieren',
notHide: '✔️ Dieses skript nicht ausblenden',
milestone: 'Herzlichen Glückwunsch, Ihre Skripte haben den Meilenstein von insgesamt $1 Installationen überschritten!',
reinstall: 'Erneut installieren',
update: 'Auf aktualisieren'
},
en: {
downgrade: 'Downgrade to',
hide: '❌ Hide this script',
install: 'Install',
notHide: '✔️ Not hide this script',
milestone: 'Congrats, your scripts got over the milestone of $1 total installs!',
reinstall: 'Reinstall',
update: 'Update to'
},
es: {
downgrade: 'Degradar a',
hide: '❌ Ocultar este script',
install: 'Instalar',
notHide: '✔️ No ocultar este script',
milestone: '¡Felicidades, sus scripts superaron el hito de $1 instalaciones totales!',
reinstall: 'Reinstalar',
update: 'Actualizar a'
},
fr: {
downgrade: 'Revenir à',
hide: '❌ Cacher ce script',
install: 'Installer',
notHide: '✔️ Ne pas cacher ce script',
milestone: 'Félicitations, vos scripts ont franchi le cap des $1 installations au total!',
reinstall: 'Réinstaller',
update: 'Mettre à'
},
it: {
downgrade: 'Riporta a',
hide: '❌ Nascondi questo script',
install: 'Installa',
notHide: '✔️ Non nascondere questo script',
milestone: 'Congratulazioni, i tuoi script hanno superato il traguardo di $1 installazioni totali!',
reinstall: 'Reinstalla',
update: 'Aggiorna a'
},
ru: {
downgrade: 'Откатить до',
hide: '❌ Скрыть этот скрипт',
install: 'Установить',
notHide: '✔️ Не скрывать этот сценарий',
milestone: 'Поздравляем, ваши скрипты преодолели рубеж в $1 установок!',
reinstall: 'Переустановить',
update: 'Обновить до'
},
'zh-CN': {
downgrade: '降级到',
hide: '❌ 隐藏此脚本',
install: '安装',
notHide: '✔️ 不隐藏此脚本',
milestone: '恭喜,您的脚本超过了 $1 次总安装的里程碑!',
reinstall: '重新安装',
update: '更新到'
},
'zh-TW': {
downgrade: '降級至',
hide: '❌ 隱藏此腳本',
install: '安裝',
notHide: '✔️ 不隱藏此腳本',
milestone: '恭喜,您的腳本安裝總數已超過 $1!',
reinstall: '重新安裝',
update: '更新至'
},
'ja': {
downgrade: 'ダウングレードする',
hide: '❌ このスクリプトを隠す',
install: 'インストール',
notHide: '✔️ このスクリプトを隠さない',
milestone: 'おめでとうございます、あなたのスクリプトの合計インストール回数が $1 を超えました!',
reinstall: '再インストール',
update: '更新する'
},
'ko': {
downgrade: '다운그레이드하기',
hide: '❌ 이 스크립트 숨기기',
install: '설치',
notHide: '✔️ 이 스크립트 숨기지 않기',
milestone: '축하합니다, 스크립트의 총 설치 횟수가 $1을 넘었습니다!',
reinstall: '재설치',
update: '업데이트하기'
}
};
const blacklist = [
'\\bagar((\\.)?io)?\\b', '\\bagma((\\.)?io)?\\b', '\\baimbot\\b', '\\barras((\\.)?io)?\\b', '\\bbot(s)?\\b',
'\\bbubble((\\.)?am)?\\b', '\\bcheat(s)?\\b', '\\bdiep((\\.)?io)?\\b', '\\bfreebitco((\\.)?in)?\\b', '\\bgota((\\.)?io)?\\b',
'\\bhack(s)?\\b', '\\bkrunker((\\.)?io)?\\b', '\\blostworld((\\.)?io)?\\b', '\\bmoomoo((\\.)?io)?\\b', '\\broblox(\\.com)?\\b',
'\\bshell\\sshockers\\b', '\\bshellshock((\\.)?io)?\\b', '\\bshellshockers\\b', '\\bskribbl((\\.)?io)?\\b', '\\bslither((\\.)?io)?\\b',
'\\bsurviv((\\.)?io)?\\b', '\\btaming((\\.)?io)?\\b', '\\bvenge((\\.)?io)?\\b', '\\bvertix((\\.)?io)?\\b', '\\bzombs((\\.)?io)?\\b',
// '\\p{Extended_Pictographic}'
];
const settingsCSS = `
/*
#greasyfork-plus label::before {
content:'';
display:block;
position:absolute;
left:0;
right:0;
top:0;
bottom:0;
z-index:1;
}
#greasyfork-plus label {
position:relative;
z-index:0;
}
*/
html {
color: #222;
background: #f9f9f9;
}
#greasyfork-plus{
--config-var-display: flex;
}
#greasyfork-plus * {
font-family:Open Sans,sans-serif,Segoe UI Emoji !important;
font-size:12px
}
#greasyfork-plus .section_header[class] {
background-color:#670000;
background-image:linear-gradient(#670000,#900);
border:1px solid transparent;
color:#fff
}
#greasyfork-plus .field_label[class]{
margin-bottom:4px
}
#greasyfork-plus .field_label[class] span{
font-size:95%;
font-style:italic;
opacity:.8;
}
#greasyfork-plus .field_label[class] b{
color:#670000
}
#greasyfork-plus_logging_var[class],
#greasyfork-plus_debugging_var[class] {
--config-var-display: inline-flex;
}
#greasyfork-plus #greasyfork-plus_logging_var label.field_label[class],
#greasyfork-plus #greasyfork-plus_debugging_var label.field_label[class] {
margin-bottom:0;
align-self: center;
}
#greasyfork-plus .config_var[class]{
display:var(--config-var-display);
position: relative;
}
#greasyfork-plus_customBlacklist_var[class],
#greasyfork-plus_hiddenList_var[class],
#greasyfork-plus_milestoneNotification_var[class]{
flex-direction:column;
margin-left:21px;
}
#greasyfork-plus_customBlacklist_var[class]::before,
#greasyfork-plus_hiddenList_var[class]::before,
#greasyfork-plus_milestoneNotification_var[class]::before{
/* content: "◉"; */
content: "◎";
position: absolute;
left: auto;
top: auto;
margin-left: -16px;
}
#greasyfork-plus_field_customBlacklist[class],
#greasyfork-plus_field_milestoneNotification[class]{
flex:1;
}
#greasyfork-plus_field_hiddenList[class]{
box-sizing:border-box;
overflow:hidden;
resize:none;
width:100%
}
body > #greasyfork-plus_wrapper:only-child {
box-sizing: border-box;
overflow: auto;
max-height: calc(100vh - 72px);
padding: 12px;
/* overflow: auto; */
scrollbar-gutter: both-edges;
background: rgba(127,127,127,0.05);
border: 1px solid rgba(127,127,127,0.5);
}
#greasyfork-plus_wrapper > #greasyfork-plus_buttons_holder:last-child {
position: fixed;
bottom: 0;
right: 0;
margin: 0 12px 6px 0;
}
#greasyfork-plus .saveclose_buttons[class] {
padding: 4px 14px;
margin: 6px;
}
#greasyfork-plus .section_header_holder#greasyfork-plus_section_2[class] {
position: fixed;
left: 0;
bottom: 0;
margin: 8px;
}
#greasyfork-plus .section_header#greasyfork-plus_section_header_2[class] {
background: #000;
color: #eee;
}
#greasyfork-plus_header[class]{
font-size: 16pt;
font-weight: bold;
}
`;
const pageCSS = `
.script-list li.blacklisted{
display:none;
background:#321919;
color:#e8e6e3
}
.script-list li.hidden{
display:none;
background:#321932;
color:#e8e6e3
}
.script-list li.blacklisted a:not(.install-link),.script-list li.hidden a:not(.install-link){
color:#ff8484
}
#script-info.hidden,#script-info.hidden .user-content{
background:#321932;
color:#e8e6e3
}
#script-info.hidden a:not(.install-link):not(.install-help-link){
color:#ff8484
}
#script-info.hidden code{
background-color:transparent
}
html {
--block-btn-color:#111;
--block-btn-bgcolor:#eee;
}
#script-info.hidden, #script-info.hidden .user-content {
--block-btn-color:#eee;
--block-btn-bgcolor:#111;
}
[style-54998]{
float:right;
font-size: 70%;
text-decoration:none;
}
[style-16377]{
cursor:pointer;
font-size:70%;
white-space:nowrap;
border: 1px solid #888;
background: var(--block-btn-bgcolor, #eee);
color: var(--block-btn-color);
border-radius: 4px;
padding: 0px 6px;
margin: 0 8px;
}
[style-77329] {
cursor: pointer;
margin-left: 1ex;
white-space: nowrap;
float: right;
border: 1px solid #888;
background: var(--block-btn-bgcolor, #eee);
color: var(--block-btn-color);
border-radius: 4px;
padding: 0px 6px;
}
a#hyperlink-35389,
a#hyperlink-40361,
a#hyperlink-35389:visited,
a#hyperlink-40361:visited,
a#hyperlink-35389:hover,
a#hyperlink-40361:hover,
a#hyperlink-35389:focus,
a#hyperlink-40361:focus,
a#hyperlink-35389:active,
a#hyperlink-40361:active {
border: none !important;
outline: none !important;
box-shadow: none !important;
appearance: none !important;
background: none !important;
color:inherit !important;
}
a#hyperlink-35389{
opacity: var(--hyperlink-blacklisted-option-opacity);
}
a#hyperlink-40361{
opacity: var(--hyperlink-hidden-option-opacity);
}
html {
--hyperlink-blacklisted-option-opacity: 0.5;
--hyperlink-hidden-option-opacity: 0.5;
}
.list-option.list-current[class] > a[href] {
text-decoration:none;
}
html {
--blacklisted-display: none;
--hidden-display: none;
}
[blacklisted-shown] {
--blacklisted-display: list-item;
--hyperlink-blacklisted-option-opacity: 1;
}
[hidden-shown] {
--hidden-display: list-item;
--hyperlink-hidden-option-opacity: 1;
}
.script-list li.blacklisted{
display: var(--blacklisted-display);
}
.script-list li.hidden{
display: var(--hidden-display);
}
.install-link.install-status-checking,
.install-link.install-status-checking:visited,
.install-link.install-status-checking:active,
.install-link.install-status-checking:hover,
.install-help-link.install-status-checking {
background-color: #405458;
}
div.previewable{
display: flex;
flex-direction: column;
}
.script-version-ainfo-span {
align-self:end;
font-size: 90%;
padding: 4px 8px;
margin: 0;
}
[style*="display:"] + .script-version-ainfo-span{
display: none;
}
/* Greasy Fork Enhance - Flat Layout */
[greasyfork-enhance-k37*="|flat-layout|"] ol.script-list > li > article > h2 {
width: 0;
flex-grow: 1;
flex-basis: 60%;
}
[greasyfork-enhance-k37*="|flat-layout|"] ol.script-list > li > article > div.script-meta-block {
width: auto;
flex-basis: 40%;
flex-shrink: 0;
flex-grow: 0;
}
[greasyfork-enhance-k37*="|flat-layout|"] .script-list li:not(.ad-entry) {
padding: 1em;
margin: 0;
}
[greasyfork-enhance-k37*="|flat-layout|"] .script-list li:not(.ad-entry) article {
padding: 0;
margin: 0;
}
[greasyfork-enhance-k37*="|flat-layout|"] #script-info div.script-meta-block + #additional-info {
max-width: calc( 100% - 340px );
min-height: 300px;
box-sizing: border-box;
}
[greasyfork-enhance-k37*="|basic|"] ul.outline {
margin-bottom: -99vh;
}
.discussion-list .hidden {
display: none;
}
`
const window = {};
/** @param {typeof WinComm.createInstance} createInstance */
function contentScriptText(shObject, createInstance) {
// avoid setupEthicalAdsFallback looping
if (typeof window.ethicalads === "undefined") {
const p = Promise.resolve([]);
window.ethicalads = { wait: p };
}
/*
*
return new Promise((resolve, reject) => {
const external = unsafeWindow.external;
console.log(334, external)
const scriptHandler = GM.info.scriptHandler;
if (external && external.Violentmonkey && (scriptHandler || 'Violentmonkey') === 'Violentmonkey' ) {
external.Violentmonkey.isInstalled(name, namespace).then((data) => resolve(data));
return;
}
if (external && external.Tampermonkey && (scriptHandler || 'Tampermonkey') === 'Tampermonkey') {
external.Tampermonkey.isInstalled(name, namespace, (data) => {
(data.installed) ? resolve(data.version) : resolve();
});
return;
}
resolve();
});
*/
if (document.querySelector('#greasyfork-enhance-basic')) {
const setScriptOnDisabled = async (style) => {
try {
const pd = Object.getOwnPropertyDescriptor(style.constructor.prototype, 'disabled');
const { get, set } = pd;
Object.defineProperty(style, 'disabled', {
get() {
return get.call(this);
},
set(nv) {
let r = set.call(this, nv);
Promise.resolve().then(chHead);
return r;
}
})
} catch (e) {
}
};
document.addEventListener('style-s48', function (evt) {
const target = (evt || 0).target || 0;
if (!target) return;
setScriptOnDisabled(target)
}, true);
const isScriptEnabled = (style) => {
if (style instanceof HTMLStyleElement) {
if (!style.hasAttribute('s48')) {
style.setAttribute('s48', '');
style.dispatchEvent(new CustomEvent('style-s48'));
// setScriptOnDisabled(style);
}
return style.disabled !== true;
}
return false;
}
const chHead = () => {
let p = [];
if (isScriptEnabled(document.getElementById('greasyfork-enhance-basic')))
p.push('basic');
if (isScriptEnabled(document.getElementById('greasyfork-enhance-flat-layout')))
p.push('flat-layout');
if (isScriptEnabled(document.getElementById('greasyfork-enhance-animation')))
p.push('animation');
if (p.length >= 1)
document.documentElement.setAttribute('greasyfork-enhance-k37', `|${p.join('|')}|`);
else
document.documentElement.removeAttribute('greasyfork-enhance-k37');
}
const moHead = new MutationObserver(chHead);
moHead.observe(document.head, { subtree: false, childList: true });
chHead();
/*
const outline = document.querySelector('aside.panel > ul.outline');
if(outline) {
const div = document.createElement('div');
//outline.replaceWith(div);
//div.appendChild(outline)
}
*/
// Promise.resolve().then(()=>{
// let outline = document.querySelector('[greasyfork-enhance-k37*="|basic|"] header + aside.panel ul.outline');
// if(outline){
// let aside = outline.closest('aside.panel');
// let header = aside.parentNode.querySelector('header');
// let p = header.getBoundingClientRect().height;
// document.body.parentNode.insertBefore(aside, document.body);
// // outline.style.top='0'
// p+=(parseFloat(getComputedStyle(outline).marginTop.replace('px',''))||0)
// outline.style.marginTop= p.toFixed(2)+'px';
// }
// })
}
const { scriptHandler, scriptName, scriptVersion, scriptNamespace, communicationId } = shObject;
const wincomm = createInstance(communicationId);
const external = window.external;
if (external[scriptHandler]) 1;
else if (external && external.Violentmonkey && (scriptHandler || 'Violentmonkey') === 'Violentmonkey') scriptHandler = 'Violentmonkey';
else if (external && external.Tampermonkey && (scriptHandler || 'Tampermonkey') === 'Tampermonkey') scriptHandler = 'Tampermonkey';
const manager = external[scriptHandler];
if (!manager) {
wincomm.send('userScriptManagerNotDetected', {
code: 1
});
return;
}
const promiseWrap = (x) => {
// bug in FireFox + Violentmonkey
if (typeof (x || 0) === 'object' && typeof x.then === 'function') return x; else return Promise.resolve(x);
};
const pnIsInstalled2 = (type, scriptName, scriptNamespace) => new Promise((resolve, reject) => {
const resultPr = promiseWrap(manager.isInstalled(scriptName, scriptNamespace));
resultPr.then((result) => resolve({
type,
result: typeof result === 'string' ? { version: result } : result
})).catch(reject);
}).catch(console.warn);
const pnIsInstalled3 = (type, scriptName, scriptNamespace) => new Promise((resolve, reject) => {
try {
manager.isInstalled(scriptName, scriptNamespace, (result) => {
resolve({
type,
result: typeof result === 'string' ? { version: result } : result
});
});
} catch (e) {
reject(e);
}
}).catch(console.warn);
const enableScriptInstallChecker = (r) => {
const { type, result } = r;
let version = result.version;
// console.log(type, result, version)
if (version !== scriptVersion) return;
const pnIsInstalled = type < 25 ? pnIsInstalled2 : pnIsInstalled3;
wincomm.hook('_$GreasyFork$Msg$OnScriptInstallCheck', {
'installedVersion.req': (d, evt) => {
pnIsInstalled(type, d.data.name, d.data.namespace).then((r) => {
if (r && 'result' in r) {
wincomm.response(evt, 'installedVersion.res', {
version: r.result ? (r.result.version || '') : ''
});
}
})
}
});
wincomm.send('ready', { type });
// console.log('enableScriptInstallChecker', r)
}
const kl = manager.isInstalled.length;
if (!(kl === 2 || kl === 3)) return;
const puds = kl === 2 ? [
pnIsInstalled2(21, scriptName, scriptNamespace), // scriptName is GM.info.script.name not GM.info.script.name_i18n
pnIsInstalled2(20, scriptName, '')
] : [
pnIsInstalled3(31, scriptName, scriptNamespace),
pnIsInstalled3(30, scriptName, '')
];
Promise.all(puds).then((rs) => {
const [r1, r0] = rs;
if (r0 && r0.result && r0.result.version) enableScriptInstallChecker(r0); // '3.1.4'
else if (r1 && r1.result && r1.result.version) enableScriptInstallChecker(r1);
});
// console.log(327, shObject, scriptHandler);
}
return { fields, logo, locales, blacklist, settingsCSS, pageCSS, contentScriptText }
})();
(async () => {
let rafPromise = null;
const getRafPromise = () => rafPromise || (rafPromise = new Promise(resolve => {
requestAnimationFrame(hRes => {
rafPromise = null;
resolve(hRes);
});
}));
const isVaildURL = (url) => {
if (!url || typeof url !== 'string' || url.length < 23) return;
let obj = null;
try {
obj = new URL(url);
} catch (e) {
return false;
}
if (obj && obj.host === obj.hostname && !obj.port && (obj.protocol || '').startsWith('http') && obj.pathname) {
return true;
}
return false;
};
const installLinkPointerDownHandler = function (e) {
if (!e || !e.isTrusted) return;
const button = e.target || this;
if (button.hasAttribute('acnmd')) return;
const href = button.href;
if (!href || !isVaildURL(href)) return;
if (/\.js[^-.\w\d\s:\/\\]*$/.test(href)) {
0 && fetch(href, {
method: "GET",
cache: 'reload',
redirect: "follow"
}).then(() => {
console.debug('code url reloaded', href);
}).catch((e) => {
console.debug(e);
});
const m = /^(https\:\/\/(greasyfork|sleazyfork)\.org\/[_-\w\/]*scripts\/(\d+)[-\w%]*)(\/|$)/.exec(location.href)
if (m && m[1]) {
const href = `${m[1]}/code`
0 && fetch(href, {
method: "GET",
cache: 'reload',
redirect: "follow"
}).then(() => {
console.debug('code url reloaded', href);
}).catch((e) => {
console.debug(e);
});
}
if (m && m[3] && href.includes('.user.js')) {
const href = `https://${location.hostname}/scripts/${m[3]}-fetching/code/${crypto.randomUUID()}.user.js?version_=${Date.now()}`
0 && fetch(href, {
method: "GET",
cache: 'reload',
redirect: "follow"
}).then(() => {
console.debug('code url reloaded', href);
}).catch((e) => {
console.debug(e);
});
}
}
button.setAttribute('acnmd', '');
};
const setupInstallLink = (button) => {
if (!button || button.className !== 'install-link' || button.nodeName !== "A" || !button.href) return button;
button.addEventListener('pointerdown', installLinkPointerDownHandler);
return button;
};
function fixValue(key, def, test) {
return GM.getValue(key, def).then((v) => test(v) || GM.deleteValue(key))
}
function numberArr(arrVal) {
if (!arrVal || typeof arrVal.length !== 'number') return [];
return arrVal.filter(e => typeof e === 'number' && !isNaN(e))
}
const isScriptFirstUse = await GM.getValue('firstUse', true);
await Promise.all([
fixValue('hiddenList', [], v => v && typeof v === 'object' && typeof v.length === 'number' && (v.length === 0 || typeof v[0] === 'number')),
fixValue('lastMilestone', 0, v => v && typeof v === 'number' && v >= 0)
])
function createRE(t, ...opt) {
try {
return new RegExp(t, ...opt);
} catch (e) { }
return null;
}
const useHashedScriptName = true;
const fixLibraryScriptCodeLink = true;
const addAdditionInfoLengthHint = true;
const id = 'greasyfork-plus';
const title = `${GM.info.script.name} v${GM.info.script.version} Settings`;
const fields = mWindow.fields;
const logo = mWindow.logo;
const nonLatins = /[^\p{Script=Latin}\p{Script=Common}\p{Script=Inherited}]/gu;
const blacklist = createRE((mWindow.blacklist || []).filter(e => !!e).join('|'), 'giu');
const hiddenList = numberArr(await GM.getValue('hiddenList', []));
const lang = document.documentElement.lang;
const locales = mWindow.locales;
const _isBlackList = (text) => {
if (!text || typeof text !== 'string') return false;
if (text.includes('hack') && (text.includes('EXPERIMENT_FLAGS') || text.includes('yt.'))) return false;
return blacklist.test(text);
}
const isBlackList = (name, description) => {
// To be reviewed
if (!blacklist) return false;
return _isBlackList(name) || _isBlackList(description);
}
function hiddenListStrToArr(str) {
if (!str || typeof str !== 'string') str = '';
return [...new Set(str ? numberArr(str.split(',').map(e => parseInt(e))) : [])];
}
const gmc = new GM_config({
id,
title,
fields,