summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/carousel/jetpack-carousel.js')
-rw-r--r--plugins/jetpack/modules/carousel/jetpack-carousel.js40
1 files changed, 27 insertions, 13 deletions
diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.js b/plugins/jetpack/modules/carousel/jetpack-carousel.js
index 95b6c4b0..a4b6aac4 100644
--- a/plugins/jetpack/modules/carousel/jetpack-carousel.js
+++ b/plugins/jetpack/modules/carousel/jetpack-carousel.js
@@ -86,7 +86,7 @@ jQuery(document).ready(function($) {
buttons = $('<div class="jp-carousel-buttons">' + buttons + '</div>');
- caption = $('<h2></h2>');
+ caption = $('<h2 itemprop="caption description"></h2>');
photo_info = $('<div class="jp-carousel-photo-info"></div>').append(caption);
imageMeta = $('<div></div>')
@@ -226,11 +226,14 @@ jQuery(document).ready(function($) {
container = $('<div></div>')
.addClass('jp-carousel-wrap')
.addClass( 'jp-carousel-transitions' );
-
if ( 'white' === jetpackCarouselStrings.background_color ) {
container.addClass('jp-carousel-light');
}
+ container.attr('itemscope', '');
+
+ container.attr('itemtype', 'http://schema.org/ImageGallery');
+
container.css({
'position' : 'fixed',
'top' : 0,
@@ -902,7 +905,7 @@ jQuery(document).ready(function($) {
.css( 'width', '100%' )
.css( 'height', '100%' );
- var slide = $('<div class="jp-carousel-slide"></div>')
+ var slide = $('<div class="jp-carousel-slide" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject"></div>')
.hide()
.css({
//'position' : 'fixed',
@@ -987,7 +990,7 @@ jQuery(document).ready(function($) {
if ( medium_width >= args.max_width || medium_height >= args.max_height ) {
return args.medium_file;
}
-
+
if ( isPhotonUrl ) {
// args.orig_file doesn't point to a Photon url, so in this case we use args.large_file
// to return the photon url of the original image.
@@ -1016,7 +1019,7 @@ jQuery(document).ready(function($) {
if ( '9999' === size_parts[0] ) {
size_parts[0] = '0';
}
-
+
if ( '9999' === size_parts[1] ) {
size_parts[1] = '0';
}
@@ -1230,12 +1233,23 @@ jQuery(document).ready(function($) {
if(!current || !current.data) {
return false;
}
- var original = current.data('orig-file').replace(/\?.+$/, ''),
- origSize = current.data('orig-size').split(','),
- permalink = $( '<a>'+gallery.jp_carousel('format', {'text': jetpackCarouselStrings.download_original, 'replacements': origSize})+'</a>' )
- .addClass( 'jp-carousel-image-download' )
- .attr( 'href', original )
- .attr( 'target', '_blank' );
+ var original,
+ origSize = current.data('orig-size').split(',' ),
+ imageLinkParser = document.createElement( 'a' );
+
+ imageLinkParser.href = current.data( 'src' ).replace( /\?.+$/, '' );
+
+ // Is this a Photon URL?
+ if ( imageLinkParser.hostname.match( /^i[\d]{1}.wp.com$/i ) !== null ) {
+ original = imageLinkParser.href;
+ } else {
+ original = current.data('orig-file').replace(/\?.+$/, '');
+ }
+
+ var permalink = $( '<a>'+gallery.jp_carousel('format', {'text': jetpackCarouselStrings.download_original, 'replacements': origSize})+'</a>' )
+ .addClass( 'jp-carousel-image-download' )
+ .attr( 'href', original )
+ .attr( 'target', '_blank' );
// Update (replace) the content of the anchor
$( 'div.jp-carousel-image-meta a.jp-carousel-image-download' ).replaceWith( permalink );
@@ -1436,9 +1450,9 @@ jQuery(document).ready(function($) {
} );
if ( ! slide.data( 'preview-image' ) || ( slide.data( 'thumb-size' ) && slide.width() > slide.data( 'thumb-size' ).width ) ) {
- image.attr( 'src', image.closest( '.jp-carousel-slide' ).data( 'src' ) );
+ image.attr( 'src', image.closest( '.jp-carousel-slide' ).data( 'src' ) ).attr('itemprop', 'image');
} else {
- image.attr( 'src', slide.data( 'preview-image' ) );
+ image.attr( 'src', slide.data( 'preview-image' ) ).attr('itemprop', 'image');
}
image.data( 'loaded', 1 );