Advertisement
Guest User

Untitled

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