Advertisement
Guest User

Untitled

a guest
Dec 6th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @id          frankerfacez
  3. // @name        FrankerFaceZ
  4. // @namespace   FrankerFaceZ
  5. //
  6. // @version     1.58
  7. // @updateURL   https://cdn.frankerfacez.com/script/ffz_injector.user.js
  8. //
  9. // @description FrankerFaceZ gives Twitch users custom chat emotes and introduces new features to improve the viewing experience.
  10. // @homepage    https://www.frankerfacez.com/
  11. // @icon        https://cdn.frankerfacez.com/script/icon32.png
  12. // @icon64      https://cdn.frankerfacez.com/script/icon64.png
  13. // @icon128     https://cdn.frankerfacez.com/script/icon128.png
  14. //
  15. // @include     http://twitch.tv/*
  16. // @include     https://twitch.tv/*
  17. // @include     http://*.twitch.tv/*
  18. // @include     https://*.twitch.tv/*
  19. //
  20. // @exclude     http://api.twitch.tv/*
  21. // @exclude     https://api.twitch.tv/*
  22. //
  23. // @grant       none
  24. // @run-at      document-end
  25. // ==/UserScript==
  26.  
  27. function ffz_init()
  28. {
  29.     var script = document.createElement('script');
  30.  
  31.     script.id = 'ffz_script';
  32.     script.type = 'text/javascript';
  33.     script.src = '//cdn.frankerfacez.com/script/script.min.js?_=' + Date.now();
  34.  
  35.     if ( localStorage.ffzDebugMode == "true" ) {
  36.         // Developer Mode is enabled. But is the server running? Check before
  37.         // we include the script, otherwise someone could break their
  38.         // experience and not be able to recover.
  39.         var xhr = new XMLHttpRequest();
  40.         xhr.open("GET", "//localhost:8000/dev_server", true);
  41.         xhr.onload = function(e) {
  42.             var resp = JSON.parse(xhr.responseText);
  43.             console.log("FFZ: Development Server is present. Version " + resp.version + " running from: " + resp.path);
  44.             script.src = "//localhost:8000/script/script.js?_=" + Date.now();
  45.             document.body.classList.add("ffz-dev");
  46.             document.head.appendChild(script);
  47.         };
  48.         xhr.onerror = function(e) {
  49.             console.log("FFZ: Development Server is not present. Using CDN.");
  50.             document.head.appendChild(script);
  51.         };
  52.         return xhr.send(null);
  53.     }
  54.  
  55.     document.head.appendChild(script);
  56. }
  57.  
  58. ffz_init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement