1
0
mirror of https://github.com/arsenetar/pelican-red.git synced 2024-11-22 19:29:02 +00:00
pelican-red/static/js/app.js
Andrew Senetar d42e24c57f Update javacript to use minified source files loading via yepnopejs
Vendor javascript files are now minified versions. The javacript files are
loaded via yepnopejs (Modernizr.load) using app.js. The finishes the
javascript portion of issue #4.
2013-07-13 23:36:42 -04:00

44 lines
1.1 KiB
JavaScript

// Javascript loaded via modernizr.load (aka yepnopejs )
// Find the baseURL
var baseURL = '';
var scripts = document.getElementsByTagName('script');
for( var i = 0, l = scripts.length; i < l; i++ ){
if(scripts[i].src.indexOf('modernizr') >= 0)
baseURL = scripts[i].getAttribute('data');
}
yepnope.errorTimeout = 3000; // set 3 second error timeout instead of 10
// zeptojs or jquery
Modernizr.load([{
test: '__proto__' in {},
yep: 'http://cdn.jsdelivr.net/zepto/1.0/zepto.min.js',
nope: 'http://cdn.jsdelivr.net/jquery/1.10.2/jquery-1.10.2.min.js',
complete: function() {
if( !window.jQuery && !window.Zepto )
Modernizr.load([{
test: '__proto__' in {},
yep: baseURL+'zepto.min.js',
nope: baseURL+'jquery.min.js',
}])
}
},
// Foundation
{
load: 'http://cdn.jsdelivr.net/foundation/4.2.3/js/foundation.min.js',
complete: function(){
if(!window.Foundation)
Modernizr.load([{
load: baseURL+'foundation.min.js',
complete: function() { $(document).foundation() },
}]);
else {
$(document).foundation()
}
}
},
]);