// ==UserScript== // @name Pastel 4.0 (Preview Build) // @namespace https://github.com/GameSketchers/Pastel // @version 4.0-preview.2 // @description New Pastel | Bot Script | Profile Manager | Multi Game | Pastel UI | Add-Block | WhoWhere | Smart-Auto-Answer | // @match https://gartic.io/* // @connect 4everproxy.com // @grant GM_info // @grant GM_cookie // @grant GM.cookie // @grant GM_getValue // @grant GM_setValue // @grant unsafeWindow // @grant GM_xmlhttpRequest // @grant GM_getResourceText // @grant GM_addValueChangeListener // @resource LOGIN_JS https://cdn.jsdelivr.net/gh/GameSketchers/Pastel@master/src/login-popup.min.js // @resource AVATAR_JS https://cdn.jsdelivr.net/gh/GameSketchers/Pastel@master/src/avatar-picker.min.js // @resource POPUP_JS https://cdn.jsdelivr.net/gh/GameSketchers/Pastel@fd944bc/src/pastelCreatePopUp.min.js // @resource HOME_CSS https://cdn.jsdelivr.net/gh/GameSketchers/Pastel@46c0638/src/pastelHome.chunk.css // @resource LANGUAGES https://cdn.jsdelivr.net/gh/GameSketchers/Pastel@fe524fb/src/languages.temp.html // @resource SUBJECTS https://cdn.jsdelivr.net/gh/GameSketchers/Pastel@0a60a9a/src/subjects.temp.html // @supportURL https://github.com/GameSketchers/Pastel/issues/new // @run-at document-start // @license MIT // @icon https://cdn.jsdelivr.net/gh/GameSketchers/Pastel-Live/assets/pastelgirl.png // @downloadURL https://update.greasyfork.icu/scripts/575014/Pastel%2040%20%28Preview%20Build%29.user.js // @updateURL https://update.greasyfork.icu/scripts/575014/Pastel%2040%20%28Preview%20Build%29.meta.js // ==/UserScript== /** not: Script deneme sürümü olarak paylaşılmıştır. Script gelişim süreci açık ve devam etmektedir. **/ /* anonim mod sınırlıdır. İlerleyen sürümlerde iyileştirilecektir. */ /gartic\.io$/.test(location.host)&&(()=>{ try{ /*! TM workaround for parallel GM_xmlhttpRequest, see https://github.com/Tampermonkey/tampermonkey/issues/2215, included for userscript functionality. Users of this code must reference the original source as shown. */ const HAS_GM="undefined"!=typeof GM,NEW_GM=((t,o)=>{if("Tampermonkey"!==GM_info.scriptHandler||((t,o)=>{const n=GM_info.version.split(".").map(Number),e="5.3.2".split(".").map(Number),r=Math.max(n.length,e.length);for(let t=0;tr)return 1;if(on({...t,redirect:"manual",onload:function(n){if(n.status>=300&&n.status<400){const o=n.responseHeaders.match(/Location:\s*(\S+)/i),e=o&&o[1];if(e){const o=new URL(e,t.url).href;return void c({...t,url:o})}}o&&o.call(this,n),e&&e.call(this,n)},onerror:function(t){r&&r.call(this,t),e&&e.call(this,t)},onabort:function(t){i&&i.call(this,t),e&&e.call(this,t)},ontimeout:function(t){s&&s.call(this,t),e&&e.call(this,t)}});return c(l)}function i(t){let o;const n=new Promise(((n,e)=>{const{onload:i,ontimeout:s,onerror:l,...c}=t;c.onerror=function(t){l?(n(t),l.call(this,t)):e(t)},c.ontimeout=function(t){s?(n(t),s.call(this,t)):e(t)},c.onload=function(t){n(t),i&&i.call(this,t)};const u=r(c).abort;!0===o?u():o=u}));return n.abort=()=>{"function"==typeof o?o():o=!0},n}GM_xmlhttpRequest=r,t.GM_xmlhttpRequestOrig=n;const s=Object.getOwnPropertyDescriptor(o,"xmlHttpRequest");if(s&&!1===s.configurable)return{__proto__:o,xmlHttpRequest:i,xmlHttpRequestOrig:e};o.xmlHttpRequest=i,o.xmlHttpRequestOrig=e})(this,HAS_GM?GM:{});HAS_GM&&NEW_GM&&(GM=NEW_GM); const[GM_onMessage,GM_sendMessage,onElementAdded4,writePage,GM_checkGrant,pastelError,injectScript,cyberAnimeLog,deleteCookie,gmSetCookie,rnext2]=[ (k,c)=>GM_addValueChangeListener(k,(_,__,o)=>c(...o)),(k,...d)=>GM_setValue(k,d), (s,c,m=1)=>{let o,d=0,p=e=>(d||c(e),m||(d=1,o?.disconnect())),t=()=>{o?.disconnect(),d=0,o=new MutationObserver(r=>{for(let i=0;i(o?.disconnect(),d=1),start:()=>(o?.disconnect(),t()),get active(){return!d}}}, (t,m="dark",d)=>{const i="__c",e=document.getElementById(i);if(e)return e.style.whiteSpace="pre-wrap",e.style.textAlign="center",e.textContent=t,e;const b=m=="dark"?"#000":"#fff",f=m=="dark"?"#fff":"#000",s=`position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:${b};color:${f};z-index:9999;font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:600;font-size:clamp(18px,4vw,48px);user-select:none;margin:0;white-space:pre-wrap;text-align:center;line-height:1.5`,k=b=>{let el=document.createElement("div");return el.id=i,el.style.cssText=s,el.textContent=t,b.appendChild(el),el};if(d){document.documentElement.innerHTML='';if(document.body)return k(document.body);onElementAdded("body",b=>k(b))}return document.body?k(document.body):onElementAdded("body",b=>k(b))}, (L=["GM_info","unsafeWindow","GM_cookie","GM_getValue","GM_setValue","GM_xmlhttpRequest","GM_getResourceText","GM_addValueChangeListener"],V=L.map(n=>{try{return eval(n)}catch(e){return null}}))=>V.every((v,i)=>i<2?v&&typeof v=="object":typeof v=="function")?(GM_setValue("GM_checkGrant",1),!0):(pastelError(`ReferenceError: ${L[V.findIndex((v,i)=>i<2?!(v&&typeof v=="object"):typeof v!="function")]} is not defined`),!1), (q,w=false)=>{unsafeWindow?.pastelCreatePopUp?.showRoomInfo({header:"ALERT",closeable:0,noFrame:0,icon:"\E92A",text:q,buttons:[{text:"OK",color1:w?"rgb(227 102 255 / 60%)":"rgba(157,157,157,0.6)",color2:w?"rgba(255, 183, 3, .7)":"rgba(184,184,184,0.7)",img:"/static/images/new/ic_Yes.svg",onClick:(ui,id)=>{w&&ui.remove(id)}}]})}, (t)=>{let n=document.createElement("script");n.type="text/javascript",n.textContent=t,(document.head||document.documentElement).appendChild(n)}, (m,e=false)=>{console.log(`%c🌌 ${m} ⚡️`,`background:linear-gradient(90deg,#6a00ff,#ff00ff);color:${e?'#ff4d4d':'#e0e0ff'};padding:10px 15px;border-radius:5px;font-family:'Courier New',monospace;font-size:13px;font-weight:bold;text-shadow:0 0 8px #ff00ff,0 0 12px #6a00ff;box-shadow:0 0 15px #ff00ff;border:1px solid #ff00ff`)}, (n)=>new Promise(r=>{GM_cookie.delete({name:n},e=>{e?cyberAnimeLog(`✖ ${n} hatası: ${e}`,1):cyberAnimeLog(`✔ ${n} silindi.`);r()})}),/*thanks anonimbiri*/ async o=>{try{await deleteCookie('cf_clearance');await deleteCookie('garticio');return new Promise((r,j)=>{GM_cookie.set(o,e=>{e?(cyberAnimeLog('❌ Set hatası!',1),j(0)):(cyberAnimeLog('✅ İşlem tamam: Yeni çerez aktif!'),r(1))})})}catch(e){return console.error('Kritik Hata:',e),0}}, (Q)=>Q+Array.from({length:4},()=>'\u200B\u200C\u200D\u200E\u2060\u2061\u2062\u2063\u2064\u2066\u2068\u2069\u206A\u206B\u206E\u206F'[~~(Math.random()*16)]).join('')/*fr redbot*/ ],TTL=27e4; const tabMessage={on:(k,f)=>addEventListener("message",e=>{if(e.data?.type===k)f(e.data.data)}),emit:(k,d)=>top.postMessage({type:k,data:d},"*")} const HOME = localStorage.getItem('f1')||(localStorage.setItem('f1',Date.now()+"&script=pastel&version=4%2E0"),localStorage.getItem('f1')); const CHECK_ACC = sessionStorage.getItem('f2')||(sessionStorage.setItem('f2',Date.now()),sessionStorage.getItem('f2')); const extractUserFromTextUsingMarker=t=>{try{return JSON.parse(t.match(/\}\},\"user\"\s*:\s*(\{.*?\})/)?.[1]||'null')}catch{return null}}; const pageFetch=(u,init={})=>(typeof unsafeWindow!=='undefined'&&unsafeWindow.fetch)?unsafeWindow.fetch(u,init):fetch(u,init); ;(o=>o[Object.keys(o).find(k=>location.href.includes(k))]?.())({ token:()=>{ const w=unsafeWindow const upd=n=>writePage(`Token Genereting... (${n})`,'dark',false) const run=()=>setTimeout(()=>w.turnstile.render('#cf-turnstile',{ sitekey:'0x4AAAAAABBPKaIbNwnPEfSo', size:'invisible', callback:t=>{ const now=Date.now() const all=GM_getValue('Tokens')||[] const clean=all.filter(x=>now-x.time{try{w.turnstile.reset()}catch{}},1e3+Math.random()*1e3) } }),1e3) upd((GM_getValue('Tokens')||[]).filter(x=>Date.now()-x.time{ new class{ constructor(){ [this.mode,this.code,this.ID,this.nick,this.avatar,this.lang]=['o','c','i','n','a','l'].map(k=>new URLSearchParams(location.search).get(k)); const w=unsafeWindow; this._pastel=w._pastel||(w._pastel={}); Object.defineProperty(this._pastel,"self",{value:this,enumerable:0,configurable:1,writable:1}); ((g,t='turnstile',m={render:(...a)=>(queueMicrotask(()=>{let c=a[1]?.callback||(typeof a[1]=='function'&&a[1]);c&&c(t)}),'id'),remove:()=>{},reset:()=>{},getResponse:()=>t})=>{let o=g.turnstile;if(o)Object.assign(o,m);else g.turnstile=m;let d=Object.getOwnPropertyDescriptor(g,'turnstile');if(d?.set||d?.writable===!1)Object.defineProperty(g,'turnstile',{configurable:!0,enumerable:!0,get:()=>o||m,set:v=>{o=v;if(v&&typeof v=='object')Object.assign(v,m)}})})(typeof unsafeWindow!='undefined'?unsafeWindow:window); onElementAdded4("div#content",e=>{let d=[50,100,200,400],i=0,f=()=>{const k=Object.getOwnPropertyNames(e).find(x=>x.startsWith("__react")),r=k&&e[k];if(r)return this._pastel._play=r.pendingProps.children[1]._owner.stateNode._play,(o=>this._pastel._play._setPopup=(...a)=>((a[0]!==10)&&tabMessage.emit('popMessage',[this.ID,this.code,...a]),o.call(this,...a)))(this._pastel._play._setPopup),eval(`const p=_pastel._play;p.start=(...a)=>{p._data=CACHE_DATA;p._room=a[1];p._data.user||=window.CACHE_DATA.user;p._getServer();p._setPopup(10)};p._connect=()=>{const t=CACHE_DATA,e=t.user||CACHE_DATA.user,c="${this.avatar}";e.language=${this.lang};e.nome="${this.nick}";p._reconnections=0;p._viewer?p._socket.emit(12,{v:2e4,platform:1,sala:p._room?.substr(2)}):p._room?(p._room===!0?p._socket.emit("2",{v:2e4,token:_pastel.self.getToken(),nick:e.nome,avatar:c,platform:1,idioma:e.language,tipo:t.subject,limite:t.players,meta:t.points,visivel:t.visible,criado:t.created}):p._socket.emit("3",{v:2e4,token:_pastel.self.getToken(),nick:e.nome,avatar:c,platform:1,sala:p._room.substr(2)})):p._socket.emit("1",{v:2e4,token:_pastel.self.getToken(),nick:e.nome,avatar:c,platform:1,idioma:e.language})/*,p._ping()*/;p._socket.removeAllListeners("connect")}${this.mode=="roomJoin"?`;_pastel._play.start(CACHE_DATA,"${location.pathname.split('/')[1]}")`:""}`);d[i]?setTimeout(f,d[i++]):0};f()},0) onElementAdded4("div#screenRoom",e=>{let g,c,k,f=n=>n&&!g&&(n.tag==1&&(c=n.stateNode?.props?.children?.[0]?._owner?.stateNode)&&(g=this._pastel._game=c._game)&&(g._chat=c._chatElem,g._answer=c._answerElem,this.joinedRoom(g)),!g&&f(n.child));for(k in e)/^__r/.test(k)&&f(e[k])},1) this.mode=="roomJoin"&&GM_onMessage(`rejoin-${this.ID}`,(Qn,w)=>{Qn==this.ID&&this._pastel._play.start(unsafeWindow.CACHE_DATA,location.pathname.split('/')[1])}) //this.mode=="roomCreate"&&(tabMessage.emit('opened',this.ID),onElementAdded4("#screens > div > div.title > div:nth-child(1) > button",Q=>{Q.onclick=()=>tabMessage.emit('close',this.ID)})) } gT(){let c="Zx1Yp8Qr7Wv6Ut5Os4Nm3Lk2Jh0GfAeBdCvHqIjKlMnOpQrStUvWxYz0123456789_-.",r=n=>Array.from({length:n},()=>c[Math.random()*c.length|0]).join(""),s=3+Math.random()*3|0;return"1."+Array.from({length:s},()=>r(80+Math.random()*120|0)).join(".")} antiAFK(){const o=this._pastel,g=o?._game,e=g?._events;if(!e)return;e.avisoInativo=()=>{g._ativo=Date.now();g._socket.io.engine.transport.ws.send(`42[42,${g._codigo}]`)}} escapeInvisibles=s=>s.replace(/\p{C}/gu,c=>`\\u${c.codePointAt(0).toString(16).toUpperCase().padStart(4,'0')}`) joinedRoom(){ this._pastel._game.exit=()=>{this._pastel._game._socket.io.engine.transport.ws.send(`42[24,${this._pastel._game._codigo}]`);tabMessage.emit('close',this.ID)}; tabMessage.emit('opened',this.ID) addEventListener("keydown",e=>e.code==="Escape"&&(this._pastel?._game?.exit()),{passive:1,once:1}) Object.defineProperty(this._pastel._game,'_tempoVotekick',{get:()=>0,set:()=>{}}) this.antiAFK() this.mode=="roomJoin"&&onElementAdded4("#screenRoom header",Q=>{ !document.getElementById("getBot-style")&&document.head.insertAdjacentHTML('beforeend',''); let btn=(p)=>p&&!p.querySelector('#getBot')&&(p.insertAdjacentHTML('afterbegin',''),p.querySelector('#getBot').onclick=(e)=>this.getBot(e.currentTarget)); btn(Q.querySelector("div:nth-child(2) > div:nth-child(1)")); btn(document.querySelector("#interaction > div.actionsMobile")); }) this.mode=="roomView"&&onElementAdded4("#screenRoom header",q=>{q.insertAdjacentHTML('beforeend','
');q.querySelector('#exit')&&(q.querySelector('#exit').onclick=()=>this._pastel._game.exit())},0) this.mode=="roomView"&&onElementAdded4("#__next > div > div > div > div > h2",q=>{tabMessage.emit('close',this.ID)}) } getToken(){ const now=Date.now() let tokens=GM_getValue("Tokens")||[] let valid=tokens.filter(t=>!t.used && now-t.time(this.TTL-(now-b.time))<(this.TTL-(now-a.time))?b:a) tok.used=1 GM_setValue("Tokens",tokens) return tok.token } getIP=()=>{try{this.getIps??=GM_getValue("proxyIPs");if(this.getIps?.[1]===1)return alert("You don't have any IPs"),!1;if(!this.getIps?.length)return!1;this.ipIndex===undefined&&(this.ipIndex=Math.floor(Math.random()*this.getIps.length));this.ipIndex>=this.getIps.length&&(this.ipIndex=0);return this.getIps[this.ipIndex++]}catch{return!1}}; getBot(Q){this._pastel._game.users!==this._pastel._game.limit&&(Q.disabled=1,this.sendBot(Q,this._pastel._game.created,rnext2("pastel")/*rnext2(this._pastel._game.me.nick)*/,33/*this._pastel._game.me.avatar*/,this.getIP()))} async sendBot(Q,roomCode,botNome="pastel",botAv=33,selectIP){ roomCode??(()=>{throw Error("room code not found")})(); selectIP??(()=>{throw Error("IP not found")})(); const obj={encodePage:"0",stripTitle:"0",stripJS:"0",allowCookies:"1",autoPermalink:"0",selectip:selectIP,subdomain:"de",url:`https://gartic.io/server?v3=0&room=${roomCode}`}; GM_xmlhttpRequest({ method: "GET", url:`https://${obj.subdomain}.4everproxy.com/process/${btoa(new URLSearchParams({ ...obj, url: encodeURIComponent(obj.url) }).toString())}`, headers:{"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Goanna/4.0 Firefox/55.0 Basilisk/20210125","Referer":"https://www.4everproxy.com/","Cookie":"4everproxy=1;"}, timeout:3000, withCredentials:0, anonymous:1, onloadend:r=>{ try { /** * st 540-580 normalde kullanılan klasik yöntem buydu fakat kısıtlandığı için bu yolu uygulamak daha mantıklı oldu * NodeJS ortamında da bu yol kullanılabilir fakat sid ID ile açılan socket baglantılarının sayısının artışı sunucu tarafından engellenmenize sebep verebilir(eğer sunucu tarafında sid tanımlandıktan sonra 2. bir ip kontrolü oluyorsa geçerlidir). */ const u=new URL(r.responseXML.body.textContent.trim()),roomServer=u.hostname,csrf=u.searchParams.get('c'),gookie=r.responseHeaders.match(/garticio@[^=]+=[^;]+/)?.[0],obj2={encodePage:"0",stripTitle:"0",stripJS:"0",allowCookies:"1",autoPermalink:"0",selectip:selectIP,subdomain:"de",url:`https://${roomServer}/socket.io/?transport=polling&c=${csrf}`}; Q.disabled=0; GM_xmlhttpRequest({ method: "GET", url:`https://${obj2.subdomain}.4everproxy.com/process/${btoa(new URLSearchParams({...obj2,url:encodeURIComponent(obj2.url)}).toString())}`, headers:{"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Goanna/4.0 Firefox/55.0 Basilisk/20210125","Referer":"https://www.4everproxy.com/","Cookie":`4everproxy=1;${gookie}`}, withCredentials:0, anonymous:1, onloadend:async r=>{ const sid=JSON.parse((r.responseText||'').replace(/^\d+:\d+/,'')).sid; if(!sid)return Q.disabled=0; const ws = new WebSocket(`wss://${roomServer}/socket.io/?sid=${sid}&transport=websocket`); ws.onopen=()=>ws.send("2probe"); ws.onmessage=e=>{ const s=e.data; s==="3probe"&&(ws.send("5"),ws.send(`42["3",{"v":20000,"token":"${this.getToken()}","nick":"${botNome}","avatar":${botAv},"platform":1,"sala":"${roomCode.slice(2)}"}]`)); (s.length>2&&s.charCodeAt(2)===91)&&(()=>{ try{const data = JSON.parse(s.slice(2)); data?.[0]=="5"&&(ws.botid=data[2],ws.send(`42[46,${ws.botid}]`),Q.disabled=0,ws.send(`42[11,${ws.botid},"im here!"]`),(()=>{let wsInterval=setInterval(()=>ws?.readyState===1?ws.send(`2`):clearInterval(wsInterval),24e3),wsInterval2=setInterval(()=>ws?.readyState===1?ws.send(`42[42,${data[2]}]`):clearInterval(wsInterval2),98e3)})()); data?.[0]=="6"&&(ws.send("41"),ws.close()); data?.[0]=="45"&&data?.[1]==this._pastel._game?._id&&ws.send(`42[45,${ws.botid},[${JSON.stringify(data[2])},true]]`); data?.[0]=="11"&&this._pastel._game._getUser(data?.[1]).nick==this._pastel._game.me.nick&&data?.[2]=="leave"&&ws.send(`42[24,${JSON.stringify(ws.botid)}]`); }catch{} })(); }; }, ontimeout:()=>console.log("timeout") }); }catch(e){Q.disabled=0} } }); } } }, req:()=>{}, static:()=>{}, server:()=>{}, viewer:()=>{}, joinRoom:()=>{}, ping:()=>{try{const q=new URLSearchParams(location.search);if(q.get('mode')==='login'){localStorage.setItem('checkAuth','1');window.name='checkAuth';location.href=q.get('url')||'/';}}catch(e){}}, [HOME]:()=>{ new class{ constructor(){ onElementAdded4('link[rel*="icon"]',x=>{x.remove()|document.head.append(Object.assign(document.createElement('link'),{rel:'icon',href:'https://cdn.jsdelivr.net/gh/GameSketchers/Pastel-Live/assets/pastelgirl.png'}))},0) document.title="Pastel";Object.defineProperty(document,"title",{get(){return "Pastel"},set(_){},configurable:true}); onElementAdded4("body",z=>{z.remove();document.querySelector('head').remove();this.injectHomeHTML()},0) injectScript(GM_getResourceText("LOGIN_JS")); injectScript(GM_getResourceText("AVATAR_JS")); injectScript(GM_getResourceText("POPUP_JS")); sessionStorage.clear(); localStorage.clear(); localStorage.setItem("soundOff",1); localStorage.setItem('pastel','1');sessionStorage.setItem('pastel','1') this._pastel=unsafeWindow._pastel||(unsafeWindow._pastel={}); Object.defineProperty(this._pastel,"self",{value:this,enumerable:0,configurable:1,writable:1}); this._pastel.proxies=GM_getValue("proxyIPs"); } async injectHomeHTML(){ const pastelhead = Object.assign(document.createElement('head'),{id:'pastel',innerHTML:`Pastel 4.0`}); const pastelbody = Object.assign(document.createElement('body'),{id:'pastel',innerHTML:`
Pastel

⭐ Pastel: Yours ⭐

${GM_getResourceText("LANGUAGES")}
GameSketchers • by Qwyua with love

ROOMS

LANGUAGE${GM_getResourceText("LANGUAGES")}
THEME${GM_getResourceText("SUBJECTS")}
`}); //
//
R
//
+7
document.documentElement.prepend(pastelbody); document.documentElement.prepend(pastelhead); this.languages={1:"pt",2:"en",3:"es",4:"fr",6:"it",7:"ru",8:"tr",10:"pl",11:"cs",12:"th",13:"vi",14:"de",15:"ja",16:"zh",18:"nl",19:"ar",20:"ko",21:"bg",22:"sk",23:"az",34:"fa",40:"he",44:"hu",45:"id",58:"ro"}; this.subjects={1:"general",2:"animals",3:"objects",4:"foods",5:"verbs",6:"jobs",7:"pokemon",8:"movies",9:"cartoons",10:"songs",11:"lol",12:"games",13:"personalities",14:"marveldc",15:"series",16:"flags",17:"football",18:"harrypotter",19:"clashroyale",20:"lordoftherings",21:"gameofthrones",22:"dragonball",23:"dota",24:"youtubers",25:"streamers",26:"logos",27:"bands",28:"animes",29:"sports",30:"othersgeneric",31:"minecraft",32:"fortnite",33:"fnaf",34:"starwars",35:"naruto",36:"thesims",37:"halloween",38:"crazy"}; this.homeUserNameInput = document.querySelector('pastel-home #usernameInput') this.homeLanguageSelect = document.querySelector('pastel-home select[name="language"]') this.homeRoomsButton = document.querySelector('pastel-home .ic-rooms') this.homePlayButton = document.querySelector('pastel-home .ic-playHome') this.roomsBackButton = document.querySelector('pastel-rooms .back') this.roomsSearchInput = document.querySelector('pastel-rooms .search-box input'); this.roomsLanguageSelect = document.querySelector('pastel-rooms select[name="language"]'); this.roomsSubjectSelect = document.querySelector('pastel-rooms select[name="subject"]'); this.roomsCreateButton = document.querySelector('pastel-rooms .ic-rooms') this.roomsViewButton = document.querySelector('pastel-rooms .icEye') this.roomsPlayButton = document.querySelector('pastel-rooms .ic-play') this.roomsActionRooms = document.querySelector('.actRooms') this.navbar = document.querySelector('pastel-navbar') this.nextButton = document.querySelector('pastel-home button[id="nextBtn"]') this.prevButton = document.querySelector('pastel-home button[id="prevBtn"]') this.gameSec = document.querySelector('pastel-game'); this.gameBtn = document.querySelector('[data-icon="game"]'); this.tip = document.querySelector('[data-icon="game"] pastel-tooltip'); this.loading; this.initProfileManager() this.initListeners() } changeLine=(e)=>(e=document.body.appendChild(document.createElement('p')),Object.assign(e.style,{position:'fixed',top:0,height:'3px',background:'#ffbf00',boxShadow:'0 0 9px #ffbf00',zIndex:9e9}),e.animate([{width:0,opacity:1},{width:'100%',opacity:1,offset:.4},{width:'100%',opacity:0}],800).onfinish=()=>e.remove()) validateNick=q=>!/^[^<>/\\:&;"'.,!?{}*\[\]]{2,18}$/i.test((q=q.trim().replace(/\s+/g," ")))||/[\p{Emoji_Presentation}\p{Extended_Pictographic}]/u.test(q)?(pastelError("Invalid nickname: It must contain at least 2 characters, without special characters.",1),false):true; executeRoomAction=function(actionType,code="",isHome=false,playerCount='?/?'){ if (!this.validateNick(this.homeUserNameInput.value)) return; const id = Math.random().toString(36).slice(2,10); const acc = GM_getValue("gartswitch_accounts_v1")?.Accounts.find(a=>a.selected); const nick = acc?.nome||"User0"; const avatar = acc?.avatar||0; const language=GM_getValue("selectedLanguage")||(isHome?this.homeLanguageSelect.value:this.roomsLanguageSelect.value)||2; let path = ""; let tag = ""; switch(actionType) { case 'roomCreate': path=`/create?o=roomCreate&v=Pasteel&i=${id}`; tag='#Create'; break; case 'roomView': path=`/${code}/viewer?o=roomView&v=Pasteel&i=${id}`; tag='#Viewer'; break; case 'roomJoin': path=`${isHome?"?":`/${code}?`}&o=roomJoin&c=${isHome?"":code}&v=Pasteel&i=${id}&n=${nick}&a=${avatar}&l=${language}`; tag='#Play'; break; default: console.warn("Geçersiz oda eylemi:", actionType); return; } const f=Object.assign(document.createElement('iframe'),{src:path,style:'position:fixed;inset:0;width:100vw;height:100vh;border:0'}); f.dataset.id = id; f.dataset.mode = 'play'; f.dataset.code = code; this.gameSec.appendChild(f); const roomShortCode=code?code.slice(-3):"New"; this.tip.insertAdjacentHTML('beforeend', `

${tag} ~ Oda #${roomShortCode}

${playerCount}×
`); this.gameSec.querySelectorAll('iframe').forEach(el => { el.style.display = el === f ? '' : 'none' }); this.loading = unsafeWindow?.pastelCreatePopUp?.showLoader(); }; initListeners() { this.navbar.onclick=e=>{ const b = e.target.closest('.pastel-navbar-item'),active=this.navbar.querySelector('.active'); b&&b!==active&&( document.querySelector(`pastel-${active.dataset.icon}`).style.display="none", document.querySelector(`pastel-${b.dataset.icon}`).style.display="", this.changeLine(),active.classList.remove('active'),b.classList.add('active') ) }; document.querySelector('.pastel-navbar-toggle').onclick =()=>this.navbar.classList.toggle('closed'); document.querySelector('.content.bg.rooms').onclick = e => { const a = e.target.closest('.scrollElements a[data-room-code]'); a && a !== this.selectedRoom && ( document.querySelector('.scrollElements a.selected')?.classList.remove('selected'), a.classList.add('selected'), this.selectedRoom = a, this.roomsPlayButton?.removeAttribute('disabled') ); }; this.homeUserNameInput.oninput=Q=>{ let n=Q.target.value; if(n.length<2) return; this.nextButton.disabled=this.prevButton.disabled=1; clearTimeout(this.t); this.t=setTimeout(()=>{ let d=GM_getValue("gartswitch_accounts_v1"),a=d?.Accounts.find(a=>a.selected); a&&this.validateNick(n)&&(a.nome=n,/^(Anon|anon|anonimbiri|AnonimBiri|Anonimbiri|anonimBiri|Anonymous|anonymous)$/i.test(n)&&(typeof a.avatar=='number'||/^\d+$/.test(a.avatar))?a.anon=1:delete a.anon,GM_setValue("gartswitch_accounts_v1",d)); this.nextButton.disabled=this.prevButton.disabled=0; },500); }; this.homePlayButton.onclick = this.roomsActionRooms.onclick=(e)=>{ const button=e.target.closest('.pastel-button'); const actions={'ic-rooms':'roomCreate','icEye':'roomView','ic-playHome':'roomJoin'}; const activeType=Object.keys(actions).find(className => button?.classList.contains(className)); button&&this.selectedRoom&&activeType&&this.executeRoomAction( actions[activeType], this.selectedRoom.dataset.roomCode??"", !!e.target.closest('pastel-home'), this.selectedRoom.querySelector('span')?.textContent??'?/?' ); }; this.gameBtn.onclick = e => { const target = e.target, item = target.closest('div[data-mode]'), isClose = target.matches('span:last-of-type'), isInside = this.tip.contains(target), len = this.tip.children.length; item&&(isClose?(item.remove(),this.gameSec.querySelector(`iframe[data-id="${item.dataset.id}"]`)?.remove(),len<2&&(this.tip.dataset.open=0,this.gameBtn.ac?.abort())):(this.gameSec.querySelectorAll('iframe').forEach((f)=>{f.style.display=f.dataset.id===item.dataset.id?'':'none'}),this.tip.dataset.open=0,this.gameBtn.ac?.abort())); isInside||(len===1?(this.gameSec.querySelectorAll('iframe').forEach((f)=>{f.style.display=f.dataset.id===this.tip.firstElementChild.dataset.id?'':'none'})):len>1&&(this.gameBtn.ac?.abort(),(this.tip.dataset.open^=1)==1&&(this.gameBtn.ac=new AbortController(),document.addEventListener('click',(d)=>{this.gameBtn.contains(d.target)||(this.tip.dataset.open=0,this.gameBtn.ac.abort())},{capture:true,signal:this.gameBtn.ac.signal})))); }; this.homeRoomsButton.onclick=()=>{ !this.validateNick(this.homeUserNameInput.value)||document.querySelector('pastel-navbar button[data-icon="rooms"]').click() } this.roomsBackButton.onclick=()=>{document.querySelector('pastel-navbar button[data-icon="home"]').click()} this.roomsSearchInput?.addEventListener('input', () => { clearTimeout(this.searchTimeout); this.searchTimeout = setTimeout(() => this.refreshRooms(), 500); }); this.homeLanguageSelect&&( this.homeLanguageSelect.onchange=(q,d)=>( this.roomsLanguageSelect&&(this.roomsLanguageSelect.value=this.homeLanguageSelect.value), ((d=GM_getValue("gartswitch_accounts_v1"))?.Accounts?.find(a=>a.selected==1)&&(d.Accounts.find(a=>a.selected==1).language=+this.homeLanguageSelect.value,GM_setValue("gartswitch_accounts_v1",d))), this.refreshRooms?.(0),GM_setValue("selectedLanguge",this.roomsLanguageSelect.value) ) ); this.roomsLanguageSelect&&( this.roomsLanguageSelect.onchange=(q,d)=>( this.homeLanguageSelect&&(this.homeLanguageSelect.value=this.roomsLanguageSelect.value), ((d=GM_getValue("gartswitch_accounts_v1"))?.Accounts?.find(a=>a.selected==1)&&(d.Accounts.find(a=>a.selected==1).language=+this.roomsLanguageSelect.value,GM_setValue("gartswitch_accounts_v1",d))), this.refreshRooms?.(0),GM_setValue("selectedLanguge",this.roomsLanguageSelect.value) ) ); ///static/images,/new/bgAvatar.svg,icone_alerta.svg,new/bgAvatar.svg,new/icone_alerta.svg,editTheme.svg,exit.svg,erro.svg,report.svg,confirmMail.svg,iconInactive.svg,clean.svg,iconSecChange.svg,iconSameNickname.svg,iconVoteKick.svg,iconSkip.svg,iconConnection.svg this.roomsSubjectSelect?.addEventListener('change', () => {this.refreshRooms(0)}); this.roomInterval = setInterval(() => this.refreshRooms(1), 35000); tabMessage.on('opened',x=>{ this.gameBtn.click() this.loading?.remove() }) tabMessage.on('popMessage',(Q)=>{ const[q,c,w,y]=Q,[u,a]=[y.title,y.text]; this.loading?.remove(); document.querySelector('pastel-navbar button[data-icon="rooms"]').click() unsafeWindow?.pastelCreatePopUp?.showRoomInfo({ header:u, closeable:0, noFrame:0, icon:"\E93C", text:a, buttons:[ { text:"OK",color1:"rgb(227 102 255 / 60%)", color2:"rgba(255,183,3,.7)",img:"/static/images/new/ic_Yes.svg", onClick:(ui,id)=>{ ui.remove(id) document.querySelector(`iframe[data-id="${q}"]`)?.remove(); document.querySelector(`pastel-tooltip div[data-id="${q}"]`)?.remove(); } }, { text:"Retry",color1:"rgb(0 160 255 / 60%)", color2:"rgba(0,140,230,.7)",icon:"\E954", onClick:(ui,id)=>{ ui.remove(id) GM_sendMessage(`rejoin-${q}`,q,~~(Math.random()*1000)); this.loading = unsafeWindow?.pastelCreatePopUp?.showLoader(); } }, { text:"View",color1:"rgb(255 82 82 / 60%)", color2:"rgba(229,57,53,.7)",img:"/static/images/new/icEye.svg", onClick:(ui,id)=>{ ui.remove(id) this.executeRoomAction("roomView",c) document.querySelector(`iframe[data-id="${q}"]`)?.remove(); document.querySelector(`pastel-tooltip div[data-id="${q}"]`)?.remove(); } }, ] }); }); tabMessage.on('close',(id,home)=> { document.querySelector('pastel-navbar button[data-icon="rooms"]').click() document.querySelector(`iframe[data-id="${id}"]`)?.remove(); document.querySelector(`pastel-tooltip div[data-id="${id}"]`)?.remove(); }); } async firstLoadRooms(){this._firstLoaded||(this._firstLoaded=1,this.refreshRooms(0))} async refreshRooms(reboot){ console.log("Loading Rooms...") this.inputvalue=document.querySelector('pastel-rooms .search-box input')?.value||""; this.selectedlanguagecode=document.querySelector('pastel-rooms select[name="language"]')?.value||""; this.selectedSubjectvalue=document.querySelector('pastel-rooms select[name="subject"]')?.value||0; this.subjectParam=this.selectedSubjectvalue!=="0"?`&subject[]=${this.selectedSubjectvalue}`:""; this.response=await fetch(`https://gartic.io/req/list?search=${this.inputvalue}&language[]=${this.selectedlanguagecode}${this.subjectParam}`); this.roomsData=await this.response.json(); const rooms=this.roomsData.reduce((a,r)=>{ const i=a.findIndex(x=>x.code===r.code); if(i===-1)a.push(r); else if(r.quant>a[i].quant)a[i]=r; return a; },[]); const selectedCode=reboot==1?document.querySelector('.content.rooms a.selected')?.dataset.roomCode:null; const html=rooms.map(r=>{ const p=r.players||[]; const has=p.length>0; const playersHtml=!has?'':`
${p.slice(0,p.length>8?7:p.length).map(x=>`
`).join('')}${p.length>8?`
+${p.length-8}
`:''}
`; return `
${r.official?'
':''}
${this.subjects[r.subject]??''}#${r.id.slice(1)}
${playersHtml}
${r.quant}/${r.max}
${this.languages[r.lang]??'??'}
${r.points}/${r.goal}
`}).join(''); document.querySelector('.content.rooms').innerHTML=`
${html}
` } async initProfileManager(){ const qy=this // ====================== P R O F I L E M A N A G E R ===================== const ACCT_KEY='gartswitch_accounts_v1'; const gmGet=e=>"function"==typeof GM_getValue?Promise.resolve(GM_getValue(e)):GM?.getValue?GM.getValue(e):Promise.resolve(void 0); const gmSet=(e,s)=>"function"==typeof GM_setValue?Promise.resolve(GM_setValue(e,s)):GM?.setValue?GM.setValue(e,s):Promise.resolve(); const gmXHR=t=>new Promise(((o,e)=>{try{GM_xmlhttpRequest(Object.assign({},t,{onload:t=>o(t),onerror:t=>e(t),ontimeout:t=>e(t)}))}catch(t){e(t)}})); async function loadAccounts(){const t=await gmGet(ACCT_KEY);return t?"string"==typeof t?(()=>{try{return JSON.parse(t)}catch{return t}})():t:{Accounts:[]}} async function saveAccounts(a){await gmSet(ACCT_KEY,a)} const createEmptyGarticio=()=>new Promise(r=>{GM_xmlhttpRequest({method:'GET',url:location.origin+'/',anonymous:true,onload:e=>{r((e.responseHeaders.match(/garticio[^=]*=([^;,\s]+)/i)||[])[1]||null)}})}); async function fetchRootUser(){try{const r=await pageFetch(location.origin+'/',{credentials:'include',cache:'no-store'});const txt=await r.text();return extractUserFromTextUsingMarker(txt)}catch(e){return null}} async function addAccountFromCookieValue(c,v={doServerSet:!1,serverName:''}){if(!c)return null;await gmSetCookie({name:'garticio',value:c,domain:".gartic.io",path:"/",secure:!0,httpOnly:!0,sameSite:"no_restriction"});try{(typeof unsafeWindow!=='undefined'&&unsafeWindow.document)?unsafeWindow.document.cookie=`garticio=${c};path=/;`:document.cookie=`garticio=${c};path=/;`}catch(e){}if(v.doServerSet)try{await pageFetch('https://gartic.io/req/user',{method:'POST',headers:{'Content-Type':'application/json'},credentials:'include',body:JSON.stringify({avatar:0,language:GM_getValue("selectedLanguage")||2,name:v.serverName||''})})}catch(e){}const u=await fetchRootUser(),o=await loadAccounts(),a={id:u?.id||Date.now().toString(),nome:u?.nome||`User${Math.floor(9e3*Math.random())+1e3}`,avatar:void 0!==u?.avatar?u.avatar:0,language:GM_getValue("selectedLanguage")||u?.language||2,selected:1,cookie:c};o.Accounts=o.Accounts||[],o.Accounts.push(a),o.Accounts.forEach((e,i)=>e.selected=i==o.Accounts.length-1?1:0),await saveAccounts(o);return a} async function ensureInitialProfile(){const e=await loadAccounts();if(e.Accounts&&e.Accounts.length>0)return e;try{await pageFetch('https://gartic.io/logout',{method:'POST',credentials:'include'})}catch(e){}const t=await createEmptyGarticio();if(!t){alert('Account could not be created: cookie not found.');return{Accounts:[]}}await addAccountFromCookieValue(t,{doServerSet:!1});return await loadAccounts()} function waitAuthStable(e,{timeout:t=12e4}={}){try{localStorage.removeItem('checkAuth')}catch(e){}const o=window.open(e,'Auth','width=600,height=700');if(!o)return Promise.reject(new Error('Popup blocked'));return new Promise((e,p)=>{const a=Date.now(),n=setInterval(()=>{if(Date.now()-a>t){clearInterval(n);try{o.close()}catch(e){}return p(new Error('Auth timeout'))}if(o.closed){clearInterval(n);setTimeout(()=>{let t=null;try{t=localStorage.getItem('checkAuth')}catch(e){t=null}e(t??null)},120)}},250)})} async function switchToIndex(idx){const s=await loadAccounts();if(!s.Accounts||0===s.Accounts.length){alert('No account');return}if(idx<0||idx>=s.Accounts.length)return;const a=s.Accounts[idx],c=await gmSetCookie({name:'garticio',value:a.cookie,domain:".gartic.io",path:"/",secure:!0,httpOnly:!0,sameSite:"no_restriction"}).catch(()=>0);document.getElementById('usernameInput').disabled=document.querySelector('.profile-section select[name="language"]').disabled=!c;s.Accounts.forEach((e,i)=>e.selected=i===idx?1:0);await saveAccounts(s)} class GarticProfileManager { constructor(){this.avatarCount=37;this.accounts=[];this.currentIndex=0;this.switchTimer=null;this.elements={mainContainer:document.getElementById('mainContainer'),profileContainer:document.getElementById('profileContainer'),usernameInput:document.getElementById('usernameInput'),profileInfo:document.getElementById('profileInfo'),prevBtn:document.getElementById('prevBtn'),nextBtn:document.getElementById('nextBtn'),avatarCanvas:document.getElementById('avatarCanvas'),loginCanvas:document.getElementById('loginCanvas'),languageSelect:document.querySelector('.profile-section select[name="language"]')}} async init(){await this.loadProfilesFromStorage();this.loadCurrentProfile();this.loadAvatars();this.setupEventListeners()} async loadProfilesFromStorage(){const s=await loadAccounts();this.accounts=s.Accounts||[];if(0===this.accounts.length){await ensureInitialProfile();const t=await loadAccounts();this.accounts=t.Accounts||[]}const i=this.accounts.findIndex(a=>1===a.selected);this.currentIndex=-1!==i?i:0} async saveProfilesToStorage(){await saveAccounts({Accounts:this.accounts})} async loadCurrentProfile(){this.elements.profileContainer.innerHTML='';if(this.currentIndex{e.stopPropagation();this.deleteProfile()};a.onclick=()=>{g&&(this.elements.avatarCanvas.style.display='flex')};f.appendChild(a);f.appendChild(d);this.elements.profileContainer.appendChild(f);this.elements.usernameInput.value=p.nome||'';this.elements.languageSelect.value=GM_getValue("selectedLanguage")||p.language||2;this.elements.profileInfo.textContent=`${this.currentIndex+1}/${this.accounts.length} - ${p.nome}`;qy.roomsLanguageSelect.value=GM_getValue("selectedLanguage")||p.language||2;qy.firstLoadRooms()}else{const a=document.createElement('div');a.className='add-profile-frame';a.innerHTML='
';a.onclick=()=>{this.elements.loginCanvas.style.display='flex'};this.elements.profileContainer.appendChild(a);this.elements.usernameInput.value='';this.elements.profileInfo.textContent='Add New Profile'};this.elements.prevBtn.disabled=0===this.currentIndex;this.elements.nextBtn.disabled=this.currentIndex===this.accounts.length} async loadAvatars(){unsafeWindow.createAvatarCanvas(document.getElementById('avatarCanvas'),{url:"static/images/avatar/svg/~~~NUM~~~.svg",start:0,end:36},"Select Avatar",async i=>{this.currentIndex{if("user"===c){const n=await createEmptyGarticio();n?(await addAccountFromCookieValue(n,{doServerSet:!1}),await this.loadProfilesFromStorage(),this.loadCurrentProfile(),this.elements.loginCanvas.style.display='none'):alert('Could not get new garticio')}else{const n=await createEmptyGarticio();if(!n){alert('Could not get new garticio');return}const e='temp-'+Date.now()+'-'+Math.random().toString(36).slice(2,8),t={id:e,nome:'Logging in...',avatar:0,language:GM_getValue("selectedLanguge")||2,selected:0,cookie:n};this.accounts.push(t),await this.saveProfilesToStorage(),this.loadCurrentProfile();try{const r=await waitAuthStable(`https://gartic.io/ping?mode=login&url=https://gartic.io/${c}/callback`,{timeout:120000});if(null===r||'1'===r){this.accounts=this.accounts.filter(a=>a.id!==e),await this.saveProfilesToStorage(),this.loadCurrentProfile(),alert('1'===r?'Login cancelled.':'Auth result could not be obtained.'),this.elements.loginCanvas.style.display='none';return}let u=null;try{u=JSON.parse(r)}catch{}if(Array.isArray(u)&&'Success'===u[0]&&u[1]){const o=u[1],l=this.accounts.findIndex(a=>a.id===e);if(-1!==l){this.accounts[l]={id:o.id,nome:o.nome,avatar:void 0!==o.avatar?o.avatar:0,language:GM_getValue("selectedLanguage")||2,selected:1,cookie:n},this.accounts.forEach((a,i)=>{i!==l&&(a.selected=0)}),await this.saveProfilesToStorage(),await switchToIndex(l),this.loadCurrentProfile(),alert('Login successful: '+o.nome)}}else this.accounts=this.accounts.filter(a=>a.id!==e),await this.saveProfilesToStorage(),this.loadCurrentProfile(),alert('Login failed.')}catch(a){this.accounts=this.accounts.filter(b=>b.id!==e),await this.saveProfilesToStorage(),this.loadCurrentProfile(),alert('Auth error: '+a.message)}this.elements.loginCanvas.style.display='none'}})} async setupEventListeners(){this.elements.prevBtn.onclick=async()=>{if(this.currentIndex>0){this.currentIndex--;document.getElementById('usernameInput').disabled=document.querySelector('.profile-section select[name="language"]').disabled=1;await switchToIndex(this.currentIndex);this.loadCurrentProfile()}};this.elements.prevBtn.onclick=async()=>{if(this.currentIndex>0){this.currentIndex--;document.getElementById('usernameInput').disabled=document.querySelector('.profile-section select[name="language"]').disabled=1;this.loadCurrentProfile();this.switchTimer&&clearTimeout(this.switchTimer);this.switchTimer=setTimeout(()=>{switchToIndex(this.currentIndex);this.switchTimer=null;document.querySelector('.delete-btn')?.classList.remove('disabled')},14e2)}};this.elements.nextBtn.onclick=async()=>{if(this.currentIndex{switchToIndex(this.currentIndex);this.switchTimer=null;document.querySelector('.delete-btn')?.classList.remove('disabled')},14e2)}}} async deleteProfile(){if(this.accounts.length<=1){alert('You cannot delete the only account.');return}const i=this.accounts.findIndex(a=>1==a.selected),n=i!==this.currentIndex;n&&await switchToIndex(this.currentIndex);try{await pageFetch('https://gartic.io/logout',{method:'POST',credentials:'include'})}catch(e){}n&&-1!==i&&await switchToIndex(i);this.accounts.splice(this.currentIndex,1);this.currentIndex>=this.accounts.length&&(this.currentIndex=this.accounts.length-1);this.accounts.forEach((a,o)=>a.selected=o==this.currentIndex?1:0);await this.saveProfilesToStorage();this.accounts.length>0&&await switchToIndex(this.currentIndex);this.loadCurrentProfile()} } setTimeout(async()=>{ await ensureInitialProfile(); const manager = new GarticProfileManager(); await manager.init(); }, 200); } } }, [CHECK_ACC]:async()=>{try{setTimeout(async()=>{const r=await pageFetch(location.origin+'/',{credentials:'include',cache:'no-store'});const txt=await r.text();const user=extractUserFromTextUsingMarker(txt);localStorage.setItem('checkAuth',JSON.stringify((user&&(user.logado===true||(typeof user.avatar==='string'&&user.avatar.startsWith('http'))))?['Success',user]:['Failed']));window.name='';window.close()},5e2)}catch(e){localStorage.setItem('checkAuth',JSON.stringify());window.name='';window.close()}}, gartic:()=>{ new class{ setProgress=e=>{const t=Math.min(100,Math.max(0,e));this.progressBar&&(this.progressBar.style.width=t+"%"),this.percentageText&&(this.percentageText.innerText=Math.floor(t)+"%")}; setLoadingText=t=>{this.loadingText&&(this.loadingText.style.opacity=0,setTimeout((()=>{this.loadingText.innerText=t,this.loadingText.style.opacity=1}),150))}; runStages=async()=>{for(const t of this.stages){const s=this.currentProgress||0,e=t.limit,o=t.duration||2e3;if(s>=e)continue;this.setLoadingText(t.text);const r=50,n=(e-s)/(o/r);let i=s;const a=setInterval((()=>{i+=n,i>=.65*e?(i=.65*e,this.setProgress(i)):this.setProgress(i)}),r),c=Date.now();await t.task();const g=Date.now()-c;if(clearInterval(a),gsetTimeout(t,70)))}else this.setProgress(e);this.currentProgress=e}location.href=`/?${HOME}`}; constructor() { const w=unsafeWindow this._owner=w._owner||(w._owner={}) GM_getValue("GM_checkGrant")||GM_checkGrant() Object.defineProperty(this._owner,"self",{value:this,enumerable:0,configurable:1,writable:1}) localStorage.setItem('pastel','1');sessionStorage.setItem('pastel','1') this._owner=this; this._owner.proxies=GM_getValue('proxyIPs')||[] this.stages=[ {limit:5,text:"Pending...",duration:4e3,task:async()=>{await new Promise(r=>setTimeout(r,4e3))}}, {limit:35,text:"Checking Proxies...",duration:5e4,task: async()=>{ await new Promise(ASD=>{ this._owner.proxies?.length?ASD():(async()=>{ /** * C R O X Y ' S W E B S C R A P E U S A G E * Normally, Croxy would be used directly with GM_cookie and GM_xhr to activate socket connections inside gartic.io, * but since a large portion of IP addresses started getting blocked by Cloudflare, * other suitable web proxies that can be used in browser/extension environments had to be tried. * However, the fact that this method doesn't work here doesn't mean it won't work in other environments/games/websites. * For those who want to use it: * @grant GM_xmlhttpRequest * @connect croxyproxy.com * @connect x.x.x.x * @connect * * ! Croxy IP list is updated at unknown intervals, so just using "@connect *" is recommended. * ! This requires the user to click "Always Allow All Domains" (one-time Tampermonkey permission) * CODE USAGE: const[getCroxyIPs,getCSRF,getActivationCookie]=[ (Q,u='https://www.croxyproxy.com')=>new Promise(async(r,w)=>{try{let c=Q||await new Promise(r2=>GM_xmlhttpRequest({method:"GET",url:u,withCredentials:0,anonymous:1,onload:x=>r2(x.responseXML.forms[0][2].value)}));GM_xmlhttpRequest({method:"POST",url:u+'/servers',headers:{'Content-Type':'application/x-www-form-urlencoded'},data:`url=&csrf=${c}`,onload:x=>r(JSON.parse(x.responseXML.scripts[1].dataset.ss).flatMap(s=>((d=new TextDecoder).decode(Uint8Array.fromHex(atob(s))).match(/(\d+\.){3}\d+/)?{ip:RegExp.$&,cookies:{}}:[]))),onerror:w})}catch(e){w(e)}}), (u='https://www.croxyproxy.com')=>new Promise((r,w)=>GM_xmlhttpRequest({method:"GET",url:u,withCredentials:0,anonymous:1,onload:x=>x.responseXML?.forms[0]?.[2]?.value?r(x.responseXML.forms[0][2].value):w("CSRF not found"),onerror:w})), (Q,w,y)=>new Promise(r=>GM_xmlhttpRequest({method:"GET",url:`https://${Q}/__cpi.php?s=${encodeURIComponent(w)}&r=${encodeURIComponent(btoa(`https://${Q}/server?__cpo=${btoa(y)}`))}&__cpo=1`,onloadend:x=>{let c=x.responseHeaders?.split(/\r?\n/).find(h=>/^set-cookie:/i.test(h)&&/__cpc=/i.test(h))?.match(/__cpc=([^;]+)/)?.[1];r(c||null)}})) ]; (async()=>{ const IPs = await getCroxyIPs(); // [{ip:"1.2.3.4", cookies:{}}, ...] const csrf = await getCSRF(); // "CSRF_KEY" const targetURL = "https://httpbin.org/ip"; const selectedIP = (IPs[Math.random()*IPs.length|0]).ip; const activationCookie = await getActivationCookie(selectedIP,csrf,targetURL); const proxyURL = `https://${selectedIP}/ip?__cpo=${btoa(targetURL)}`; // https://IP/TARGET_PATHNAME?__cpo=BASE64_TARGET_ORIGIN_OR_TARGET_URL GM_xmlhttpRequest({ method:"GET", url:proxyURL, headers:{Cookie:`__cpc=${activationCookie};`}, anonymous:1, withCredentials:0, onloadend:r=>{ console.log(r.responseText); // { "origin": "SELECTED_IP_ADRESS" } }, onerror:e=>console.error(e) }) })(); */ GM_xmlhttpRequest({method:"GET",url:"https://4everproxy.com/",headers:{"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Goanna/4.0 Firefox/55.0 Basilisk/20210125","Referer":"https://4everproxy.com"},withCredentials:0,anonymous:1,onloadend:r=>{GM_setValue('proxyIPs',r.responseXML.forms[0][5].innerHTML.match(/\d+\.\d+\.\d+\.\d+/g)||[1]);ASD()}}) })() }) }}, {limit:95,text:"Processing...",duration:1e3,task:async()=>{console.log(0)}}, {limit:0x64,text:"Completed!",duration:8e2,task:async()=>{console.log(11)}} ]; this.init(); } init=()=>{ const o=new MutationObserver(m=>{document.querySelectorAll('body:not(#pastel),script,head:not(#pastel)').forEach(e=>e.remove());clearTimeout(o._t);o._t=setTimeout(()=>o.disconnect(),100)});o.observe(document.documentElement,{childList:true,subtree:true}); const pastelhead = Object.assign(document.createElement('head'),{id:'pastel',innerHTML:`Pastel Loading`}); const pastelbody = Object.assign(document.createElement('body'),{id:'pastel',innerHTML:`
PASTEL
New Game • New Rules
0%
`}); document.documentElement.prepend(pastelbody); document.documentElement.prepend(pastelhead); if (localStorage.getItem('checkAuth')=='1'&&window.name=='checkAuth') location.href=`https://gartic.io/${CHECK_ACC}` this.progressBar = document.getElementById('progress-bar'); this.loadingText = document.getElementById('loading-text'); this.percentageText = document.getElementById('percentage-text'); this.setProgress(0); this.runStages().catch(console.error); } } } }); }catch(e){console.error(e)} })();