// Gallery plugin written by Towfiq I.
jQuery(window).ready(function() {
//Check if image links to attachment
jQuery('.gallery-item a[href*="attachment_id"]').each(function() {
jQuery(this).addClass('attachedlink');
});
jQuery('.gallery').each(function() {
jQuery(this).has('.attachedlink').addClass('defgallery');
});
//remove any
inside the gallery markup
jQuery(".gallery br").remove();
//Empty Caption FIX
jQuery('.gallery-item:not(:has(.gallery-caption))').prepend('
');
//wrap all .gallery-item with .gall_dash / For making the thumbnail navigation area
jQuery(".gallery").each(function (){jQuery(this).find(".gallery-item").wrapAll('');});
jQuery('.gall_dash .hasimg').removeClass('hasimg');
//Prepend the big image area. and load the src image of the first thumbnail. The.ast_full is for fancybox integration.
jQuery(".single_post .gallery").prepend("");
//==============REMAP AND APPEND THE MAIN IMAGES================
jQuery(".gallery").each(function (){
var gallid = jQuery(this).attr('id');
var tn_array = jQuery(this).find(".gallery-item a").map(function() {
return jQuery(this).attr("href");
});
var tn_array_cap = jQuery(this).find(".gallery-caption").map(function() {
return jQuery(this).text();
});
var tn_array_src = jQuery(this).find(".gallery-item img").map(function() {
return jQuery(this).attr("src");
});
var pageLimit= jQuery(this).find(".gall_dash img").size() - 1;
for (var i = 0; i <= pageLimit; i++) {
var article = jQuery(this).find(".gallery-item a");
jQuery(article[i]).addClass("" + i + "");
jQuery(article[i]).attr('id' , "vis" + i + "");
jQuery(this).find('.ast_gall_wrap').append("");
jQuery(this).find('.ast_gall_wrap').after('')
}
});
});
jQuery(window).ready(function() {
jQuery(".ast_gall_wrap").each(function (){
jQuery(this).waitForImages(function() {
jQuery(this).css({"minHeight":"initial"});
jQuery(this).parent().find('.sk-spinner-wave').hide();
jQuery(this).fadeIn();
jQuery(this).nivoSlider({
effect: 'fade',
animSpeed:300,
pauseTime:3000,
startSlide:0,
slices:5,
directionNav:true,
directionNavHide:true,
controlNav:true,
controlNavThumbs:true,
keyboardNav:true,
manualAdvance: true,
afterChange: function(){
jQuery(this).parent().find('.ast_full').attr('href', jQuery(this).find('.nivo-main-image').attr('src'));
jQuery(this).find('.nivo-caption').css({"width":jQuery(this).find('.nivo-main-image').width()});
}
});
jQuery(this).parent().find('.ast_full').attr('href', jQuery(this).find('.nivo-main-image').attr('src'));
jQuery(".ast_full").fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'speedIn' : 400,
'speedOut' : 200,
'overlayShow' : true,
'hideOnContentClick' : true,
'titleShow':false
});
});
});
});