Team:Aachen/Template:Team:Aachen/JS/figureac

$('.figure').each(function () {

   var directlink = $(this).find('img').attr('src');
   var link = $(this).find('.image');
   var title = $(this).find('td:eq(1)').html(); 
   
   link.attr('href', directlink);
   link.attr('caption', title);

});

$('.figraw').each(function (i, obj) {

   var classes = obj.className.split(' ');
   if ($.inArray('figure-large', classes) != -1)
       obj.className = "figure figure-large col-xs-12 col-sm-12 col-lg-8";
   else if ($.inArray('figure-medium', classes) != -1)
       obj.className = "figure figure-medium col-xs-12 col-sm-6 col-md-4"; // do not pull-right because this destroys the centered floating
   else if ($.inArray('figure-small', classes) != -1)
       obj.className = "figure figure-small col-xs-12 col-sm-6 col-md-3 pull-left";

});


$(document).ready(function () {

   $("a.image").each(function () {
       $(this).fancybox({
           title:  $(this).attr('caption'),
           helpers: {
               overlay: {
                   locked: false
               },
               title: {
                   type: 'inside'
               }
           }
       });
   });

});