Sha256: 1a25b3458b18f38ab9ab68985fbc679e582f7b4e9aaa74c5bf14179e355433d5

Contents?: true

Size: 1.25 KB

Versions: 25

Compression:

Stored size: 1.25 KB

Contents

(function() {
  Screw.Assets = {};
  Screw.Assets.use_cache_buster = false; // TODO: NS/CTI - make this configurable from the UI.
  var required_paths = [];
  var included_stylesheets = {};
  var cache_buster = parseInt(new Date().getTime()/(1*1000));

  Screw.Assets.require = function(javascript_path, onload) {
    if(!required_paths[javascript_path]) {
      var full_path = javascript_path + ".js";
      if (Screw.Assets.use_cache_buster) {
        full_path += '?' + cache_buster;
      }
      document.write("<script src='" + full_path + "' type='text/javascript'></script>");
      if(onload) {
        var scripts = document.getElementsByTagName('script');
        scripts[scripts.length-1].onload = onload;
      }
      required_paths[javascript_path] = true;
    }
  };

  Screw.Assets.stylesheet = function(stylesheet_path) {
    if(!included_stylesheets[stylesheet_path]) {
      var full_path = stylesheet_path + ".css";
      if(Screw.Assets.use_cache_buster) {
        full_path += '?' + cache_buster;
      }
      document.write("<link rel='stylesheet' type='text/css' href='" + full_path + "' />");
      included_stylesheets[stylesheet_path] = true;
    }
  };

  window.require = Screw.Assets.require;
  window.stylesheet = Screw.Assets.stylesheet;
})();

Version data entries

25 entries across 23 versions & 7 rubygems

Version Path
btakita-screw-unit-server-0.3.0 core/lib/screw.assets.js
btakita-screw_unit-0.1.0 core/lib/screw.assets.js
btakita-screw_unit-0.3.0 core/lib/screw.assets.js
xmvc-0.1.12 lib/xmvc/generators/templates/app/public/vendor/screw-unit/lib/screw.assets.js
xmvc-0.1.11 lib/xmvc/generators/templates/app/public/vendor/screw-unit/lib/screw.assets.js
xmvc-0.1.10 lib/xmvc/generators/templates/app/public/vendor/screw-unit/lib/screw.assets.js
xmvc-0.1.9 lib/xmvc/generators/templates/app/public/vendor/screw-unit/lib/screw.assets.js
xmvc-0.1.8 lib/xmvc/generators/templates/app/public/vendor/screw-unit/lib/screw.assets.js
xmvc-0.1.7 lib/xmvc/generators/templates/app/public/vendor/screw-unit/lib/screw.assets.js
xmvc-0.1.6 lib/xmvc/generators/templates/app/public/vendor/screw-unit/lib/screw.assets.js
xmvc-0.1.5 lib/xmvc/generators/templates/app/public/vendor/screw-unit/lib/screw.assets.js
xmvc-0.1.4 lib/xmvc/generators/templates/app/public/vendor/screw-unit/lib/screw.assets.js
extjs-mvc-0.4.0.e lib/vendor/vendor/screw-unit/lib/screw.assets.js
xmvc-0.1.3 lib/xmvc/generators/templates/app/public/vendor/screw-unit/lib/screw.assets.js
xmvc-0.1.2 lib/xmvc/generators/templates/app/public/vendor/screw-unit/lib/screw.assets.js
extjs-mvc-0.4.0.d lib/vendor/vendor/screw-unit/lib/screw.assets.js
xmvc-0.1.1 lib/xmvc/generators/templates/app/public/vendor/screw-unit/lib/screw.assets.js
xmvc-0.1.0 lib/xmvc/generators/templates/app/vendor/screw-unit/lib/screw.assets.js
extjs-mvc-0.4.0.b lib/js/vendor/screw-unit/lib/screw.assets.js
extjs-mvc-0.4.0.b lib/extjs-mvc/generators/templates/app/vendor/screw-unit/lib/screw.assets.js