// ==UserScript==
// @name Gartic IO Node Mode Menu
// @namespace http://tampermonkey.net/
// @version 2025-03-05
// @description Tries to cheat by changing the codes of the game
// @author anonimbiri
// @license MIT
// @match https://gartic.io/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=gartic.io
// @run-at document-start
// @grant none
// ==/UserScript==
Node.prototype.appendChild = new Proxy(Node.prototype.appendChild, {
apply: function(target, thisArg, argumentsList) {
const node = argumentsList[0];
console.log('Modified script injected:', node.src);
// Eğer eklenen bir script elementi ise kontrol et
if (node.nodeName.toLowerCase() === 'script' && node.src && node.src.includes('room')) {
console.log('Hedef script algılandı:', node.src);
fetch(node.src)
.then(response => response.text())
.then(scriptContent => {
// Script içeriğini değiştir
let modifiedContent = scriptContent
// 1. Sohbet alanını login olmayanlar için açma
.replace(
'r.created||c?Rt("input",{type:"text",name:"chat",className:"mousetrap",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",value:i,placeholder:this._lang.chatHere,maxLength:100,enterKeyHint:"send",onChange:this.handleText,ref:this._ref}):Rt("input",{type:"text",name:"chat",className:"mousetrap",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",value:this._lang.loginChat,maxLength:100,ref:this._ref,disabled:!0})',
'Rt("input",{type:"text",name:"chat",className:"mousetrap",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",value:i,placeholder:this._lang.chatHere,maxLength:100,enterKeyHint:"send",onChange:this.handleText,ref:this._ref})'
)
// 2. Anti-AFK zamanlayıcıda popup yerine socket sinyali gönderme
.replace(
'this._timerAtivo=setInterval((function(){Date.now()-e._ativo>15e4&&(O(Object(f.a)(n.prototype),"emit",e).call(e,"avisoInativo"),e._ativo=Date.now())}),1e3)',
'this._timerAtivo=setInterval((function(){Date.now()-e._ativo>15e4&&e.active()}),1e3)'
)
// 3. Tüm eklemeleri (window.game ve otomatik geri votekick) tek bir replace ile birleştirme
.replace(
'e.unlock()}',
'e.unlock();window.game={state:e.state,users:e.users,turn:e.turn,word:e.word,room:e.room,me:e.me,limit:e.limit,goal:e.goal,subject:e.subject,language:e.language,time:e.time,timeWasted:e.timeWasted,interval:e.interval,lobby:e.lobby,official:e.official,photo:e.photo,viewer:e.viewer,roomId:e.roomId};setInterval(()=>{window.game={state:e.state,users:e.users,turn:e.turn,word:e.word,room:e.room,me:e.me,limit:e.limit,goal:e.goal,subject:e.subject,language:e.language,time:e.time,timeWasted:e.timeWasted,interval:e.interval,lobby:e.lobby,official:e.official,photo:e.photo,viewer:e.viewer,roomId:e.roomId}},1000);e.on("votekick",(t,i,o)=>{if(i.id===e.me.id){e.votekick(t.id,true);}});}'
);
// Değiştirilen script için Blob oluştur
let blob = new Blob([modifiedContent], { type: 'application/javascript' });
let blobUrl = URL.createObjectURL(blob);
// Orijinal node'un src'sini blobUrl ile güncelle
node.src = blobUrl;
node.textContent = '';
// Değiştirilmiş node'u ekle
return target.apply(thisArg, [node]);
})
.catch(error => {
console.error('Failed to fetch/modify script:', error);
// Hata durumunda orijinal script'i ekle
return target.apply(thisArg, argumentsList);
});
// Orijinal script'in hemen eklenmesini engelle (fetch tamamlanana kadar)
return node;
}
// Script değilse veya 'room' içermiyorsa orijinal davranışı koru
return target.apply(thisArg, argumentsList);
}
});
//2. versiyon
/*
let originalSrcDescriptor = Object.getOwnPropertyDescriptor(HTMLScriptElement.prototype, 'src');
// Override the src property
Object.defineProperty(HTMLScriptElement.prototype, 'src', {
set: function(url) {
// Check if this is the target script with 'room' in the URL
if (typeof url === 'string' && url.includes('room')) {
console.log('Intercepted target script:', url);
// Fetch the original script content
fetch(url)
.then(response => response.text())
.then(scriptContent => {
// Script içeriğini değiştir
let modifiedContent = scriptContent
// 1. Sohbet alanını login olmayanlar için açma
.replace(
'r.created||c?Rt("input",{type:"text",name:"chat",className:"mousetrap",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",value:i,placeholder:this._lang.chatHere,maxLength:100,enterKeyHint:"send",onChange:this.handleText,ref:this._ref}):Rt("input",{type:"text",name:"chat",className:"mousetrap",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",value:this._lang.loginChat,maxLength:100,ref:this._ref,disabled:!0})',
'Rt("input",{type:"text",name:"chat",className:"mousetrap",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",value:i,placeholder:this._lang.chatHere,maxLength:100,enterKeyHint:"send",onChange:this.handleText,ref:this._ref})'
)
// 2. Anti-AFK zamanlayıcıda popup yerine socket sinyali gönderme
.replace(
'this._timerAtivo=setInterval((function(){Date.now()-e._ativo>15e4&&(O(Object(f.a)(n.prototype),"emit",e).call(e,"avisoInativo"),e._ativo=Date.now())}),1e3)',
'this._timerAtivo=setInterval((function(){Date.now()-e._ativo>15e4&&e.active()}),1e3)'
)
// 3. Tüm eklemeleri (window.game ve otomatik geri votekick) tek bir replace ile birleştirme
.replace(
'e.unlock()}',
'e.unlock();window.game={state:e.state,users:e.users,turn:e.turn,word:e.word,room:e.room,me:e.me,limit:e.limit,goal:e.goal,subject:e.subject,language:e.language,time:e.time,timeWasted:e.timeWasted,interval:e.interval,lobby:e.lobby,official:e.official,photo:e.photo,viewer:e.viewer,roomId:e.roomId};setInterval(()=>{window.game={state:e.state,users:e.users,turn:e.turn,word:e.word,room:e.room,me:e.me,limit:e.limit,goal:e.goal,subject:e.subject,language:e.language,time:e.time,timeWasted:e.timeWasted,interval:e.interval,lobby:e.lobby,official:e.official,photo:e.photo,viewer:e.viewer,roomId:e.roomId}},1000);e.on("votekick",(t,i,o)=>{if(i.id===e.me.id){e.votekick(t.id,true);}});}'
);
// Create a Blob from the modified content
const blob = new Blob([modifiedContent], { type: 'application/javascript' });
const blobUrl = URL.createObjectURL(blob);
// Use the original setter to load the modified script as a Blob URL
originalSrcDescriptor.set.call(this, blobUrl);
console.log('Modified script injected via Blob URL:', blobUrl);
})
.catch(error => {
console.error('Failed to fetch/modify script:', error);
// Fallback to original URL if modification fails
originalSrcDescriptor.set.call(this, url);
});
// Prevent the original src from being set directly
return;
}
// For non-target scripts, use the original setter
originalSrcDescriptor.set.call(this, url);
},
get: originalSrcDescriptor.get // Preserve the getter
});*/