Copy Message Gartic

Copy the message in Gartic

  1. // ==UserScript==
  2. // @name Copy Message Gartic
  3. // @description Copy the message in Gartic
  4. // @version 1.0
  5. // @author STRAGON
  6. // @license N/A
  7. // @match *://gartic.io/*
  8. // @match *://*/*?__cpo=aHR0cHM6Ly9nYXJ0aWMuaW8
  9. // @icon https://static.cdnlogo.com/logos/s/96/st.svg
  10. // @grant GM_setValue
  11. // @grant GM_getValue
  12. // @grant GM_addValueChangeListener
  13. // @grant GM_addStyle
  14. // @grant GM_openInTab
  15. // @namespace https://greasyfork.org/en/users/1353946-stragon-x
  16. // ==/UserScript==
  17.  
  18. (function() {
  19. let originalSend = WebSocket.prototype.send, setTrue = false;
  20. window.wsObj = {};
  21.  
  22. WebSocket.prototype.send = function(data) {
  23. console.log("Gönderilen Veri: " + data);
  24. originalSend.apply(this, arguments);
  25. if (Object.keys(window.wsObj).length == 0) {
  26. window.wsObj = this;
  27. window.eventAdd();
  28. }
  29. };
  30.  
  31. let massHistory = [];
  32.  
  33. window.eventAdd = () => {
  34. if (!setTrue) {
  35. setTrue = 1;
  36. window.wsObj.addEventListener("message", (msg) => {
  37. let data = JSON.parse(msg.data.slice(2));
  38. console.log(data);
  39. if (data[0] == 11) {
  40. window.wsObj.mass = data[2];
  41. massHistory.push(window.wsObj.mass);
  42. if (massHistory.length > 3) {
  43. massHistory.shift();
  44. }
  45. }
  46. });
  47. }
  48. };
  49.  
  50.  
  51. function setCSS() {
  52. var css = `
  53. .cards {
  54. position: absolute;
  55. top: 50%;
  56. left: 50%;
  57. transform: translate(-50%, -50%);
  58. }
  59. /* From Uiverse.io by alexruix */
  60. .card {
  61. --background: linear-gradient(to left, #ff0000 0%, #0008ff 100%);
  62. width: 190px;
  63. height: 254px;
  64. padding: 5px;
  65. border-radius: 1rem;
  66. overflow: visible;
  67. background: #f7ba2b;
  68. background: var(--background);
  69. position: relative;
  70. z-index: 1;
  71. }
  72.  
  73. .card::after {
  74. position: absolute;
  75. content: "";
  76. top: 30px;
  77. left: 0;
  78. right: 0;
  79. z-index: -1;
  80. height: 100%;
  81. width: 100%;
  82. transform: scale(0.8);
  83. filter: blur(25px);
  84. background: #f7ba2b;
  85. background: var(--background);
  86. transition: opacity .5s;
  87. }
  88.  
  89. .card-info {
  90. --color: #000000;
  91. background: var(--color);
  92. color: var(--color);
  93. display: flex;
  94. justify-content: center;
  95. align-items: center;
  96. width: 100%;
  97. height: 100%;
  98. overflow: visible;
  99. border-radius: .7rem;
  100. }
  101.  
  102. .card .title {
  103. font-weight: bold;
  104. letter-spacing: .1em;
  105. }
  106.  
  107. /*Hover*/
  108. .card:hover::after {
  109. opacity: 0;
  110. }
  111.  
  112. .card:hover .card-info {
  113. color: #f7ba2b;
  114. transition: color 1s;
  115. }
  116.  
  117.  
  118. .cards {
  119. display: flex;
  120. flex-direction: column;
  121. gap: 10px;
  122. .input-field {
  123. background-color: transparent;
  124. height: 60px;
  125. width: 155px;
  126. text-align: center;
  127. border: 2px solid;
  128. border-image: linear-gradient(to right, #ff0000, #0000ff) 1;
  129. color: #ffffff; /* added this line to set the text color to white */
  130. border-radius: 15px; /* added this line to set the border radius to 15px */
  131. }
  132. `;
  133. GM_addStyle(css);
  134. }
  135.  
  136. setCSS();
  137.  
  138. let panel = document.createElement("div");
  139. panel.style.position = "fixed";
  140. panel.style.top = "50%";
  141. panel.style.right = "25px";
  142. panel.style.transform = "translateY(-50%)";
  143. panel.style.zIndex = 999999;
  144. document.body.appendChild(panel);
  145.  
  146. function createHTML() {
  147. let html = `
  148.  
  149. <div class="card">
  150. <div class="card-info">
  151. <p class="title"></p>
  152. <div class="cards">
  153. <input type="text" value="${massHistory[2]}" id="input-0" class="input-field">
  154. <input type="text" value="${massHistory[2]}" id="input-1" class="input-field">
  155. <input type="text" value="${massHistory[2]}" id="input-2" class="input-field">
  156. </div>
  157. </div>
  158. </div>
  159.  
  160. `;
  161. panel.innerHTML = html;
  162. }
  163.  
  164. createHTML();
  165.  
  166. function copyValue(value) {
  167. navigator.clipboard.writeText(value);
  168. }
  169.  
  170. setInterval(() => {
  171. for (let i = 0; i < 3; i++) {
  172. document.getElementById(`input-${i}`).value = massHistory[i];
  173. }
  174. }, 10);
  175. })();