Fake kick

Fake kick at

  1. // ==UserScript==
  2.  
  3. // @name Fake kick
  4.  
  5. // @name:tr Fake kick
  6.  
  7. // @name:az Fake kick
  8.  
  9. // @description Fake kick at
  10.  
  11. // @description:tr Fake kick at
  12.  
  13. // @description:az Fake kick at
  14.  
  15. // @version 1.0
  16.  
  17. // @author AsadovSc
  18.  
  19. // @license
  20.  
  21. // @match *://gartic.io/*
  22.  
  23. // @match *://*/*?__cpo=aHR0cHM6Ly9nYXJ0aWMuaW8
  24.  
  25. // @icon https://gartic.io/static/images/avatar/svg/0.svg
  26.  
  27. // @grant GM_setValue
  28.  
  29. // @grant GM_getValue
  30.  
  31. // @grant GM_addValueChangeListener
  32.  
  33. // @grant GM_addStyle
  34.  
  35. // @namespace https://greasyfork.org/users/1220697
  36.  
  37.  
  38.  
  39. // ==/UserScript==
  40.  
  41. function fa(hv){return document.querySelectorAll(hv)}
  42.  
  43. if(window.location.href.indexOf("gartic.io")!=-1){
  44.  
  45. let readyc=0,botc=0,otoeven=0,roomusers=[]
  46.  
  47. let WebSocket=window.WebSocket
  48.  
  49. window.ginterval=0
  50.  
  51. window.selectlevel=-1
  52.  
  53. let originalSend = WebSocket.prototype.send,setTrue=false;
  54.  
  55. window.wsObj={}
  56.  
  57. console.log("running")
  58.  
  59. WebSocket.prototype.send=function(data){
  60.  
  61. originalSend.apply(this, arguments)
  62.  
  63. if(Object.keys(window.wsObj).length==0){window.wsObj=this;window.eventAdd()}
  64.  
  65. };
  66.  
  67. function updatespeckicks(){
  68.  
  69. f(".userkickmenu").innerHTML=""
  70.  
  71. roomusers.forEach(user=>{
  72.  
  73. user.nick.split("‏").join("")!="RED"?f(".userkickmenu").innerHTML+=`<input type="submit" class="kickmenubtn" value="`+user.nick+`" onclick="window.postMessage('kickuser.`+user.id+`','*')">`:0
  74.  
  75. })
  76.  
  77. }
  78.  
  79. window.eventAdd=()=>{
  80.  
  81. if(!setTrue){
  82.  
  83. setTrue=1
  84.  
  85. window.wsObj.addEventListener("message",(msg)=>{
  86.  
  87. if(msg.data.indexOf('42["5"')!=-1){
  88.  
  89. let objlist=JSON.parse('["5"'+msg.data.split('42["5"')[1])
  90.  
  91. objlist[5].forEach(item=>{roomusers.push(item)})
  92.  
  93. updatespeckicks()
  94.  
  95. window.addEventListener("message",function(event){
  96.  
  97. if(typeof(event.data)==="string"){
  98.  
  99. if(event.data.indexOf("kickuser.")!=-1){
  100.  
  101. let userid=event.data.split("kickuser.")[1]
  102.  
  103. let objlist=JSON.parse('["5"'+msg.data.split('42["5"')[1])
  104.  
  105. var longID = objlist[1]
  106.  
  107. var id = objlist[2]
  108.  
  109. window.wsObj.send('42[45,'+id+',["'+userid+'",true]]')
  110.  
  111. window.wsObj.send('42[45,'+id+',["'+userid+'",false]]')
  112.  
  113. }
  114.  
  115. }
  116.  
  117. })
  118.  
  119. }
  120.  
  121. if(msg.data.indexOf('42["23"')!=-1){
  122.  
  123. let user=JSON.parse("{"+msg.data.split("{")[1].split("}")[0]+"}")
  124.  
  125. roomusers.push(user)
  126.  
  127. updatespeckicks()
  128.  
  129. document.querySelector("body > div:nth-child(19) > input:nth-child(12)").value = user.nick
  130.  
  131. }
  132.  
  133. if(msg.data.indexOf('42["24"')!=-1){
  134.  
  135. let user=msg.data.split(",")[1].split('"')[1]
  136.  
  137. for(let i=0;i<roomusers.length;i++){
  138.  
  139. typeof(roomusers[i].id)==='undefined'?0:roomusers[i].id==user?roomusers.splice(i,1):0
  140.  
  141. }
  142.  
  143. updatespeckicks()
  144.  
  145. }
  146.  
  147. })
  148.  
  149. }
  150.  
  151. }
  152.  
  153. let html=`
  154.  
  155. <div class="userlist">
  156.  
  157. <div class="userkickmenu"></div>
  158.  
  159. </div>
  160.  
  161. `
  162.  
  163. function setCSS(){
  164.  
  165. var css = `
  166.  
  167. @import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
  168.  
  169. .rb4 *{box-sizing:border-box;}
  170.  
  171. .userlist {
  172.  
  173. display:block;text-align:center;opacity:none;font-size:10pt;color:#FF0000;font-style:italic;
  174.  
  175. position:fixed;left:50%;top:3px;padding:5px 3px !important;margin:0px;background:#000000;font-family: 'Roboto', sans-serif;border:2px solid #303132;
  176.  
  177. transform:translate(-50%,0);border-radius:15px;z-index:999999999;display:block !important;height:auto !important;width:200px !important;
  178.  
  179. }
  180.  
  181. .userlist input[type=text]{height:20px;border-radius:3px;font-size:9pt;background:white;color:white;padding-left:3px;}
  182.  
  183. .userlist input[type=submit]{height:25px;border-radius:3px;background:#FFFFFF;}
  184.  
  185. .userlist input[type=checkbox]{margin-top:2px;}
  186.  
  187. #background{
  188.  
  189. z-index:999;width:0px;height:0px;position:fixed;left:0px;top:0px;
  190.  
  191. }
  192.  
  193. `;
  194.  
  195. GM_addStyle(css);
  196.  
  197. }
  198.  
  199. setInterval(()=>{
  200.  
  201. if(f("#users")){
  202.  
  203. fa(".kickmenubtn").forEach(ele=>{
  204.  
  205. f(".scrollElements").innerText.indexOf(ele.value)==-1?ele.remove():0
  206.  
  207. })
  208.  
  209. f("g")?f("g").remove():0;
  210.  
  211. }
  212.  
  213. if(f("#background")&&!f(".userlist")){
  214.  
  215. f("#background").innerHTML+=html
  216.  
  217. setCSS()
  218.  
  219. }
  220.  
  221. },100)
  222.  
  223. }
  224.  
  225. let m_s, a_i, m_a, m_z, m_b;
  226.  
  227. const f = x => document.querySelector(x),
  228.  
  229. sendMessage = (inputSelector, mesaj) => {
  230.  
  231. a_i = document.querySelector(inputSelector);
  232.  
  233. m_a = a_i.value;
  234.  
  235. // Add a random invisible character from the list before the message
  236.  
  237. const invisibleChars = ["\u200B", "\u200C", "\u200D", "\u2060", "\u180E", "\uFEFF"];
  238.  
  239. const randomChar = invisibleChars[Math.floor(Math.random() * invisibleChars.length)];
  240.  
  241. a_i.value = randomChar + mesaj + m_a;
  242.  
  243. m_z = new Event("input", { bubbles: !0 });
  244.  
  245. m_z.simulated = !0;
  246.  
  247. m_b = new Event("submit", { bubbles: !0 });
  248.  
  249. m_b.simulated = !0;
  250.  
  251. m_s = a_i._valueTracker;
  252.  
  253. m_s && m_s.setValue(m_a);
  254.  
  255. a_i.dispatchEvent(m_z);
  256.  
  257. a_i.form.dispatchEvent(m_b);
  258.  
  259. },
  260.  
  261. rand = x => Math.floor(Math.random() * 1000000),
  262.  
  263. GM_onMessage = (label, cb) => GM_addValueChangeListener(label, (_, __, data) => cb(...data)),
  264.  
  265. GM_sendMessage = (label, ...data) => GM_setValue(label, data);
  266.  
  267. GM_onMessage('ucur', (atılacak, _) => {
  268.  
  269. atılacak && document.querySelectorAll(".nick").forEach(nick => {
  270.  
  271. nick.innerText === atılacak && (nick.click(), f(".ic-votekick")?.click())
  272.  
  273. })
  274.  
  275. });
  276.  
  277. GM_onMessage('msg', (i, w, _) => {
  278.  
  279. sendMessage(i, w)
  280.  
  281. })
  282.  
  283. GM_onMessage('skip', (_, __) => {
  284.  
  285. let leButton = document.evaluate('//*[@id="notification"]/div/div[2]/div[1]/button', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  286.  
  287. if (leButton) {
  288.  
  289. leButton.click();}
  290.  
  291. let reportButton = document.evaluate('//*[@id="tools"]/div/div[1]/button[4]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  292.  
  293. if (reportButton) {
  294.  
  295. reportButton.click();
  296.  
  297. let confirmButton = document.evaluate('//*[@id="popUp"]/div/div/div[3]/button[2]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  298.  
  299. if (confirmButton) {
  300.  
  301. confirmButton.click();
  302.  
  303. }
  304.  
  305. }
  306.  
  307. });
  308.  
  309. GM_onMessage('report', (_, __) => {
  310.  
  311. let reportButton = document.evaluate('//*[@id="canvas"]/button', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  312.  
  313. if (reportButton) {
  314.  
  315. reportButton.click();
  316.  
  317. let confirmButton = document.evaluate('//*[@id="popUp"]/div[1]/div/div[3]/button[2]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  318.  
  319. if (confirmButton) {
  320.  
  321. confirmButton.click();
  322.  
  323. }
  324.  
  325. }
  326.  
  327. });
  328.  
  329. GM_onMessage('exit', (_, __) => {
  330.  
  331. let exitButton = document.evaluate('//*[@id="exit"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  332.  
  333. if (exitButton) {
  334.  
  335. setTimeout(function () {
  336.  
  337. exitButton.click();
  338.  
  339. let confirmButton = document.evaluate('//*[@id="popUp"]/div[1]/div/div[3]/button[2]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  340.  
  341. if (confirmButton) {
  342.  
  343. confirmButton.click();
  344.  
  345. }
  346.  
  347. }, 0); // Delay of 1 second
  348.  
  349. }
  350.  
  351. });
  352.  
  353. window.onload = function () {
  354.  
  355. const roomConsole = document.createElement("div");
  356.  
  357. roomConsole.style = "color:#FFD700;margin-top:5px;";
  358.  
  359. container.appendChild(roomConsole);
  360.  
  361. let currentGarticRoom;
  362.  
  363. // Function to check if the current page is a gartic.io room
  364.  
  365. function getGarticRoom() {
  366.  
  367. let garticRegex = /gartic\.io\/(.+)$/;
  368.  
  369. let match = window.location.href.match(garticRegex);
  370.  
  371. if (match && match[1]) {
  372.  
  373. return match[1];
  374.  
  375. }
  376.  
  377. return null;
  378.  
  379. }
  380.  
  381. // Function to update the current gartic.io room
  382.  
  383. function updateCurrentRoom() {
  384.  
  385. let room = getGarticRoom();
  386.  
  387. if (room !== currentGarticRoom) {
  388.  
  389. currentGarticRoom = room;
  390.  
  391. roomConsole.innerText = `Current Room: ${currentGarticRoom || 'No room found'}`;
  392.  
  393. }
  394.  
  395. }
  396.  
  397. // Update the room initially
  398.  
  399. updateCurrentRoom();
  400.  
  401. // Check for room changes every 5 seconds
  402.  
  403. setInterval(updateCurrentRoom, 1000);
  404.  
  405. };
  406.  
  407. function createInput(width, height) {
  408.  
  409. const input = document.createElement("input");
  410.  
  411. input.style = `width:${width};height:${height};border-radius:5px;padding:5px;border:1px solid #FFD700;background-color:#333333;color:#FFD700;`;
  412.  
  413. return input;
  414.  
  415. }
  416.  
  417. function createButton(width, height, text, clickHandler) {
  418.  
  419. const button = document.createElement("button");
  420.  
  421. button.style = `width:${width};height:${height};background-color:#FFD700;color:black;border-radius:5px;border:1px solid black;margin-top:5px;`;
  422.  
  423. button.textContent = text;
  424.  
  425. button.addEventListener("mousedown", clickHandler);
  426.  
  427. return button;
  428.  
  429. }