chrahunt

texture-pack.user.js

May 12th, 2015
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name          My Texture Pack Loader
  3. // @namespace     http://www.reddit.com/u/snaps_/
  4. // @description   Used for texture pack loading.
  5. // @include       http://tagpro-*.koalabeast.com:*
  6. // @include       http://tangent.jukejuice.com:*
  7. // @include       http://*.newcompte.fr:*
  8. // @license       GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
  9. // @author        snaps
  10. // @version       0.2.0
  11. // @resource  tiles  http://i.imgur.com/YnJ9THs.png
  12. // @resource  speedpad  http://i.imgur.com/Lgiwb5Q.png
  13. // @resource  speedpadRed  http://i.imgur.com/XuN3NbB.png
  14. // @resource  speedpadBlue  http://i.imgur.com/5JKeYSQ.png
  15. // @resource  portal  http://i.imgur.com/xJe0hBy.png?1
  16. // @resource  splats  http://i.imgur.com/RZYNTYs.png
  17. // @resource  gravityWell  http://i.imgur.com/OTtqsQm.png
  18. // ==/UserScript==
  19.  
  20. // Wait until the tagpro object exists, and add the function to tagpro.ready
  21. function waitForTagpro(fn) {
  22.     // Make sure the tagpro object exists.
  23.     if (typeof tagpro !== "undefined") {
  24.         fn();
  25.     } else {
  26.         // If not ready, try again after a short delay.
  27.         setTimeout(function() {
  28.             waitForTagpro(fn);
  29.         }, 0);
  30.     }
  31. }
  32.  
  33. var loadTexture = function() {
  34.     var assetTypes = ["tiles", "speedpad", "speedpadRed", "speedpadBlue", "portal", "splats", "gravityWell"];
  35.     var assets = {};
  36.     assetTypes.forEach(function(assetType) {
  37.         assets[assetType] = GM_getResourceURL(assetType);
  38.     });
  39.     tagpro.loadAssets(assets);
  40. };
  41. waitForTagpro(loadTexture);
Add Comment
Please, Sign In to add comment