Skip to content

Instantly share code, notes, and snippets.

@vinaydotblog
Last active February 9, 2016 05:43
Show Gist options
  • Save vinaydotblog/af85a4c4190c3df73f33 to your computer and use it in GitHub Desktop.
Save vinaydotblog/af85a4c4190c3df73f33 to your computer and use it in GitHub Desktop.
/*
* @author Vinay Aggarwal
* @date 9-feb-2016
* @url https://gist.github.com/vinnizworld/af85a4c4190c3df73f33
*/
(function(){var t=window.libs,u=window.SITE_URL||"/",m=[],d={},w=function(a,e,c){if(d[a])d[a].push(e);else{if(~m.indexOf(a))return e();d[a]=[];c=document.createElement("script");c.type="text/javascript";document.head.appendChild(c);c.addEventListener("load",function(){m.push(a);d[a]&&(d[a].map(function(a){a()}),d[a]=null);e(a)});c.onerror=function(){};0===a.indexOf("http")?c.src=a:0===a.indexOf("//")?c.src=a:c.src=u+a}},p=!1;document.addEventListener("DOMContentLoaded",function(a){p=!0});window.require=
function(){var a=[],e=[],c=0,d=0,f={},g=!1,q=!1,k=!1,r=function(){g=!0;k&&h()},n=function(){q=!0},h=function(){};f.ready=function(a){p?g?h():k=!0:document.addEventListener("DOMContentLoaded",function(a){g?h():k=!0});p&&g?h():h=a;return f};f.done=function(a){g?a():r=function(){g=!0;k&&h();a()};return f};f.fail=function(a){q?a():n=function(){q=!0;a()};return f};for(c=0;c<arguments.length;c++){var b=arguments[c];if("function"===typeof b){k=!0;r=b;break}if(!t[b])return n(),console.error("Script: %s doesn't exists!",
b);b=t[b];"string"===typeof b?a.push(b):"object"===typeof b&&(b.js?"string"===typeof b.js?a.push(b.js):b.js.slice&&(a=a.concat(b.js)):b.css&&("string"===typeof b.css?e.push(b.css):b.css.slice&&(e=b.css.concat(e))))}if(!a.length)return n(),console.error("no script to load");var m=a.length,v=function(){d<m?w(a[d++],v,n):r()};v();for(var b=0,l,b=0;b<e.length;b++)l=document.createElement("link"),l.href=u+"scripts/"+e[c],l.rel="stylesheet",l.type="text/css",document.head.appendChild(l);return f}})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment