Greasy Fork is available in English.

Gartic IO Quick Draw

While drawing, it automatically adds an image related to the word you select behind the canvas using the Google search engine. (Translate)

  1. // ==UserScript==
  2. // @name Gartic IO Quick Draw
  3. // @namespace http://tampermonkey.net/
  4. // @version 2025-04-03
  5. // @description While drawing, it automatically adds an image related to the word you select behind the canvas using the Google search engine. (Translate)
  6. // @description:tr Çizim yaparken kanvasın arkasına seçtiğiniz kelimeyle alakalı Google arama altyapısı kullanarak otomatik olarak görsel ekler.
  7. // @author YGN
  8. // @match https://gartic.io/*
  9. // @match https://www.google.com/search?*
  10. // @icon https://www.google.com/s2/favicons?sz=64&domain=gartic.io
  11. // @grant GM_setValue
  12. // @grant GM_addValueChangeListener
  13. // @run-at document-end
  14. // ==/UserScript==
  15.  
  16. if(window.location.href.indexOf("gartic")>-1){
  17. GM_addValueChangeListener("imgdata",function(a,b,c,d){document.querySelector("#drawing").style=`background-blend-mode: lighten;background-color: rgba(255,255,255,0.7);background-size:80% 80%;background-image:url(`+c+`) !important;`})
  18.  
  19. document.querySelector("#background").innerHTML+=`<iframe src="#" style="position:absolute;margin-left:-3000px;" class="mif" width="800" height="400" allow="autoplay" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe>`
  20.  
  21. function imgreq(param){let paramnext=encodeURI(param.split(" ").join("+"));document.querySelector(".mif").setAttribute("src","https://www.google.com/search?q="+paramnext+"+png+vector+icon&udm=2&biw=1536&bih=714&uact=5&oq="+paramnext+"+png+vector+icon&sclient=img&igu=1&returnfirstimg")}
  22.  
  23. let originalSend = WebSocket.prototype.send,setTrue=false;
  24. window.wsObj={}
  25.  
  26. WebSocket.prototype.send=function(data){originalSend.apply(this, arguments);if(Object.keys(window.wsObj).length==0){window.wsObj=this;window.eventAdd()}};
  27.  
  28. window.eventAdd=()=>{if(!setTrue){setTrue=1;window.wsObj.addEventListener("message",(msg)=>{try{let data=JSON.parse(msg.data.slice(2));if(data[0]==34){imgreq(data[1])}if(data[0]==25||data[0]==18||data[0]==28){document.querySelector("#drawing").style=`background-size:100%;background-image:url(https://gartic.io/static/images/marcadagua.svg?v=1) !important;`}}catch(err){}})}}
  29. }
  30.  
  31. if(window.location.href.indexOf("returnfirstimg")>-1){GM_setValue("imgdata",document.querySelector("div[data-id=mosaic]").querySelector("img").src)}