ChatGPT Auto Refresh ↻

*SAFELY* eliminate 10-minute chat resets + constant network errors + Cloudflare checks from ChatGPT

Install this script?
Author's suggested script

You may also like ChatGPT Widescreen Mode 🖥️.

Install this script
// ==UserScript==
// @name                ChatGPT Auto Refresh ↻
// @name:af             ChatGPT Auto Verfris ↻
// @name:am             የአቃጥል GPT ራስሀሽ ↻
// @name:ar             ChatGPT تحديث تلقائي ↻
// @name:az             ChatGPT Avtomatik Yenilə ↻
// @name:be             Аўтаматычнае абнаўленне ChatGPT ↻
// @name:bem            ChatGPT Auto Sintalula ↻
// @name:bg             Автоматично опресняване на ChatGPT ↻
// @name:bn             ChatGPT স্বয়ংক্রিয় রিফ্রেশ ↻
// @name:bo             ChatGPT རེའུ་མིན་པར་སྣོད་དང་ ↻
// @name:bs             ChatGPT Automatsko Osvježavanje ↻
// @name:ca             ChatGPT Actualització Automàtica ↻
// @name:ckb            ChatGPT نوێکردنهوهی خۆکار ↻
// @name:cs             ChatGPT Automatické obnovení ↻
// @name:cy             ChatGPT Adnewyddu Auto ↻
// @name:da             ChatGPT Automatisk Opdatering ↻
// @name:de             ChatGPT Automatisches Aktualisieren ↻
// @name:dv             ChatGPT އައްޗައިސް އަސްޓްރީ ↻
// @name:dz             ChatGPT རེའུ་མིན་པར་སྣོད་དང་ ↻
// @name:el             ChatGPT Αυτόματη Ανανέωση ↻
// @name:eo             ChatGPT Aŭtomata Refreŝigo ↻
// @name:es             ChatGPT Actualización Automática ↻
// @name:et             ChatGPT Automaatne Värskendamine ↻
// @name:eu             ChatGPT Automatikoki Freskatu ↻
// @name:fa             به روز رسانی خودکار ChatGPT ↻
// @name:fi             ChatGPT Automaattinen Päivitys ↻
// @name:fo             ChatGPT Auto Uppdatering ↻
// @name:fr             ChatGPT Actualisation Automatique ↻
// @name:fr-CA          ChatGPT Actualisation Automatique ↻
// @name:gd             ChatGPT Ath-bhualadh Aonaranach ↻
// @name:gl             ChatGPT Actualización Automática ↻
// @name:gu             ChatGPT સ્વચાલિત રિફ્રેશ ↻
// @name:haw            Hoʻonoho Hōʻike Auto ChatGPT ↻
// @name:he             רענון אוטומטי של ChatGPT ↻
// @name:hi             ChatGPT स्वचालित रीफ़्रेश ↻
// @name:hr             ChatGPT Automatsko Osvježavanje ↻
// @name:ht             ChatGPT Rafrechi Otomatik ↻
// @name:hu             ChatGPT Automatikus Frissítés ↻
// @name:hy             Ինքնաշխատ Թարմացում ChatGPT ↻
// @name:id             ChatGPT Pembaruan Otomatis ↻
// @name:is             ChatGPT Sjálfvirk Endurnýjun ↻
// @name:it             ChatGPT Aggiornamento Automatico ↻
// @name:ja             ChatGPT 自動更新 ↻
// @name:jv             Pembaruan Otomatis ChatGPT ↻
// @name:ka             ChatGPT ავტომატური განახლება ↻
// @name:kab            ChatGPT Akarẓim Aɣelnaw ↻
// @name:kk             ChatGPT Автоматты Жаңарту ↻
// @name:km             ChatGPT បន្ទាប់ពីបច្ចុប្បន្នភាព ↻
// @name:kn             ChatGPT ಸ್ವಯಂಚಾಲಿತ ರಿಫ್ರೆಶ್ ↻
// @name:ko             ChatGPT 자동 새로 고침 ↻
// @name:ky             ChatGPT Автоматтык Тазартуу ↻
// @name:la             ChatGPT Automatica Refectio ↻
// @name:lb             ChatGPT Automatescht Aktualiséieren ↻
// @name:lo             ChatGPT ປັບປຸງອັດຕະໂນມັດອັດຕະໂນມັດ ChatGPT ↻
// @name:lt             ChatGPT Automatinis Atnaujinimas ↻
// @name:lv             ChatGPT Automātiska Atsvaidzināšana ↻
// @name:mg             Fanavaozana Ankehitriny i ChatGPT ↻
// @name:mi             ChatGPT Whakahōu Aunoa ↻
// @name:mk             Автоматско освежување ChatGPT ↻
// @name:ml             ChatGPT ഓട്ടോ അപ്‌ഡേറ്റ് ↻
// @name:mn             ChatGPT Автоматаар Шинэчлэх ↻
// @name:ms             Penyegaran Auto ChatGPT ↻
// @name:mt             ChatGPT Rifreżġjar Awtomatiku ↻
// @name:my             ChatGPT အလိုအလျောက်ထပ်ဖြန် ↻
// @name:ne             ChatGPT आफ्नैजस्तै ताजा गर्नुहोस् ↻
// @name:nl             ChatGPT Automatische Vernieuwing ↻
// @name:no             ChatGPT Automatisk Oppdatering ↻
// @name:pa             ChatGPT ਆਟੋ ਰਿਫਰੈਸ਼ ↻
// @name:pap            ChatGPT Refreskamentu Automatico ↻
// @name:pl             ChatGPT Automatyczne Odświeżanie ↻
// @name:ps             د ChatGPT زما تازه کول ↻
// @name:pt             ChatGPT Atualização Automática ↻
// @name:pt-BR          ChatGPT Atualização Automática ↻
// @name:rn             ChatGPT Gushira Ubushyuhe ↻
// @name:ro             ChatGPT Reîmprospătare Automată ↻
// @name:ru             Автообновление ChatGPT ↻
// @name:sg             ChatGPT Rafraîchissement Auto ↻
// @name:si             ChatGPT ස්වයංක්රීය නැවතුම් ↻
// @name:sk             ChatGPT Automatické Obnovenie ↻
// @name:sl             ChatGPT Samodejna Osvežitev ↻
// @name:sm             ChatGPT Toeaina Auto Taulagaina ↻
// @name:sn             ChatGPT Rurefu Rakaita Zvakanaka ↻
// @name:so             ChatGPT Dib-u-helayna Xafiiska ↻
// @name:sr             ChatGPT Аутоматско Освежавање ↻
// @name:sv             ChatGPT Automatisk Uppdatering ↻
// @name:sw             ChatGPT Kupakia Moja kwa moja ↻
// @name:ta             ChatGPT தானியங்கி புதுப்பிப்பு ↻
// @name:te             ChatGPT ఆటో రిఫ్రెష్ ↻
// @name:tg             ChatGPT Таҷдиди худкори ChatGPT ↻
// @name:th             ChatGPT รีเฟรชอัตโนมัติ ↻
// @name:ti             ChatGPT ኣካውንታት እውነት ዓይኒ ↻
// @name:tk             ChatGPT Awtomatik Täzele ↻
// @name:tn             ChatGPT Tlhokomelo ya Moafrika ↻
// @name:to             ChatGPT Fakahā ʻihaotaha ↻
// @name:tpi            ChatGPT Awto Rifrehs ↻
// @name:tr             ChatGPT Otomatik Yenileme ↻
// @name:uk             Автоматичне Оновлення ChatGPT ↻
// @name:ur             خودکار تازہ کاری ChatGPT ↻
// @name:uz             ChatGPT Avtomatik Yangilash ↻
// @name:vi             ChatGPT Tự động Cập nhật ↻
// @name:xh             ChatGPT Ukunovusa Okuvela ↻
// @name:yi             ChatGPT אַטאַ אַקטואַליזירן ↻
// @name:zh             ChatGPT 自动刷新 ↻
// @name:zh-CN          ChatGPT 自动刷新 ↻
// @name:zh-HK          ChatGPT 自動刷新 ↻
// @name:zh-SG          ChatGPT 自动刷新 ↻
// @name:zh-TW          ChatGPT 自動刷新 ↻
// @name:zu             ChatGPT Ukusasaza Ngokuzenzakalelayo ↻
// @description         *SAFELY* eliminate 10-minute chat resets + constant network errors + Cloudflare checks from ChatGPT
// @description:af      *VEILIG* elimineer 10-minuut klets herstelling + aanhoudende netwerkfoute + Cloudflare-kontroles uit ChatGPT.
// @description:am      *ባርማ* ከChatGPT ውስጥ የ10 ደቂቃ መካከለኛ ገጽታ መድረስን፣ *በጭራቅ የሚከሰቱ አውታረ መረብ ስህተቶችን*እና ክላይንት ፓስያንት ምርመራዎችን ይወግዱ።
// @description:ar      *بأمان* احذف إعادة تعيين الدردشة لمدة 10 دقائق + *أخطاء الشبكة المستمرة* + فحوصات Cloudflare من ChatGPT.
// @description:az      *TƏHLÜKƏSİZ* 10 dəqiqəlik söhbət sıfırlamalarını, *davamlı şəbəkə xətalarını* və Cloudflare yoxlamalarını ChatGPT'dən çıxarın.
// @description:be      *БЯСПЕКА* выдаліце 10-хвілінныя перазагрузкі чата, *пастаянныя сеткавыя памылкі* і праверкі Cloudflare са ChatGPT.
// @description:bem     *UMULI* fyumbafye amafuula ya menso 10 + *aya makota yambi konse konse* nefimfi ifyakwa pantu + ifiletelwe ifyakwa Cloudflare ukufuma mu ChatGPT.
// @description:bg      *БЕЗОПАСНО* премахнете 10-минутни нулирания на чата, *постоянни мрежови грешки* и проверки на Cloudflare от ChatGPT.
// @description:bn      ChatGPT-এর থেকে ১০ মিনিটের চ্যাট রিসেট, *চিরস্থায়ী নেটওয়ার্ক ত্রুটি* এবং ক্লাউডফ্লেয়ার যাচাই-বাছাই সরিয়ে দিন *নিরাপদে*।
// @description:bo      *རྒྱབ་བཞིན་པའི་* ཟའ་གྲགས་10 སྐར་མ་གཞན་འགྱུར་འདོན་སྐབས་མེད་པ། *ངོས་འཛིན་ཡོད་པ་* Cloudflare་དྲི་ཞིམ་བཟོ་བའི་ཕྱིར་ ChatGPT་ནས་ཕྱི་ལོག །
// @description:bs      *SIGURNO* uklonite 10-minutna resetovanja četa, *konstantne greške mreže* i Cloudflare provjere iz ChatGPT.
// @description:ca      *SEGUR* elimineu els reajustaments de xat de 10 minuts + *errors de xarxa constants* i comprovacions de Cloudflare de ChatGPT.
// @description:ceb     *LUWAS* hika ang mga pag-reset sa pag-chat sa 10 ka minuto + *walay hunong nga mga sayop sa network* + mga pagsusi sa Cloudflare gikan sa ChatGPT.
// @description:ckb     *بەبێ پەیمانە* پشوودانی سنووری چاتی ١٠ خولەکی، *کێشەی شبکەیی ڕاستەوخۆ* و بڵاودەکردنەوەکانی Cloudflare لە ChatGPT دابڕۆ.
// @description:cs      *BEZPEČNĚ* odstraňte 10minutová obnovení chatu, *trvalé síťové chyby* a kontroly Cloudflare z ChatGPT.
// @description:cy      *YN DIOGEL* cael gwared â 10 munud ailosod sgwrs + *gwallau rhwydwaith parhaus* + gwiriadau Cloudflare o ChatGPT.
// @description:da      *SIKKERT* fjern 10-minutters chat-nulstillinger + *konstante netværksfejl* og Cloudflare-tjek fra ChatGPT.
// @description:de      *SICHER* entfernen Sie 10-Minuten-Chat-Zurücksetzungen + *kontinuierliche Netzwerkfehler* und Cloudflare-Überprüfungen aus ChatGPT.
// @description:dv      ChatGPT އިން ދޮގު ނަތީޖާ ގެ ގޮތުން ދިމާވާ މިނެޓުގެ އަޑުގަދަވުމުގެ ވަގުތު އަލުން ސެޓްކުރުން 10 ގެ އަދަދު އަނބުރާ ގެނެސްދިނުމާއެކު + *ތެރޭގައި ހުރި ނެޓްވޯކް މައްސަލަތަކާއި* ކްލައުޑްފްލެއަރގެ ޗެކްތައް ދޫކުރުން ބޭނުންވެއެވެ.  
// @description:dz      *དགའ་བསྐྱིད་བཞུགས་བརྡ* མི་ཉུང་སྐར་མ་གི་ཟའ་གྲགས་རིམ་ལེབ་འགྱུར་བསྡད་མེད་པ། *ངོས་འཛིན་ཡོད་པ་* Cloudflare་བཤད་པ་བཟོ་བའི་ཕྱིར་ ChatGPT ནས་ཕྱི་ལོག །  
// @description:el      *ΜΕ ΑΣΦΑΛΕΙΑ* εξαλείψτε τις επαναφορές συνομιλίας 10 λεπτών + *συνεχείς σφάλματα δικτύου* και ελέγχους Cloudflare από το ChatGPT.
// @description:eo      *SEKURE* forigu 10-minutajn babiletajajn rekomencigojn + *konstantajn reto-erarojn* kaj Cloudflare-kontrolojn de ChatGPT.
// @description:es      *SEGURO* elimine los reinicios de chat de 10 minutos + *errores de red constantes* y verificaciones de Cloudflare de ChatGPT.
// @description:et      *TURVALISELT* eemalda ChatGPT-st 10-minutilised vestluse lähtestamised + *püsivad võrguvead* ja Cloudflare'i kontrollid.
// @description:eu      *SEGUROA* kendu ChatGPT-tik 10 minutuko txat berrabiarazteak + *sareko akats etengabeak* eta Cloudflare egiaztapenak.
// @description:fa      *به طور ایمن* بازنشانی چت 10 دقیقه ای + *خطاهای مداوم شبکه* و بررسی های Cloudflare را از ChatGPT حذف کنید.
// @description:fi      *TURVALLISESTI* poista ChatGPT:stä 10 minuutin keskustelun nollaukset + *jatkuvat verkkovirheet* ja Cloudflare-tarkistukset.
// @description:fo      *TRYGT* strika 10 minuttir endursetan av samrøðum + *staðug netbrek* og Cloudflare-royndir frá ChatGPT.
// @description:fr      *EN TOUTE SÉCURITÉ* éliminez les réinitialisations de chat de 10 minutes + *les erreurs réseau constantes* et les vérifications Cloudflare de ChatGPT.
// @description:fr-CA   *EN TOUTE SÉCURITÉ* éliminez les réinitialisations de chat de 10 minutes + *les erreurs réseau constantes* et les vérifications Cloudflare de ChatGPT. 
// @description:gd      *GU SÀBHALTE* thoir air falbh ath-shuidheachadh còmhraidh 10 mionaid + *mearachdan lìonraidh leantainneach* agus sgrùdaidhean Cloudflare à ChatGPT.
// @description:gl      *SEGURAMENTE* elimine os reinicios de conversa de 10 minutos + *erros de rede constantes* e verificacións de Cloudflare de ChatGPT.
// @description:gu      ChatGPT માંથી ૧૦ મિનિટના ચૅટ રીસેટ, *સ્થાયી નેટવર્ક ભૂલો* અને ક્લાઉડફ્લેર તપાસો *સુરક્ષિતપણે* દૂર કરો.
// @description:haw     *KUHIAO* wehe i ka hoʻomaʻemaʻe ʻana i nā hoʻouka hou ʻana o ka walaʻau no 10 minuke + mau ʻano hihia mau loa o ka nahenahe + nā hoʻokolokolo o Cloudflare, mai ke keʻena nei o ChatGPT.
// @description:he      *בטחון* הסירו איפוסי צ'אט של 10 דקות + *שגיאות רשת קבועות* ובדיקות קלאודפלייר מ-ChatGPT.
// @description:hi      ChatGPT से 10 मिनट के चैट रीसेट, *स्थायी नेटवर्क त्रुटियाँ* और क्लाउडफ़्लेयर जाँच को *सुरक्षित रूप से* हटाएं।
// @description:hr      *SIGURNO* uklonite 10-minutna resetiranja čavrljanja, *stalne mrežne pogreške* i Cloudflare provjere iz ChatGPT-a.
// @description:ht      *AN SEKIRITE,* elimine resè chat 10 minit yo, *erè sou rezo ki konstan* epitou tchèk Cloudflare nan ChatGPT.
// @description:hu      *BIZTONSÁGOSAN* távolítsa el a 10 perces csevegések visszaállításait, a *folyamatos hálózati hibákat* és a Cloudflare ellenőrzéseket a ChatGPT-ből.
// @description:hy      *ԱՆՎՏԱՆԳՈՒԹՅՈՒՆ ՀԱՍԿԱՑՈՒՄԸ`* հեռացնել 10 րոպեանոց չատի վերագործարկումները, *մշտական ցանցային սխալները* եւ Cloudflare ստուգումները ChatGPT-ից:
// @description:id      *AMAN* menghapus batas obrolan 10 menit, *kesalahan jaringan yang konstan*, dan pemeriksaan Cloudflare dari ChatGPT. 
// @description:is      *ÖRUGGLEGA* fjarlægðu endurstillingu spjalls í 10 mínútur, *sífelldum netvillum* og Cloudflare prófanir úr ChatGPT.
// @description:it      *IN SICUREZZA* eliminare i reset della chat di 10 minuti, *gli errori di rete costanti* e i controlli Cloudflare da ChatGPT.
// @description:ja      ChatGPTから10分のチャットのリセット、*定常的なネットワークのエラー*、Cloudflareのチェックを*安全に*削除してください。
// @description:jv      *AMAN* busak wates obrolan 10 menit, *kesalahan jaringan sing konstan*, lan pemeriksaan Cloudflare saka ChatGPT.
// @description:ka      *უსაფრთხოდ* წაშალეთ 10 წუთიანი ჩეთის დაბრუნებები, *მუდმივი ქსელური შეცდომები* და Cloudflare შემოწმებები ChatGPT-დან.
// @description:kk      *ҚАУІПСІЗ* ChatGPT дан 10 минуттық чат қайта орнатуларды, *тұрақты желі қателерін* және Cloudflare тексерістерін жойыңыз.
// @description:km      *ដោយសុវត្ថិភាព* លុបការកំណត់ឡើងវិញនៃការជជែក 10 នាទី, *កំហុសបណ្តាញជាក់លាក់* និងការពិនិត្យរបស់ Cloudflare ចេញពី ChatGPT។
// @description:kn      ChatGPT ನಿಂದ 10 ನಿಮಿಷಗಳ ಚಾಟ್ ಮರುಹೊಂದಿಕೆಗಳು, *ನಿರಂತರ ಜಾಲ ದೋಷಗಳು* ಮತ್ತು ಕ್ಲೌಡ್‍ಫ್ಲೇರ್ ಪರಿಶೀಲನೆಗಳನ್ನು *ಸುರಕ್ಷಿತವಾಗಿ* ತೆಗೆದುಹಾಕಿ.
// @description:ko      ChatGPT에서 10분 채팅 재설정, *지속적인 네트워크 오류*, 클라우드플레어 검사를 *안전하게* 제거하십시오.
// @description:ku      *بە ئاسایی* ڕیسێتی چاتی ١٠ خولەکی، *کێشەی شبکەیی ڕاستەوخۆ* و دیاریکردنی کلاڵدفلەر لە ChatGPT دابڕۆ.
// @description:ky      *КООПСУЗДУК МЕНЕН* ChatGPT дан 10 мүнөттүк чаттын кайра жөндөөсүн, *туруктуу тармак каталарын* жана Cloudflare текшерүүлөрүн алып салыңыз.
// @description:la      *TUTO* dele 10 minutarum colloquii reconsitutiones, *crebros errores retis* et inspectiones Cloudflare ab ChatGPT.
// @description:lb      *SÉCHER* Huel 10 Minutte Chat-Limitt-Reschtellungen, *bestänneg Netzwierker-Feeler* an d'Cloudflare-Iwwerpréifunge fort vu ChatGPT.
// @description:lo      *ດ້ວຍຄວາມປອດໄພ* ລຶບການຕັ້ງຄ່າໃຫມ່ການແຊັດ 10 ນາທീ, *ຂໍ້ຜິດພາດເຄືອຂ່າຍປະຈໍາ* ແລະ ການກວດສອບຂອງ Cloudflare ອອກຈາກ ChatGPT.
// @description:lt      *SAUGIAI* pašalinkite 10 minučių pokalbių atstatymus, *nuolatinius tinklo trikdžius* ir Cloudflare patikras iš ChatGPT.
// @description:lv      *DROŠI* noņemiet 10 minūšu čata atiestatījumus, *pastāvīgās tīkla kļūdas* un Cloudflare pārbaudes no ChatGPT.
// @description:mg      *MIANDRY ARA-KIRA* esory ny fandrombahana ny fisalasana 10 minitra, *ny diso amin'ny tambajotra mandritra* ary ny fanamarinana amin'ny Cloudflare avy amin'ny ChatGPT.
// @description:mi      *KA TŪTURU* whakakorehia ngā whakatikatika kōrero 10 meneti, *hapa whatunga rāroto e tohu tonu ana + ngā aroturuki Cloudflare i ChatGPT.
// @description:mk      *БЕЗБЕДНО* отстранете ги 10-минутните повторни вклучувања на разговорот, *константни мрежни грешки* и проверките на Cloudflare од ChatGPT.
// @description:ml      ChatGPT നിന്ന് 10 മിനിറ്റ് ചാറ്റ് പുനഃസജ്ജമാക്കലുകൾ, *തുടർച്ചയായ നെറ്റ്‌വർക്ക് പിശകുകൾ*, ക്ലൗഡ്ഫ്ലെയർ പരിശോധനകൾ *സുരക്ഷിതമായി* നീക്കം ചെയ്യുക.
// @description:mn      ChatGPT-с *АЮУЛГҮЙ БОЛОВЧ* 10 минутын чат дахин тохирохыг, *үргэлжилсэн сүлжээний алдаа* болон Cloudflare-ийн шалгалтуудыг хасна уу.
// @description:mr      ChatGPT मधून *सुरक्षितपणे* १० मिनिटांची गप्पागोष्टी पुन्हा सेट करणे, *सातत्याने नेटवर्क त्रुटी* आणि क्लाउडफ्लेअर तपासणी काढून टाका.
// @description:ms      *DENGAN SELAMAT* singkirkan had sembang semula 10 minit, *kesalahan rangkaian yang kerap*, dan semakan Cloudflare daripada ChatGPT.
// @description:mt      *B'SIGURTÀ* neħħi l-limiti ta' risettjar tal-kliem ta' 10 minuta, *żbalji fil-network persistenti*, u kontrolli ta' Cloudflare minn ġewwa ChatGPT.
// @description:my      ChatGPT မှ *လုံးဝ လုံခြုံစွာ* ၁၀ မိနစ် စကားပြောရန် ပြန်လည် သတ်မှတ်ချက်များ၊ *မြောက်မြောက် ကွန်ရက် ပြၚ အမှား* များနှင့် Cloudflare စစ်ဆေးမှုများကို ဖယ်ရှားပါ။
// @description:ne      ChatGPT बाट *सुरक्षितरूपमा* १० मिनेटको च्याट पुनःसेट, *निरन्तर नेटवर्क त्रुटि* र क्लाउडफ्लेयर जाँच हटाउनुहोस्।
// @description:nl      *VEILIG* verwijder 10-minuten chat resets, *constante netwerkfouten* en Cloudflare-controles van ChatGPT.
// @description:no      *TRYGT* fjern 10-minutters chat-tilbakestillinger, *konstante nettverksfeil* og Cloudflare-sjekker fra ChatGPT.
// @description:ny      *NDIWOYIMILIRENI* tsikani kupindulitsanso kogawana kwamizuzu khumi + *zolakwika zambirimbiri pa intaneti* ndi zolingalira za Cloudflare kuchokera ku ChatGPT.
// @description:pa      ChatGPT ਤੋਂ *ਸੁਰੱਖਿਅਤ ਢੰਗ ਨਾਲ* 10 ਮਿੰਟ ਦੀਆਂ ਚੈਟ ਰੀ-ਸੈਟਾਂ, *ਲਗਾਤਾਰ ਨੈੱਟਵਰਕ ਗਲਤੀਆਂ* ਅਤੇ ਕਲਾਉਡਫਲੇਅਰ ਜਾਂਚਾਂ ਹਟਾਓ।
// @description:pap     *SEGURO* eliminá rekashonan di chat di 10 minüt, *faltanan di red kontínuo* i kontròlnan di Cloudflare for di ChatGPT.
// @description:pl      *BEZPIECZNIE* usuń 10-minutowe resetowanie czatu, *stałe błędy sieciowe* i kontrole Cloudflare z ChatGPT.
// @description:ps      له ChatGPT څخه *په امنه* توګه د ۱۰ دقیقو چت بیا ټاکل کول، *دوامداره شبکي غلطي* او Cloudflare بررسۍ لرې کړئ.
// @description:pt      *COM SEGURANÇA* elimine resets de chat de 10 minutos, *erros de rede constantes* e verificações do Cloudflare do ChatGPT.
// @description:pt-BR   *COM SEGURANÇA* elimine as redefinições de chat de 10 minutos, *erros frequentes de rede* e checagens do do Cloudflare do ChatGPT.
// @description:rn      *MU BUNYAMINE* gukuraho ingaruka zo gusegurira imyumvire icumi, amakosa akomeye yo mu murongo w'ubucuruzi no kugenzura amabuye ya Cloudflare ukufuma mu ChatGPT.
// @description:ro      *ÎN SIGURANȚĂ* eliminați reinițializările de chat de 10 minute, erorile constante de rețea și verificările Cloudflare din ChatGPT.  
// @description:ru      *БЕЗОПАСНО* устраните 10-минутные сбросы чата, постоянные сетевые ошибки и проверки Cloudflare из ChatGPT.
// @description:rw      *MU BUNYAMINE* ikuraho iseswa ry’iminota 10, amakosa akomeje kw’itumanaho mu rwego rw’ibikorwaremezo n’igenzura rya Cloudflare mu ChatGPT.
// @description:sg      *NI ÌTỌJU* ṣe ìyọ̀sọ́wọ́jú ọrọ̀'lọ̀wọ́ mẹ́rinlelogun, awọn ṣiṣe ilana aláilóbájẹ́ + awọn adánilọ́jọ́ Cloudflare láti inú ChatGPT.
// @description:si      *ආරක්ෂිතව* 10 මිනිත්තු චැට් යළි සැකසීම්, ස්ථිර ජාල දෝෂ සහ Cloudflare පරීක්ෂණ ChatGPT වෙතින් ඉවත් කරන්න.
// @description:sk      *BEZPEČNE* odstráňte 10-minútové opätovné nastavenia četu, neustále sieťové chyby a kontroly Cloudflare z ChatGPT.
// @description:sl      *VARNO* odstranite 10-minutna ponastavljanja klepetov, nenehne napake v omrežju in preverjanja cloudfare iz ChatGPT. 
// @description:sm      *MA FA'AMANUIAGA* ia eseese fa'amalosi e tusi tulaga tautua ta'aloga e 10 minute + tala esemanuuga + nisi'i Cloudflare mai ChatGPT.
// @description:sn      *KANA KUTAMBA WAKAWANDA* dzimba kupindura zvakare maonero echirongwa che10min + zvivi zvisingakoni nekupera + ruzivo rweCloudflare uye kubvisa zviri muChatGPT.
// @description:so      *SI AMMAAN* ka saar 10 daqiiqo dib u habayn xidhiidh + xatooyin xaaladaha ah + baaritaan Cloudflare ka mid ah ChatGPT.
// @description:sr      *BEZBEDNO* eliminišite 10-minutna resetovanja ćaska, konstantne mrežne greške i Cloudflare provere iz ChatGPT-a.
// @description:sv      *SÄKERT* eliminera 10-minuters återställningar av chattar, konstanta nätverksfel och Cloudflare-kontroller från ChatGPT.
// @description:sw      *KWA USALAMA* ondoa marejesho ya mazungumzo ya dakika 10, hitilafu endelevu za mtandao na ukaguzi wa Cloudflare kutoka ChatGPT.  
// @description:ta      *பாதுகாப்பாக* 10 நிமிட உரையாடல் மறுதொடக்கங்கள், தொடர்ச்சியான வலையமைப்பு பிழைகள், மேகக்கம்பெனி சோதனைகளை ChatGPT இருந்து அகற்றுங்கள்.
// @description:te      *సురక్షితంగా* 10 నిమిషాల చాట్ రీసెట్లు, నిరంతర నెట్వర్క్ లోపాలు, క్లౌడ్ఫ్లేర్ తనిఖీలను ChatGPT నుండి తీసివేయండి.
// @description:tg      *БО ҲИФЗИ АМНИЯТ* 10-дақиқагии бозсозии чат, хатогиҳои доимии шабака ва санҷиши Cloudflare-ро аз ChatGPT ҳазф намоед.
// @description:th      *อย่างปลอดภัย* กําจัดการรีเซ็ตแชท 10 นาที ข้อผิดพลาดของเครือข่ายตลอดเวลา และการตรวจสอบของ Cloudflare ออกจาก ChatGPT
// @description:ti      *ብናይ ደሞዝ* 10 ደቂቕ ድምጺ ናይ መጀመርታ ምቕራብን, ናይ ሕፅይቲ ምእታይን, ናይ Cloudflare ፍልጠትን ካብ ChatGPT ክወግዙ::
// @description:tk      *HOWPSUZLYK BILEN* 10 minutly çat ýeniden başlatmalaryny, durnukly internet ýalňyşlaryny we Cloudflare barlagyny ChatGPT-den aýyrыň.
// @description:tn      *KA POLAOKEHI* e ntšha thekiso ya ho qala hape ya metsotso e 10 + diphoso tsa neteweke tse kileng + dipatlisiso tsa Cloudflare ho tswa ho ChatGPT.
// @description:to      *'I HE FA'A'EA'EA'ANGA* 'e aveese 'a e ngaahi fili 'o e fetu'utaki chatí ki he meniti 'e 10 + hili pea 'o e ngaahi me'angaue'aki 'a e néétuiaki + ngaahi sivi 'o e Cloudflare mei he ChatGPT.
// @description:tr      *GÜVENLİ BİR ŞEKİLDE* 10 dakikalık sohbet sıfırlamalarını, sürekli ağ hatalarını ve Cloudflare kontrollerini ChatGPT'ten kaldırın.
// @description:uk      *БЕЗПЕЧНО* усуньте 10-хвилинні скинення чату, постійні мережеві помилки та перевірки Cloudflare з ChatGPT.
// @description:ur      *محفوظ* ChatGPT سے 10 منٹ کی چیٹ ری سیٹس، مستقل نیٹ ورک نقص اور کلاؤڈ فلیئر چیکس ہٹائیں۔
// @description:uz      *XAVFSIZ* 10 daqiqa suhbat qayta tiklanishlarini, doimiy tarmoq xatoliklarini va Cloudflare tekshiruvlarini ChatGPT'dan olib tashlang.
// @description:vi      *AN TOÀN* loại bỏ đặt lại trò chuyện 10 phút, lỗi mạng liên tục và kiểm tra Cloudflare khỏi ChatGPT.
// @description:xh      *NGEKONAKALIYO* susa ukunqamula okutsha koxo yemizuzu eli-10 + amathuba olu hlulekileyo womeli + ukuhlolwa kukaCloudflare ukusuka ku ChatGPT.
// @description:yi      *זיכער* נעמט אַראָפ 10 מינוט רעד איבערארבעטן, שטענדיק נעץ פֿעלערן און קלוידפֿלאַרע באַשעקן פֿון ChatGPT.
// @description:zh      *安全* 消除 10 分钟聊天重置 + 持续的网络错误 + ChatGPT 的 Cloudflare 检查。
// @description:zh-CN   *安全* 消除 10 分钟聊天重置 + 持续的网络错误 + ChatGPT 的 Cloudflare 检查。
// @description:zh-HK   *安全* 消除 10 分鐘聊天重設 + 持續的網路錯誤 + ChatGPT 的 Cloudflare 檢查。
// @description:zh-SG   *安全* 消除 10 分钟聊天重置 + 持续的网络错误 + ChatGPT 的 Cloudflare 检查。
// @description:zh-TW   *安全* 消除 10 分鐘聊天重設 + 持續的網路錯誤 + ChatGPT 的 Cloudflare 檢查。
// @description:zu      *NGOKUPHEPHA* susa ukusetha kabusha ingxoxo yemizuzu eyi-10 + amaphutha enethiwekhi ahlala njalo + Ukuhlolwa kwe-Cloudflare ku-ChatGPT.
// @author              Adam Lui
// @namespace           https://github.com/adamlui
// @version             2024.4.4
// @license             MIT
// @match               *://chat.openai.com/*
// @compatible          chrome
// @compatible          firefox
// @compatible          edge
// @compatible          opera
// @compatible          brave
// @compatible          vivaldi
// @compatible          waterfox
// @compatible          librewolf
// @compatible          ghost
// @compatible          qq
// @icon                https://raw.githubusercontent.com/adamlui/userscripts/master/chatgpt/media/icons/openai-favicon48.png
// @icon64              https://raw.githubusercontent.com/adamlui/userscripts/master/chatgpt/media/icons/openai-favicon64.png
// @require             https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@2.6.8/dist/chatgpt.min.js#sha256-veeaKpmLF7CZ6kxNfn8SMjD36ijLffGCzel9G4ykpPI=
// @connect             raw.githubusercontent.com
// @connect             greasyfork.org
// @grant               GM_setValue
// @grant               GM_getValue
// @grant               GM_registerMenuCommand
// @grant               GM_unregisterMenuCommand
// @grant               GM_openInTab
// @grant               GM.xmlHttpRequest
// @run-at              document-start
// @noframes
// @homepageURL         https://github.com/adamlui/chatgpt-auto-refresh
// @supportURL          https://github.com/adamlui/chatgpt-auto-refresh/issues
// ==/UserScript==

// NOTE: This script relies on the powerful chatgpt.js library @ https://chatgpt.js.org (c) 2023–2024 KudoAI & contributors under the MIT license.

(async () => {

    // Init config
    const config = {
        appName: 'ChatGPT Auto Refresh', appSymbol: '↻', keyPrefix: 'chatGPTautoRefresh',
        userLanguage: chatgpt.getUserLanguage(),
        gitHubURL: 'https://github.com/adamlui/chatgpt-auto-refresh',
        greasyForkURL: 'https://greasyfork.org/scripts/462422-chatgpt-auto-refresh' }
    config.updateURL = config.greasyForkURL.replace('https://', 'https://update.')
        .replace(/(\d+)-?([a-zA-Z-]*)$/, (_, id, name) => `${ id }/${ !name ? 'script' : name }.meta.js`)
    config.supportURL = config.gitHubURL + '/issues/new'
    config.assetHostURL = config.gitHubURL.replace('github.com', 'raw.githubusercontent.com') + '/main/'
    loadSetting('arDisabled', 'notifDisabled', 'refreshInterval', 'toggleHidden')
    if (!config.refreshInterval) saveSetting('refreshInterval', 30) // init refresh interval to 30 secs if unset

    // Prevent sporadic convo resets
    const ogAEL = EventTarget.prototype.addEventListener
    EventTarget.prototype.addEventListener = function(type, listener, optionsOrUseCapture) {
        let calledByOpenAI = false
        if (type == 'focus' && this === unsafeWindow || type == 'visibilitychange') {
            const callStack = new Error().stack + '\n',
                  aelCaller = /-extension:\/\/.*\n(.+)/.exec(callStack)?.[1]
            calledByOpenAI = !aelCaller?.includes('-extension://')
            if (calledByOpenAI && type == 'visibilitychange') {
                ogAEL.call(this, type, function(event) {
                    if (document.visibilityState != 'visible') listener.call(this, event)
                }, optionsOrUseCapture)
        }}
        if (!calledByOpenAI) ogAEL.apply(this, arguments)
    }

    // Define messages
    const msgsLoaded = new Promise(resolve => {
        const msgHostDir = config.assetHostURL + 'greasemonkey/_locales/',
              msgLocaleDir = ( config.userLanguage ? config.userLanguage.replace('-', '_') : 'en' ) + '/'
        let msgHref = msgHostDir + msgLocaleDir + 'messages.json', msgXHRtries = 0
        GM.xmlHttpRequest({ method: 'GET', url: msgHref, onload: onLoad })
        function onLoad(response) {
            try { // to return localized messages.json
                const messages = new Proxy(JSON.parse(response.responseText), {
                    get(target, prop) { // remove need to ref nested keys
                        if (typeof target[prop] == 'object' && target[prop] !== null && 'message' in target[prop]) {
                            return target[prop].message
                }}}) ; resolve(messages)
            } catch (err) { // if 404
                msgXHRtries++ ; if (msgXHRtries === 3) return // try up to 3X (original/region-stripped/EN) only
                msgHref = config.userLanguage.includes('-') && msgXHRtries === 1 ? // if regional lang on 1st try...
                    msgHref.replace(/([^_]*)_[^/]*(\/.*)/, '$1$2') // ...strip region before retrying
                        : ( msgHostDir + 'en/messages.json' ) // else use default English messages
                GM.xmlHttpRequest({ method: 'GET', url: msgHref, onload: onLoad })
            }
        }
    }) ; const messages = await msgsLoaded

    // Init/register menu
    const state = {
        symbol: ['✔️', '❌'], word: ['ON', 'OFF'],
        separator: getUserscriptManager() == 'Tampermonkey' ? ' — ' : ': ' }
    let menuIDs = [] ; registerMenu() // create browser toolbar menu

    // Add/update tweaks style
    const tweaksStyleUpdated = 2023123 // datestamp of last edit for this file's `tweaksStyle`
    await chatgpt.isLoaded()
    let tweaksStyle = document.getElementById('tweaks-style') // try to select existing style
    if (!tweaksStyle || parseInt(tweaksStyle.getAttribute('last-updated'), 10) < tweaksStyleUpdated) { // if missing or outdated
        if (!tweaksStyle) { // outright missing, create/id/attr/append it first
            tweaksStyle = document.createElement('style') ; tweaksStyle.id = 'tweaks-style'
            tweaksStyle.setAttribute('last-updated', tweaksStyleUpdated.toString())
            document.head.append(tweaksStyle)
        }
        tweaksStyle.innerText = (
            '.chatgpt-modal button {'
              + 'font-size: 0.77rem ; text-transform: uppercase ;'
              + 'border-radius: 0 !important ; padding: 5px !important ; min-width: 102px }'
          + '.modal-buttons { margin-left: -13px !important }'
          + '* { scrollbar-width: thin }' // make FF scrollbar skinny to not crop toggle
        )
    }

    // Create nav toggle div, add styles
    const navToggleDiv = document.createElement('div')
    navToggleDiv.style.maxHeight = '44px' // prevent flex overgrowth
    navToggleDiv.style.margin = '2px 0' // add v-margins
    navToggleDiv.style.userSelect = 'none' // prevent highlighting
    navToggleDiv.style.cursor = 'pointer' // add finger cursor
    updateToggleHTML() // create children

    // Borrow classes from sidebar div
    const chatHistorySelector = 'nav[aria-label="Chat history"]',
          re_firstBtnText = chatgpt.history.isOff() ? /ChatGPTClear/ : /ChatGPT(ChatGPT|New)/
    chatgpt.history.isLoaded().then(setTimeout(() => { 
        const chatHistoryNav = document.querySelector(chatHistorySelector) || {},
              navLinks = chatHistoryNav.querySelectorAll('a'),
              firstLink = [...navLinks].find(link => re_firstBtnText.test(link.textContent)),
              firstIcon = firstLink.querySelector('div:first-child'),
              firstLabel = firstLink.querySelector('div:nth-child(2)')
        navToggleDiv.classList.add(...firstLink.classList, ...firstLabel.classList)
        navToggleDiv.querySelector('img')?.classList.add(...firstIcon.classList)
    }, 100))

    // Add listener to toggle switch/label/config/menu/auto-refresh
    navToggleDiv.addEventListener('click', () => {
        const toggleInput = document.querySelector('#arToggleInput')
        toggleInput.checked = !toggleInput.checked
        config.arDisabled = !toggleInput.checked
        updateToggleHTML()
        for (const id of menuIDs) { GM_unregisterMenuCommand(id) } registerMenu() // refresh menu
        if (!config.arDisabled && !chatgpt.autoRefresh.isActive) {
            chatgpt.autoRefresh.activate(config.refreshInterval)
            if (!config.notifDisabled) notify(( messages.menuLabel_autoRefresh || 'Auto-Refresh' ) + ': ON')
        } else if (config.arDisabled && chatgpt.autoRefresh.isActive) {
            chatgpt.autoRefresh.deactivate()
            if (!config.notifDisabled) notify(( messages.menuLabel_autoRefresh || 'Auto-Refresh' ) + ': OFF')
        } saveSetting('arDisabled', config.arDisabled)
    })

    // Insert full toggle on page load + during navigation
    insertToggle()
    const nodeObserver = new MutationObserver(mutations => {
        mutations.forEach(mutation => {
            if (mutation.type == 'childList' && mutation.addedNodes.length) {
                insertToggle()
    }})}) ; nodeObserver.observe(document.documentElement, { childList: true, subtree: true })

    // Activate auto-refresh on first visit if enabled
    if (!config.arDisabled) {
        chatgpt.autoRefresh.activate(config.refreshInterval)
        if (!config.notifDisabled) notify(( messages.menuLabel_autoRefresh || 'Auto-Refresh' ) + ': ON')
    }

    // Define SCRIPT functions

    function loadSetting(...keys) { keys.forEach(key => { config[key] = GM_getValue(config.keyPrefix + '_' + key, false) })}
    function saveSetting(key, value) { GM_setValue(config.keyPrefix + '_' + key, value) ; config[key] = value }
    function safeWindowOpen(url) { window.open(url, '_blank', 'noopener') } // to prevent backdoor vulnerabilities
    function getUserscriptManager() { try { return GM_info.scriptHandler } catch (err) { return 'other' }}

    // Define MENU functions

    function registerMenu() {
        menuIDs = [] // empty to store newly registered cmds for removal while preserving order

        // Add command to toggle auto-refresh
        const arLabel = state.symbol[+config.arDisabled] + ' '
                      + ( messages.menuLabel_autoRefresh || 'Auto-Refresh' ) + ' ↻ '
                      + state.separator + state.word[+config.arDisabled]
        menuIDs.push(GM_registerMenuCommand(arLabel, () => {
            document.querySelector('#arSwitchSpan').click()
        }))

        // Add command to toggle visibility of toggle
        const tvLabel = state.symbol[+config.toggleHidden] + ' '
                      + ( messages.menuLabel_toggleVis || 'Toggle Visibility' )
                      + state.separator + state.word[+config.toggleHidden]
        menuIDs.push(GM_registerMenuCommand(tvLabel, () => {
            saveSetting('toggleHidden', !config.toggleHidden)
            navToggleDiv.style.display = config.toggleHidden ? 'none' : 'flex' // toggle visibility
            if (!config.notifDisabled)
                notify(( messages.menuLabel_toggleVis || 'Toggle Visibility' ) + ': '+ state.word[+config.toggleHidden])
            for (const id of menuIDs) { GM_unregisterMenuCommand(id) } registerMenu() // refresh menu
        }))

        // Add command to show notifications when switching modes
        const mnLabel = state.symbol[+config.notifDisabled] + ' '
                      + ( messages.menuLabel_modeNotifs || 'Mode Notifications' )
                      + state.separator + state.word[+config.notifDisabled]
        menuIDs.push(GM_registerMenuCommand(mnLabel, () => {
            saveSetting('notifDisabled', !config.notifDisabled)
            notify(( messages.menuLabel_modeNotifs || 'Mode Notifications' ) + ': ' + state.word[+config.notifDisabled])
            for (const id of menuIDs) { GM_unregisterMenuCommand(id) } registerMenu() // refresh menu
        }))

        // Add command to change refresh interval
        const riLabel = '⌚ ' + ( messages.menuLabel_refreshInt || 'Refresh Interval' ) + ' '
                      + state.separator + config.refreshInterval + 's'
        menuIDs.push(GM_registerMenuCommand(riLabel, () => {
            while (true) {
                const refreshInterval = prompt(
                    `${ messages.prompt_updateInt || 'Update refresh interval (in secs)' }:`, config.refreshInterval)
                if (refreshInterval === null) break // user cancelled so do nothing
                else if (!isNaN(parseInt(refreshInterval)) && parseInt(refreshInterval) > 0) { // valid int set
                    saveSetting('refreshInterval', parseInt(refreshInterval))
                    if (chatgpt.autoRefresh.isActive) { // reset running auto-refresh
                        chatgpt.autoRefresh.deactivate()
                        chatgpt.autoRefresh.activate(refreshInterval)
                    }
                    for (const id of menuIDs) { GM_unregisterMenuCommand(id) } registerMenu() // refresh menu
                    const minInterval = Math.max(2, config.refreshInterval - 10),
                          maxInterval = config.refreshInterval + 10
                    alert(( messages.alert_intUpdated || 'Interval updated' ) + '!',
                          ( messages.alert_willRefresh || 'ChatGPT session will auto-refresh every' )
                            + `${ minInterval }–${ maxInterval } ${ messages.unit_secs || 'secs' }`
                    )
                    break
        }}}))

        // Add command to launch About modal
        const amLabel = `💡 ${ messages.menuLabel_about || 'About' } ${ messages.appName || config.appName }`
        menuIDs.push(GM_registerMenuCommand(amLabel, launchAboutModal))
    }

    function launchAboutModal() {

        // Init data/styles
        const chatgptJSver = (/chatgpt-([\d.]+)\.min/.exec(GM_info.script.header) || [null, ''])[1],
              headingStyle = 'font-size: 1.15rem',
              pStyle = 'position: relative ; left: 3px',
              pBrStyle = 'position: relative ; left: 4px ',
              aStyle = 'color: ' + ( chatgpt.isDarkMode() ? '#c67afb' : '#8325c4' ) // purple

        // Show modal
        const aboutAlertID = alert(
            messages.appName || config.appName, // title
            `<span style="${ headingStyle }"><b>🏷️ <i>${ messages.about_version || 'Version' }</i></b>: </span>`
                + `<span style="${ pStyle }">${ GM_info.script.version }</span>\n`
            + `<span style="${ headingStyle }"><b>⚡ <i>${ messages.about_poweredBy || 'Powered by' }</i></b>: </span>`
                + `<span style="${ pStyle }"><a style="${ aStyle }" href="https://chatgpt.js.org" target="_blank" rel="noopener">`
                + 'chatgpt.js</a>' + ( chatgptJSver ? ( ' v' + chatgptJSver ) : '' ) + '</span>\n'
            + `<span style="${ headingStyle }"><b>📜 <i>${ messages.about_sourceCode || 'Source code' }</i></b>:</span>\n`
                + `<span style="${ pBrStyle }"><a href="${ config.gitHubURL }" target="_blank" rel="nopener">`
                + config.gitHubURL + '</a></span>',
            [ // buttons
                function checkForUpdates() { updateCheck() },
                function getSupport() { safeWindowOpen(config.supportURL) },
                function leaveAReview() { // show new modal
                    const reviewAlertID = chatgpt.alert(( messages.alert_choosePlatform || 'Choose a platform' ) + ':', '',
                        [ function greasyFork() { safeWindowOpen(config.greasyForkURL + '/feedback#post-discussion') },
                          function futurepedia() { safeWindowOpen(
                              'https://www.futurepedia.io/tool/chatgpt-auto-refresh#chatgpt-auto-refresh-review') }])
                    document.getElementById(reviewAlertID).querySelector('button')
                        .style.display = 'none' }, // hide Dismiss button
                function moreChatGPTapps() { safeWindowOpen('https://github.com/adamlui/chatgpt-apps') }
            ], '', 478 // set width
        )

        // Re-format buttons to include emoji + localized label + hide Dismiss button
        for (const button of document.getElementById(aboutAlertID).querySelectorAll('button')) {
            if (/updates/i.test(button.textContent)) button.textContent = (
                '🚀 ' + ( messages.buttonLabel_updateCheck || 'Check for Updates' ))
            else if (/support/i.test(button.textContent)) button.textContent = (
                '🧠 ' + ( messages.buttonLabel_getSupport || 'Get Support' ))
            else if (/review/i.test(button.textContent)) button.textContent = (
                '⭐ ' + ( messages.buttonLabel_leaveReview || 'Leave a Review' ))
            else if (/apps/i.test(button.textContent)) button.textContent = (
                '🤖 ' + ( messages.buttonLabel_moreApps || 'More ChatGPT Apps' ))
            else button.style.display = 'none' // hide Dismiss button
        }
    }

    function updateCheck() {

        // Fetch latest meta
        const currentVer = GM_info.script.version
        GM.xmlHttpRequest({
            method: 'GET', url: config.updateURL + '?t=' + Date.now(),
            headers: { 'Cache-Control': 'no-cache' },
            onload: response => { const updateAlertWidth = 377

                // Compare versions
                const latestVer = /@version +(.*)/.exec(response.responseText)[1]
                for (let i = 0 ; i < 4 ; i++) { // loop thru subver's
                    const currentSubVer = parseInt(currentVer.split('.')[i], 10) || 0,
                          latestSubVer = parseInt(latestVer.split('.')[i], 10) || 0
                    if (currentSubVer > latestSubVer) break // out of comparison since not outdated
                    else if (latestSubVer > currentSubVer) { // if outdated

                        // Alert to update
                        const updateAlertID = alert(( messages.alert_updateAvail || 'Update available' ) + '! 🚀', // title
                            ( messages.alert_newerVer || 'An update to' ) + ' ' // msg
                                + ( messages.appName || config.appName ) + ' '
                                + `(v ${ latestVer }) ${ messages.alert_isAvail || 'is available' }!   `
                                + '<a target="_blank" rel="noopener" style="font-size: 0.7rem" '
                                    + 'href="' + config.gitHubURL + '/commits/main/greasemonkey/'
                                    + config.updateURL.replace(/.*\/(.*)meta\.js/, '$1user.js') + '" '
                                    + `> ${ messages.link_viewChanges || 'View changes' }</a>`,
                            function update() { // button
                                GM_openInTab(config.updateURL.replace('meta.js', 'user.js') + '?t=' + Date.now(),
                                    { active: true, insert: true } // focus, make adjacent
                                ).onclose = () => location.reload() },
                            '', updateAlertWidth
                        )

                        // Localize button labels if needed
                        if (!config.userLanguage.startsWith('en')) {
                            const updateAlert = document.querySelector(`[id="${ updateAlertID }"]`),
                                  updateBtns = updateAlert.querySelectorAll('button')
                            updateBtns[1].textContent = messages.buttonLabel_update || 'Update'
                            updateBtns[0].textContent = messages.buttonLabel_dismiss || 'Dismiss'
                        }

                        return
                }}

                // Alert to no update, return to About alert
                alert(( messages.alert_upToDate || 'Up-to-date' ) + '!', // title
                    `${ messages.appName || config.appName } (v${ currentVer }) ` // msg
                        + ( messages.alert_isUpToDate || 'is up-to-date' ) + '!',
                    '', '', updateAlertWidth
                )
                launchAboutModal()
    }})}

    // Define FEEDBACK functions

    function notify(msg, position = '', notifDuration = '', shadow = '') {
        chatgpt.notify(`${ config.appSymbol } ${ msg }`, position, notifDuration, shadow || chatgpt.isDarkMode() ? '' : 'shadow') }

    function alert(title = '', msg = '', btns = '', checkbox = '', width = '') {
        return chatgpt.alert(`${ config.appSymbol } ${ title }`, msg, btns, checkbox, width )}

    // Define TOGGLE functions

    async function insertToggle() {
        await chatgpt.history.isLoaded()

        // Select sidebar elems
        const chatHistoryNav = document.querySelector('nav[aria-label="Chat history"]') || {},
              navButtons = chatHistoryNav.querySelectorAll('a'),
              firstButton = [...navButtons].find(button => re_firstBtnText.test(button.textContent))

        // Hide 'Enable History' div + sibling gradient div
        if (chatgpt.history.isOff())
            try {
                const enableHistoryDiv = firstButton.parentNode.parentNode.nextElementSibling,
                      gradientDiv = enableHistoryDiv.nextElementSibling
                enableHistoryDiv.parentNode.style.width = '100%'
                for (const div of [enableHistoryDiv, gradientDiv]) div.style.display = 'none'
            } catch (err) {}

        // Insert toggle
        const parentToInsertInto = firstButton.parentNode.parentNode.parentNode,
              childToInsertBefore = firstButton.parentNode.parentNode.nextElementSibling
        if (!parentToInsertInto.contains(navToggleDiv))
            try { parentToInsertInto.insertBefore(navToggleDiv, childToInsertBefore) } catch (err) {}

        // Tweak styles
        firstButton.parentNode.parentNode.style.paddingBottom = '0'
        parentToInsertInto.style.backgroundColor = ( // hide transparency revealing chat log
            chatgpt.isDarkMode() ? '#0d0d0d' : '#f9f9f9' )
        if (chatgpt.history.isOff() && !config.toggleHidden)
            navToggleDiv.style.display = 'flex' // remove forced cloaking in private mode
        navToggleDiv.style.paddingLeft = chatgpt.history.isOff() ? '20px' : '8px'
        document.querySelector('#arToggleFavicon').src = `${ // update navicon color in case scheme changed
            config.assetHostURL }media/images/icons/auto-refresh/${
            chatgpt.isDarkMode() ? 'white' : 'black' }/icon32.png`
    }

    function updateToggleHTML() {

        // Create/size/position navicon
        const navicon = document.querySelector('#arToggleFavicon') || document.createElement('img')
        navicon.id = 'arToggleFavicon'
        navicon.style.width = navicon.style.height = '1.25rem'
        navicon.style.marginLeft = navicon.style.marginRight = '4px'

        // Create/ID/disable/hide/update checkbox
        const toggleInput = document.querySelector('#arToggleInput') || document.createElement('input')
        toggleInput.id = 'arToggleInput' ; toggleInput.type = 'checkbox' ; toggleInput.disabled = true
        toggleInput.style.display = 'none' ; toggleInput.checked = !config.arDisabled

        // Create/ID/stylize switch
        const switchSpan = document.querySelector('#arSwitchSpan') || document.createElement('span')
        switchSpan.id = 'arSwitchSpan'
        const switchStyles = {
            position: 'relative', left: `${ chatgpt.browser.isMobile() ? 211 : 152 }px`,
            backgroundColor: toggleInput.checked ? '#ccc' : '#AD68FF', // init opposite  final color
            width: '32px', height: '16px', '-webkit-transition': '.4s', transition: '0.4s',  borderRadius: '28px'
        }
        Object.assign(switchSpan.style, switchStyles)

        // Create/stylize knob, append to switch
        const knobSpan = document.querySelector('#arToggleKnobSpan') || document.createElement('span')
        knobSpan.id = 'arToggleKnobSpan'
        const knobWidth = 13
        const knobStyles = {
            position: 'absolute', left: '3px', bottom: '0.1em',
            width: `${ knobWidth }px`, height: `${ knobWidth }px`, content: '""', borderRadius: '28px',
            transform: toggleInput.checked ? // init opposite final pos
                'translateX(0)' : `translateX(${ knobWidth }px) translateY(0)`,
            backgroundColor: 'white',  '-webkit-transition': '0.4s', transition: '0.4s'
        }
        Object.assign(knobSpan.style, knobStyles) ; switchSpan.append(knobSpan)

        // Create/stylize/fill label
        const toggleLabel = document.querySelector('#arToggleLabel') || document.createElement('label')
        toggleLabel.id = 'arToggleLabel'
        toggleLabel.style.marginLeft = '-41px' // left-shift to navicon
        toggleLabel.style.cursor = 'pointer' // add finger cursor on hover
        toggleLabel.style.width = `${ chatgpt.browser.isMobile() ? 201 : 148 }px` // to truncate overflown text
        toggleLabel.style.overflow = 'hidden' // to truncate overflown text
        toggleLabel.style.textOverflow = 'ellipsis' // to truncate overflown text
        toggleLabel.innerText = ( messages.menuLabel_autoRefresh || 'Auto-Refresh' ) + ' '
                              + ( toggleInput.checked ? ( messages.state_enabled  || 'enabled' )
                                                      : ( messages.state_disabled || 'disabled' ))
        // Append elements
        for (const elem of [navicon, toggleInput, switchSpan, toggleLabel]) navToggleDiv.append(elem)

        // Update visual state
        navToggleDiv.style.display = config.toggleHidden ? 'none' : 'flex'
        setTimeout(() => {
            if (toggleInput.checked) {
                switchSpan.style.backgroundColor = '#AD68FF'
                switchSpan.style.boxShadow = '2px 1px 9px #D8A9FF'
                knobSpan.style.transform = `translateX(${ knobWidth }px) translateY(0)`
            } else {
                switchSpan.style.backgroundColor = '#CCC'
                switchSpan.style.boxShadow = 'none'
                knobSpan.style.transform = 'translateX(0)'
            }
        }, 1) // min delay to trigger transition fx
    }

})()