2013-07-14 03:36:42 +00:00
|
|
|
// 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
|
|
|
|
|
2013-07-29 09:53:34 +00:00
|
|
|
function ready(){
|
|
|
|
// Hack to fix .codehilitetable overflow
|
|
|
|
$('.codehilitetable').wrap('<div class="codehilitewrapper">');
|
2013-07-29 20:09:35 +00:00
|
|
|
// Hack to make images more responsive and wrap with .th class
|
|
|
|
$('#main article img').each( function() {
|
|
|
|
$(this).css({'height': '', 'width': ''});
|
2013-07-30 18:44:31 +00:00
|
|
|
$(this).wrap('<a class="th" href="'+$(this).attr('src')+'" style="max-width:'+Math.min(this.naturalWidth, 770)+'px">');
|
2013-07-29 20:09:35 +00:00
|
|
|
});
|
2013-07-29 09:53:34 +00:00
|
|
|
};
|
|
|
|
|
2013-07-14 03:36:42 +00:00
|
|
|
// zeptojs or jquery
|
|
|
|
Modernizr.load([{
|
|
|
|
test: '__proto__' in {},
|
2013-11-09 20:57:26 +00:00
|
|
|
yep: 'http://cdn.jsdelivr.net/foundation/4.3.2/js/vendor/zepto.js',
|
2013-07-14 03:36:42 +00:00
|
|
|
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
|
|
|
|
{
|
2013-11-09 20:57:26 +00:00
|
|
|
load: 'http://cdn.jsdelivr.net/foundation/4.3.2/js/foundation.min.js',
|
2013-07-14 03:36:42 +00:00
|
|
|
complete: function(){
|
|
|
|
if(!window.Foundation)
|
|
|
|
Modernizr.load([{
|
|
|
|
load: baseURL+'foundation.min.js',
|
2013-07-29 09:53:34 +00:00
|
|
|
complete: function() {
|
|
|
|
$(document).foundation()
|
|
|
|
ready()
|
|
|
|
},
|
2013-07-14 03:36:42 +00:00
|
|
|
}]);
|
|
|
|
else {
|
|
|
|
$(document).foundation()
|
2013-07-29 09:53:34 +00:00
|
|
|
ready()
|
2013-07-14 03:36:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
|