Instasynch emotes loader

Template for IntsaSync emote userscript

  1. // ==UserScript==
  2. // @name Instasynch emotes loader
  3. // @namespace Bibby
  4. // @description Template for IntsaSync emote userscript
  5. // @version 1.08
  6. // @license MIT
  7. // @author Zod-
  8. // @grant none
  9.  
  10. // @include *://*.instasynch.com/*
  11. // @include *://instasynch.com/*
  12. // @include *://*.instasync.com/*
  13. // @include *://instasync.com/*
  14.  
  15. // ==/UserScript==
  16.  
  17. var emotes = [
  18. //{ src:"http://i.imgur.com/uWCIsFe.jpg", width:55, height:55, title:'anita'},
  19. //{ src:"http://i.imgur.com/uWCIsFe.jpg", width:55, height:55, title:'anita'}
  20. ];
  21. function addEmotes(){
  22. emotes.forEach(function(emote){
  23. window.$codes[emote.title || emote.name] = $('<img>', emote)[0].outerHTML;
  24. });
  25. }
  26. function main(){
  27. if(!window.$codes || Object.keys(window.$codes).length === 0){
  28. setTimeout(main, 75);
  29. }else{
  30. addEmotes();
  31. }
  32. }
  33. if (window.document.readyState === 'complete') {
  34. main();
  35. } else {
  36. window.addEventListener('load', main, false);
  37. }