Skip to content
Browse files

- define `j`

  • Loading branch information...
1 parent b6c5fbc commit 326782877067090842b9a3861890f0f23c33b889 @ded committed Apr 24, 2012
Showing with 17 additions and 17 deletions.
  1. +7 −7 dist/script.js
  2. +1 −1 dist/script.min.js
  3. +1 −1 package.json
  4. +1 −1 src/ender.js
  5. +7 −7 src/script.js
View
14 dist/script.js
@@ -4,10 +4,10 @@
* (c) Dustin Diaz, Jacob Thornton 2011
* License: MIT
*/
-(function (name, definition) {
- if (typeof module != 'undefined') module.exports = definition()
- else if (typeof define == 'function' && define.amd) define(name, definition)
- else this[name] = definition()
+(function (name, definition, context) {
+ if (typeof context['module'] != 'undefined' && context['module']['exports']) context['module']['exports'] = definition()
+ else if (typeof context['define'] != 'undefined' && context['define'] == 'function' && context['define']['amd']) define(name, definition)
+ else context[name] = definition()
})('$script', function () {
var doc = document
, head = doc.getElementsByTagName('head')[0]
@@ -17,8 +17,8 @@
, push = 'push', domContentLoaded = 'DOMContentLoaded', readyState = 'readyState'
, addEventListener = 'addEventListener', onreadystatechange = 'onreadystatechange'
- function every(ar, fn, i) {
- for (i = 0, j = ar.length; i < j; ++i) if (!fn(ar[i])) return f
+ function every(ar, fn) {
+ for (var i = 0, j = ar.length; i < j; ++i) if (!fn(ar[i])) return f
return 1
}
function each(ar, fn) {
@@ -109,4 +109,4 @@
return $script
}
return $script
-});
+}, this);
View
2 dist/script.min.js
@@ -4,4 +4,4 @@
* (c) Dustin Diaz, Jacob Thornton 2011
* License: MIT
*/
-(function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&define.amd?define(a,b):this[a]=b()})("$script",function(){function q(a,b,c){for(c=0,j=a.length;c<j;++c)if(!b(a[c]))return k;return 1}function r(a,b){q(a,function(a){return!b(a)})}function s(a,b,i){function o(a){return a.call?a():d[a]}function p(){if(!--n){d[m]=1,k&&k();for(var a in f)q(a.split("|"),o)&&!r(f[a],o)&&(f[a]=[])}}a=a[l]?a:[a];var j=b&&b.call,k=j?b:i,m=j?a.join(""):b,n=a.length;return setTimeout(function(){r(a,function(a){if(h[a])return m&&(e[m]=1),h[a]==2&&p();h[a]=1,m&&(e[m]=1),t(!c.test(a)&&g?g+a+".js":a,p)})},0),s}function t(c,d){var e=a.createElement("script"),f=k;e.onload=e.onerror=e[p]=function(){if(e[n]&&!/^c|loade/.test(e[n])||f)return;e.onload=e[p]=null,f=1,h[c]=2,d()},e.async=1,e.src=c,b.insertBefore(e,b.firstChild)}var a=document,b=a.getElementsByTagName("head")[0],c=/^https?:\/\//,d={},e={},f={},g,h={},i="string",k=!1,l="push",m="DOMContentLoaded",n="readyState",o="addEventListener",p="onreadystatechange";return!a[n]&&a[o]&&(a[o](m,function u(){a.removeEventListener(m,u,k),a[n]="complete"},k),a[n]="loading"),s.get=t,s.order=function(a,b,c){(function d(e){e=a.shift(),a.length?s(e,d):s(e,b,c)})()},s.path=function(a){g=a},s.ready=function(a,b,c){a=a[l]?a:[a];var e=[];return!r(a,function(a){d[a]||e[l](a)})&&q(a,function(a){return d[a]})?b():!function(a){f[a]=f[a]||[],f[a][l](b),c&&c(e)}(a.join("|")),s},s})
+(function(a,b,c){typeof c["module"]!="undefined"&&c.module.exports?c.module.exports=b():typeof c["define"]!="undefined"&&c["define"]=="function"&&c.define.amd?define(a,b):c[a]=b()})("$script",function(){function p(a,b){for(var c=0,d=a.length;c<d;++c)if(!b(a[c]))return j;return 1}function q(a,b){p(a,function(a){return!b(a)})}function r(a,b,i){function o(a){return a.call?a():d[a]}function t(){if(!--n){d[m]=1,l&&l();for(var a in f)p(a.split("|"),o)&&!q(f[a],o)&&(f[a]=[])}}a=a[k]?a:[a];var j=b&&b.call,l=j?b:i,m=j?a.join(""):b,n=a.length;return setTimeout(function(){q(a,function(a){if(h[a])return m&&(e[m]=1),h[a]==2&&t();h[a]=1,m&&(e[m]=1),s(!c.test(a)&&g?g+a+".js":a,t)})},0),r}function s(c,d){var e=a.createElement("script"),f=j;e.onload=e.onerror=e[o]=function(){if(e[m]&&!/^c|loade/.test(e[m])||f)return;e.onload=e[o]=null,f=1,h[c]=2,d()},e.async=1,e.src=c,b.insertBefore(e,b.firstChild)}var a=document,b=a.getElementsByTagName("head")[0],c=/^https?:\/\//,d={},e={},f={},g,h={},i="string",j=!1,k="push",l="DOMContentLoaded",m="readyState",n="addEventListener",o="onreadystatechange";return!a[m]&&a[n]&&(a[n](l,function t(){a.removeEventListener(l,t,j),a[m]="complete"},j),a[m]="loading"),r.get=s,r.order=function(a,b,c){(function d(e){e=a.shift(),a.length?r(e,d):r(e,b,c)})()},r.path=function(a){g=a},r.ready=function(a,b,c){a=a[k]?a:[a];var e=[];return!q(a,function(a){d[a]||e[k](a)})&&p(a,function(a){return d[a]})?b():!function(a){f[a]=f[a]||[],f[a][k](b),c&&c(e)}(a.join("|")),r},r},this)
View
2 package.json
@@ -2,7 +2,7 @@
"name": "scriptjs"
, "description": "Asyncronous JavaScript loader and dependency manager"
, "keywords": ["ender", "script", "dependency", "ajax", "jsonp", "loader"]
- , "version": "2.2.5"
+ , "version": "2.2.6"
, "homepage": "https://github.com/ded/script.js"
, "author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)"
, "contributors": ["Jacob Thornton <jacob@twitter.com> (https://github.com/fat)"]
View
2 src/ender.js
@@ -4,4 +4,4 @@ ender.ender({
, require: s
, ready: s.ready
, getScript: s.get
-})
+});
View
14 src/script.js
@@ -1,7 +1,7 @@
-(function (name, definition) {
- if (typeof module != 'undefined') module.exports = definition()
- else if (typeof define == 'function' && define.amd) define(name, definition)
- else this[name] = definition()
+(function (name, definition, context) {
+ if (typeof context['module'] != 'undefined' && context['module']['exports']) context['module']['exports'] = definition()
+ else if (typeof context['define'] != 'undefined' && context['define'] == 'function' && context['define']['amd']) define(name, definition)
+ else context[name] = definition()
})('$script', function () {
var doc = document
, head = doc.getElementsByTagName('head')[0]
@@ -11,8 +11,8 @@
, push = 'push', domContentLoaded = 'DOMContentLoaded', readyState = 'readyState'
, addEventListener = 'addEventListener', onreadystatechange = 'onreadystatechange'
- function every(ar, fn, i) {
- for (i = 0, j = ar.length; i < j; ++i) if (!fn(ar[i])) return f
+ function every(ar, fn) {
+ for (var i = 0, j = ar.length; i < j; ++i) if (!fn(ar[i])) return f
return 1
}
function each(ar, fn) {
@@ -103,4 +103,4 @@
return $script
}
return $script
-});
+}, this);

0 comments on commit 3267828

Please sign in to comment.
Something went wrong with that request. Please try again.