Permalink
Browse files

cleaned up steal

  • Loading branch information...
1 parent 145d326 commit 73f86e9c5480096cf73b0670a54e9bff340df5cd @justinbmeyer justinbmeyer committed Oct 13, 2011
Showing with 31 additions and 76 deletions.
  1. +0 −48 README.md
  2. +3 −1 steal.js
  3. +28 −27 steal.production.js
View
48 README.md
@@ -76,51 +76,3 @@ js steal/clean path/to/page.html
@codestart text
js steal/htmljs http://localhost/cookbook.html#recipes
@codeend
-
-## Getting Started with StealJS
-
-The remainder of this page walks through using StealJS to create a
-micro application. The application will use a basic tabs widget to
-load content from the server and show it in a content area. We'll
-use steal to generate a google crawlable version of the site.
-
-We won't use jQuery to demonstrate that steal works with any library.
-
-### Installing Steal
-
-Download StealJS or JavaScriptMVC and unzip it in a public folder.
-
-### Setting up your app.
-
-JavaScriptMVC encourages you to have two root folders. One for reusable
-widgets, plugins and other code that can be potentially used across multiple applications.
-
-The other folder will be code specific to your application.
-
-
-
-
-### Setting up your page
-
-In a page, add the script tag
-
-### Loading Scripts
-
-Load other scripts
-
-### Load other types (Less and Coffee)
-
-### Installing Other Scripts
-
-No
-
-### Cleaning Scripts
-
-Our scripts are ugly, we can clean them ... or JS lint them ...
-
-### Make your site crawl-able
-
-If you want Google to be able to find your site, you better make it crawlable.
-
-Google does not know how to crawl ajax applications. However, Steal makes this possible.
-
View
4 steal.js
@@ -421,7 +421,9 @@
}
}
extend(File.prototype,
- /* @prototype */
+ /**
+ * @prototype
+ */
{
/**
* Removes hash and params
View
55 steal.production.js
@@ -1,27 +1,28 @@
-(function(){function c(){var a=x(arguments);c.before(a);p.push.apply(p,arguments);c.after(a);return c}function G(a,b,d,c,f){q[d.shift()].require(a,b,function(){d.length?G(a,b,d,c,f):c.apply(this,arguments)},f)}function m(a,b,d){return d?function(){return a.apply(this,b.apply(this,arguments))}:function(){b.apply(this,arguments);return a.apply(this,arguments)}}function n(a,b,d){return d?function(){return b.apply(this,[a.apply(this,arguments)].concat(x(arguments)))}:function(){var d=a.apply(this,arguments);
-b.apply(this,arguments);return d}}function D(a,b){var d=a[b];if(!a[b].callbacks)a[b]=function(){var b=arguments.callee,c;c=d.apply(a,arguments);var g=b.callbacks,j=g.length;b.called=!0;for(b=0;b<j;b++)g[b].called();return c},a[b].callbacks=[];return a[b]}function H(a,b){this.obj=a;this.meth=b;D(a,b);this.calls=0}function t(){var a=x(arguments),b=a[a.length-1];typeof b==="function"&&(a[a.length-1]={fn:b},a.push("fn"));for(var b=a.pop(),c=a.pop(),b=new H(c,b),c=0;c<a.length;c+=2)b.add(a[c],a[c+1]);
-b.go()}var i=function(){return this}.call(null),h=i.document,R=/loaded|complete/,E=function(a){var b=h.createElement("script");b.type=a||"text/javascript";return b},r=function(){var a=h.documentElement,b=h.getElementsByTagName("head")[0];b||(b=h.createElement("head"),a.insertBefore(b,a.firstChild));r=function(){return b};return b},k=function(a,b){for(var c in b)a[c]=b[c];return a},x=function(a){var b=[];o(a,function(a,c){b.push(c)});return b},o=function(a,b){for(var c=0,e=a.length;c<e;c++)b.call(a[c],
-c,a[c])},I=h&&function(){var a=E();a.setAttribute("onerror","return;");return typeof a.onerror==="function"?!0:"onerror"in a}(),J=h&&"attachEvent"in E(),u=function(){},y=i.steal,F=typeof y=="object"?y:{};c.File=function(a){if(this.constructor!=c.File)return new c.File(a);this.path=typeof a=="string"?a:a.path};var g=c.File,K;g.cur=function(a){if(a!==void 0)K=g(a);else return K||g("")};k(g.prototype,{clean:function(){return this.path.match(/([^\?#]*)/)[1]},ext:function(){var a=this.clean().match(/\.([\w\d]+)$/);
-return a?a[1]:""},dir:function(){var a=this.clean().lastIndexOf("/"),a=a!=-1?this.clean().substring(0,a):"",b=a!==""&&a.match(/^(https?:\/|file:\/)$/);return b&&b[1]?this.clean():a},filename:function(){var a=this.clean(),b=a.lastIndexOf("/"),b=b!=-1?a.substring(b+1,a.length):a,c=b.match(/^(https?:\/|file:\/)$/);return c&&c[1]?a:b},domain:function(){var a=this.path.match(/^(?:https?:\/\/)([^\/]*)/);return a?a[1]:null},join:function(a){return g(a).joinFrom(this.path)},joinFrom:function(a,b){var d=g(a);
-if(this.protocol()){var e=this.domain(),d=d.domain();return e&&e==d?e?this.afterDomain():this.toReferenceFromSameDomain(a):this.path}else if(a===c.pageUrl().dir()&&!b)return this.path;else if(this.isLocalAbsolute())return(d.domain()?d.protocol()+"//"+d.domain():"")+this.path;else{if(a==="")return this.path.replace(/\/$/,"");var e=a.split("/"),d=this.path.split("/"),f=d[0];for(a.match(/\/$/)&&e.pop();f==".."&&d.length>0;){if(!e.pop())break;d.shift();f=d[0]}return e.concat(d).join("/")}},relative:function(){return this.path.match(/^(https?:|file:|\/)/)===
-null},afterDomain:function(){return this.path.match(/https?:\/\/[^\/]*(.*)/)[1]},toReferenceFromSameDomain:function(a){for(var b=this.path.split("/"),a=a.split("/"),c="";b.length>0&&a.length>0&&b[0]==a[0];)b.shift(),a.shift();o(a,function(){c+="../"});return c+b.join("/")},isCrossDomain:function(){return this.isLocalAbsolute()?!1:this.domain()!=g(i.location.href).domain()},isLocalAbsolute:function(){return this.path.indexOf("/")===0},protocol:function(){var a=this.path.match(/^(https?:|file:)/);return a&&
-a[0]},getAbsolutePath:function(){var a=g.cur().dir(),b=g(a);return b.relative()?b.joinFrom(c.root.path,!0):a},normalize:function(){var a=g.cur().dir(),b=this.path;if(/^\/\//.test(this.path))b=this.path.substr(2);else if(/^\.\//.test(this.path))this.path=this.path.substr(2),b=this.joinFrom(a),this.path="./"+this.path;else if(!/^[^\.|\/]/.test(this.path)&&(this.relative()||g.cur().isCrossDomain()&&!this.protocol()))b=this.joinFrom(a);return b}});var p=[],S=0,s={};c.p={make:function(a){var b=new c.p.init(a),
-d=b.options.rootSrc;b.unique&&d&&(!s[d]&&!s[d+".js"]?s[d]=b:(b=s[d],k(b.options,a)));return b},init:function(a){this.dependencies=[];this.id=++S;if(a)if(typeof a=="function"){var b=g.cur().path;this.options={fn:function(){g.cur(b);a(c.send||i.jQuery||c)},rootSrc:b,orig:a,type:"fn"};this.waits=!0;this.unique=!1}else this.orig=a,this.options=c.makeOptions(k({},typeof a=="string"?{src:a}:a)),this.waits=this.options.waits||!1,this.unique=!0;else this.options={},this.waits=!1,this.pack="production.js"},
-complete:function(){this.completed=!0},loaded:function(a){var b,d,a=a&&a.src||this.options.src;g.cur(this.options.rootSrc);this.isLoaded=!0;J&&a&&(b=l[a]);b||(b=p.slice(0),p=[]);if(b.length){var e=this,f,i=c.options.env=="production",j=[],h=function(a,b,d,e){var f=[d,e];o(a,function(a,c){f.unshift(c,b)});t.apply(c,f)},k=function(a,b,c,d){o(c,function(c,e){t(a,b,e,d)})};o(b.reverse(),function(a,b){if(!i||!b.ignore)d=c.p.make(b),e.dependencies.unshift(d),d.waits===!1?j.push(d):(f?(h(j.length?j.concat(d):
-[d],"complete",f,"load"),k(d,"complete",j.length?j:[f],"load")):(h(j.length?j.concat(d):[d],"complete",e,"complete"),j.length&&k(d,"complete",j,"load")),f=d,j=[])});j.length?(f?h(j,"complete",f,"load"):h(j,"complete",e,"complete"),o(j.reverse(),function(){this.load()})):f?f.load():e.complete()}else this.complete()},load:function(){if(!this.loading&&!this.isLoaded){this.loading=!0;var a=this;c.require(this.options,this.orig,function(b){a.loaded(b)},function(){clearTimeout(a.completeTimeout);throw"steal.js : "+
-a.options.src+" not completed";})}}};c.p.init.prototype=c.p;var L;k(c,{root:g(""),rootUrl:function(a){if(a!==void 0){c.root=g(a);var b=c.pageUrl(),a=b.join(a);g.cur(b.toReferenceFromSameDomain(a));return c}else return c.root.path},extend:k,pageUrl:function(a){return a?(L=g(g(a).clean()),c):L||g("")},cur:function(a){return a===void 0?g.cur():(g.cur(a),c)},browser:{rhino:i.load&&i.readUrl&&i.readFile},options:{env:"development",loadProduction:!0},add:function(a){s[a.rootSrc]=a},makeOptions:function(a){if(!g(a.src).ext())a.src.indexOf(".")==
-0||a.src.indexOf("/")==0?a.src+=".js":a.src=a.src+"/"+g(a.src).filename()+".js";var b=c.File(a.src).normalize(),d=c.File(a.src).protocol();k(a,{originalSrc:a.src,rootSrc:b,src:c.root.join(b),protocol:d||(h?location.protocol:"file:")});a.originalSrc=a.src;return a},then:function(){var a=typeof arguments[0]=="function"?arguments:[function(){}].concat(x(arguments));return c.apply(i,a)},callOnArgs:function(a){return function(){for(var b=0;b<arguments.length;b++)a(arguments[b]);return c}},bind:function(a,
-b){v[a]||(v[a]=[]);var d=c.events[a];d&&d.add&&(b=d.add(b));b&&v[a].push(b);return c},one:function(a,b){c.bind(a,function(){b.apply(this,arguments);c.unbind(arguments.callee)});return c},events:{},unbind:function(a,b){for(var c=v[a]||[],e=0;e<c.length;)b===c[e]?c.splice(e,1):e++},trigger:function(a,b){o(v[a]||[],function(a,c){c(b)})},loading:function(){useInteractive=!1;for(var a=0;a<arguments.length;a++)c.p.make(arguments[a]).loading=!0},loaded:function(a){a=c.p.make(a);a.loading=!0;a.loaded();return c}});
-var v={},u=m(u,function(){c.pageUrl(i.location?i.location.href:"")}),q={};c.type=function(a,b){var c=a.split(" ");if(!b)return q[c.shift()].require;q[c.shift()]={require:b,convert:c}};c.p.load=m(c.p.load,function(){var a=this.options;if(!a.type){var b=g(a.src).ext();!b&&!q[b]&&(b="js");a.type=b}b=q[a.type].convert;a.buildType=b.length?b[b.length-1]:a.type});c.require=function(a,b,c,e){var f=q[a.type];f.convert.length?(f=f.convert.slice(0),f.unshift("text",a.type)):f=[a.type];G(a,b,f,c,e)};var M=function(a){a.onreadystatechange=
-a.onload=a.onerror=null;r().removeChild(a)},z;c.type("js",function(a,b,c,e){var f=E();a.text?f.text=a.text:(b=function(){if(!f.readyState||R.test(f.readyState))M(f),c(f)},f.attachEvent?f.attachEvent("onreadystatechange",b):f.onload=b,I&&e&&a.protocol!=="file:"&&(f.attachEvent?f.attachEvent("onerror",e):f.onerror=e),f.src=a.src,f.onSuccess=c);try{z=f,r().insertBefore(f,r().firstChild)}catch(g){console.log(g)}a.text&&(c(),M(f))});c.type("fn",function(a,b,c){c(a.fn())});c.type("text",function(a,b,d,
-e){c.request(a,function(b){a.text=b;d(b)},e)});var w=0,T=h&&h.createStyleSheet,N,O;c.type("css",function(a,b,c){if(a.text){var e=h.createElement("style");typeof e.styleSheet!=="undefined"?setTimeout(function(){e.styleSheet.cssText=a.text},0):function(a){e.childNodes.length>0?e.firstChild.nodeValue!==a.nodeValue&&e.replaceChild(a,e.firstChild):e.appendChild(a)}(h.createTextNode(a.text));r().appendChild(e)}else{if(T){w==0?(N=document.createStyleSheet(a.src),O=a,w++):(b=g(a.src).joinFrom(g(O.src).dir()),
-console.log(b),N.addImport(b),w++,w==30&&(w=0));c();return}a=a||{};b=h.createElement("link");b.rel=a.rel||"stylesheet";b.href=a.src;b.type="text/css";r().appendChild(b)}c()});(function(){if(F.types)for(var a in F.types)c.type(a,F.types[a])})();var U=function(){return i.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest};c.request=function(a,b,c){var e=new U,f=a.contentType||"application/x-www-form-urlencoded; charset=utf-8",g=function(){e=h=g=null},h=function(){e.readyState===
-4&&(e.status===500||e.status===404||e.status===2||e.status===0&&e.responseText===""?c&&c():b(e.responseText),g())};e.open("GET",a.src,a.async===!1?!1:!0);e.setRequestHeader("Content-type",f);e.overrideMimeType&&e.overrideMimeType(f);e.onreadystatechange=function(){h()};try{e.send(null)}catch(i){console.error(i),c&&c(),g()}};var P=function(a){var b,d;for(b in c.mappings)if(d=c.mappings[b],d.test.test(a))return a.replace(b,d.path);return a};g.prototype.mapJoin=function(a){a=P(a);return g(a).joinFrom(this.path)};
-c.makeOptions=n(c.makeOptions,function(a){a.src=c.root.join(a.rootSrc=P(a.rootSrc))});c.mappings={};c.map=function(a,b){if(typeof a=="string")c.mappings[a]={test:RegExp("^("+a+")([/.]|$)"),path:b};else for(var d in a)c.map(d,a[d]);return this};var A;k(c,{before:function(){},after:function(){if(!A){var a=A=new c.p.init,b=function(){c.trigger("start",a);t(a,"complete",function(){c.trigger("end",a)});a.loaded()};i.setTimeout?setTimeout(b,0):b()}},_before:m,_after:n});c.p.complete=m(c.p.complete,function(){this===
-A&&(A=null)});(function(){var a=!1,b,d=!1;c.p.loaded=m(c.p.loaded,function(){var c=typeof jQuery!=="undefined"?jQuery:null;c&&"readyWait"in c&&!a&&(b=c,c.readyWait+=1,a=!0)});c.bind("end",function(){a&&!d&&(b.ready(!0),d=!0)})})();c.p.load=n(c.p.load,function(){if(i.document&&!this.completed&&!this.completeTimeout&&(this.options.protocol=="file:"||!I)){var a=this;this.completeTimeout=setTimeout(function(){throw"steal.js : "+a.options.src+" not completed";},5E3)}});c.p.complete=n(c.p.complete,function(){this.completeTimeout&&
-clearTimeout(this.completeTimeout)});k(H.prototype,{called:function(){this.calls--;this.go()},add:function(a,b){var c=D(a,b);c.called||(c.callbacks.push(this),this.calls++)},go:function(){if(this.calls===0)this.obj[this.meth]()}});c.browser.rhino&&typeof console=="undefined"&&(console={log:function(){print.apply(null,arguments)}});var B={load:function(){},end:function(){}};firstEnd=!1;(function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):c()})(i,"load",
-function(){B.load()});c.one("end",function(a){B.end();firstEnd=a;c.trigger("done",firstEnd)});t(B,"load",B,"end",function(){c.trigger("ready");c.isReady=!0});c.events.done={add:function(a){return firstEnd?(a(firstEnd),!1):a}};c.p.make=n(c.p.make,function(a){a.isLoaded&&a.options.has&&a.loadHas();return a},!0);c.p.loaded=m(c.p.loaded,function(){this.options.has&&this.loadHas()});c.p.loadHas=function(){var a,b,d=g.cur();for(b=0;b<this.options.has.length;b++)g.cur(d),a=c.p.make(this.options.has[b]),
-D(a,"complete"),a.loaded()};var C,l={},Q=function(){var a,b,c;if(C&&C.readyState==="interactive")return C;a=document.getElementsByTagName("script");for(b=a.length-1;b>-1&&(c=a[b]);b--)if(c.readyState==="interactive")return c;return z&&z.readyState=="interactive"?z:null};if(J)c.after=n(c.after,function(){var a=Q();if(a&&a.src&&!/steal\.(production\.)*js/.test(a.src)){var b=a.src;l[b]||(l[b]=[]);b&&(l[b].push.apply(l[b],p),p=[],C=a)}}),c.loaded=m(c.loaded,function(a){var a=s[a].options.src,b=Q().src;
-l[a]=l[b];l[b]=null});c.getScriptOptions=function(a){var b;if(!(b=a))a:{if(h){b=h.getElementsByTagName("script");for(var a=/steal\.(production\.)?js/,d=0,e=b.length;d<e;d++){var f=b[d].src;if(f&&a.test(f)){b=b[d];break a}}}b=void 0}a=b;b={};if(a){a=a.src;d=a.replace(/steal(\.production)?\.js.*/,"");b.rootUrl=/steal\/$/.test(d)?d.substr(0,d.length-6):d+"../";if(/steal\.production\.js/.test(a))b.env="production";if(a.indexOf("?")!==-1){a=a.split("?")[1];a=a.split(",");if(a[0]&&a[0].lastIndexOf(".js")>
-0)b.startFile=a[0];else if(a[0])b.app=a[0];if(a[1]&&c.options.env!="production")b.env=a[1]}}return b};u=n(u,function(){k(c.options,c.getScriptOptions());typeof y=="object"&&k(c.options,y);c.rootUrl(c.options.rootUrl);if(c.options.app)c.options.startFile=c.options.app+"/"+c.options.app.match(/[^\/]+$/)[0]+".js";if(!c.options.logLevel)c.options.logLevel=0;if(!c.options.production&&c.options.startFile)c.options.production=g(c.options.startFile).dir()+"/production.js";c.options.production&&(c.options.production+=
-c.options.production.indexOf(".js")==-1?".js":"");if(c.options.env=="production"&&c.options.loadProduction){if(c.options.production&&c({src:c.options.production,force:!0}),c.options.loaded)for(var a=0;a<c.options.loaded.length;a++)c.loaded(c.options.loaded[a])}else a=[],c.options.loadDev!==!1&&a.push({src:"steal/dev/dev.js",ignore:!0}),c.options.startFile&&a.push(c.options.startFile),a.length&&c.apply(null,a)});c.when=t;i.steal=c;u()})();
+(function(){function b(){var a=x(arguments);b.before(a);q.push.apply(q,arguments);b.after(a);return b}function G(a,c,b,e,f){m[b.shift()].require(a,c,function(){b.length?G(a,c,b,e,f):e.apply(this,arguments)},f)}function n(a,c,b){return b?function(){return a.apply(this,c.apply(this,arguments))}:function(){c.apply(this,arguments);return a.apply(this,arguments)}}function o(a,c,b){return b?function(){return c.apply(this,[a.apply(this,arguments)].concat(x(arguments)))}:function(){var b=a.apply(this,arguments);
+c.apply(this,arguments);return b}}function E(a,c){var b=a[c];if(!a[c].callbacks)a[c]=function(){var c=arguments.callee,f;f=b.apply(a,arguments);var g=c.callbacks,j=g.length;c.called=true;for(c=0;c<j;c++)g[c].called();return f},a[c].callbacks=[];return a[c]}function H(a,c){this.obj=a;this.meth=c;E(a,c);this.calls=0}function s(){var a=x(arguments),c=a[a.length-1];typeof c==="function"&&(a[a.length-1]={fn:c},a.push("fn"));for(var c=a.pop(),b=a.pop(),c=new H(b,c),b=0;b<a.length;b+=2)c.add(a[b],a[b+1]);
+c.go()}var h=function(){return this}.call(null),i=h.document,T=/loaded|complete/,I=function(a){var c=i.createElement("script");c.type=a||"text/javascript";return c},t=function(){var a=i.documentElement,c=i.getElementsByTagName("head")[0];c||(c=i.createElement("head"),a.insertBefore(c,a.firstChild));t=function(){return c};return c},k=function(a,c){for(var b in c)a[b]=c[b];return a},x=function(a){var c=[];p(a,function(a,b){c.push(b)});return c},p=function(a,c){for(var b=0,e=a.length;b<e;b++)c.call(a[b],
+b,a[b])},J=i&&function(){var a=I();a.setAttribute("onerror","return;");return typeof a.onerror==="function"?true:"onerror"in a}(),K=false,u=function(){},y=h.steal,F=typeof y=="object"?y:{};b.File=function(a){if(this.constructor!=b.File)return new b.File(a);this.path=typeof a=="string"?a:a.path};var g=b.File,L;g.cur=function(a){if(a!==void 0)L=g(a);else return L||g("")};k(g.prototype,{clean:function(){return this.path.match(/([^\?#]*)/)[1]},ext:function(){var a=this.clean().match(/\.([\w\d]+)$/);return a?
+a[1]:""},dir:function(){var a=this.clean().lastIndexOf("/"),a=a!=-1?this.clean().substring(0,a):"",c=a!==""&&a.match(/^(https?:\/|file:\/)$/);return c&&c[1]?this.clean():a},filename:function(){var a=this.clean(),c=a.lastIndexOf("/"),c=c!=-1?a.substring(c+1,a.length):a,b=c.match(/^(https?:\/|file:\/)$/);return b&&b[1]?a:c},domain:function(){var a=this.path.match(/^(?:https?:\/\/)([^\/]*)/);return a?a[1]:null},join:function(a){return g(a).joinFrom(this.path)},joinFrom:function(a,c){var d=g(a);if(this.protocol()){var e=
+this.domain(),d=d.domain();return e&&e==d?e?this.afterDomain():this.toReferenceFromSameDomain(a):this.path}else if(a===b.pageUrl().dir()&&!c)return this.path;else if(this.isLocalAbsolute())return(d.domain()?d.protocol()+"//"+d.domain():"")+this.path;else{if(a==="")return this.path.replace(/\/$/,"");var e=a.split("/"),d=this.path.split("/"),f=d[0];for(a.match(/\/$/)&&e.pop();f==".."&&d.length>0;){if(!e.pop())break;d.shift();f=d[0]}return e.concat(d).join("/")}},relative:function(){return this.path.match(/^(https?:|file:|\/)/)===
+null},afterDomain:function(){return this.path.match(/https?:\/\/[^\/]*(.*)/)[1]},toReferenceFromSameDomain:function(a){for(var c=this.path.split("/"),a=a.split("/"),b="";c.length>0&&a.length>0&&c[0]==a[0];)c.shift(),a.shift();p(a,function(){b+="../"});return b+c.join("/")},isCrossDomain:function(){return this.isLocalAbsolute()?false:this.domain()!=g(h.location.href).domain()},isLocalAbsolute:function(){return this.path.indexOf("/")===0},protocol:function(){var a=this.path.match(/^(https?:|file:)/);
+return a&&a[0]},getAbsolutePath:function(){var a=g.cur().dir(),c=g(a);return c.relative()?c.joinFrom(b.root.path,true):a},normalize:function(){var a=g.cur().dir(),c=this.path;if(/^\/\//.test(this.path))c=this.path.substr(2);else if(/^\.\//.test(this.path))this.path=this.path.substr(2),c=this.joinFrom(a),this.path="./"+this.path;else if(!/^[^\.|\/]/.test(this.path)&&(this.relative()||g.cur().isCrossDomain()&&!this.protocol()))c=this.joinFrom(a);return c}});var q=[],U=0,r={};b.p={make:function(a){var c=
+new b.p.init(a),d=c.options.rootSrc;c.unique&&d&&(!r[d]&&!r[d+".js"]?r[d]=c:(c=r[d],k(c.options,typeof a==="string"?{}:a)));return c},init:function(a){this.dependencies=[];this.id=++U;if(a)if(typeof a=="function"){var c=g.cur().path;this.options={fn:function(){g.cur(c);a(b.send||h.jQuery||b)},rootSrc:c,orig:a,type:"fn"};this.waits=true;this.unique=false}else this.orig=a,this.options=b.makeOptions(k({},typeof a=="string"?{src:a}:a)),this.waits=this.options.waits||false,this.unique=true;else this.options=
+{},this.waits=false,this.pack="production.js"},complete:function(){this.completed=true},loaded:function(a){var c,d,a=a&&a.src||this.options.src;g.cur(this.options.rootSrc);this.isLoaded=true;K&&a&&(c=l[a]);c||(c=q.slice(0),q=[]);if(c.length){var e=this,f,h=b.options.env=="production",j=[],i=function(a,c,d,e){var f=[d,e];p(a,function(a,b){f.unshift(b,c)});s.apply(b,f)},k=function(a,c,b,d){p(b,function(b,e){s(a,c,e,d)})};p(c.reverse(),function(a,c){if(!h||!c.ignore)d=b.p.make(c),e.dependencies.unshift(d),
+d.waits===false?j.push(d):(f?(i(j.length?j.concat(d):[d],"complete",f,"load"),k(d,"complete",j.length?j:[f],"load")):(i(j.length?j.concat(d):[d],"complete",e,"complete"),j.length&&k(d,"complete",j,"load")),f=d,j=[])});j.length?(f?i(j,"complete",f,"load"):i(j,"complete",e,"complete"),p(j.reverse(),function(){this.load()})):f?f.load():e.complete()}else this.complete()},load:function(){if(!this.loading&&!this.isLoaded){this.loading=true;var a=this;b.require(this.options,this.orig,function(c){a.loaded(c)},
+function(){clearTimeout(a.completeTimeout);throw"steal.js : "+a.options.src+" not completed";})}}};b.p.init.prototype=b.p;var M;k(b,{root:g(""),rootUrl:function(a){if(a!==void 0){b.root=g(a);var c=b.pageUrl(),a=c.join(a);g.cur(c.toReferenceFromSameDomain(a));return b}else return b.root.path},extend:k,pageUrl:function(a){return a?(M=g(g(a).clean()),b):M||g("")},cur:function(a){return a===void 0?g.cur():(g.cur(a),b)},browser:{rhino:h.load&&h.readUrl&&h.readFile},options:{env:"development",loadProduction:true},
+add:function(a){r[a.rootSrc]=a},makeOptions:function(a){if(!g(a.src).ext())a.src.indexOf(".")==0||a.src.indexOf("/")==0?a.src+=".js":a.src=a.src+"/"+g(a.src).filename()+".js";var c=b.File(a.src).normalize(),d=b.File(a.src).protocol();k(a,{originalSrc:a.src,rootSrc:c,src:b.root.join(c),protocol:d||(i?location.protocol:"file:")});a.originalSrc=a.src;return a},then:function(){var a=typeof arguments[0]=="function"?arguments:[function(){}].concat(x(arguments));return b.apply(h,a)},callOnArgs:function(a){return function(){for(var c=
+0;c<arguments.length;c++)a(arguments[c]);return b}},bind:function(a,c){v[a]||(v[a]=[]);var d=b.events[a];d&&d.add&&(c=d.add(c));c&&v[a].push(c);return b},one:function(a,c){b.bind(a,function(){c.apply(this,arguments);b.unbind(arguments.callee)});return b},events:{},unbind:function(a,c){for(var b=v[a]||[],e=0;e<b.length;)c===b[e]?b.splice(e,1):e++},trigger:function(a,c){p(v[a]||[],function(a,b){b(c)})},loading:function(){useInteractive=false;for(var a=0;a<arguments.length;a++)b.p.make(arguments[a]).loading=
+true},loaded:function(a){a=b.p.make(a);a.loading=true;a.loaded();return b}});var v={},u=n(u,function(){b.pageUrl(h.location?h.location.href:"")}),m={};b.type=function(a,c){var b=a.split(" ");if(!c)return m[b.shift()].require;m[b.shift()]={require:c,convert:b}};b.p.load=n(b.p.load,function(){var a=this.options;if(!a.type){var c=g(a.src).ext();!c&&!m[c]&&(c="js");a.type=c}if(!m[a.type])throw"steal.js - type "+a.type+" has not been loaded.";c=m[a.type].convert;a.buildType=c.length?c[c.length-1]:a.type});
+b.require=function(a,c,b,e){var f=m[a.type];f.convert.length?(f=f.convert.slice(0),f.unshift("text",a.type)):f=[a.type];G(a,c,f,b,e)};var N=function(a){a.onreadystatechange=a.onload=a.onerror=null;t().removeChild(a)},z;b.type("js",function(a,c,b,e){var f=I();a.text?f.text=a.text:(c=function(){if(!f.readyState||T.test(f.readyState))N(f),b(f)},f.attachEvent?f.attachEvent("onreadystatechange",c):f.onload=c,J&&e&&a.protocol!=="file:"&&(f.attachEvent?f.attachEvent("onerror",e):f.onerror=e),f.src=a.src,
+f.onSuccess=b);try{z=f,t().insertBefore(f,t().firstChild)}catch(g){console.log(g)}a.text&&(b(),N(f))});b.type("fn",function(a,c,b){b(a.fn())});b.type("text",function(a,c,d,e){b.request(a,function(c){a.text=c;d(c)},e)});var w=0,V=i&&i.createStyleSheet,O,P;b.type("css",function(a,c,b){if(a.text)c=i.createElement("style"),c.type="text/css",c.styleSheet?c.styleSheet.cssText=a.text:(a=i.createTextNode(a.text),c.childNodes.length>0?c.firstChild.nodeValue!==a.nodeValue&&c.replaceChild(a,c.firstChild):c.appendChild(a));
+else{if(V){w==0?(O=document.createStyleSheet(a.src),P=a,w++):(a=g(a.src).joinFrom(g(P.src).dir()),O.addImport(a),w++,w==30&&(w=0));b();return}a=a||{};c=i.createElement("link");c.rel=a.rel||"stylesheet";c.href=a.src;c.type="text/css"}t().appendChild(c);b()});(function(){if(F.types)for(var a in F.types)b.type(a,F.types[a])})();var W=function(){return h.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest};b.request=function(a,c,b){var e=new W,f=a.contentType||"application/x-www-form-urlencoded; charset=utf-8",
+g=function(){e=h=g=null},h=function(){e.readyState===4&&(e.status===500||e.status===404||e.status===2||e.status===0&&e.responseText===""?b&&b():c(e.responseText),g())};e.open("GET",a.src,a.async===false?false:true);e.setRequestHeader("Content-type",f);e.overrideMimeType&&e.overrideMimeType(f);e.onreadystatechange=function(){h()};try{e.send(null)}catch(i){console.error(i),b&&b(),g()}};var Q=function(a){var c,d;for(c in b.mappings)if(d=b.mappings[c],d.test.test(a))return a.replace(c,d.path);return a};
+g.prototype.mapJoin=function(a){a=Q(a);return g(a).joinFrom(this.path)};b.makeOptions=o(b.makeOptions,function(a){a.src=b.root.join(a.rootSrc=Q(a.rootSrc))});b.mappings={};b.map=function(a,c){if(typeof a=="string")b.mappings[a]={test:RegExp("^("+a+")([/.]|$)"),path:c};else for(var d in a)b.map(d,a[d]);return this};var A;k(b,{before:function(){},after:function(){if(!A){var a=A=new b.p.init,c=function(){b.trigger("start",a);s(a,"complete",function(){b.trigger("end",a)});a.loaded()};h.setTimeout?setTimeout(c,
+0):c()}},_before:n,_after:o});b.p.complete=n(b.p.complete,function(){this===A&&(A=null)});(function(){var a=false,c,d=false;b.p.loaded=n(b.p.loaded,function(){var b=typeof jQuery!=="undefined"?jQuery:null;b&&"readyWait"in b&&!a&&(c=b,b.readyWait+=1,a=true)});b.bind("end",function(){a&&!d&&(c.ready(true),d=true)})})();b.p.load=o(b.p.load,function(){if(h.document&&!this.completed&&!this.completeTimeout&&(this.options.protocol=="file:"||!J)){var a=this;this.completeTimeout=setTimeout(function(){throw"steal.js : "+
+a.options.src+" not completed";},5E3)}});b.p.complete=o(b.p.complete,function(){this.completeTimeout&&clearTimeout(this.completeTimeout)});k(H.prototype,{called:function(){this.calls--;this.go()},add:function(a,c){var b=E(a,c);b.called||(b.callbacks.push(this),this.calls++)},go:function(){if(this.calls===0)this.obj[this.meth]()}});b.browser.rhino&&typeof console=="undefined"&&(console={log:function(){print.apply(null,arguments)}});var B={load:function(){},end:function(){}},C=false;(function(a,c,b){a.addEventListener?
+a.addEventListener(c,b,false):a.attachEvent?a.attachEvent("on"+c,b):b()})(h,"load",function(){B.load()});b.one("end",function(a){B.end();C=a;b.trigger("done",C)});s(B,"load",B,"end",function(){b.trigger("ready");b.isReady=true});b.events.done={add:function(a){return C?(a(C),false):a}};b.p.make=o(b.p.make,function(a){a.options.has&&(a.isLoaded?a.loadHas():b.loading.apply(b,a.options.has));return a},true);b.p.loaded=n(b.p.loaded,function(){this.options.has&&this.loadHas()});b.p.loadHas=function(){var a,
+c,d=g.cur();for(c=0;c<this.options.has.length;c++)g.cur(d),a=b.p.make(this.options.has[c]),E(a,"complete"),a.loaded()};var D,l={},R=function(){var a,c,b=i.getElementsByTagName("script");for(a=b.length-1;a>-1&&(c=b[a]);a--)if(c.readyState==="interactive")return c},S=function(){var a;return D&&D.readyState==="interactive"?D:(a=R())?a:z&&z.readyState=="interactive"?z:null};if(K=i&&!!R())b.after=o(b.after,function(){var a=S();if(a&&a.src&&!/steal\.(production\.)*js/.test(a.src)){var b=a.src;l[b]||(l[b]=
+[]);b&&(l[b].push.apply(l[b],q),q=[],D=a)}}),b.loaded=n(b.loaded,function(a){var a=r[a].options.src,b=S().src;l[a]=l[b];l[b]=null});h.location&&/mode=commandline/.test(h.location.search)&&b(decodeURIComponent(h.location.search).replace(/-/g,"/").match(/client=([\w|\/]+)/)[1]+"/client.js");b.getScriptOptions=function(a){var c;if(!(c=a))a:{if(i){c=i.getElementsByTagName("script");for(var a=/steal\.(production\.)?js/,d=0,e=c.length;d<e;d++){var f=c[d].src;if(f&&a.test(f)){c=c[d];break a}}}c=void 0}a=
+c;c={};if(a){a=a.src;d=a.replace(/steal(\.production)?\.js.*/,"");c.rootUrl=/steal\/$/.test(d)?d.substr(0,d.length-6):d+"../";if(/steal\.production\.js/.test(a))c.env="production";if(a.indexOf("?")!==-1){a=a.split("?")[1];a=a.split(",");if(a[0]&&a[0].lastIndexOf(".js")>0)c.startFile=a[0];else if(a[0])c.app=a[0];if(a[1]&&b.options.env!="production")c.env=a[1]}}return c};u=o(u,function(){k(b.options,b.getScriptOptions());typeof y=="object"&&k(b.options,y);b.rootUrl(b.options.rootUrl);if(b.options.app)b.options.startFile=
+b.options.app+"/"+b.options.app.match(/[^\/]+$/)[0]+".js";if(!b.options.logLevel)b.options.logLevel=0;if(!b.options.production&&b.options.startFile)b.options.production=g(b.options.startFile).dir()+"/production.js";b.options.production&&(b.options.production+=b.options.production.indexOf(".js")==-1?".js":"");if(b.options.env=="production"&&b.options.loadProduction){if(b.options.production&&b({src:b.options.production,force:true}),b.options.loaded)for(var a=0;a<b.options.loaded.length;a++)b.loaded(b.options.loaded[a])}else a=
+[],b.options.loadDev!==false&&a.push({src:"steal/dev/dev.js",ignore:true}),b.options.startFile&&a.push(b.options.startFile),a.length&&b.apply(null,a)});b.when=s;h.steal=b;u()})();

0 comments on commit 73f86e9

Please sign in to comment.