Adding missing loader.js

This commit is contained in:
Hannah Wolfe 2014-03-07 10:14:40 +00:00
parent 31f41822e0
commit 4be10448a0
3 changed files with 76 additions and 2 deletions

2
.gitignore vendored
View File

@ -35,14 +35,12 @@ projectFilesBackup
.sass-cache/
/core/clientold/tpl/hbs-tpl.js
/core/clientold/assets/vendor
/core/clientold/assets/css
/core/clientold/assets/sass/config.rb
/core/clientold/assets/sass/layouts/config.rb
/core/clientold/assets/sass/modules/config.rb
/core/clientold/assets/sass/modules/bourbon
/core/clientold/assets/sass/modules/bourbon/*
/core/client/assets/vendor
/core/client/assets/css
/core/client/assets/sass/config.rb
/core/client/assets/sass/layouts/config.rb

View File

@ -9,6 +9,7 @@ GEM
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
bourbon

75
core/client/assets/vendor/loader.js vendored Normal file
View File

@ -0,0 +1,75 @@
var define, requireModule, require, requirejs;
(function() {
var registry = {}, seen = {}, state = {};
var FAILED = false;
define = function(name, deps, callback) {
registry[name] = {
deps: deps,
callback: callback
};
};
requirejs = require = requireModule = function(name) {
if (state[name] !== FAILED &&
seen.hasOwnProperty(name)) {
return seen[name];
}
if (!registry.hasOwnProperty(name)) {
throw new Error('Could not find module ' + name);
}
var mod = registry[name];
var deps = mod.deps;
var callback = mod.callback;
var reified = [];
var exports;
var value;
var loaded = false;
seen[name] = { }; // enable run-time cycles
try {
for (var i=0, l=deps.length; i<l; i++) {
if (deps[i] === 'exports') {
reified.push(exports = {});
} else {
reified.push(requireModule(resolve(deps[i], name)));
}
}
value = callback.apply(this, reified);
loaded = true;
} finally {
if (!loaded) {
state[name] = FAILED;
}
}
return seen[name] = exports || value;
};
function resolve(child, name) {
if (child.charAt(0) !== '.') { return child; }
var parts = child.split('/');
var parentBase = name.split('/').slice(0, -1);
for (var i = 0, l = parts.length; i < l; i++) {
var part = parts[i];
if (part === '..') { parentBase.pop(); }
else if (part === '.') { continue; }
else { parentBase.push(part); }
}
return parentBase.join('/');
}
requirejs._eak_seen = registry;
requirejs.clear = function(){
requirejs._eak_seen = registry = {};
seen = {};
};
})();