Skip to content

Instantly share code, notes, and snippets.

@cramforce
Created December 2, 2011 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cramforce/1424936 to your computer and use it in GitHub Desktop.
Save cramforce/1424936 to your computer and use it in GitHub Desktop.
dojo/cache.js
var e = {}, f = require.m || function() {
};
if(!f("dojo-has-api")) {
var g = "undefined" != typeof window && "undefined" != typeof location && "undefined" != typeof document && window.location == location && window.document == document, h = this, i = g && document, k = i && i.createElement("DiV"), l = {}, f = function(a) {
return l[a] = "function" == typeof l[a] ? l[a](h, i, k) : l[a]
};
f.b = l;
f.add = function(a, b, c, d) {
("undefined" == typeof l[a] || d) && (l[a] = b);
return c && f(a)
};
f.add("host-browser", g);
f.add("dom", g);
f.add("dojo-dom-ready-api", 1);
f.add("dojo-sniff", 1)
}
if(f("host-browser")) {
var m = navigator.userAgent;
f.add("dom-addeventlistener", !!document.addEventListener);
f.add("touch", "ontouchstart" in document);
f.add("device-width", screen.availWidth || innerWidth);
f.add("agent-ios", !!m.match(/iPhone|iP[ao]d/));
f.add("agent-android", 1 < m.indexOf("android"))
}
f.z = function(a) {
a.innerHTML = "";
return a
};
f.normalize = function(a, b) {
function c(a) {
var b = d[t++];
if(":" == b) {
return 0
}
if("?" == d[t++]) {
if(!a && f(b)) {
return c()
}
c(!0);
return c(a)
}
return b || 0
}
var d = a.match(/[\?:]|[^:\?]*/g), t = 0;
return(a = c()) && b(a)
};
f.load = function(a, b, c) {
a ? b([a], c) : c()
};
e.a = f;
e.a && (e = e.a);
var n = {}, o = e, p = {};
if(o("dojo-config-api")) {
var q = require.s, r;
for(r in q) {
p[r] = q[r]
}
}else {
var s = function(a, b) {
for(r in a) {
"has" != r && o.add(b + r, a[r], 0, 1)
}
}, p = o("dojo-loader") ? require.s : this.C || this.A || {};
s(p, "config");
s(p.m, "")
}
n.a = p;
n.a && (n = n.a);
var u = {}, v = n, w = e, x, y, z = {}, D = {}, E = {g:v, global:this, h:z, i:D}, F = {B:["dojo", E], h:["dijit", z], i:["dojox", D]}, G = require.q && require.q[module.id.match(/[^\/]+/)[0]].K || {}, H;
for(y in G) {
F[y] ? F[y][0] = G[y] : F[y] = [G[y], {}]
}
for(y in F) {
H = F[y], H[1].w = H[0], v.J || (this[H[0]] = H[1])
}
E.N = F;
E.d = E.g.d = require.d;
E.G = !w("dojo-loader") || require.async;
E.n = v.n;
var I = "$Rev: 23930 $".match(/\d+/);
E.version = {o:1, p:7, r:0, k:"", t:I ? +I[0] : NaN, toString:function() {
var a = E.version;
return a.o + "." + a.p + "." + a.r + a.k + " (" + a.t + ")"
}};
w.add("extend-dojo", 1);
if(w("dojo-loader")) {
E.eval = require.eval
}else {
var J = new Function("__text", "return eval(__text);");
E.eval = function(a, b) {
return J(a + "\r\n////@ sourceURL=" + b)
}
}
E.F = w("host-rhino") ? function(a) {
quit(a)
} : function() {
};
w.add("dojo-guarantee-console", 1);
if(w("dojo-guarantee-console")) {
"undefined" != typeof console || (console = {});
var K = "assert,count,debug,dir,dirxml,error,group,groupEnd,info,profile,profileEnd,time,timeEnd,trace,warn,log".split(","), L;
for(x = 0;L = K[x++];) {
console[L] || function() {
var a = L + "";
console[a] = "log" in console ? function() {
var b = Array.apply({}, arguments);
b.unshift(a + ":");
console.log(b.join(" "))
} : function() {
};
console[a].u = !0
}()
}
}
w.add("dojo-debug-messages", !!v.H);
w("dojo-debug-messages") ? (E.c = function(a, b, c) {
a = "DEPRECATED: " + a;
b && (a += " " + b);
c && (a += " -- will be removed in version: " + c);
console.warn(a)
}, E.j = function(a, b) {
var c = "EXPERIMENTAL: " + a + " -- APIs subject to change without notice.";
b && (c += " " + b);
console.warn(c)
}) : E.c = E.j = function() {
};
w.add("dojo-modulePaths", 1);
if(w("dojo-modulePaths") && v.e) {
E.c("dojo.modulePaths", "use paths configuration");
var M = {};
for(y in v.e) {
M[y.replace(/\./g, "/")] = v.e[y]
}
require({L:M})
}
w.add("dojo-moduleUrl", 1);
w("dojo-moduleUrl") && (E.I = function(a, b) {
E.c("dojo.moduleUrl()", "use require.toUrl", "2.0");
var c = null;
a && (c = require.f(a.replace(/\./g, "/") + (b ? "/" + b : "") + "/*.*").replace(/\/\*\.\*/, "") + (b ? "" : "/"));
return c
});
E.v = {};
u.a = E;
u.a && (u = u.a);
var N = {}, O = u, P;
has("host-browser") ? P = function(a, b, c) {
xhr("GET", {url:a, O:!!b, load:c})
} : require.l ? P = require.l : console.error("dojo/text plugin failed to load because loader does not support getText");
var R = {};
function S(a) {
if(a) {
var a = a.replace(/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, ""), b = a.match(/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im);
b && (a = b[1])
}else {
a = ""
}
return a
}
var T = {}, U = {};
O.b = function(a, b, c) {
var d;
"string" == typeof a ? /\//.test(a) ? (d = a, c = b) : d = require.f(a.replace(/\./g, "/") + (b ? "/" + b : "")) : (d = a + "", c = b);
a = void 0 != c && "string" != typeof c ? c.value : c;
c = c && c.M;
if("string" == typeof a) {
return R[d] = a, c ? S(a) : a
}
if(null === a) {
return delete R[d], null
}
d in R || P(d, !0, function(a) {
R[d] = a
});
return c ? S(R[d]) : R[d]
};
N.a = {D:!0, normalize:function(a, b) {
var c = a.split("!"), d = c[0];
return(/^\./.test(d) ? b(d) : d) + (c[1] ? "!" + c[1] : "")
}, load:function(a, b, c) {
function d(a) {
c(t ? S(a) : a)
}
var a = a.split("!"), t = 1 < a.length, B = a[0], j = b.f(a[0]), a = T;
B in R ? a = R[B] : j in b.b ? a = b.b[j] : j in R && (a = R[j]);
if(a === T) {
if(U[j]) {
U[j].push(d)
}else {
var Q = U[j] = [d];
P(j, !b.async, function(a) {
R[B] = R[j] = a;
for(var b = 0;b < Q.length;) {
Q[b++](a)
}
delete U[j]
})
}
}else {
d(a)
}
}};
N.a && (N = N.a);
var V = {};
V.a = u.b;
V.a && (V = V.a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment