// taken from https://raw.github.com/ervwalter/octopress-ewal/5dd64d3b52f183e18e1bb035ee288b09ac70c554/source/javascripts/slash.js
(function($){
// Open external links in new window
var externalLinks = function(){
var host = location.host;
$('body').on('click', 'a', function(e){
var href = this.href,
link = href.replace(/https?:\/\/([^\/]+)(.*)/, '$1');
if (link != '' && link != host && !$(this).hasClass('fancybox')){
window.open(href);
e.preventDefault();
}
});
};
// Append caption after pictures
var appendCaption = function(){
$('.entry-content').each(function(i){
var _i = i;
$(this).find('img').each(function(){
var alt = this.alt;
if (alt != ''){
$(this).after(''+alt+'');
}
$(this).wrap('');
});
});
};
$('.entry-content').each(function(i){
var _i = i;
$(this).find('img.fancybox').each(function(){
var img = $(this);
var title = img.attr("title");
var classes = img.attr("class");
img.removeAttr("class");
img.wrap('');
if (title != "")
{
img.parent().attr("title", title);
}
});
});
$('.fancybox').fancybox();
})(jQuery);