Johann Burkard

Code snippets, quotes, BASH scripts and nonsense. Not surprisingly, my main site is called Johann Burkard, too. Check out my web applications: Online Audio Converter, QR Code Generator, Pearson and Spearman Correlation calculator, PDF to JPEG Converter, Forex Data Feed and my exchange rates calculator based on currencyfeed.com. Also, check out Ole’s Tauschbörse Arbeit.

Page 1 · Page 2 · Page 3 · Page 4 · Page 5 · Page 6 · Page 7 · Page 8 · Page 9 · Page 10

Feb 01 2011

458 B cross-domain JavaScript/JSON-P loader

(Somewhat) readable

function load(u,c){
 var b=document, element = 'script', s=b.createElement(element), name=2166136261,
  i = u.length, backup = c, callback = /=\?/,
  b=b.body, x='onreadystatechange', y='onload', z='readyState';
 if (callback.test(u)) {
  while (i--) {
   name = (name * 16777619) ^ u.charCodeAt(i);
  }
  window[element += (name < 0 ? -name : name)] = function() {
   backup.apply(backup, arguments);
   delete window[element];
  }
  u = u.replace(callback, '=' + element);
  c = 0;
 }
 s[y]=s[x]=function(){
  if (/de|m/.test(s[z]||'m')) {
   c && c();
   b.removeChild(s);
   try { for (c in s) delete s[c]; } catch (e) {}
  }
 };
 s.src=u;
 window.setTimeout(function(){b.appendChild(s)},0);
}

Closure compressed (458 B)

function load(b,c){var d=document,f="script",a=d.createElement(f),e=2166136261,g=b.length,h=c,i=/=\?/,d=d.body;if(i.test(b)){for(;g--;)e=e*16777619^b.charCodeAt(g);window[f+=e<0?-e:e]=function(){h.apply(h,arguments);delete window[f]};b=b.replace(i,"="+f);c=0}a.onload=a.onreadystatechange=function(){if(/de|m/.test(a.readyState||"m")){c&&c();d.removeChild(a);try{for(c in a)delete a[c]}catch(b){}}};a.src=b;window.setTimeout(function(){d.appendChild(a)},0)};

Page 1 · Page 2 · Page 3 · Page 4 · Page 5 · Page 6 · Page 7 · Page 8 · Page 9 · Page 10

Johann Burkard, , @johannburkard
Teisendorf, Germany
N 47° 51' 5.904", E 12° 49' 0.012"