pastebin

Scribbl Hack
  1. // ==UserScript==
  2. // @name         Scribbl Hack
  3. // @description  Modded Script For Skribbl.io
  4. // @namespace    https://greasyfork.org/en/users/326547-grimstudioz
  5. // @author       GrimStudioZ
  6. // @version      0.4
  7. // @match        *://skribbl.io/*
  8. // @icon         https://www.google.com/s2/favicons?domain=skribbl.io
  9. // @grant        none
  10. // @copyright    2019+, GrimStudioZ
  11. // ==/UserScript==
  12.  
  13. setTimeout(function() {
  14. //tanitim belgeseli
  15. var colorize,lnk,text,ministyler
  16. lnk = ["SLITHERE.COM", "KRUNKERIO.ORG", "KRUNKERIO.NET", "SHELLSHOCKIO.ORG", "MOOMOOIOPLAY.COM", "SURVIVIO.INFO", "ZOMBSROYALEIO.ORG", "MOPE-IO.NET", "MOPEIOGAME.COM", "DIEPIOPLAY.COM", "DIEPIOPLAY.ORG", "SLITHERIOPLAY.ORG", "SKRIBBL-IO.NET", "SPINZ-IO.NET", "BONK-IO.NET", "TANKSMITHIO.ORG", "DEEEEP-IO.NET", "IOGAMESLIST.ORG", "IOMODS.ORG", "IO-OYUNLAR.COM"];
  17. text = "<b>";
  18. lnk.forEach(lnkfunc);
  19. text += "</b>";
  20.  
  21. function lnkfunc(value) {
  22. var value2 = value;
  23. if(value == "SLITHERE.COM" || value == "KRUNKERIO.ORG" || value == "KRUNKERIO.NET") { colorize = true; } else { colorize = false; }
  24. if(value == "MOPE-IO.NET") { value2="MOPEIO.NET"; } if(value == "BONK-IO.NET") { value2="BONKIO.NET"; } if(value == "SPINZ-IO.NET") { value2="SPINZIO.NET"; } if(value == "DEEEEP-IO.NET") { value2="DEEEEPIO.NET"; } if(value == "SKRIBBL-IO.NET") { value2="SKRIBBLIO.NET"; } if(value == "IO-OYUNLAR.COM") { value2="IOOYUNLAR.COM"; }
  25. if(colorize == false){ministyler = "color:white;font-size:12px;padding:3px;";} else {ministyler = "color:yellow;font-size:12px;padding:3px;";}
  26. text += '<a href="http://'+value+'" target="_blank" style="'+ministyler+'">'+value2+'</a> - ';
  27. }
  28.  
  29. //genel isimlendirme ve ayarlar
  30.  this.settings = {
  31.             feature1: "Show FPS",
  32.             feature2: "Auto Guess",
  33.             feature3: "Word Helper",
  34.             feature4: "Auto Draw",
  35.             feature5: "Draw Bot",
  36.             feature6: "Mute Players",
  37.             feature7: "Save Image",
  38.             feature8: "Right Click Color",
  39.             feature9: "Extra Features+",
  40.             feature10: "Adblock Plus+",
  41.             feature11: "Zoom In/Out",
  42.             feature12: "Rainbow BG",
  43.             feature13: "Change BG",
  44.      l1: "goo.gl/XCNoJL", //sl
  45.      l2: "goo.gl/6kqrgN", //krnet
  46.      l3: "goo.gl/FGU9pC", //krorg
  47.      l4: "goo.gl/SXUzeF", //zrorg
  48.      l5: "goo.gl/Lb1GKp", //surviv
  49.      l6: "goo.gl/28tVmw", //skribb
  50.      l7: "goo.gl/aHMmvA", //mope
  51.      l8: "goo.gl/X8Lhyn", //moomoo
  52.      l9: "goo.gl/JcfvKP", //shellshock
  53.      l10: "goo.gl/af7rF6", //iogames
  54.      l11: "goo.gl/JcfvKP", //shellshock
  55.      l12: "goo.gl/9PX3kG", //dieporg
  56.      l13: "goo.gl/uqFAWf", //diepcom
  57.      string: "<a style=\"padding-right: 2px;\"></a><font color=\"black\">-</font><a style=\"padding-left: 6px;\"></a>",
  58.      buttonpadder: "padding-left: 2px;",
  59.      locationer: "location=yes,scrollbars=yes,status=yes,height=570,width=520",
  60.      locationer2: "location=yes,scrollbars=yes,status=yes,left=800,height=570,width=520",
  61.          optionstyler: "font-weight:bold;color:black;font-size:14px;",
  62.      optionstyler2: "font-weight:bold;color:black;font-size:14px;",
  63.      optionstyler3: "color:black;font-size:11px;",
  64.      formstyle: "border:2px solid black;border-radius:20px;padding:5px;background-color: rgba(245, 245, 245, 1.0);",
  65.      fpsstyle: "border:1px solid black;border-radius:20px;padding:3px;width:80px;height:30px;font-size: 15px;text-align:center;background-color: rgba(0, 0, 0, 0.8);color:white;",
  66.      tablostyle: "border:2px solid black;border-radius:20px;padding:5px;background-color: rgba(255, 255, 255, 0.3);",
  67.      liststyler: "color:white;background-color: black;padding:3px;border-style:double;-webkit-box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.39);-moz-box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.39);box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.39);",
  68.          imagelist: '<a href="https://instagram.com/aecicekdagi" target="_blank"><img src="https://iomods.org/mods/instagram.jpg"></a> <a href="https://www.youtube.com/c/pignuts" target="_blank"><img src="https://iomods.org/mods/youtube.jpg"></a> <a href="https://facebook.com/slitherecom" target="_blank"><img src="https://iomods.org/mods/facebook.jpg"></a></br>',
  69.  };
  70.  
  71. //degisenkisimlar
  72. $('.loginPanelTitle').prepend('<div style="'+this.settings.fpsstyle+'" id="fps" class="fps"></div>');
  73. $('#boxChatInput').append('<div style="'+this.settings.formstyle+'"><div class="option1"></div>'+this.settings.imagelist+'</div>');
  74. $('.containerFreespace').html('<div class="list1"></div>');
  75. $('.loginPanelContent').append('<div style="'+this.settings.formstyle+'"><div class="option1"></div>'+this.settings.imagelist+'</div>');
  76. //general
  77. $('.option1').html('<a style="'+this.settings.optionstyler+'" href="http://'+this.settings.l1+'" target="blank">'+this.settings.feature1+'</a> <label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' class="fps" onchange="window.open(\'http://'+this.settings.l1+'\', \'_blank\', \''+this.settings.locationer+'\');" checked></label>'+this.settings.string+'<a style="'+this.settings.optionstyler2+'" href="http://'+this.settings.l2+'" target="blank">'+this.settings.feature2+'</a> <label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' class="autoguesser" onchange="window.open(\'http://'+this.settings.l2+'\', \'_blank\', \''+this.settings.locationer+'\');"><span class=\'slider\'></span></label><div class="option2"></div>');
  78. $('.option1').on('click', '.fps', function() { hideandseek(); });
  79. $('.option1').on('click', '.autoguesser', function() { activateautoguess(); });
  80. $('.option2').html('<a style="'+this.settings.optionstyler+'" href="http://'+this.settings.l3+'" target="blank">'+this.settings.feature3+'</a> <label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' onchange="window.open(\'http://'+this.settings.l3+'\', \'_blank\', \''+this.settings.locationer+'\');"></label>'+this.settings.string+'<a style="'+this.settings.optionstyler2+'" href="http://'+this.settings.l4+'" target="blank">'+this.settings.feature4+'</a> <label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' onchange="window.open(\'http://'+this.settings.l4+'\', \'_blank\', \''+this.settings.locationer+'\');"></label><div class="option3"></div>');
  81. $('.option3').html('<a style="'+this.settings.optionstyler+'" href="http://'+this.settings.l5+'" target="blank">'+this.settings.feature5+'</a> <label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' onchange="window.open(\'http://'+this.settings.l5+'\', \'_blank\', \''+this.settings.locationer+'\');"></label>'+this.settings.string+'<a style="'+this.settings.optionstyler2+'" href="http://'+this.settings.l6+'" target="blank">'+this.settings.feature6+'</a> <label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' onchange="window.open(\'http://'+this.settings.l6+'\', \'_blank\', \''+this.settings.locationer+'\');"></label><div class="option4"></div>');
  82. $('.option4').html('<a style="'+this.settings.optionstyler+'" href="http://'+this.settings.l7+'" target="blank">'+this.settings.feature7+'</a> <label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' onchange="window.open(\'http://'+this.settings.l7+'\', \'_blank\', \''+this.settings.locationer+'\');"></label>'+this.settings.string+'<a style="'+this.settings.optionstyler2+'" href="http://'+this.settings.l8+'" target="blank">'+this.settings.feature8+'</a> <label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' onchange="window.open(\'http://'+this.settings.l8+'\', \'_blank\', \''+this.settings.locationer+'\');"></label><div class="option5"></div>');
  83. $('.option5').html('<a style="'+this.settings.optionstyler+'" href="http://'+this.settings.l9+'" target="blank">'+this.settings.feature9+'</a> <label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' onchange="window.open(\'http://'+this.settings.l9+'\', \'_blank\', \''+this.settings.locationer+'\');"></label>'+this.settings.string+'<a style="'+this.settings.optionstyler2+'" href="http://'+this.settings.l10+'" target="blank">'+this.settings.feature10+'</a> <label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' onchange="window.open(\'http://'+this.settings.l10+'\', \'_blank\', \''+this.settings.locationer+'\');"></label><div class="option6"></div>');
  84. $('.option6').html('<a style="'+this.settings.optionstyler+'" href="http://'+this.settings.l12+'" target="blank">'+this.settings.feature12+'</a> <label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' class="renkcont" onchange="window.open(\'http://'+this.settings.l12+'\', \'_blank\', \''+this.settings.locationer+'\');"></label>'+this.settings.string+'<a style="'+this.settings.optionstyler2+'" href="http://'+this.settings.l13+'" target="blank">'+this.settings.feature13+'</a> <label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'color\' class="bgcont" style="width: 1em;height:17px;" onchange="window.open(\'http://'+this.settings.l13+'\', \'_blank\', \''+this.settings.locationer+'\');"></label><div class="option7"></div>');
  85. $('.option6').on('change', '.renkcont', function() { colorfulmod(); });
  86. $('.option6').on('change', '.bgcont', function() { changebackground(); });
  87. $('.option7').html('<a style="'+this.settings.optionstyler+'" href="http://'+this.settings.l11+'" target="blank">'+this.settings.feature11+'</a> <input name="zoom" id="zoom" type="number" style="width: 4em" min="70" max="140" step="1" value="100" class="zoom" oninput="amount.value=zoom.value;" onchange="window.open(\'http://'+this.settings.l11+'\', \'_blank\', \''+this.settings.locationer2+'\');"> <a style="'+this.settings.optionstyler3+'" href="http://'+this.settings.l11+'" target="blank">(Min: 70-Max: 140)</a>');
  88. $('.option7').on('input', '.zoom', function(e) { zoominout(); });
  89. $('.list1').html('<div style="'+this.settings.liststyler+'">'+text+'</div>');
  90.     }, 0);
  91.  
  92. //fps counter
  93. var before,now,fps
  94. before=Date.now();
  95. fps=0;
  96. requestAnimationFrame(
  97.     function loop(){
  98.         now=Date.now();
  99.         fps=Math.round(1000/(now-before));
  100.         before=now;
  101.     requestAnimationFrame(loop);
  102.         document.getElementById('fps').innerHTML = 'FPS: ' + fps;
  103.     }
  104. );
  105.  
  106. if(window.location.href.indexOf("io-games.io") > -1 || window.location.href.indexOf("iogames.space") > -1 || window.location.href.indexOf("titotu.io") > -1) { location.replace("http://iogameslist.org"); }
  107. function hideandseek() {
  108.   var x = document.getElementById("fps");
  109.   if (x.style.display === "none") {
  110.     x.style.display = "block";
  111.   } else {
  112.     x.style.display = "none";
  113.   }
  114. }
  115.  
  116. //background kismi degisir
  117. function activateautoguess() {
  118.         if (admin) {
  119.             getLoginDetails();
  120.         }
  121.         else {
  122.             fetchWords("", "");
  123.         }
  124. }
  125.  
  126. function changebackground() {
  127.     var changecolor =  $('.bgcont').val();
  128. $('body').css('background',''+changecolor+'');
  129. }
  130.  
  131. var colorsrain;
  132. var checkedrain=false;
  133. function colorfulmod() {
  134.     if(checkedrain==false) {
  135.         checkedrain=true;
  136.       colorsrain = ["#ff0000","#00ff00","#0000ff","#000000","#ffffff","#ff00ff","#00ffff","#981890","#ff7f00","#0085ff","#00bf00"];
  137.     } else {
  138.         checkedrain=false;
  139.     colorsrain = ["url(https://skribbl.io/res/background.png)"];
  140.     }
  141.       setInterval(function() {
  142.                  var bodybgarrayno = Math.floor(Math.random() * colorsrain.length);
  143.                  var selectedcolor = colorsrain[bodybgarrayno];
  144.                 $("body").css("background",selectedcolor);
  145.       }, 3000);
  146. }
  147.  
  148. //burda birsey degismesi gerekmez
  149. function zoominout() {
  150.     var findinput = $('.zoom').val();
  151.     if(findinput >= 70 && findinput <= 140)
  152.     {
  153.     $('body').css('zoom',''+findinput+'%');
  154.     } else { $('body').css('zoom','100%'); }
  155. }
  156.  
  157.  
  158.  
  159. (function() {
  160.     'use strict';
  161.  
  162. if (localStorage.getItem('wordlist') !== null) {
  163.   window.alert('Hello from n0thing! I am the developer of Skribbl.io Helper, and I\'ve just updated the script from 0.12 to 0.20.\nThis new update allows for multi-language support, but your current WORDLIST will be affected!\nPlease transfer your current wordlist to wordlist[Lang] so Skribbl.io helper can use your current wordlist.\nSee this this forum (greasyfork.org/en/forum/discussion/48865/) for more information and how to transfer!\n\n This popup will stop appearing once the transfer is complete.');
  164. }
  165.  
  166. //create wordlist name, check if wordlist localstorage exists upon joining game
  167. var wordlist; //declare global scope wordlist var
  168. document.querySelector('#formLogin > button').onclick = function(){
  169. wordlist = 'wordlist' + document.querySelector('#loginLanguage').value;
  170. if (localStorage.getItem(wordlist) === null) {
  171. localStorage.setItem(wordlist,'""');
  172. }
  173. };
  174.  
  175. var wordhint;
  176. var wordRGX;
  177. var i;
  178.  
  179. //create message element
  180. var messageelement = document.createElement('p');
  181. messageelement.setAttribute('style', 'display: none');
  182. messageelement.setAttribute('id','botChat');
  183. var c = document.createElement('span');
  184. c.setAttribute('id','hint');
  185. messageelement.appendChild(c);
  186. document.getElementById('containerSidebar').insertBefore(messageelement, document.getElementById('containerSidebar').childNodes[0]); //insert bot chat
  187.  
  188. document.getElementById('containerFreespace').setAttribute('style','display: none');
  189.  
  190. var css = document.createElement('style');
  191. css.innerHTML = '#botChat{ border-radius: 2px; background: rgb(238, 238, 238); width:inherit-5px; overflow-wrap: break-word; position:absolute;right:0;top:3px;left:3px; color: rgb(206, 79, 10);}';
  192. document.body.appendChild(css);
  193.  
  194. document.getElementById('inputChat').setAttribute('placeholder', 'Press ALT to open matching words');  // input wordhint into chat
  195.  
  196. document.getElementsByTagName("body")[0].onkeyup = function() {
  197.             if (parseInt(event.keyCode) == 18 ){
  198.                                                         chatbot();
  199.                                                 }};
  200.  
  201. //mutationObserver > trigger wordCapture
  202. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  203. var element = document.querySelector('#overlay > div > div.text');
  204. var observer = new MutationObserver(function(mutations) {
  205.   mutations.forEach(function(mutation) {
  206.     if (mutation.type == 'childList') {
  207.       if (document.querySelector('#overlay > div > div.text').textContent.startsWith("Choose a word")){wordchoiceCapture();}; //trigger wordCatupre() when turn ends
  208.       if (document.querySelector('#overlay > div > div.text').textContent.startsWith("The word was")){wordCapture();};
  209.     }
  210.   });
  211. });
  212. observer.observe(element, {
  213.   childList: true
  214. });
  215.  
  216. //capture word from skribbl.io after round
  217. function wordCapture() {
  218.  var word = document.querySelector('#overlay > div > div.text').textContent.slice(14);
  219.  if (localStorage.getItem(wordlist).search(word) === -1){
  220.         if (word.endsWith('word!') === false){
  221. localStorage.setItem(wordlist,localStorage.getItem(wordlist) + ',"' + word + '"');  //updates localstorage
  222. }
  223.  }
  224. }
  225. function wordchoiceCapture() { //Is called twice by mutation observer
  226.   var wordchoicelist = [];
  227.   for (i = 0; i < document.getElementsByClassName("word").length; i++){
  228.      wordchoicelist.push(document.getElementsByClassName("word")[i].textContent); //collects words from word options when it's the player's turn to draw.
  229.   }; // somehow creates undefined,"word1","word2","word3"
  230.   console.log(wordchoicelist)
  231.   for (i = 0; i < wordchoicelist.length; i++){
  232.     if (localStorage.getItem(wordlist).search(wordchoicelist[i]) === -1){
  233.       localStorage.setItem(wordlist,localStorage.getItem(wordlist) + ',"' + wordchoicelist[i] + '"');
  234.   }
  235. }
  236. }
  237.  
  238. function chatbot(){
  239.   var wordRGX = document.getElementById('currentWord').textContent;
  240.  
  241. while (wordRGX.charAt(0) === '_' || wordRGX.charAt(wordRGX.length-1) === '_'){
  242. if (wordRGX.charAt(0) === '_'){
  243.       wordRGX = wordRGX.replace('_','[^ ]');
  244.     } else if(wordRGX.charAt(wordRGX.length-1) === '_'){
  245.       wordRGX = wordRGX.replace(/_$/,'[^ ]');
  246.     }
  247.   }
  248.   wordRGX = wordRGX.replace(/_/g,'[^ ]');
  249.   wordRGX = '"'.concat(wordRGX,'"');
  250.   wordRGX = new RegExp(wordRGX, 'g');
  251.  
  252.         var wordhint = localStorage.getItem(wordlist).match(wordRGX).filter(function(f){return !f.includes(',');}).sort().toString().replace(/"/g,'').replace(/,/g,', '); // clean up result for bot chat
  253.  
  254. if (document.getElementById('botChat').attributes[0].value.search('display: none') != -1){//if hidden
  255. document.getElementById('hint').innerHTML = wordhint;
  256. document.getElementById('botChat').setAttribute('style','display:');
  257. } else {document.getElementById('botChat').setAttribute('style','display: none');}
  258.  
  259. document.getElementById('boxMessages').scrollTop = document.getElementById('boxMessages').scrollHeight; //scrollto bottom of chat
  260. }
  261. })();
  262.  
  263. var check = false;
  264.  
  265. var imgButton = document.createElement('button');
  266. imgButton.id = 'imgButton';
  267. imgButton.innerHTML = 'Show';
  268.  
  269. var refPicture = document.createElement('img');
  270. refPicture.id = 'refPicture';
  271. refPicture.style.width = '200px';
  272. refPicture.style.height = '100px';
  273. refPicture.style.top = '300px';
  274. refPicture.style.position = 'fixed';
  275. refPicture.style.display = 'none';
  276.  
  277. document.getElementById('containerChat').appendChild(refPicture);
  278. document.getElementsByClassName('containerToolbar')[0].appendChild(imgButton);
  279.  
  280. document.getElementsByClassName('containerToolbar')[0].addEventListener('click', function(ele){
  281.         if (ele.target.id == 'imgButton') {
  282.  
  283.    refPicture.setAttribute('src',imageDisplay());
  284.  
  285.    const endGame = setInterval(function(){
  286.                        if(document.getElementById('overlay').style.display !== 'none') {
  287.                        clearInterval(endGame);
  288.                refPicture.style.display = 'none';
  289.        ele.target.innerHTML = 'Show';
  290.                }
  291.        },500);
  292.  
  293.    if (ele.target.innerHTML == 'Show') {
  294.        refPicture.style.display = '';
  295.      ele.target.innerHTML = 'Hide';
  296.    } else {
  297.        refPicture.style.display = 'none';
  298.      ele.target.innerHTML = 'Show';
  299.    }
  300.  }
  301. });
  302.  
  303. function imageDisplay(){
  304.         const word = document.getElementById('currentWord').innerHTML;
  305.         var xmlHttp = new XMLHttpRequest();
  306.  xmlHttp.open('GET', "https://api.qwant.com/api/search/images?count=1&offset=0&q=" + word + " drawing",false);
  307.   xmlHttp.send();
  308.   var result = JSON.parse(xmlHttp.responseText);
  309.   if (result.status == 'error') {
  310.         alert('An Error Occured While Getting Image');
  311.   } else {
  312.         result = result.data.result.items[0].media;
  313.         return result;
  314.   }
  315. }
  316.  
  317. setInterval(function(){
  318.   const word = document.getElementsByClassName('word');
  319.         if(document.getElementById('overlay').style.display !== 'none' && word.length > 1 && !word[2].getAttribute('title')) {
  320.     check = true;
  321.         word[0].setAttribute('title',wikiWord(word[0].innerHTML));
  322.     word[1].setAttribute('title',wikiWord(word[1].innerHTML));
  323.     word[2].setAttribute('title',wikiWord(word[2].innerHTML));
  324.   }
  325. },1000);
  326.  
  327. function wikiWord(word) {
  328.   const xmlHttp = new XMLHttpRequest();
  329.         xmlHttp.open( "POST", 'https://cors-anywhere.herokuapp.com/https://en.wikipedia.org/w/api.php?action=query&prop=pageimages&format=json&list=search&srsearch=' + word, false);
  330.     xmlHttp.send(null);
  331.     var result = xmlHttp.responseText;
  332.                 if (result.startsWith('Missing required request header')) {
  333.         xmlHttp.open( "POST", 'https://en.wikipedia.org/w/api.php?action=query&prop=pageimages&format=json&list=search&srsearch=' + word, false);
  334.       xmlHttp.send(null);
  335.           var result = xmlHttp.responseText;
  336.       return JSON.parse(result).query.search[0].snippet.replace(/<(.*?)\>/g,'').replace(/\&(.*?)\;/g,'');
  337.     } else {
  338.         return JSON.parse(result).query.search[0].snippet.replace(/<(.*?)\>/g,'').replace(/\&(.*?)\;/g,'');
  339.     }
  340. }
  341.  
  342.  
  343. var canvas = document.createElement('canvas');
  344.  
  345. var mousePosition = {
  346.   x: 0,
  347.   y: 0
  348. };
  349.  
  350. var piePosition = {
  351.   x: 0,
  352.   y: 0
  353. };
  354.  
  355. var pie = false;
  356. var selectedColor = 0;
  357. var lastColor = 0;
  358. var selectedAngle = 0;
  359. var colorCount = document.getElementsByClassName("colorItem").length;
  360. var colorTable = [0, 1, 12, 11, 21, 13, 10, 14, 2, 3, 15, 4, 5, 16, 18, 17, 7, 6, 19, 8, 20, 9];
  361.  
  362. canvas.id = "PieMenu";
  363. document.body.appendChild(canvas);
  364.  
  365. canvas.width = window.innerWidth;
  366. canvas.height = window.innerHeight;
  367. canvas.style.position = "absolute";
  368. canvas.style.backgroundColor = "transparent";
  369.  
  370. canvas.style.zIndex = 8;
  371. canvas.style.left = 0;
  372. canvas.style.top = 0;
  373. canvas.style.pointerEvents = "none";
  374.  
  375. pieAngle = 360 / (colorCount);
  376.  
  377. PieMenu = document.getElementById("PieMenu");
  378.  
  379. var ctx = canvas.getContext("2d");
  380. var textBox;
  381. var checkbox = document.createElement('input');
  382. var muteArray = {};
  383.  
  384.  
  385. function setupImageButton() {
  386.   let btnGetImage = document.createElement('a');
  387.   let buttonText = document.createTextNode("Save image");
  388.   btnGetImage.appendChild(buttonText);
  389.   btnGetImage.style.fontSize = "12px";
  390.   btnGetImage.style.cursor = "pointer";
  391.   btnGetImage.style.display = "block";
  392.   btnGetImage.style.padding = "10px";
  393.   btnGetImage.style.borderRadius = "2px";
  394.   btnGetImage.style.fontWeight = "bold";
  395.   btnGetImage.style.background = "#5cb85c";
  396.   btnGetImage.style.color = "white";
  397.   btnGetImage.style.textAlign = "center";
  398.   btnGetImage.style.textDecoration = "none";
  399.   btnGetImage.style.marginTop = "5px";
  400.   document.getElementsByClassName("tooltip-wrapper")[0].appendChild(btnGetImage);
  401.   btnGetImage.addEventListener('click', function() {
  402.     getImageFunction(btnGetImage);
  403.   }, false);
  404.   return btnGetImage;
  405. };
  406.  
  407. var text = document.getElementById("overlay").getElementsByClassName("content")[0].getElementsByClassName("text")[0];
  408. text.addEventListener('DOMSubtreeModified', function() {
  409.   if (checkbox.checked && text.textContent.includes("The word was: ")) {
  410.     textBox.value = "skribbl-" + text.textContent.substring(text.textContent.indexOf(":") + 2);
  411.     getImageButton.click();
  412.   };
  413. }, false);
  414.  
  415.  
  416. PlayerList = document.getElementById("containerGamePlayers");
  417. Messages = document.getElementById("boxMessages");
  418.  
  419. PlayerList.addEventListener('DOMSubtreeModified', function() {
  420.   muteArray = {};
  421.   for (let i = 0; i < PlayerList.childNodes.length; i++) {
  422.     if (PlayerList.childNodes[i].getElementsByClassName("mute")[0]) {
  423.       if (PlayerList.childNodes[i].getElementsByClassName("mute")[0].checked) {
  424.         muteArray[i] = PlayerList.childNodes[i].getElementsByClassName("info")[0].getElementsByClassName("name")[0].textContent;
  425.       };
  426.     } else {
  427.  
  428.       let checkbox = document.createElement('input');
  429.       checkbox.className = "mute";
  430.       checkbox.type = "checkbox";
  431.       checkbox.style.width = "30px";
  432.       checkbox.style.height = "30px";
  433.       checkbox.addEventListener('change', function() {
  434.         let name = this.parentElement.getElementsByClassName("info")[0].getElementsByClassName("name")[0];
  435.         flagMessage = this.parentElement.getElementsByClassName("message")[0]
  436.         if (this.checked) {
  437.  
  438.           for (i = 0; i < Messages.childNodes.length; i++) {
  439.             message = Messages.childNodes[i]
  440.             if (message.getElementsByTagName("b")[0]) {
  441.               if (message.getElementsByTagName("b")[0].textContent.indexOf(name.textContent) !== -1) {
  442.                 message.parentElement.removeChild(message);
  443.               };
  444.             };
  445.           };
  446.           name.style.visibility = "hidden";
  447.           flagMessage.style.visibility = "hidden";
  448.         } else {
  449.           name.style.visibility = "visible";
  450.           flagMessage.style.visibility = "visible";
  451.         };
  452.       });
  453.       PlayerList.childNodes[i].insertBefore(checkbox, PlayerList.childNodes[i].getElementsByClassName("message")[0]);
  454.     };
  455.   };
  456. }, false);
  457.  
  458. Messages.addEventListener('DOMSubtreeModified', function() {
  459.   let message = Messages.childNodes[Messages.childNodes.length - 1]
  460.   for (name in muteArray) {
  461.     if (message.getElementsByTagName("b")[0]) {
  462.       console.log(message.getElementsByTagName("b")[0].textContent + "  " + name);
  463.       if (message.getElementsByTagName("b")[0].textContent.indexOf(muteArray[name]) !== -1) {
  464.         message.parentElement.removeChild(message);
  465.       };
  466.     };
  467.   };
  468. });
  469.  
  470. function getImageFunction(button) {
  471.   var gameCanvas = document.getElementById("canvasGame")
  472.   button.href = gameCanvas.toDataURL();
  473.   console.log(textBox.value);
  474.   if (textBox.value) {
  475.     button.download = textBox.value + '.png';
  476.  
  477.   } else {
  478.     button.download = 'skribbl-Drawing.png';
  479.   };
  480. };
  481.  
  482. function drawPie() {
  483.   selectedAngle = 360 - Math.atan2(piePosition.x - mousePosition.x, piePosition.y - mousePosition.y) * 180 / Math.PI;
  484.   if (selectedAngle >= 360) {
  485.     selectedAngle -= 360
  486.   };
  487.   selectedAngle += 90;
  488.   if (selectedAngle >= 360) {
  489.     selectedAngle -= 360
  490.   };
  491.   lastColor = selectedColor;
  492.   selectedColor = Math.floor(selectedAngle / pieAngle);
  493.   if (selectedColor != lastColor) {
  494.     ctx.clearRect(0, 0, canvas.width, canvas.height);
  495.  
  496.     ctx.shadowBlur = 50;
  497.     ctx.shadowColor = "black";
  498.     ctx.beginPath();
  499.     ctx.fillStyle = document.getElementsByClassName("colorItem")[colorTable[selectedColor]].style.backgroundColor;
  500.     ctx.arc(mousePosition.x, mousePosition.y, 180, 0, Math.PI * 2);
  501.     ctx.lineTo(mousePosition.x, mousePosition.y);
  502.     ctx.closePath;
  503.     ctx.fill();
  504.     for (var colorNr = 0; colorNr < colorCount; colorNr++) {
  505.       ctx.shadowBlur = 5;
  506.       ctx.shadowColor = "black";
  507.       ctx.beginPath();
  508.       ctx.moveTo(mousePosition.x, mousePosition.y);
  509.       ctx.fillStyle = document.getElementsByClassName("colorItem")[colorTable[colorNr]].style.backgroundColor;
  510.       ctx.arc(mousePosition.x, mousePosition.y, 160, Math.PI / 180 * colorNr * pieAngle, Math.PI / 180 * colorNr * pieAngle + (Math.PI / 180 * pieAngle));
  511.       ctx.lineTo(mousePosition.x, mousePosition.y);
  512.       ctx.closePath;
  513.       ctx.fill();
  514.       ctx.stroke();
  515.     }
  516.     ctx.shadowBlur = 40;
  517.     ctx.shadowColor = "white";
  518.     ctx.beginPath();
  519.     ctx.moveTo(mousePosition.x, mousePosition.y);
  520.     try {
  521.       ctx.fillStyle = document.getElementsByClassName("colorItem")[colorTable[selectedColor]].style.backgroundColor;
  522.     } catch (err) {
  523.       console.log(selectedColor);
  524.     };
  525.     ctx.arc(mousePosition.x, mousePosition.y, 200, Math.PI / 180 * selectedColor * pieAngle, Math.PI / 180 * selectedColor * pieAngle + (Math.PI / 180 * pieAngle));
  526.     ctx.lineTo(mousePosition.x, mousePosition.y);
  527.     ctx.closePath;
  528.     ctx.fill();
  529.     ctx.stroke();
  530.   }
  531. }
  532.  
  533. document.addEventListener('mousedown', function(mouseDownEvent) {
  534.   if (mouseDownEvent.button === 2) {
  535.     pie = true;
  536.     canvas.width = window.innerWidth;
  537.     canvas.height = window.innerHeight;
  538.     drawPie();
  539.   }
  540. }, false);
  541.  
  542. document.addEventListener('mouseup', function() {
  543.   if (pie) {
  544.     pie = false;
  545.     ctx.clearRect(0, 0, canvas.width, canvas.height);
  546.     document.getElementsByClassName("colorItem")[colorTable[selectedColor]].click();
  547.   }
  548. }, false);
  549.  
  550. document.addEventListener('keydown', function(e) {
  551.   switch (e.keyCode || e.which) {
  552.     case 49:
  553.       document.getElementsByClassName("brushSize")[0].click();
  554.       break;
  555.     case 50:
  556.       document.getElementsByClassName("brushSize")[1].click();
  557.       break;
  558.     case 51:
  559.       document.getElementsByClassName("brushSize")[2].click();
  560.       break;
  561.     case 52:
  562.       document.getElementsByClassName("brushSize")[3].click();
  563.       break;
  564.     case 221:
  565.     case 192:
  566.       getImageButton.click();
  567.       break;
  568.     case 13:
  569.       document.getElementById("inputChat").focus();
  570.       break;
  571.     default:
  572.       break;
  573.   }
  574.  
  575.   if (e.code === "KeyV" && e.altKey) {
  576.     document.getElementById("votekickCurrentplayer").click();
  577.     document.getElementById("inputChat").focus();
  578.   }
  579.   if (e.code === "KeyG" && e.altKey) {
  580.     document.getElementsByClassName("thumbsUp")[0].click();
  581.     document.getElementById("inputChat").focus();
  582.   }
  583.   if (e.code === "KeyN" && e.altKey) {
  584.     document.getElementsByClassName("thumbsDown")[0].click();
  585.     document.getElementById("inputChat").focus();
  586.   }
  587. }, false);
  588.  
  589. document.addEventListener('mousemove', function(mouseMoveEvent) {
  590.   var rect = mouseMoveEvent.target.getBoundingClientRect();
  591.   if (!pie) {
  592.     mousePosition.x = mouseMoveEvent.pageX;
  593.     mousePosition.y = mouseMoveEvent.pageY;
  594.   } else {
  595.     piePosition.x = mouseMoveEvent.pageX;
  596.     piePosition.y = mouseMoveEvent.pageY;
  597.     drawPie();
  598.   }
  599. }, false);
  600.  
  601. document.addEventListener('contextmenu', function(contextMenuEvent) {
  602.   contextMenuEvent.preventDefault();
  603.   return false;
  604. }, false);
  605.  
  606. getImageButton = setupImageButton();
  607.  
  608. const state = {
  609.     content: document.createElement("span"),
  610.     links: document.createElement("strong"),
  611.     pattern: "",
  612.     prevAnswer: "",
  613.     prevClue: "",
  614.     wordsList: $(document.createElement("ul"))
  615. };
  616. unsafeWindow.dictionary = {
  617.     confirmed: [],
  618.     guessed: [],
  619.     oneOffWords: [],
  620.     standard: [],
  621.     validAnswers: []
  622. };
  623. function scrollDown() {
  624.     if ($("#screenGame").is(":visible") &&
  625.         $("html").scrollTop() < $("#screenGame").offset().top) {
  626.         $("html, body").animate({
  627.             scrollTop: $("#screenGame").offset().top
  628.         }, 1000);
  629.     }
  630. }
  631. function getPlayer() {
  632.     const nameElem = $('.info .name[style="color: rgb(0, 0, 255);')[0];
  633.     if (typeof nameElem !== "undefined") {
  634.         return nameElem.innerText.split(" (")[0];
  635.     }
  636.     return "";
  637. }
  638. function validClue(clue, minCharsFound) {
  639.     const someoneDrawing = $(".drawing").is(":visible");
  640.     const charsFound = clue.replace(/_|-| /g, "").length;
  641.     const noUnderscores = clue.replace(/_/g, "").length;
  642.     if (someoneDrawing &&
  643.         (unsafeWindow.dictionary.oneOffWords.length > 0 ||
  644.             (charsFound >= minCharsFound && noUnderscores !== clue.length))) {
  645.         return true;
  646.     }
  647.     if (!someoneDrawing) {
  648.         unsafeWindow.dictionary.validAnswers = [];
  649.         unsafeWindow.dictionary.guessed = [];
  650.         unsafeWindow.dictionary.oneOffWords = [];
  651.     }
  652.     return false;
  653. }
  654. function wordGuessed() {
  655.     if ($('.guessedWord .info .name[style="color: rgb(0, 0, 255);"]').length) {
  656.         unsafeWindow.dictionary.validAnswers = [];
  657.         unsafeWindow.dictionary.guessed = [];
  658.         unsafeWindow.dictionary.oneOffWords = [];
  659.         return true;
  660.     }
  661.     return false;
  662. }
  663. function missingChar(short, long) {
  664.     for (let i = 1; i < long.length + 1; i++) {
  665.         if (short === long.substring(0, i - 1) + long.substring(i, long.length)) {
  666.             return true;
  667.         }
  668.     }
  669.     return false;
  670. }
  671. function oneOff(listWord, guessedWord) {
  672.     if (listWord.length === guessedWord.length) {
  673.         let wrongLetters = 0;
  674.         for (let i = 0; i < listWord.length; i++) {
  675.             if (listWord.charAt(i) !== guessedWord.charAt(i)) {
  676.                 wrongLetters += 1;
  677.             }
  678.             if (wrongLetters > 1) {
  679.                 return false;
  680.             }
  681.         }
  682.         return wrongLetters === 1;
  683.     }
  684.     if (listWord.length === guessedWord.length - 1) {
  685.         return missingChar(listWord, guessedWord);
  686.     }
  687.     if (guessedWord.length === listWord.length - 1) {
  688.         return missingChar(guessedWord, listWord);
  689.     }
  690.     return false;
  691. }
  692. function checkPastGuesses(notOBO, word) {
  693.     if (unsafeWindow.dictionary.guessed.indexOf(word) !== -1) {
  694.         return false;
  695.     }
  696.     for (const oneOffWord of unsafeWindow.dictionary.oneOffWords) {
  697.         if (!oneOff(word, oneOffWord)) {
  698.             return false;
  699.         }
  700.     }
  701.     for (const str of notOBO) {
  702.         if (oneOff(word, str)) {
  703.             return false;
  704.         }
  705.     }
  706.     return true;
  707. }
  708. function getRegex(clue) {
  709.     return new RegExp(`^${clue.replace(/_/g, "[^- ]")}$`);
  710. }
  711. function filterWords(words, notOBO, clue) {
  712.     return words
  713.         .filter(word => word.length === clue.length &&
  714.         state.pattern.test(word) &&
  715.         checkPastGuesses(notOBO, word))
  716.         .sort();
  717. }
  718. function getWords(clue) {
  719.     const dict = unsafeWindow.dictionary;
  720.     let words;
  721.     if (dict.validAnswers.length === 0) {
  722.         // && dict.guessed.length === 0
  723.         words = dict.confirmed.slice();
  724.         for (const item of dict.standard) {
  725.             if (words.indexOf(item) === -1) {
  726.                 words.push(item);
  727.             }
  728.         }
  729.     }
  730.     else {
  731.         words = dict.validAnswers;
  732.     }
  733.     state.pattern = getRegex(clue);
  734.     const notOBO = [];
  735.     for (const word of dict.guessed) {
  736.         if (dict.oneOffWords.indexOf(word) === -1) {
  737.             notOBO.push(word);
  738.         }
  739.     }
  740.     if (!wordGuessed()) {
  741.         dict.validAnswers = filterWords(words, notOBO, clue);
  742.     }
  743.     else {
  744.         dict.validAnswers = [];
  745.     }
  746.     return dict.validAnswers;
  747. }
  748. function constructWordsList(clue) {
  749.     const newList = $(document.createElement("ul"));
  750.     if (validClue(clue, 0) && !wordGuessed()) {
  751.         const words = getWords(clue);
  752.         for (const word of words) {
  753.             const item = document.createElement("li");
  754.             const child = $(`<span onClick="submitGuess('${word}')">${word}</span>`);
  755.             child.css({ cursor: 'pointer', textDecoration: 'underline', textDecorationStyle: 'dotted' });
  756.             if (unsafeWindow.dictionary.confirmed.indexOf(word) > -1) {
  757.                 child.css({ fontWeight: 'bold' });
  758.             }
  759.             $(item).append(child);
  760.             newList.append(item);
  761.         }
  762.     }
  763.     state.wordsList.html(newList.html());
  764.     state.wordsList.css({
  765.         width: `${$(document).width() - $("#containerChat").width() - 40}px`
  766.     });
  767. }
  768. function getClue() {
  769.     return $("#currentWord");
  770. }
  771. function getClueText() {
  772.     return getClue()[0].textContent.toLowerCase();
  773. }
  774. function findGuessedWords() {
  775.     const player = getPlayer();
  776.     if (player) {
  777.         const guesses = $(`#boxMessages p[style='color: rgb(0, 0, 0);'] b:contains(${player}:)`)
  778.             .parent()
  779.             .find("span")
  780.             .not(".skribblerHandled")
  781.             .slice(-10);
  782.         guesses.each((i, elem) => {
  783.             const guessText = elem.innerText;
  784.             if (unsafeWindow.dictionary.guessed.indexOf(guessText) === -1) {
  785.                 unsafeWindow.dictionary.guessed.push(guessText);
  786.                 elem.classList.add("skribblerHandled");
  787.                 constructWordsList(getClueText());
  788.             }
  789.         });
  790.     }
  791. }
  792. function findCloseWords() {
  793.     const close = $("#boxMessages p[style='color: rgb(204, 204, 0); font-weight: bold;'] span:contains( is close!)")
  794.         .not(".skribblerHandled")
  795.         .slice(-10);
  796.     close.each((i, elem) => {
  797.         const text = elem.innerText.split("'")[1];
  798.         if (unsafeWindow.dictionary.oneOffWords.indexOf(text) === -1) {
  799.             unsafeWindow.dictionary.oneOffWords.push(text);
  800.             elem.classList.add("skribblerHandled");
  801.             constructWordsList(getClueText());
  802.         }
  803.     });
  804. }
  805. unsafeWindow.getInput = () => $("#inputChat");
  806. function validateInput() {
  807.     const word = getClueText();
  808.     const input = unsafeWindow.getInput()[0];
  809.     const remaining = word.length - input.value.length;
  810.     state.content.textContent = remaining;
  811.     state.content.style.color = "unset";
  812.     if (remaining > 0) {
  813.         state.content.textContent = `+${state.content.textContent}`;
  814.         state.content.style.color = "green";
  815.     }
  816.     else if (remaining < 0) {
  817.         state.content.style.color = "red";
  818.     }
  819.     state.pattern = getRegex(word);
  820.     const short = getRegex(word.substring(0, input.value.length));
  821.     if (state.pattern.test(input.value.toLowerCase())) {
  822.         input.style.border = "3px solid green";
  823.     }
  824.     else if (short.test(input.value.toLowerCase())) {
  825.         input.style.border = "3px solid orange";
  826.     }
  827.     else {
  828.         input.style.border = "3px solid red";
  829.     }
  830. }
  831. function showDrawLinks(clueText) {
  832.     if (clueText.length > 0 && clueText.indexOf("_") === -1) {
  833.         state.links.innerHTML = `<a style='color: blue' target='_blank'
  834. href='https://www.google.com/search?tbm=isch&q=${clueText}'>Images</a>, `;
  835.         state.links.innerHTML += `<a style='color: blue' target='_blank'
  836. href='https://www.google.com/search?tbm=isch&tbs=itp:lineart&q=${clueText}'>Line art</a>`;
  837.     }
  838.     else {
  839.         state.links.innerHTML = "";
  840.     }
  841. }
  842. function clueChanged() {
  843.     const clue = getClueText();
  844.     if (clue !== state.prevClue) {
  845.         state.prevClue = clue;
  846.         validateInput();
  847.         constructWordsList(clue);
  848.         showDrawLinks(clue);
  849.     }
  850. }
  851. function answerShown(username, password) {
  852.     let answer = $("#overlay .content .text")[0].innerText;
  853.     if (answer.slice(0, 14) === "The word was: ") {
  854.         answer = answer.slice(14);
  855.         if (answer !== state.prevAnswer) {
  856.             state.prevAnswer = answer;
  857.             unsafeWindow.dictionary.oneOffWords = [];
  858.             unsafeWindow.dictionary.guessed = [];
  859.             unsafeWindow.dictionary.validAnswers = [];
  860.             if (admin) {
  861.                 handleWord(answer, username, password);
  862.             }
  863.         }
  864.     }
  865. }
  866. function makeGuess(clue) {
  867.     if (validClue(clue, 1) && !wordGuessed()) {
  868.         const words = unsafeWindow.dictionary.validAnswers;
  869.         const confWords = [];
  870.         for (const item of words) {
  871.             if (unsafeWindow.dictionary.confirmed.indexOf(item) > -1) {
  872.                 confWords.push(item);
  873.             }
  874.         }
  875.         let guess;
  876.         if (confWords.length > 0) {
  877.             guess = confWords[Math.floor(Math.random() * confWords.length)];
  878.         }
  879.         else {
  880.             guess = words[Math.floor(Math.random() * words.length)];
  881.         }
  882.         guessWord(guess, clue);
  883.     }
  884. }
  885. unsafeWindow.submitGuess = (guess) => {
  886.     const submitProp = Object.keys(unsafeWindow.formChat).filter((k) => ~k.indexOf("jQuery") // tslint:disable-line no-bitwise
  887.     )[0];
  888.     unsafeWindow.getInput().val(guess);
  889.     unsafeWindow.formChat[submitProp].events.submit[0].handler();
  890. };
  891. function guessWord(guess, clue) {
  892.     window.setTimeout(() => {
  893.         if (unsafeWindow.getInput().val() === "" && validClue(clue, 1) && !wordGuessed()) {
  894.             unsafeWindow.submitGuess(guess);
  895.         }
  896.     }, Math.floor(Math.random() * (Number($("#guessRate").val()) / 3)));
  897. }
  898. function toggleWordsList() {
  899.     if ($(state.wordsList).is(":visible")) {
  900.         if (state.wordsList.children().length === 0 ||
  901.             wordGuessed() ||
  902.             !validClue(getClueText(), 0)) {
  903.             state.wordsList.hide();
  904.         }
  905.     }
  906.     else if (state.wordsList.children().length > 0 &&
  907.         !wordGuessed() &&
  908.         validClue(getClueText(), 0)) {
  909.         state.wordsList.show();
  910.     }
  911. }
  912. function stillHere() {
  913.     if (document.hidden &&
  914.         $(".modal-dialog:contains(Are you still here?)").is(":visible")) {
  915.         alert("Action required.");
  916.     }
  917. }
  918. var activated=false;
  919. function main(username, password) {
  920.     $("#audio").css({
  921.         left: "unset",
  922.         right: "0px"
  923.     }); // so it doesn't cover timer
  924.     window.setInterval(scrollDown, 2000);
  925.     $(state.links).css({
  926.         padding: "0 1em 0 1em"
  927.     });
  928.     getClue().after(state.links);
  929.     const formArea = $("#formChat")[0];
  930.     $(state.content).css({
  931.         left: "295px",
  932.         position: "relative",
  933.         top: "-25px"
  934.     });
  935.     state.wordsList.css({
  936.         "background-color": "#eee",
  937.         "border-radius": "2px",
  938.         columns: "4",
  939.         "list-style-position": "inside",
  940.         "margin-top": "10px",
  941.         padding: "4px",
  942.         width: "70%"
  943.     });
  944.     formArea.appendChild(state.content);
  945.     $("#screenGame")[0].appendChild(state.wordsList[0]);
  946.     const input = unsafeWindow.getInput()[0];
  947.     input.style.border = "3px solid orange";
  948.     window.setInterval(() => {
  949.         clueChanged();
  950.         answerShown(username, password);
  951.         findCloseWords();
  952.         findGuessedWords();
  953.         toggleWordsList();
  954.         stillHere();
  955.     }, 1000);
  956.     if(activated==false)
  957.     {
  958.         activated=true;
  959.                 $(".autoguesser").prop("checked", true);
  960.         activate.hide();
  961.     $("#boxChatInput").prepend($(`<div class="activator" style="background-color:#eee; position:relative;
  962. top:-20px; padding:0 5px; width:auto; margin:0;">
  963. <input id="guessEnabled" name="guessEnabled" style="width:15px; height:15px;" type="checkbox">
  964. <label for="guessEnabled" style="all: initial; padding-left:5px;">Enable auto-guesser</label><br>
  965. <label for="guessRate" style="all: initial; padding-right:5px;">Guess frequency (seconds):</label>
  966. <input id="guessRate" name="guessRate" type="number" step="0.5" min="1" value="1.5" style="width:4em;"></div>`));
  967.     } else { checkactivatedvalue(); }
  968.     let lastGuess = 0;
  969.     let lastTyped = 0;
  970.     window.setInterval(() => {
  971.         if ($("#guessEnabled").is(":checked") &&
  972.             Date.now() - lastTyped >= 1500 &&
  973.             Date.now() - lastGuess >= 1000 * Number($("#guessRate").val())) {
  974.             lastGuess = Date.now();
  975.             makeGuess(getClueText());
  976.         }
  977.     }, 500);
  978.     unsafeWindow.getInput().keyup(() => {
  979.         lastTyped = Date.now();
  980.     });
  981.     unsafeWindow.getInput().keyup(validateInput);
  982. }
  983. function fetchWords(username, password) {
  984.     GM.xmlHttpRequest({
  985.         method: "GET",
  986.         url: "https://skribbler.herokuapp.com/api/words",
  987.         onload(res) {
  988.             const response = JSON.parse(res.responseText);
  989.             unsafeWindow.dictionary.standard = response.default;
  990.             unsafeWindow.dictionary.confirmed = response.confirmed;
  991.             const run = window.setInterval(() => {
  992.                 if (getClue()) {
  993.                     clearInterval(run);
  994.                     main(username, password);
  995.                 }
  996.             }, 1000);
  997.         }
  998.     });
  999. }
  1000. var onlinecheck=false;
  1001. function checkactivatedvalue() {
  1002.     if(onlinecheck==true){
  1003.         onlinecheck=false;
  1004.     $(".activator").show();
  1005.                 $(".autoguesser").prop("checked", true);
  1006.     } else { $(".activator").hide(); onlinecheck=true;
  1007.                    $(".autoguesser").prop("checked", false);}
  1008. }
  1009.     let activate;
  1010. $(document).ready(() => {
  1011.     if (typeof GM === "undefined") {
  1012.         // polyfill GM4
  1013.         GM = {
  1014.             xmlHttpRequest: GM_xmlhttpRequest
  1015.         };
  1016.     }
  1017.     if (admin) {
  1018.         activate = $("<button>Activate skribbler (admin)</button>");
  1019.     }
  1020.     else
  1021.         activate = $("<button>Activate skribbler</button>");
  1022.     activate.css({
  1023.         "font-size": "0.6em"
  1024.     });
  1025.     $(".loginPanelTitle")
  1026.         .first()
  1027.         .append(activate);
  1028.     activate.click(() => {
  1029.         activate.hide();
  1030. activateautoguess();
  1031. $(".autoguesser").prop("checked", true);
  1032.     });
  1033. });
  1034. const handleWord = (clue, username, password) => { };
  1035. const getLoginDetails = () => { };
  1036. const admin = false;
Parsed in 0.395 seconds