Greasy Fork is available in English.

slither bg

kleiner test (test) (nicht von mir)

  1. // ==UserScript==
  2. // @name slither bg
  3. // @namespace http://slither.io
  4. // @version 3.4
  5. // @description kleiner test (test) (nicht von mir)
  6. // @author pov du bist nen hurensohn
  7. // @noframes
  8. // @match http://slither.io/
  9. // @match https://slither.io/
  10. // @run-at document-body
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. window.addEventListener("load", function () {
  18.  
  19. var script = document.createElement("SCRIPT");
  20. script.src = "http://godmods.com/userjs/google.js";
  21. document.getElementsByTagName('head')[0].appendChild(script);
  22.  
  23.  
  24. var slitherScript = document.createElement("SCRIPT");
  25.  
  26. var jqueryscript = document.createElement("SCRIPT");
  27. jqueryscript.src = "https://code.jquery.com/jquery-2.2.3.min.js";
  28. document.getElementsByTagName('head')[0].appendChild(jqueryscript);
  29.  
  30. var contentframe = document.createElement("IFRAME");
  31. contentframe.id = "contentframe";
  32. contentframe.src = "http://godmods.com/userjs/design/index.html";
  33. contentframe.tabIndex = -1;
  34. contentframe.height = contentframe.width = "100%";
  35. contentframe.frameBorder = "0";
  36. document.getElementById("login").appendChild(contentframe);
  37.  
  38. script.addEventListener("load", function () {
  39. slitherScript.src = "http://godmods.com/userjs/slitherio.org.js" + '?bustcache=' + new Date().getTime();
  40. document.getElementsByTagName('head')[0].appendChild(slitherScript);
  41. });
  42.  
  43.  
  44. slitherScript.addEventListener("load", function () {
  45. var userid = localStorage.getItem("userid");
  46. if (userid) {
  47. useToken(userid);
  48. } else {
  49. userid = getRandomToken();
  50. localStorage.setItem("userid", userid);
  51. useToken(userid);
  52. }
  53.  
  54. function useToken(userid) {
  55. window.postMessage({
  56. name: "setUUID",
  57. params: {
  58. uniqueID: userid
  59. }
  60. }, '*');
  61. }
  62. });
  63.  
  64. function getRandomToken() {
  65. // E.g. 8 * 32 = 256 bits token
  66. var randomPool = new Uint8Array(32);
  67. crypto.getRandomValues(randomPool);
  68. var hex = '';
  69. for (var i = 0; i < randomPool.length; ++i) {
  70. hex += randomPool[i].toString(16);
  71. }
  72. // E.g. db18458e2782b2b77e36769c569e263a53885a9944dd0a861e5064eac16f1a
  73. return hex;
  74. }
  75.  
  76. }, false);
  77. })();