forked from xcanwin/KeepChatGPT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
KeepChatGPT.user.js
752 lines (702 loc) · 54.7 KB
/
KeepChatGPT.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
// ==UserScript==
// @name KeepChatGPT
// @description ChatGPT畅聊插件。解决所有报错,让我们的AI体验无比顺畅、丝滑、高效。持续更新的增强功能,如取消审计等。解决的报错如下: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @version 11.13
// @author xcanwin
// @namespace https://github.com/xcanwin/KeepChatGPT/
// @supportURL https://github.com/xcanwin/KeepChatGPT/
// @updateURL https://raw.githubusercontent.com/xcanwin/KeepChatGPT/main/KeepChatGPT.user.js
// @downloadURL https://raw.githubusercontent.com/xcanwin/KeepChatGPT/main/KeepChatGPT.user.js
// @description:ar برنامج ChatGPT للمحادثة الحرة. يحل جميع مشاكل التقارير ويجعل تجربة AI الخاصة بنا سلسة وسلسة وفعالة للغاية. يتم تحديث الميزات بشكل مستمر ، مثل إلغاء المراجعات وما إلى ذلك. يحل مشاكل التقارير التالية: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:bg ChatGPT плъгин за безпроблемно чатване. Решава всички грешки, които имаме с AI, и ги прави изключително гладки и ефективни. Постоянно актуализирани подобрени функции, като прекратяване на прегледите и т.н. Решава следните грешки: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:cs ChatGPT plugin pro bezproblémové chatování. Řeší všechny chyby, které máme s AI, a dělá je extrémně hladké a efektivní. Neustále aktualizované vylepšené funkce, jako je zrušení auditů atd. Řeší následující chyby: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:da ChatGPT-plugin til problemfri chat. Løser alle fejl, vi har med AI, og gør dem ekstremt glatte og effektive. Konstant opdaterede forbedrede funktioner, såsom aflysning af revisioner osv. Løser følgende fejl: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:de ChatGPT-Plugin für reibungslose Gespräche. Löst alle Fehler, die wir mit KI haben, und macht sie extrem glatt und effektiv. Kontinuierlich aktualisierte verbesserte Funktionen wie Aufhebung von Überprüfungen usw. Löst folgende Fehler: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:el Πρόσθετο ChatGPT για άψογη συνομιλία. Λύνει όλα τα σφάλματα που έχουμε με την AI και τα καθιστά απίστευτα ομαλά και αποτελεσματικά. Διαρκώς ενημερωμένες βελτιωμένες λειτουργίες, όπως ακύρωση ελέγχων κ.λπ. Λύνει τα παρακάτω σφάλματα: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:en ChatGPT plugin for seamless chatting. Solves all the errors we have with AI and makes them extremely smooth and efficient. Continuously updated enhanced features such as cancellation of reviews, etc. Solves the following errors: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:eo ChatGPT babilu pli fluante, glate kaj efike. Ĝi solvas ĉiujn erarojn, kaj enhavas novajn funkciojn kiel malkontrolado de la kontentaro. Jen kelkaj el la solvitaj eraroj: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:es El complemento ChatGPT para conversaciones sin problemas, fluidas y eficientes. Soluciona todos los errores y ofrece nuevas funciones como la cancelación de auditoría. Algunos de los errores que soluciona son: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:fi ChatGPT:n sujuva ja tehokas keskusteluliitännäinen. Se ratkaisee kaikki virheet ja sisältää uusia ominaisuuksia kuten tarkistuksen poisto. Joitakin ratkaistuja virheitä ovat: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:fr Le plugin ChatGPT pour des conversations fluides et efficaces. Résout toutes les erreurs et inclut de nouvelles fonctionnalités telles que la désactivation de l'audit. Voici quelques-unes des erreurs résolues : (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:fr-CA Le plugin ChatGPT pour des conversations fluides et efficaces. Résout toutes les erreurs et inclut de nouvelles fonctionnalités telles que la désactivation de l'audit. Voici quelques-unes des erreurs résolues : (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:he תוסף ChatGPT לשיחות חלקות ויעילות. פותר את כל השגיאות וכולל תכונות חדשות כמו ביטול אודיט. כמה מהשגיאות שפתר: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:hu A ChatGPT plugin sima és hatékony beszélgetésekhez. Megoldja az összes hibát és új funkciókat tartalmaz, mint például az auditálás kikapcsolása. Íme néhány megoldott hiba: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:id Plugin ChatGPT untuk percakapan yang lancar dan efisien. Menyelesaikan semua kesalahan dan menyertakan fitur baru seperti pembatalan audit. Berikut beberapa kesalahan yang diselesaikan: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:it Il plugin ChatGPT per conversazioni fluide ed efficienti. Risolve tutti gli errori e include nuove funzionalità come la disattivazione dell'audit. Ecco alcuni degli errori risolti: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:ja スムーズで効率的な会話のためのChatGPTプラグイン。すべてのエラーを解決し、監査のキャンセルなどの新しい機能を含みます。解決されるいくつかのエラーは次のとおりです: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:ka ChatGPT ჩატის პლაგინი. შეცვლის ყველა შეცდომას, გახსნის ჩვენს AI-ს ენახაზე შემდეგი მარტივი, სურვილებითი და ეფექტური ამაღლებულები. განმარტების განვითარება, მაგალითად, ანულება აუდიტის. შეცდომების შემცირება შემდეგია: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:ko ChatGPT 채팅 플러그인입니다. 모든 오류를 해결하여 우리의 AI 경험을 매우 원활하고 매끄럽고 효율적으로 만듭니다. 강화 기능은 지속적으로 업데이트되며 감사 검토 등이 포함됩니다. 해결되는 오류는 다음과 같습니다: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:nb ChatGPT-chatpluggen. Løser alle feil, noe som gjør AI-opplevelsen vår utrolig glatt, sømløs og effektiv. Kontinuerlig oppdaterte forbedringsfunksjoner som inkluderer å avbryte revisjon. Feil som løses inkluderer: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:nl ChatGPT-chatplugin. Lost alle fouten op, waardoor onze AI-ervaring ongelooflijk soepel, naadloos en efficiënt wordt. Voortdurend bijgewerkte verbeteringsfuncties, waaronder het annuleren van audit. Problemen die worden opgelost zijn onder meer: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:pl Wtyczka ChatGPT do płynnej i efektywnej rozmowy. Rozwiązuje wszystkie problemy z błędami, a funkcje takie jak anulowanie audytu są stale aktualizowane: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:pt-BR O plug-in ChatGPT para conversas suaves e eficientes. Resolve todos os erros, e recursos como cancelar auditoria são continuamente atualizados: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:ro Plugin-ul ChatGPT pentru conversații fluente și eficiente. Rezolvă toate erorile, iar funcții precum anularea auditului sunt actualizate în mod constant: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:ru Плагин для чатов ChatGPT. Решает все проблемы, обеспечивая невероятно гладкое, плавное и эффективное взаимодействие с нашим ИИ. Непрерывно улучшающиеся функции, такие как отключение аудита. Решенные ошибки: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:sk Chatovací plugin ChatGPT. Rieši všetky chyby a umožňuje nám s našou AI získať neuveriteľne plynulú, hladkú a efektívnu skúsenosť. Neustále vylepšované funkcie, ako napríklad zrušenie auditu. Vyriešené chyby sú nasledujúce: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:sr Plugin za razgovor ChatGPT. Rešava sve greške, omogućavajući nam neverovatno glatko, efikasno i besprekidno iskustvo sa našom AI. Neprestano unapređene funkcije, kao što je isključenje revizije. Rešeni problemi su sledeći: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:sv Chattplugin ChatGPT. Löser alla fel och ger oss en otroligt smidig, jämn och effektiv AI-upplevelse. Funktioner som kontinuerligt förbättras, till exempel avaktivering av revision. De lösta felen är följande: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:th ปลั๊กอินการสนทนา ChatGPT แก้ไขข้อผิดพลาดทั้งหมด ทำให้ประสบการณ์กับ AI ของเราเป็นอย่างลื่นไหล มีประสิทธิภาพและไม่มีการขัดจังหวะ ฟังก์ชั่นที่ปรับปรุงอยู่เสมอ เช่นการปิดการตรวจสอบ ข้อผิดพลาดที่แก้ไขได้คือ: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:tr ChatGPT Sohbet Eklentisi. Tüm hataları çözer, AI deneyimimizi inanılmaz derecede sorunsuz, pürüzsüz, verimli hale getirir. İptal denetimi gibi sürekli güncellenen artırılmış özellikler. Aşağıdaki hataları çözer: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:uk Плагін ChatGPT для плавного та ефективного спілкування. Вирішує всі проблеми з помилками, а функції, такі як скасування аудиту, постійно оновлюються: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:ug ChatGPT پلاگىنى سەركەسىنلىك ۋە ئەۋەتىلمىش پاراڭلىق ئالاقىدار. ھەممە ئىشلەتكۈچ خاتالىقىنى حەل قىلىدۇ، ئۈنۈمدار قاتارلىق مەشغۇلاتلار ئورۇنلاشتۇرۇپ بولىدۇ: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:vi ChatGPT Plugin trò chuyện. Giải quyết tất cả các lỗi, mang lại trải nghiệm AI của chúng tôi một cách cực: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:zh-CN ChatGPT畅聊插件。解决所有报错,让我们的AI体验无比顺畅、丝滑、高效。持续更新的增强功能,如取消审计等。解决的报错如下: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @description:zh-TW ChatGPT暢聊插件。解決所有報錯,讓我們的AI體驗無比順暢、絲滑、高效。持續更新的增強功能,如取消審計等。解決的報錯如下: (1) NetworkError when attempting to fetch resource. (2) Something went wrong. If this issue persists please contact us through our help center at help.openai.com. (3) Conversation not found. (4) This content may violate our content policy.
// @icon data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="2" fill="none" stroke="currentColor"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path></svg>
// @license GPL-2.0-only
// @match https://chat.openai.com/*
// @grant GM_addStyle
// @grant GM_addElement
// @grant GM_setValue
// @grant GM_getValue
// @grant unsafeWindow
// @run-at document-idle
// @noframes
// ==/UserScript==
(function() {
'use strict';
const $ = (Selector, el) => (el || document).querySelector(Selector);
const $$ = (Selector, el) => (el || document).querySelectorAll(Selector);
const u = `/api/${GM_info.script.namespace.slice(33, 34)}uth/s${GM_info.script.namespace.slice(28, 29)}ssion`;
const symbol1_selector = 'nav.flex .transition-colors';
const symbol2_selector = 'button.justify-center';
const getLang = function() {
let lang = `
{
"index": {"暗色主题": "dm", "显示调试": "sd", "取消审计": "cm", "取消动画": "ca", "关于": "ab", "建议间隔30秒": "si", "调整间隔": "mi", "检查更新": "cu", "当前版本": "cv", "发现最新版": "dl", "已是最新版": "lv", "克隆对话": "cc", "净化页面": "pp"},
"local": {
"ar": {"dm": "الوضع الداكن", "sd": "إظهار التصحيح", "cm": "إلغاء التدقيق", "ca": "إلغاء الرسوم المتحركة", "ab": "حول", "si": "اقتراح فاصل زمني 30 ثانية", "mi": "تعديل الفاصل", "cu": "التحقق من التحديثات", "cv": "الإصدار الحالي", "dl": "اكتشف أحدث إصدار", "lv": "أحدث إصدار", "cc": "استنساخ المحادثة", "pp": "تنقية الصفحة"},
"bg": {"dm": "Тъмна тема", "sd": "Показване на отстраняване на грешки", "cm": "Отказ от одит", "ca": "Отмяна на анимацията", "ab": "За", "si": "Предложете интервал от 30 секунди", "mi": "Промяна на интервала", "cu": "Проверка на актуализации", "cc": "Клониране на разговора", "pp": "Почистване на страницата"},
"cs": {"dm": "Tmavý režim", "sd": "Zobrazit ladění", "cm": "Zrušení auditu", "ca": "Zrušit animaci", "ab": "O", "si": "Navrhnout interval 30 sekund", "mi": "Upravit interval", "cu": "Kontrola aktualizací", "cc": "Klonovat konverzaci", "pp": "Očistit stránku"},
"da": {"dm": "Mørk tilstand", "sd": "Vis fejlfinding", "cm": "Annuller revision", "ca": "Annuller animation", "ab": "Om", "si": "Forslag interval på 30 sekunder", "mi": "Ændre interval", "cu": "Tjek for opdateringer", "cc": "Klon samtalen", "pp": "Rensning af siden"},
"de": {"dm": "Dunkler Modus", "sd": "Fehlerbehebung anzeigen", "cm": "Prüfung abbrechen", "ca": "Animation abbrechen", "ab": "Über", "si": "Vorschlag für Intervall von 30 Sekunden", "mi": "Intervall bearbeiten", "cu": "Überprüfung auf Updates", "cv": "Aktuelle Version", "dl": "Entdecken Sie die neueste Version", "lv": "ist die neueste Version", "cc": "Konversation klonen", "pp": "Seite bereinigen"},
"el": {"dm": "Σκοτεινή θεματολογία", "sd": "Εμφάνιση αποσφαλμάτωσης", "cm": "Ακύρωση ελέγχου", "ca": "Ακύρωση κινούμενων σχεδίων", "ab": "Σχετικά με", "si": "Προτείνετε διάστημα 30 δευτερολέπτων", "mi": "Τροποποίηση διαστήματος", "cu": "Έλεγχος ενημερώσεων", "cc": "Κλωνοποίηση συνομιλίας", "pp": "Καθαρισμός σελίδας"},
"en": {"dm": "Dark mode", "sd": "Show debugging", "cm": "Cancel audit", "ca": "Cancel animation", "ab": "About", "si": "Suggest interval of 30 seconds; The author usually sets 150", "mi": "Modify interval", "cu": "Check for updates", "cv": "Current version", "dl": "Discover the latest version", "lv": "is the latest version", "cc": "Clone conversation", "pp": "Purify page"},
"eo": {"dm": "Malhela moduso", "sd": "Montri depuradon", "cm": "Nuligi kontroli", "ca": "Nuligi animacion", "ab": "Pri", "si": "Sugesti intervalon de 30 sekundoj", "mi": "Modifi intervalon", "cu": "Kontroli ĝisdatigojn", "cc": "Kloni konversacion", "pp": "Pura paĝo"},
"es": {"dm": "Modo oscuro", "sd": "Mostrar depuración", "cm": "Cancelar auditoría", "ca": "Cancelar animación", "ab": "Acerca de", "si": "Sugerir un intervalo de 30 segundos", "mi": "Modificar intervalo", "cu": "Comprobar actualizaciones", "cv": "Versión actual", "dl": "Descubre la última versión", "lv": "es la última versión", "cc": "Clonar conversación", "pp": "Purificar página"},
"fi": {"dm": "Tumma tila", "sd": "Näytä virheenkorjaus", "cm": "Peruuta tarkistus", "ca": "Peruuta animaatio", "ab": "Tietoa", "si": "Ehdota 30 sekunnin väliaikaa", "mi": "Muokkaa väliä", "cu": "Tarkista päivitykset", "cc": "Kloonaa keskustelu", "pp": "Puhdista sivu"},
"fr": {"dm": "Mode sombre", "sd": "Afficher le débogage", "cm": "Annuler l'audit", "ca": "Annuler l'animation", "ab": "À propos de", "si": "Suggérer un intervalle de 30 secondes", "mi": "Modifier l'intervalle", "cu": "Vérifier les mises à jour", "cv": "Version actuelle", "dl": "Découvrir la dernière version", "lv": "est la dernière version", "cc": "Cloner la conversation", "pp": "Purifier la page"},
"fr-CA": {"dm": "Mode nuit", "sd": "Afficher le débogage", "cm": "Annuler la vérification", "ca": "Annuler l'animation", "ab": "À propos de", "si": "Suggérer un intervalle de 30 secondes", "mi": "Modifier l'intervalle", "cu": "Vérifier les mises à jour", "cv": "Version actuelle", "dl": "Découvrir la dernière version", "lv": "est la dernière version", "cc": "Cloner la conversation", "pp": "Purifier la page"},
"he": {"dm": "מצב כהה", "sd": "הצגת התיקון", "cm": "ביטול ביקורת", "ca": "בטל אנימציה", "ab": "אודות", "si": "הצע מרווח של 30 שניות", "mi": "שינוי מרווח", "cu": "בדיקת עדכונים", "cc": "שכפול שיחה", "pp": "טיהור הדף"},
"hu": {"dm": "Sötét mód", "sd": "Hibakeresés mutatása", "cm": "Ellenőrzés megszüntetése", "ca": "Animáció törlése", "ab": "Rólunk", "si": "Javaslat 30 másodperces időközre", "mi": "Időköz módosítása", "cu": "Frissítések keresése", "cc": "Beszélgetés klónozása", "pp": "Oldal tisztítása"},
"id": {"dm": "Mode gelap", "sd": "Tampilkan debugging", "cm": "Batalkan audit", "ca": "Batalkan animasi", "ab": "Tentang", "si": "Sarankan interval 30 detik", "mi": "Modifikasi interval", "cu": "Periksa Pembaruan", "cc": "Klon percakapan", "pp": "Membersihkan halaman"},
"it": {"dm": "Modalità scura", "sd": "Mostra debug", "cm": "Annulla verifica", "ca": "Annulla animazione", "ab": "Riguardo a", "si": "Suggerisci un intervallo di 30 secondi", "mi": "Modifica intervallo", "cu": "Verifica aggiornamenti", "cv": "Versione attuale", "dl": "Scopri l'ultima versione", "lv": "è l'ultima versione", "cc": "Clona conversazione", "pp": "Purifica pagina"},
"ja": {"dm": "ダークモード", "sd": "デバッグを表示", "cm": "監査をキャンセル", "ca": "アニメーションのキャンセル", "ab": "について", "si": "30秒間隔を提案する", "mi": "間隔を変更する", "cu": "更新をチェックする", "cv": "現在のバージョン", "dl": "最新バージョンを発見する", "lv": "最新バージョンです", "cc": "会話をクローンする", "pp": "ページを浄化する"},
"ka": {"dm": "ბნელი რეჟიმი", "sd": "გამოჩენა დებაგი", "cm": "ანულირება აუდიტი", "ca": "ანიმაციის გაუქმება", "ab": "შესახებ", "si": "30 წამის ინტერვალის შეტანა", "mi": "ინტერვალის შეცვლა", "cu": "განახლებების შემოწმება", "cc": "კონვერსაციის კლონირება", "pp": "გვერდის გაწმენდა"},
"ko": {"dm": "다크 모드", "sd": "디버깅 표시", "cm": "감사 취소", "ca": "애니메이션 취소", "ab": "관하여", "si": "30초 간격 건의", "mi": "간격 수정", "cu": "업데이트 확인", "cv": "현재 버전", "dl": "최신 버전 찾기", "lv": "최신 버전입니다.", "cc": "대화 복제", "pp": "페이지 정화"},
"nb": {"dm": "Mørk modus", "sd": "Vis feilsøking", "cm": "Avbryt revisjonen", "ca": "Avbryt animasjon", "ab": "Om", "si": "Forslag om et intervall på 30 sekunder", "mi": "Endre intervall", "cu": "Sjekk etter oppdateringer", "cc": "Klon samtalen", "pp": "Rens side"},
"nl": {"dm": "Donkere modus", "sd": "Foutopsporing weergeven", "cm": "Controle annuleren", "ca": "Animatie annuleren", "ab": "Over", "si": "Stel een interval van 30 seconden voor", "mi": "Interval wijzigen", "cu": "Controleren op updates", "cc": "Gesprek klonen", "pp": "Pagina zuiveren"},
"pl": {"dm": "Tryb ciemny", "sd": "Pokaż debugowanie", "cm": "Anuluj audyt", "ca": "Anuluj animację", "ab": "O", "si": "Zasugeruj interwał 30 sekund", "mi": "Zmień interwał", "cu": "Sprawdź aktualizacje", "cc": "Klonuj rozmowę", "pp": "Oczyść stronę"},
"pt-BR": {"dm": "Modo escuro", "sd": "Mostrar depuração", "cm": "Cancelar auditoria", "ca": "Cancelar animação", "ab": "Sobre", "si": "Sugira um intervalo de 30 segundos", "mi": "Modificar intervalo", "cu": "Verificar atualizações", "cc": "Clonar conversa", "pp": "Purificar página"},
"ro": {"dm": "Mod întunecat", "sd": "Afișare depanare", "cm": "Anulare audit", "ca": "Anulare animație", "ab": "Despre", "si": "Sugerați un interval de 30 secunde", "mi": "Modificați intervalul", "cu": "Verifică actualizări", "cc": "Clonează conversația", "pp": "Purificare pagină"},
"ru": {"dm": "Темный режим", "sd": "Показать отладку", "cm": "Отменить аудит", "ca": "Отменить анимацию", "ab": "О", "si": "Предложить интервал в 30 секунд", "mi": "Изменить интервал", "cu": "Проверить обновления", "cc": "Клонировать диалог", "pp": "Очистить страницу"},
"sk": {"dm": "Tmavý režim", "sd": "Zobraziť ladenie", "cm": "Zrušiť audit", "ca": "Zrušiť animáciu", "ab": "O", "si": "Navrhnúť interval 30 sekúnd", "mi": "Zmena intervalu", "cu": "Kontrola aktualizácií", "cc": "Klonovať konverzáciu", "pp": "Očistiť stránku"},
"sr": {"dm": "Тамни режим", "sd": "Прикажи отклањање грешака", "cm": "Откажи ревизију", "ca": "Откажи анимацију", "ab": "О", "si": "Predložiti interval od 30 sekundi", "mi": "Измена интервала", "cu": "Provera ažuriranja", "cc": "Клонирај разговор", "pp": "Прочисти страницу"},
"sv": {"dm": "Mörkt läge", "sd": "Visa felsökning", "cm": "Avbryt revision", "ca": "Avbryt animation", "ab": "Om", "si": "Föreslå intervall på 30 sekunder", "mi": "Ändra intervall", "cu": "Kontrollera uppdateringar", "cc": "Klonar samtal", "pp": "Rensa sidan"},
"th": {"dm": "โหมดมืด", "sd": "แสดงการแก้ไขข้อผิดพลาด", "cm": "ยกเลิกการตรวจสอบ", "ca": "ยกเลิกการเคลื่อนไหว", "ab": "เกี่ยวกับ", "si": "เสนอช่วงเวลา 30 วินาที", "mi": "แก้ไขระยะห่าง", "cu": "ตรวจสอบการอัปเดต", "cc": "โคลนสนทนา", "pp": "ทำความสะอาดหน้า"},
"tr": {"dm": "Karanlık mod", "sd": "Hata ayıklama göster", "cm": "Denetimi İptal Et", "ca": "Animasyonu iptal et", "ab": "Hakkında", "si": "30 saniyelik aralık önerin", "mi": "Aralığı değiştir", "cu": "Güncelleştirmeleri kontrol et", "cc": "Sohbeti kopyala", "pp": "Sayfayı temizle"},
"uk": {"dm": "Темний режим", "sd": "Показати налагодження", "cm": "Скасувати аудит", "ca": "Скасувати анімацію", "ab": "Про", "si": "Запропонуйте інтервал у 30 секунд", "mi": "Змінити інтервал", "cu": "Перевірити оновлення", "cc": "Клонувати діалог", "pp": "Очистити сторінку"},
"ug": {"dm": "تېما كۆرسىتىش", "sd": "كۆرسەتكەن يۇقىرىلاش", "cm": "ئەمەلدىن قالدۇرۇش", "ca": "ئېنىماتىكىنى بىكار قىلىش", "ab": "ئۇچۇرلىق", "si": "30 سىكونتلىك ئارىلىقنى سۇنۇشتۇرۇش", "mi": "ئارىلىق ئۆزگەرتىش", "cu": "يېڭىلانما كۆزەت", "cc": "كۆپچەي ئىككىلىش", "pp": "چۈشۈرۈش بەت"},
"vi": {"dm": "Chế độ tối", "sd": "Hiển thị gỡ lỗi", "cm": "Hủy đánh giá", "ca": "Hủy hoạt hình", "ab": "Về", "si": "Đề xuất khoảng thời gian 30 giây", "mi": "Sửa khoảng cách", "cu": "Kiểm tra cập nhật", "cc": "Sao chép cuộc trò chuyện", "pp": "Làm sạch trang"},
"zh-CN": {"dm": "暗色主题", "sd": "显示调试", "cm": "取消审计", "ca": "取消动画", "ab": "关于", "si": "建议间隔30秒以上,作者平时设置的是150", "mi": "调整间隔", "cu": "检查更新", "cc": "克隆对话", "pp": "净化页面"},
"zh-TW": {"dm": "暗黑模式", "sd": "顯示調試", "cm": "取消稽核", "ca": "取消動畫", "ab": "關於", "si": "建議間隔30秒", "mi": "調整間隔", "cu": "檢查更新", "cc": "複製對話", "pp": "淨化頁面"}
}
}
`;
lang = JSON.parse(lang);
for(let k in lang.local){
if (k.length > 2 && !(k.slice(0, 2) in lang.local)) {
lang.local[k.slice(0, 2)] = lang.local[k];
}
}
const nls = navigator.languages;
let language = "zh-CN";
for (let j = 0; j < nls.length; j++) {
let nl = nls[j];
if (nl in lang.local) {
language = nl;
break;
} else if (nl.length > 2 && nl.slice(0, 2) in lang.local) {
language = nl.slice(0, 2);
break;
}
}
//language = "en"; //debug
return [lang.index, lang.local[language]];
};
const [langIndex, langLocal] = getLang();
const tl = function(s) {
let r;
try {
const i = langIndex[s];
r = langLocal[i];
} catch (e) {
r = s;
}
if (r === undefined) {r = s;}
return r;
};
const sv = function(key, value = "") {
GM_setValue(key, value);
};
const gv = function(key, value = "") {
return GM_getValue(key, value);
};
const formatDate = function(d) {
return (new Date(d)).toLocaleString();
};
const formatJson = function(d) {
try {
const j = JSON.parse(d);
return `<pre>${JSON.stringify(j, null, 2)}</pre>`;
} catch (e) {
return d;
}
};
const setIfr = function(u = "") {
if ($("#xcanwin") === null) {
const nIfr = document.createElement('iframe');
nIfr.id = "xcanwin";
nIfr.style = `height: 0px; width: 100%;`;
if (gv("k_showDebug", false) === true) {
nIfr.style.height = '80px';
} else {
nIfr.style.height = '0px';
}
if (u) {
nIfr.src = u;
}
nIfr.onload = function() {
const nIfrText = $("#xcanwin").contentWindow.document.documentElement.innerText;
try {
$("#xcanwin").contentWindow.document.documentElement.style = `background: #FCF3CF; height: 360px; width: 1080px; overflow; auto;`;
if (nIfrText.indexOf(`"expires":"`) > -1) {
console.log(`KeepChatGPT: IFRAME: Expire date: ${formatDate(JSON.parse(nIfrText).expires)}`);
$("#xcanwin").contentWindow.document.documentElement.innerHTML = formatJson(nIfrText);
} else if (nIfrText.match(/Please stand by|while we are checking your browser|Please turn JavaScript on|Please enable Cookies|reload the page/)) {
console.log(`KeepChatGPT: IFRAME: BypassCF`);
}
} catch (e) {
console.log(`KeepChatGPT: IFRAME: ERROR: ${e},\nERROR RESPONSE:\n${nIfrText}`);
}
};
$("main").lastElementChild.appendChild(nIfr);
} else{
if (u) {
$("#xcanwin").src = u;
}
}
};
const keepChat = function() {
fetch(u).then((response) => {
response.text().then((data) => {
try {
const contentType = response.headers.get('Content-Type');
if (contentType.indexOf("application/json") > -1 && response.status !== 403 && data.indexOf(`"expires":"`) > -1) {
console.log(`KeepChatGPT: FETCH: Expire date: ${formatDate(JSON.parse(data).expires)}`);
$("#xcanwin").contentWindow.document.documentElement.innerHTML = formatJson(data);
} else {
setIfr(u);
}
} catch (e) {
console.log(`KeepChatGPT: FETCH: ERROR: ${e},\nERROR RESPONSE:\n${data}`);
setIfr(u);
}
})
});
}
const ncheckbox = function() {
const nsvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
nsvg.setAttribute("viewBox", "0 0 100 30");
nsvg.classList.add("checkbutton");
nsvg.innerHTML = `<g fill="none" fill-rule="evenodd"><path fill="#E3E3E3" d="M0 15C0 6.716 6.716 0 15 0h14c8.284 0 15 6.716 15 15s-6.716 15-15 15H15C6.716 30 0 23.284 0 15z"/><circle fill="#FFF" cx="15" cy="15" r="13"/></g>`;
return nsvg.cloneNode(true);
};
const ndialog = function(title = 'KeepChatGPT', content = '', buttonvalue = 'OK', buttonfun = function(t) {return t;}, inputtype = 'br', inputvalue = '') {
const ndivalert = document.createElement('div');
ndivalert.setAttribute("class", "kdialog relative z-50");
ndivalert.innerHTML = `
<div class="fixed inset-0 bg-gray-500/90"></div>
<div class="fixed inset-0 overflow-y-auto z-50">
<div class="flex items-end justify-center min-h-full p-4 sm:items-center sm:p-0 text-center">
<div class="bg-white dark:bg-gray-900 rounded-lg sm:max-w-lg sm:p-6 text-left">
<div class="flex items-center justify-between">
<div>
<div class="flex items-center justify-between">
<h3 class="dark:text-gray-200 text-gray-900 text-lg">${title}</h3>
<p class="kdialogclose" style="cursor: pointer;">X</p>
</div>
<p class="dark:text-gray-100 mt-2 text-gray-500 text-sm" style="margin-bottom: 10px;">${content}</p>
<div class="md:py-3 md:pl-4 border border-black/10 bg-white dark:border-gray-900/50 dark:text-white dark:bg-gray-700 rounded-md shadow-[0_0_10px_rgba(0,0,0,0.10)] dark:shadow-[0_0_15px_rgba(0,0,0,0.10)]">
<${inputtype} class="kdialoginput resize-none border-0 bg-transparent p-0 pr-7 focus:ring-0 focus-visible:ring-0 dark:bg-transparent" style="max-height: 200px; height: 24px; outline: none;" placeholder=""></${inputtype}>
</div>
</div>
</div>
<div class="flex sm:flex-row-reverse sm:mt-4"><button class="btn btn-neutral kdialogbtn">${buttonvalue}</button>
</div>
</div>
</div>
</div>
`;
if (inputtype !== 'br') {
$(".kdialoginput", ndivalert).value = inputvalue;
} else {
$(".kdialoginput", ndivalert).parentElement.style.display = 'none';
}
$(".kdialogclose", ndivalert).onclick = function() {
ndivalert.remove();
};
$(".kdialogbtn", ndivalert).onclick = function() {
buttonfun(ndivalert);
$(".kdialogclose", ndivalert).onclick();
};
document.body.appendChild(ndivalert);
};
const loadMenu = function() {
if ($(".kmenu") !== null) {
return;
}
const ndivmenu = document.createElement('div');
ndivmenu.setAttribute("class", "kmenu");
ndivmenu.innerHTML = `
<ul>
<li id=nmenuid_sd>${tl("显示调试")}</li>
<li id=nmenuid_dm>${tl("暗色主题")}</li>
<li id=nmenuid_ca>${tl("取消动画")}</li>
<li id=nmenuid_cm>${tl("取消审计")}</li>
<li id=nmenuid_af>${tl("调整间隔")}</li>
<li id=nmenuid_cc>${tl("克隆对话")}</li>
<li id=nmenuid_pp>${tl("净化页面")}</li>
<li id=nmenuid_cu>${tl("检查更新")}</li>
<li id=nmenuid_ab>${tl("关于")}</li>
</ul>
`;
document.body.appendChild(ndivmenu);
$('#nmenuid_sd').appendChild(ncheckbox());
$('#nmenuid_dm').appendChild(ncheckbox());
$('#nmenuid_ca').appendChild(ncheckbox());
$('#nmenuid_cm').appendChild(ncheckbox());
$('#nmenuid_cc').appendChild(ncheckbox());
$('#nmenuid_pp').appendChild(ncheckbox());
$('#nmenuid_sd').onclick = function() {
if ($('.checkbutton', this).classList.contains('checked')) {
$('#xcanwin').style.height = '0px';
sv("k_showDebug", false);
} else {
$('#xcanwin').style.height = '80px';
sv("k_showDebug", true);
}
$('.checkbutton', this).classList.toggle('checked');
};
$('#nmenuid_dm').onclick = function() {
if ($('.checkbutton', this).classList.contains('checked')) {
$('#kcg').style = $('#kcg').styleOrigin;
sv("k_theme", "light");
} else {
$('#kcg').styleOrigin = $('#kcg').style;
$('#kcg').style.background = "#2C3E50";
$('#kcg').style.animation = "none";
$('#kcg').style.color = "#ffffff";
$('#kcg').style.marginRight = "inherit";
sv("k_theme", "dark");
}
$('.checkbutton', this).classList.toggle('checked');
};
$('#nmenuid_ca').onclick = function() {
sv("k_cancelAnimation", !$('.checkbutton', this).classList.contains('checked'));
$('#kcg').classList.toggle('shine');
$('.checkbutton', this).classList.toggle('checked');
};
$('#nmenuid_cm').onclick = function() {
if ($('.checkbutton', this).classList.contains('checked')) {
byeModer(false);
sv("k_closeModer", false);
} else {
byeModer(true);
sv("k_closeModer", true);
}
$('.checkbutton', this).classList.toggle('checked');
};
$('#nmenuid_af').onclick = function() {
toggleMenu('hide');
ndialog(`${tl("调整间隔")}`, `${tl("建议间隔30秒")}`, `Go`, function(t) {
try {
interval2Time = parseInt($(".kdialoginput", t).value);
} catch (e) {
interval2Time = parseInt(gv("k_interval", 30));
}
if (interval2Time < 10) {
return;
}
clearInterval(nInterval2);
nInterval2 = setInterval(nInterval2Fun, 1000 * interval2Time);
sv("k_interval", interval2Time);
}, `input`, parseInt(gv("k_interval", 30)));
};
$('#nmenuid_cc').onclick = function() {
if ($('.checkbutton', this).classList.contains('checked')) {
sv("k_clonechat", false);
cloneChat(false);
} else {
sv("k_clonechat", true);
cloneChat(true);
}
$('.checkbutton', this).classList.toggle('checked');
};
$('#nmenuid_pp').onclick = function() {
if ($('.checkbutton', this).classList.contains('checked')) {
sv("k_cleanlyhome", false);
} else {
sv("k_cleanlyhome", true);
}
$('.checkbutton', this).classList.toggle('checked');
};
$('#nmenuid_cu').onclick = function() {
toggleMenu('hide');
checkForUpdates();
};
$('#nmenuid_ab').onclick = function() {
window.open(GM_info.script.namespace, '_blank');
};
};
const toggleMenu = function(action) {
const ndivmenu = $(".kmenu");
if (action === "show") {
ndivmenu.style.display = 'block';
if ($("#kcg")) {
ndivmenu.style.left = `${$("#kcg").getBoundingClientRect().right + 20}px`;
ndivmenu.style.top = `${$("#kcg").getBoundingClientRect().top}px`;
}
} else {
ndivmenu.style.display = 'none';
}
};
const loadKCG = function() {
let symbol_prt;
if ($("#kcg") !== null) {
return;
}
if ($("main").kcg !== undefined) {
if ($(symbol1_selector)) {
$("main").kcg.innerHTML = $("main").kcg._symbol1_innerHTML;
symbol_prt = findParent($(symbol1_selector), "nav.flex", 3);
} else if ($(symbol2_selector)) {
$("main").kcg.innerHTML = $("main").kcg._symbol2_innerHTML;
symbol_prt = $(symbol2_selector).parentElement;
}
symbol_prt.insertBefore($("main").kcg, symbol_prt.childNodes[0]);
return;
}
loadMenu();
setIfr(u);
const ndivkcg = document.createElement("div");
ndivkcg.id = "kcg";
ndivkcg.setAttribute("class", "shine flex py-3 px-3 items-center gap-3 rounded-md text-sm mb-1 flex-shrink-0 border border-white/20");
const ndivmenu = $(".kmenu");
ndivkcg.onmouseover = ndivmenu.onmouseover = function() {
toggleMenu('show');
};
ndivkcg.onmouseleave = ndivmenu.onmouseleave = function() {
toggleMenu('hide');
};
ndivkcg.onclick = function() {
if (ndivmenu.style.display === 'none') {
toggleMenu('show');
} else {
toggleMenu('hide');
}
};
const icon = GM_info.script.icon ? GM_info.script.icon : `${GM_info.script.namespace}raw/main/assets/logo.svg`;
ndivkcg._symbol1_innerHTML = `<img src='${icon}' />Keep${ndivkcg.id.slice(1,2).toUpperCase()}hatGPT by x${ndivkcg.id.slice(1,2)}anwin`;
ndivkcg._symbol2_innerHTML = `Keep${ndivkcg.id.slice(1,2).toUpperCase()}hatGPT`;
if ($(symbol1_selector)) {
ndivkcg.innerHTML = ndivkcg._symbol1_innerHTML;
symbol_prt = findParent($(symbol1_selector), "nav.flex", 3);
} else if ($(symbol2_selector)) {
ndivkcg.innerHTML = ndivkcg._symbol2_innerHTML;
symbol_prt = $(symbol2_selector).parentElement;
}
$("main").kcg = ndivkcg;
symbol_prt.insertBefore($("main").kcg, symbol_prt.childNodes[0]);
addStyle();
setUserOptions();
};
const addStyle = function() {
GM_addStyle(`
#kcg {
color: #555;
background: linear-gradient(to top right, #F0B27A, #FDE184, #F0B27A);
animation: gradient 6s ease-in-out infinite;
position: relative;
overflow: hidden;
font-weight: bold;
user-select: none;
}
@keyframes gradient {
0%{background-color:#F0B27A;}
50%{background-color:#FDE184;}
100%{background-color:#F0B27A;}
}
.shine::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(
to bottom right,
rgba(255, 255, 255, 0.3),
rgba(255, 255, 255, 0.15),
rgba(255, 255, 255, 0)
);
transform: rotate(-45deg);
animation: shine 2.8s linear infinite;
}
@keyframes shine {
from {
transform: translateX(-50%) translateY(-50%) rotate(-45deg);
}
to {
transform: translateX(150%) translateY(150%) rotate(-45deg);
}
}
.kmenu {
background-color: #202123;
color: #FFFFFF;
border: 1px solid #4D4D4F;
border-radius: 10px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
display: none;
min-width: 200px;
padding: 12px 0;
position: absolute;
z-index: 1000;
}
.kmenu::before {
content: "";
position: absolute;
top: 0px;
bottom: 0px;
left: -30px;
right: 0px;
pointer-events: auto;
z-index: -1;
}
.kmenu::after {
content: "";
position: absolute;
top: 15px;
left: -20px;
border-style: solid;
border-width: 10px 10px 10px 10px;
border-color: transparent #202123 transparent transparent;
}
.kmenu li {
display: block;
padding: 8px 24px;
text-align: left;
user-select: none;
display: flex;
align-items: center;
}
.kmenu li:hover {
background-color: #273746;
cursor: pointer;
}
main div.items-end>div:first-child {
user-select: none;
max-width: 30px;
cursor: pointer;
}
nav {
position: relative;
}
.checkbutton {
height: 20px;
margin-left: auto;
margin-right: -35px;
padding-left: 10px;
}
.checkbutton:hover {
cursor: pointer;
}
.checked path {
fill: #30D158;
}
.checked circle {
transform: translateX(14px);
transition: transform 0.2s ease-in-out;
}
`);
};
const setUserOptions = function() {
if (gv("k_showDebug", false) === true) {
$('#nmenuid_sd .checkbutton').classList.add('checked');
$('#xcanwin').style.height = '80px';
} else {
$('#xcanwin').style.height = '0px';
}
if (gv("k_theme", "light") === "light") {
$('#kcg').styleOrigin = $('#kcg').style;
} else {
$('#nmenuid_dm .checkbutton').classList.add('checked');
$('#kcg').style.background = "#2C3E50";
$('#kcg').style.animation = "none";
$('#kcg').style.color = "#ffffff";
$('#kcg').style.marginRight = "inherit";
}
if (gv("k_cancelAnimation", false) === true) {
$('#nmenuid_ca .checkbutton').classList.add('checked');
$('#kcg').classList.remove('shine');
} else {
$('#kcg').classList.add('shine');
}
if (gv("k_closeModer", false) === true) {
$('#nmenuid_cm .checkbutton').classList.add('checked');
byeModer(true);
} else {
byeModer(false);
}
if (gv("k_clonechat", false) === true) {
$('#nmenuid_cc .checkbutton').classList.add('checked');
cloneChat(true);
}
if (gv("k_cleanlyhome", false) === true) {
$('#nmenuid_pp .checkbutton').classList.add('checked');
}
};
let byeModer = function(action) {
if (typeof _fetch === 'undefined') {
var _fetch = fetch;
}
if (action === true) {
unsafeWindow.fetch = new Proxy(fetch, {
apply: function (target, thisArg, argumentsList) {
const n = {};
n.json = function() {return {};};
return argumentsList[0].includes('moderations') ? Promise.resolve(n) : target.apply(thisArg, argumentsList);
}
});
} else {
unsafeWindow.fetch = _fetch;
}
};
let byeConversationNotFound = function(action) {
if (typeof _fetch === 'undefined') {
var _fetch = fetch;
}
if (action === true) {
unsafeWindow.fetch = new Proxy(_fetch, {
apply: function (target, thisArg, argumentsList) {
try {
if (argumentsList[0].includes('conversation')) {
const post_body = JSON.parse(argumentsList[1].body);
post_body.conversation_id = location.href.match(/\/c\/(.*)/)[1];
argumentsList[1].body = JSON.stringify(post_body);
}
} catch (e) {}
return target.apply(thisArg, argumentsList);
}
});
} else {
unsafeWindow.fetch = _fetch;
}
};
const verInt = function(vs) {
const vl = vs.split('.');
let vi = 0;
for (let i = 0; i < vl.length && i < 3; i++) {
vi += parseInt(vl[i]) * (1000 ** (2 - i));
}
return vi;
}
const checkForUpdates = function() {
const crv = GM_info.script.version;
let updateURL = GM_info.scriptUpdateURL || GM_info.script.updateURL || GM_info.script.downloadURL;
updateURL = `${updateURL}?t=${Date.now()}`;
fetch(updateURL, {
cache: 'no-cache'
}).then((response) => {
response.text().then((data) => {
const m = data.match(/@version\s+(\S+)/);
const ltv = m && m[1];
if (ltv && verInt(ltv) > verInt(crv)) {
ndialog(`${tl("检查更新")}`, `${tl("当前版本")}: ${crv}, ${tl("发现最新版")}: ${ltv}`, `UPDATE`, function(t) {
window.open(updateURL, '_blank');
});
} else {
ndialog(`${tl("检查更新")}`, `${tl("当前版本")}: ${crv}, ${tl("已是最新版")}`, `OK`);
}
});
}).catch(e => console.log(e));
}
const cloneChat = function(action) {
if (action === true) {
$('body').addEventListener('click', cloneChat.listenClick);
} else {
$('body').removeEventListener('click', cloneChat.listenClick);
}
};
cloneChat.listenClick = function(event) {
const avatarSelector = "main div.items-end>div:first-child";
let avatarDiv;
if (event.target.matches(avatarSelector)) {
avatarDiv = event.target;
} else {
avatarDiv = findParent(event.target, avatarSelector);
}
if (avatarDiv) {
if ($('text', avatarDiv) && $('text', avatarDiv).innerHTML === "ChatGPT") {
$('text', avatarDiv).remove();
}
const content = findParent(avatarDiv, "div.text-base", 2).innerText.trim();
$("form.stretch textarea").value = "";
$("form.stretch textarea").focus();
document.execCommand('insertText', false, content);
}
};
const cleanlyHome = function() {
if (location.href.match(/https:\/\/chat\.openai\.com\/\??/) && gv("k_cleanlyhome", false) === true) {
if ($("main h1") && $("main h1").innerText === "ChatGPT" && $("main h2").innerText === "Examples") {
$("main h1").parentElement.childNodes[1].remove();
const nSpan = document.createElement('span');
nSpan.className = 'rounded-md bg-yellow-200 py-1.5 px-1.5 text-xs font-medium uppercase text-gray-800';
nSpan.style = 'font-size: 40%';
nSpan.textContent = 'KEEP';
$("main h1").appendChild(nSpan);
}
const mainBottom = $("div>span", $("form.stretch").parentElement);
if (mainBottom && mainBottom.innerText.indexOf("produce inaccurate") > -1) {
mainBottom.remove();
}
}
};
const findParent = function(el, parentSelector, level = 5) {
let parent = el.parentNode;
let count = 1;
while (parent && count <= level) {
if (parent && parent.constructor !== HTMLDocument && parent.matches(parentSelector)) {
return parent;
}
parent = parent.parentNode;
count++;
}
return null;
};
const nInterval1Fun = function() {
if ($(symbol1_selector) || $(symbol2_selector)) {
loadKCG();
setIfr();
cleanlyHome();
}
};
const nInterval2Fun = function() {
if ($(symbol1_selector) || $(symbol2_selector)) {
keepChat();
}
};
let nInterval1 = setInterval(nInterval1Fun, 300);
let interval2Time = parseInt(gv("k_interval", 30));
let nInterval2 = setInterval(nInterval2Fun, 1000 * interval2Time);
})();