'$isVertical',
jcarousel : '$usejcarousel',
thumbnailColumns : '$thumbnailColumns',
thumbnail_caption : '$thumbnail_caption',
caption1_css : '$caption1_css_properties',
caption2_css : '$caption2_css_properties',
onImage : function( image, caption1, caption2, thumb ) {
image.css('display','none').fadeIn(500);
caption1.css('display','none').fadeIn(50);
caption2.css('display','none').fadeIn(50);
var _li = thumb.parents('li');
_li.siblings().children('img.selected').fadeTo(500,0.5);
thumb.fadeTo('fast',1).addClass('selected');
image.attr('title',' Click to Show Next image >> ');
},
onThumb : function( thumb ) {
var _li = thumb.parents('li');
var _fadeTo = _li.is('.active') ? '1' : '0.5';
thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1000);
thumb.hover(
function() { thumb.fadeTo('fast',1); },
function() { _li.not('.active').children('img').fadeTo('fast',0.5); }
)
if ( '$dblclick' != 'nothing' ) {
thumb.bind( 'dblclick', function() {
var _imgsrc = thumb.attr('rel');
var _title = thumb.attr('title');
var _is_ngg = thumb.hasClass('ngg_gallery');
var _posturl = './' + _imgsrc.split(/\//g).pop().replace(/\...(.)+$/, '/');
var _openmode = '$dblclick';
var _dest = ( _openmode.indexOf('post') < 0 || _is_ngg ) ? _imgsrc : _posturl;
if ( _openmode.indexOf('current') < 0 ) {
window.open( _dest );
} else {
location.href = _dest;
}
});
}
}
});
if ( $hideThumbnail == 1 ) {
// hide thumbnails
jQuery('ul.$galleryID').css('display', 'none' );
}
if ( $showNavigation == 1 ) {
// show navigation items
jQuery('div.$galleryID p.galleria_nav').css('display', 'block' );
//
if ( $playbutton == 1 ) {
jQuery('div.$galleryID button.play').css('display', 'block' );
// automatic navigation
jQuery('div.$galleryID button.play').click( function() {
if ( jQuery(this).text() == '".__('Play','galleria-wp')."' ) {
jQuery(this).text( '".__('Stop','galleria-wp')."' );
timerID_$galleryID = setInterval( \"jQuery.galleria.next( 'stage_$galleryID', '$galleryID' );\", $intervalMilliSec );
} else {
clearInterval( timerID_$galleryID );
jQuery(this).text( '".__('Play','galleria-wp')."' );
}
} );
} else {
// hide the play button
jQuery('div.$galleryID button.play').css('display', 'none' );
}
// add keybord navigation [ May 04th 2008 by Y2 ]
jQuery(document).keydown( function (e) {
if ( e.which == 27 && ($playbutton == 1) ) { // Escape Key
if ( jQuery('div.$galleryID button.play').text() == '".__('Stop','galleria-wp')."' ) {
clearInterval( timerID_$galleryID );
jQuery('div.$galleryID button.play').text( '".__('Play','galleria-wp')."' );
}
}
});
} // end of if ( $navigation == 1 )\n" );
return $output_buffer;
}
function preparejCarouselCallback( $numOfGalleries ) {
global $gGalleryClass;
$output_buffer = "";
for ( $i = 1; $i <= $numOfGalleries; $i++ ) {
$galleryID = $gGalleryClass[$i];
$output_buffer .= apply_filters( 'gallery_style',"
var jqc_gallery$i = new Object();
function mycarousel_initCallback_$i( carousel, status ) {
jqc_gallery$i = carousel;
}
function mycarousel_itemLoadCallback_$i( carousel, status ) {
var div_caption = jQuery('div.galleria_wp_thumb_caption.$galleryID');
var span_first = jQuery('div.galleria_wp_thumb_caption.$galleryID > span.first');
var span_last = jQuery('div.galleria_wp_thumb_caption.$galleryID > span.last');
if ( !carousel.options.vertical ) {
new_length = carousel.clip.width() + 'px';
div_caption.css('width', new_length );
span_first.text(carousel.first);
span_last.text(carousel.last);
span_first.css( 'display' , 'block' ).css( 'z-index' , '999' );
span_first.css( 'background-color' , 'black' ).css( 'color' , 'white' );
span_first.fadeIn(100);
span_first.fadeTo(5000,0.5, function() {
//jQuery(this).css( 'z-index' , '0' );
//jQuery(this).css( 'display' , 'none' );
} );
span_last.css( 'display' , 'block' ).css( 'z-index' , '999' );
span_last.css( 'color' , 'white' ).css( 'background-color' , 'black' );
span_last.fadeIn(100);
span_last.fadeTo(5000,0.5, function() {
//jQuery(this).css( 'z-index' , '0' );
//jQuery(this).css( 'display' , 'none' );
} );
}
}\n" );
} // end of [ for ( $i = 1; $i < $numOfGalleries; $i++ ) {} ]
$output_buffer .= apply_filters( 'gallery_style',"
function jcarousel_scroll_to_active_item( target_class ) {
var num_of_items =
parseInt( jQuery('ul.' + target_class + ' li:last-child').attr('jcarouselindex') );
var jq_active_list = jQuery('ul.' + target_class + ' li.active');
if ( jq_active_list ) {
var active_item_index = parseInt( jq_active_list.attr('jcarouselindex') );
if ( active_item_index > 0 &&
active_item_index <= num_of_items ) {
switch( target_class ) { \n");
for ( $i = 1; $i <= $numOfGalleries; $i++ ) {
$output_buffer .= apply_filters( 'gallery_style',"
case 'gallery$i' :
jqc_gallery$i.scroll( active_item_index, true );
break;
");
} // end of [ for ( $i = 1; $i <= $numOfGalleries; $i++ ) ]
$output_buffer .= apply_filters( 'gallery_style',"
default:
break;
}
}
}
}\n" );
return $output_buffer;
}
function preparejCarouselScript( $numOfGalleries ) {
global $gCarouselAttrColumns;
global $gCarouselAttrSteps;
global $gCarouselThumbWidth;
global $gCarouselThumbHeight;
global $gCarouselIsVertical;
global $gCarouselAutoHideButton;
$output_buffer = "";
for ( $i = 1; $i <= $numOfGalleries; $i++ ) {
$columns = $gCarouselAttrColumns[$i];
$steps = $gCarouselAttrSteps[$i];
$thumb_w = $gCarouselThumbWidth[$i];
$thumb_h = $gCarouselThumbHeight[$i];
$vertical_mode = ($gCarouselIsVertical[$i]) ? 'true': 'false';
$auto_hide = $gCarouselAutoHideButton[$i];
$output_buffer .= apply_filters( 'gallery_style',"
jQuery('ul.gallery$i').jcarousel({
vertical : $vertical_mode,
visible: $columns,
scroll: $steps,
thumb_w: $thumb_w,
thumb_h: $thumb_h,
auto_hide: $auto_hide,
initCallback: mycarousel_initCallback_$i,
itemLoadCallback: mycarousel_itemLoadCallback_$i
}); // end of [ jQuery('ul.gallery$i').jcarousel() {} ] \n" );
} // end of [ for ( $i = 1; $i <= $numOfGalleries; $i++ ) {} ]
return $output_buffer;
}
//==========================================================================//
// following three functions are minor modification version of //
// the "/wp-include/media.php" //
//==========================================================================//
function _wp_get_attachment_image( $attachment_id,
$size='thumbnail',
$icon = false ) {
$html = '';
$image = _wp_get_attachment_image_src($attachment_id, $size, $icon);
if ( $image ) {
list($src, $width, $height) = $image;
$hwstring = image_hwstring($width, $height);
if ( is_array($size) )
$size = join('x', $size);
$html = '';
}
return $html;
}
function _wp_get_attachment_image_src( $attachment_id,
$size='thumbnail',
$icon = false ) {
// get a thumbnail or intermediate image if there is one
if ( $image = _image_downsize($attachment_id, $size) )
return $image;
if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
$icon_dir =
apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
$src_file = $icon_dir . '/' . basename($src);
@list($width, $height) = getimagesize($src_file);
}
if ( $src && $width && $height )
return array( $src, $width, $height );
return false;
}
function _image_downsize($id, $size = 'medium') {
if ( !wp_attachment_is_image($id) )
return false;
$img_url = wp_get_attachment_url($id);
$meta = wp_get_attachment_metadata($id);
$width = $height = 0;
// plugins can use this to provide resize services
if ( $out = apply_filters('_image_downsize', false, $id, $size) )
return $out;
// try for a new style intermediate size
if ( $intermediate = image_get_intermediate_size($id, $size) ) {
$img_url = str_replace(basename($img_url), $intermediate['file'], $img_url);
$width = $intermediate['width'];
$height = $intermediate['height'];
}
elseif ( $size == 'thumbnail' ) {
// fall back to the old thumbnail
$thumb_file = wp_get_attachment_thumb_file( $id ); // modified by Y2
if ( $info = getimagesize($thumb_file) ) { //
$img_url = str_replace(basename($img_url), basename($thumb_file), $img_url);
$width = $info[0];
$height = $info[1];
}
}
if ( !$width && !$height && isset($meta['width'], $meta['height']) ) {
// any other type: use the real image and constrain it
list( $width, $height ) =
image_constrain_size_for_editor( $meta['width'],
$meta['height'], $size );
}
if ( $img_url)
return array( $img_url, $width, $height );
return false;
}
?>