Version Description
- Updated it to match original JetPack plugin updates from 3.1.1
- Fix: Language POT file
- Fix: WordPress 4.0 compatibility
Download this release
Release Info
| Developer | n7studios |
| Plugin | |
| Version | 0.7.3 |
| Comparing to | |
| See all releases | |
Code changes from version 0.7.2 to 0.7.3
- carousel-without-jetpack.php +1 -1
- carousel/class.jetpack-options.php +1 -0
- carousel/images/arrows-2x.png +0 -0
- carousel/images/arrows.png +0 -0
- carousel/images/carousel-sprite-2x.png +0 -0
- carousel/images/carousel-sprite.png +0 -0
- carousel/jetpack-carousel-ie8fix.css +10 -5
- carousel/jetpack-carousel.css +29 -9
- carousel/jetpack-carousel.js +333 -237
- carousel/jetpack-carousel.php +71 -52
- carousel/rtl/jetpack-carousel-rtl.css +37 -16
- languages/carousel-without-jetpack.pot +204 -0
- languages/carousel-xx_XX.pot +0 -21
- readme.txt +6 -1
carousel-without-jetpack.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Plugin Name: Gallery Carousel Without JetPack
|
| 4 |
Plugin URI: http://www.wpbeginner.com/
|
| 5 |
Description: Transform your standard galleries into an immersive full-screen experience without requiring you to connect to WordPress.com
|
| 6 |
-
Version: 0.7.
|
| 7 |
Author: Syed Balkhi
|
| 8 |
Author URI: http://www.wpbeginner.com
|
| 9 |
License: GPLv2 or later
|
| 3 |
Plugin Name: Gallery Carousel Without JetPack
|
| 4 |
Plugin URI: http://www.wpbeginner.com/
|
| 5 |
Description: Transform your standard galleries into an immersive full-screen experience without requiring you to connect to WordPress.com
|
| 6 |
+
Version: 0.7.3
|
| 7 |
Author: Syed Balkhi
|
| 8 |
Author URI: http://www.wpbeginner.com
|
| 9 |
License: GPLv2 or later
|
carousel/class.jetpack-options.php
CHANGED
|
@@ -39,6 +39,7 @@ class No_Jetpack_Options {
|
|
| 39 |
'gplus_authors', // (array) The Google+ authorship information for connected users.
|
| 40 |
'last_heartbeat', // (int) The timestamp of the last heartbeat that fired.
|
| 41 |
'sync_bulk_reindexing', // (bool) If a bulk reindex is currently underway.
|
|
|
|
| 42 |
);
|
| 43 |
}
|
| 44 |
|
| 39 |
'gplus_authors', // (array) The Google+ authorship information for connected users.
|
| 40 |
'last_heartbeat', // (int) The timestamp of the last heartbeat that fired.
|
| 41 |
'sync_bulk_reindexing', // (bool) If a bulk reindex is currently underway.
|
| 42 |
+
'json_api_full_management', // (bool) Allow full management (eg. Activate, Upgrade plugins) of the site via the JSON API.
|
| 43 |
);
|
| 44 |
}
|
| 45 |
|
carousel/images/arrows-2x.png
CHANGED
|
Binary file
|
carousel/images/arrows.png
CHANGED
|
Binary file
|
carousel/images/carousel-sprite-2x.png
CHANGED
|
Binary file
|
carousel/images/carousel-sprite.png
CHANGED
|
Binary file
|
carousel/jetpack-carousel-ie8fix.css
CHANGED
|
@@ -1,8 +1,13 @@
|
|
| 1 |
.jp-carousel .jp-carousel-slide {
|
| 2 |
-
|
| 3 |
}
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
display: block !important;
|
| 8 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
.jp-carousel .jp-carousel-slide {
|
| 2 |
+
display: none !important;
|
| 3 |
}
|
| 4 |
+
.jp-carousel {
|
| 5 |
+
text-align: center!important;
|
| 6 |
+
width:100%!important;
|
|
|
|
| 7 |
}
|
| 8 |
+
.jp-carousel .selected {
|
| 9 |
+
margin: 0 auto;
|
| 10 |
+
display: block !important;
|
| 11 |
+
width: auto;
|
| 12 |
+
position: relative!important;
|
| 13 |
+
}
|
carousel/jetpack-carousel.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
* {
|
| 2 |
line-height:inherit; /* prevent declarations of line-height in the universal selector */
|
| 3 |
}
|
| 4 |
|
|
@@ -270,8 +270,8 @@ div.jp-carousel-buttons a.jp-carousel-like,
|
|
| 270 |
div.jp-carousel-buttons a.jp-carousel-reblog,
|
| 271 |
div.jp-carousel-buttons a.jp-carousel-commentlink,
|
| 272 |
a.jp-carousel-image-download {
|
| 273 |
-
background: url(./images/carousel-sprite.png?
|
| 274 |
-
background-size: 16px
|
| 275 |
}
|
| 276 |
|
| 277 |
div.jp-carousel-buttons a.jp-carousel-reblog,
|
|
@@ -304,9 +304,12 @@ div.jp-carousel-buttons a.jp-carousel-reblog.reblogged:hover {
|
|
| 304 |
}
|
| 305 |
|
| 306 |
div.jp-carousel-buttons a.jp-carousel-commentlink {
|
| 307 |
-
background-position: 0px -
|
| 308 |
padding-left: 19px !important;
|
| 309 |
}
|
|
|
|
|
|
|
|
|
|
| 310 |
|
| 311 |
div.jp-carousel-buttons a.jp-carousel-reblog.reblogged:hover {
|
| 312 |
cursor: default;
|
|
@@ -335,7 +338,7 @@ only screen and (min-device-pixel-ratio: 1.5) {
|
|
| 335 |
div.jp-carousel-buttons a.jp-carousel-reblog,
|
| 336 |
div.jp-carousel-buttons a.jp-carousel-commentlink,
|
| 337 |
a.jp-carousel-image-download {
|
| 338 |
-
background-image: url(./images/carousel-sprite-2x.png?
|
| 339 |
}
|
| 340 |
}
|
| 341 |
|
|
@@ -574,6 +577,9 @@ a.jp-carousel-image-download {
|
|
| 574 |
text-decoration: none;
|
| 575 |
background-position: 0 -82px;
|
| 576 |
}
|
|
|
|
|
|
|
|
|
|
| 577 |
|
| 578 |
a.jp-carousel-image-download span.photo-size {
|
| 579 |
font-size: 11px;
|
|
@@ -587,10 +593,13 @@ a.jp-carousel-image-download span.photo-size-times {
|
|
| 587 |
}
|
| 588 |
|
| 589 |
a.jp-carousel-image-download:hover {
|
| 590 |
-
background-position: 0 -
|
| 591 |
color: #68c9e8;
|
| 592 |
border: none !important;
|
| 593 |
}
|
|
|
|
|
|
|
|
|
|
| 594 |
|
| 595 |
/** Meta Box End **/
|
| 596 |
|
|
@@ -930,7 +939,10 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
|
|
| 930 |
}
|
| 931 |
|
| 932 |
.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-commentlink {
|
| 933 |
-
background-position: 0px -
|
|
|
|
|
|
|
|
|
|
| 934 |
}
|
| 935 |
|
| 936 |
.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-like,
|
|
@@ -1020,14 +1032,22 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
|
|
| 1020 |
}
|
| 1021 |
|
| 1022 |
.jp-carousel-light a.jp-carousel-image-download {
|
| 1023 |
-
background-position: 0 -
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1024 |
}
|
| 1025 |
|
| 1026 |
.jp-carousel-light a.jp-carousel-image-download:hover {
|
| 1027 |
-
background-position: 0 -
|
| 1028 |
color: #f1831e;
|
| 1029 |
}
|
| 1030 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1031 |
.jp-carousel-light textarea#jp-carousel-comment-form-comment-field {
|
| 1032 |
background: #fbfbfb;
|
| 1033 |
color: #333;
|
| 1 |
+
.jp-carousel-wrap * {
|
| 2 |
line-height:inherit; /* prevent declarations of line-height in the universal selector */
|
| 3 |
}
|
| 4 |
|
| 270 |
div.jp-carousel-buttons a.jp-carousel-reblog,
|
| 271 |
div.jp-carousel-buttons a.jp-carousel-commentlink,
|
| 272 |
a.jp-carousel-image-download {
|
| 273 |
+
background: url(./images/carousel-sprite.png?5) no-repeat;
|
| 274 |
+
background-size: 16px 200px;
|
| 275 |
}
|
| 276 |
|
| 277 |
div.jp-carousel-buttons a.jp-carousel-reblog,
|
| 304 |
}
|
| 305 |
|
| 306 |
div.jp-carousel-buttons a.jp-carousel-commentlink {
|
| 307 |
+
background-position: 0px -156px;
|
| 308 |
padding-left: 19px !important;
|
| 309 |
}
|
| 310 |
+
.rtl div.jp-carousel-buttons a.jp-carousel-commentlink{
|
| 311 |
+
background-position: 100% -156px;
|
| 312 |
+
}
|
| 313 |
|
| 314 |
div.jp-carousel-buttons a.jp-carousel-reblog.reblogged:hover {
|
| 315 |
cursor: default;
|
| 338 |
div.jp-carousel-buttons a.jp-carousel-reblog,
|
| 339 |
div.jp-carousel-buttons a.jp-carousel-commentlink,
|
| 340 |
a.jp-carousel-image-download {
|
| 341 |
+
background-image: url(./images/carousel-sprite-2x.png?5);
|
| 342 |
}
|
| 343 |
}
|
| 344 |
|
| 577 |
text-decoration: none;
|
| 578 |
background-position: 0 -82px;
|
| 579 |
}
|
| 580 |
+
.rtl a.jp-carousel-image-download{
|
| 581 |
+
background-position: 100% -82px;
|
| 582 |
+
}
|
| 583 |
|
| 584 |
a.jp-carousel-image-download span.photo-size {
|
| 585 |
font-size: 11px;
|
| 593 |
}
|
| 594 |
|
| 595 |
a.jp-carousel-image-download:hover {
|
| 596 |
+
background-position: 0 -122px;
|
| 597 |
color: #68c9e8;
|
| 598 |
border: none !important;
|
| 599 |
}
|
| 600 |
+
.rtl a.jp-carousel-image-download:hover{
|
| 601 |
+
background-position: 100% -122px;
|
| 602 |
+
}
|
| 603 |
|
| 604 |
/** Meta Box End **/
|
| 605 |
|
| 939 |
}
|
| 940 |
|
| 941 |
.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-commentlink {
|
| 942 |
+
background-position: 0px -176px;
|
| 943 |
+
}
|
| 944 |
+
.rtl .jp-carousel-light div.jp-carousel-buttons a.jp-carousel-commentlink{
|
| 945 |
+
background-position: 100% -176px;
|
| 946 |
}
|
| 947 |
|
| 948 |
.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-like,
|
| 1032 |
}
|
| 1033 |
|
| 1034 |
.jp-carousel-light a.jp-carousel-image-download {
|
| 1035 |
+
background-position: 0 -122px;
|
| 1036 |
+
}
|
| 1037 |
+
|
| 1038 |
+
.rtl .jp-carousel-light a.jp-carousel-image-download {
|
| 1039 |
+
background-position: 100% -122px;
|
| 1040 |
}
|
| 1041 |
|
| 1042 |
.jp-carousel-light a.jp-carousel-image-download:hover {
|
| 1043 |
+
background-position: 0 -122px;
|
| 1044 |
color: #f1831e;
|
| 1045 |
}
|
| 1046 |
|
| 1047 |
+
.rtl .jp-carousel-light a.jp-carousel-image-download:hover {
|
| 1048 |
+
background-position: 100% -122px;
|
| 1049 |
+
}
|
| 1050 |
+
|
| 1051 |
.jp-carousel-light textarea#jp-carousel-comment-form-comment-field {
|
| 1052 |
background: #fbfbfb;
|
| 1053 |
color: #333;
|
carousel/jetpack-carousel.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
| 2 |
jQuery(document).ready(function($) {
|
| 3 |
|
| 4 |
// gallery faded layer and container elements
|
| 5 |
-
var overlay, comments, gallery, container, nextButton, previousButton, info,
|
| 6 |
-
caption, resizeTimeout,
|
| 7 |
screenPadding = 110, originalOverflow = $('body').css('overflow'), originalHOverflow = $('html').css('overflow'), proportion = 85,
|
| 8 |
-
last_known_location_hash = '';
|
| 9 |
|
| 10 |
if ( window.innerWidth <= 760 ) {
|
| 11 |
screenPadding = Math.round( ( window.innerWidth / 760 ) * 110 );
|
| 12 |
|
| 13 |
-
if ( screenPadding < 40 && ( ( 'ontouchstart' in window ) || window.DocumentTouch && document instanceof DocumentTouch ) )
|
| 14 |
screenPadding = 0;
|
|
|
|
| 15 |
}
|
| 16 |
|
| 17 |
var keyListener = function(e){
|
|
@@ -46,19 +50,18 @@ jQuery(document).ready(function($) {
|
|
| 46 |
}
|
| 47 |
};
|
| 48 |
|
| 49 |
-
var resizeListener = function(e){
|
| 50 |
clearTimeout(resizeTimeout);
|
| 51 |
resizeTimeout = setTimeout(function(){
|
| 52 |
gallery
|
| 53 |
.jp_carousel('slides')
|
| 54 |
.jp_carousel('fitSlide', true);
|
| 55 |
-
gallery
|
| 56 |
-
|
| 57 |
-
.jp_carousel('fitMeta', true);
|
| 58 |
}, 200);
|
| 59 |
};
|
| 60 |
|
| 61 |
-
var prepareGallery = function( dataCarouselExtra ){
|
| 62 |
if (!overlay) {
|
| 63 |
overlay = $('<div></div>')
|
| 64 |
.addClass('jp-carousel-overlay')
|
|
@@ -71,7 +74,7 @@ jQuery(document).ready(function($) {
|
|
| 71 |
});
|
| 72 |
|
| 73 |
var buttons = '<a class="jp-carousel-commentlink" href="#">' + jetpackCarouselStrings.comment + '</a>';
|
| 74 |
-
if ( 1
|
| 75 |
}
|
| 76 |
|
| 77 |
buttons = $('<div class="jp-carousel-buttons">' + buttons + '</div>');
|
|
@@ -89,9 +92,9 @@ jQuery(document).ready(function($) {
|
|
| 89 |
|
| 90 |
imageMeta
|
| 91 |
.append( buttons )
|
| 92 |
-
.append(
|
| 93 |
-
.append(
|
| 94 |
-
.append(
|
| 95 |
|
| 96 |
titleAndDescription = $('<div></div>')
|
| 97 |
.addClass('jp-carousel-titleanddesc')
|
|
@@ -105,7 +108,7 @@ jQuery(document).ready(function($) {
|
|
| 105 |
if ( jetpackCarouselStrings.local_comments_commenting_as && jetpackCarouselStrings.local_comments_commenting_as.length ) {
|
| 106 |
// Jetpack comments not enabled, fallback to local comments
|
| 107 |
|
| 108 |
-
if ( 1
|
| 109 |
commentFormMarkup += '<div id="jp-carousel-comment-form-commenting-as">' + jetpackCarouselStrings.local_comments_commenting_as + '</div>';
|
| 110 |
} else {
|
| 111 |
commentFormMarkup += '<form id="jp-carousel-comment-form">';
|
|
@@ -136,14 +139,14 @@ jQuery(document).ready(function($) {
|
|
| 136 |
'margin-top' : '20px'
|
| 137 |
});
|
| 138 |
|
| 139 |
-
commentsLoading = $('<div id="jp-carousel-comments-loading"><span>'+jetpackCarouselStrings.loading_comments+'</span></div>')
|
| 140 |
.css({
|
| 141 |
'width' : '100%',
|
| 142 |
'bottom' : '10px',
|
| 143 |
'margin-top' : '20px'
|
| 144 |
});
|
| 145 |
|
| 146 |
-
leftWidth = ( $(window).width() - ( screenPadding * 2 ) ) - (imageMeta.width() + 40);
|
| 147 |
leftWidth += 'px';
|
| 148 |
|
| 149 |
leftColWrapper = $('<div></div>')
|
|
@@ -156,7 +159,7 @@ jQuery(document).ready(function($) {
|
|
| 156 |
.append(comments)
|
| 157 |
.append(commentsLoading);
|
| 158 |
|
| 159 |
-
fadeaway = $('<div></div>')
|
| 160 |
.addClass('jp-carousel-fadeaway');
|
| 161 |
|
| 162 |
info = $('<div></div>')
|
|
@@ -177,18 +180,18 @@ jQuery(document).ready(function($) {
|
|
| 177 |
info.append( leftColWrapper );
|
| 178 |
}
|
| 179 |
|
| 180 |
-
targetBottomPos = ( $(window).height() - parseInt( info.css('top'), 10 ) ) + 'px';
|
| 181 |
|
| 182 |
-
nextButton = $(
|
| 183 |
.addClass('jp-carousel-next-button')
|
| 184 |
.css({
|
| 185 |
-
'right' : '15px'
|
| 186 |
});
|
| 187 |
|
| 188 |
-
previousButton = $(
|
| 189 |
.addClass('jp-carousel-previous-button')
|
| 190 |
.css({
|
| 191 |
-
'left' : 0
|
| 192 |
});
|
| 193 |
|
| 194 |
nextButton.add( previousButton ).css( {
|
|
@@ -213,12 +216,13 @@ jQuery(document).ready(function($) {
|
|
| 213 |
position : 'fixed'
|
| 214 |
});
|
| 215 |
|
| 216 |
-
container = $(
|
| 217 |
.addClass('jp-carousel-wrap')
|
| 218 |
.addClass( 'jp-carousel-transitions' );
|
| 219 |
|
| 220 |
-
if ( 'white'
|
| 221 |
container.addClass('jp-carousel-light');
|
|
|
|
| 222 |
|
| 223 |
container.css({
|
| 224 |
'position' : 'fixed',
|
|
@@ -291,7 +295,7 @@ jQuery(document).ready(function($) {
|
|
| 291 |
$(window).unbind('keydown', keyListener);
|
| 292 |
});
|
| 293 |
|
| 294 |
-
if ( textarea && textarea.attr('id')
|
| 295 |
// For first page load
|
| 296 |
$(window).unbind('keydown', keyListener);
|
| 297 |
$('#jp-carousel-comment-form-submit-and-info-wrapper').slideDown('fast');
|
|
@@ -314,12 +318,12 @@ jQuery(document).ready(function($) {
|
|
| 314 |
return;
|
| 315 |
}
|
| 316 |
|
| 317 |
-
if ( 1
|
| 318 |
ajaxData['email'] = emailField.val();
|
| 319 |
ajaxData['author'] = authorField.val();
|
| 320 |
ajaxData['url'] = urlField.val();
|
| 321 |
|
| 322 |
-
if ( 1
|
| 323 |
if ( ! ajaxData['email'].length || ! ajaxData['email'].match('@') ) {
|
| 324 |
gallery.jp_carousel('postCommentError', {'field': 'jp-carousel-comment-form-email-field', 'error': jetpackCarouselStrings.no_comment_email});
|
| 325 |
return;
|
|
@@ -335,10 +339,10 @@ jQuery(document).ready(function($) {
|
|
| 335 |
url: jetpackCarouselStrings.ajaxurl,
|
| 336 |
data: ajaxData,
|
| 337 |
dataType: 'json',
|
| 338 |
-
success: function(response
|
| 339 |
-
if ( 'approved'
|
| 340 |
$('#jp-carousel-comment-post-results').slideUp('fast').html('<span class="jp-carousel-comment-post-success">' + jetpackCarouselStrings.comment_approved + '</span>').slideDown('fast');
|
| 341 |
-
} else if ( 'unapproved'
|
| 342 |
$('#jp-carousel-comment-post-results').slideUp('fast').html('<span class="jp-carousel-comment-post-success">' + jetpackCarouselStrings.comment_unapproved + '</span>').slideDown('fast');
|
| 343 |
} else {
|
| 344 |
// 'deleted', 'spam', false
|
|
@@ -349,7 +353,7 @@ jQuery(document).ready(function($) {
|
|
| 349 |
$('#jp-carousel-comment-form-button-submit').val(jetpackCarouselStrings.post_comment);
|
| 350 |
$('#jp-carousel-comment-form-spinner').spin(false);
|
| 351 |
},
|
| 352 |
-
error: function(xhr, status, error) {
|
| 353 |
// TODO: Add error handling and display here
|
| 354 |
gallery.jp_carousel('postCommentError', {'field': 'jp-carousel-comment-form-comment-field', 'error': jetpackCarouselStrings.comment_post_error});
|
| 355 |
return;
|
|
@@ -376,7 +380,7 @@ jQuery(document).ready(function($) {
|
|
| 376 |
})
|
| 377 |
.bind('jp_carousel.afterClose', function(){
|
| 378 |
if ( history.pushState ) {
|
| 379 |
-
history.pushState(
|
| 380 |
} else {
|
| 381 |
last_known_location_hash = '';
|
| 382 |
window.location.hash = '';
|
|
@@ -387,13 +391,14 @@ jQuery(document).ready(function($) {
|
|
| 387 |
// If the movement transitions take more than twice the allotted time, disable them.
|
| 388 |
// There is some wiggle room in the 2x, since some of that time is taken up in
|
| 389 |
// JavaScript, setting up the transition and calling the events.
|
| 390 |
-
if ( 'transform'
|
| 391 |
var transitionMultiplier = ( ( Date.now() - transitionBegin ) / 1000 ) / e.originalEvent.elapsedTime;
|
| 392 |
|
| 393 |
container.off( 'transitionend.jp-carousel' );
|
| 394 |
|
| 395 |
-
if ( transitionMultiplier >= 2 )
|
| 396 |
$( '.jp-carousel-transitions' ).removeClass( 'jp-carousel-transitions' );
|
|
|
|
| 397 |
}
|
| 398 |
} );
|
| 399 |
|
|
@@ -428,32 +433,43 @@ jQuery(document).ready(function($) {
|
|
| 428 |
var methods = {
|
| 429 |
testForData: function(gallery) {
|
| 430 |
gallery = $( gallery ); // make sure we have it as a jQuery object.
|
| 431 |
-
|
| 432 |
-
return false;
|
| 433 |
-
}
|
| 434 |
-
return true;
|
| 435 |
},
|
| 436 |
|
| 437 |
testIfOpened: function() {
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
},
|
| 442 |
|
| 443 |
open: function(options) {
|
| 444 |
var settings = {
|
| 445 |
-
'items_selector' :
|
| 446 |
'start_index': 0
|
| 447 |
},
|
| 448 |
data = $(this).data('carousel-extra');
|
| 449 |
|
| 450 |
-
if ( !data )
|
| 451 |
return; // don't run if the default gallery functions weren't used
|
|
|
|
| 452 |
|
| 453 |
prepareGallery( data );
|
| 454 |
|
| 455 |
-
if ( gallery.jp_carousel( 'testIfOpened' ) )
|
| 456 |
return; // don't open if already opened
|
|
|
|
| 457 |
|
| 458 |
// make sure to stop the page from scrolling behind the carousel overlay, so we don't trigger
|
| 459 |
// infiniscroll for it when enabled (Reader, theme infiniscroll, etc).
|
|
@@ -475,26 +491,29 @@ jQuery(document).ready(function($) {
|
|
| 475 |
// with our default settings
|
| 476 |
var $this = $(this);
|
| 477 |
|
| 478 |
-
if ( options )
|
| 479 |
$.extend( settings, options );
|
| 480 |
-
|
|
|
|
| 481 |
settings.start_index = 0; //-1 returned if can't find index, so start from beginning
|
|
|
|
| 482 |
|
| 483 |
container.trigger('jp_carousel.beforeOpen').fadeIn('fast',function(){
|
| 484 |
container.trigger('jp_carousel.afterOpen');
|
| 485 |
gallery
|
| 486 |
.jp_carousel('initSlides', $this.find(settings.items_selector), settings.start_index)
|
| 487 |
-
.jp_carousel('
|
| 488 |
});
|
| 489 |
gallery.html('');
|
| 490 |
});
|
| 491 |
},
|
| 492 |
|
| 493 |
-
|
| 494 |
-
var slides = this.jp_carousel('slides'), selected = slides.eq(
|
| 495 |
|
| 496 |
-
if ( 0 === selected.length )
|
| 497 |
selected = slides.eq(0);
|
|
|
|
| 498 |
|
| 499 |
gallery.jp_carousel('selectSlide', selected, false);
|
| 500 |
return this;
|
|
@@ -531,10 +550,11 @@ jQuery(document).ready(function($) {
|
|
| 531 |
},
|
| 532 |
|
| 533 |
resetButtons : function(current) {
|
| 534 |
-
if ( current.data('liked') )
|
| 535 |
$('.jp-carousel-buttons a.jp-carousel-like').addClass('liked').text(jetpackCarouselStrings.unlike);
|
| 536 |
-
else
|
| 537 |
$('.jp-carousel-buttons a.jp-carousel-like').removeClass('liked').text(jetpackCarouselStrings.like);
|
|
|
|
| 538 |
},
|
| 539 |
|
| 540 |
selectedSlide : function(){
|
|
@@ -553,111 +573,148 @@ jQuery(document).ready(function($) {
|
|
| 553 |
});
|
| 554 |
},
|
| 555 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 556 |
selectSlide : function(slide, animate){
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
|
|
|
| 560 |
attachmentId = current.data( 'attachment-id' ),
|
| 561 |
previous = gallery.jp_carousel( 'prevSlide' ),
|
| 562 |
next = gallery.jp_carousel( 'nextSlide' ),
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
next_next = next.next(),
|
| 566 |
-
galleryWidth = gallery.width(),
|
| 567 |
-
currentWidth = current.width(),
|
| 568 |
-
left = Math.floor( ( galleryWidth - currentWidth ) * 0.5 ),
|
| 569 |
-
info_left,
|
| 570 |
-
method,
|
| 571 |
animated,
|
| 572 |
-
|
| 573 |
-
// center the main image
|
| 574 |
|
|
|
|
| 575 |
gallery.jp_carousel( 'loadFullImage', current );
|
| 576 |
|
| 577 |
caption.hide();
|
| 578 |
|
| 579 |
-
if ( next.length
|
| 580 |
$( '.jp-carousel-next-button' ).hide();
|
| 581 |
-
else
|
| 582 |
$( '.jp-carousel-next-button' ).show();
|
|
|
|
| 583 |
|
| 584 |
-
if ( previous.length
|
| 585 |
$( '.jp-carousel-previous-button' ).hide();
|
| 586 |
-
else
|
| 587 |
$( '.jp-carousel-previous-button' ).show();
|
|
|
|
| 588 |
|
| 589 |
-
method = 'css';
|
| 590 |
animated = current
|
| 591 |
-
.add(previous)
|
| 592 |
-
.add(
|
| 593 |
-
.add(next)
|
| 594 |
-
.add(
|
| 595 |
-
.jp_carousel('loadSlide');
|
| 596 |
-
// slide the whole view to the x we want
|
| 597 |
-
slides.not(animated).hide();
|
| 598 |
|
| 599 |
-
|
| 600 |
-
|
| 601 |
-
// minimum width
|
| 602 |
-
gallery.jp_carousel('fitInfo', animate);
|
| 603 |
-
|
| 604 |
-
// prep the slides
|
| 605 |
-
var direction = last.is(current.prevAll()) ? 1 : -1;
|
| 606 |
-
|
| 607 |
-
if ( 1 == direction ) {
|
| 608 |
-
if ( ! next_next.is( previous ) )
|
| 609 |
-
next_next.jp_carousel('setSlidePosition', galleryWidth + next.width()).show();
|
| 610 |
-
|
| 611 |
-
if ( ! previous_previous.is( next ) )
|
| 612 |
-
previous_previous.jp_carousel('setSlidePosition', -previous_previous.width() - currentWidth ).show();
|
| 613 |
-
}
|
| 614 |
-
else {
|
| 615 |
-
if ( ! next_next.is( previous ) )
|
| 616 |
-
next_next.jp_carousel('setSlidePosition', galleryWidth + currentWidth ).show();
|
| 617 |
-
}
|
| 618 |
|
| 619 |
-
|
| 620 |
-
next.jp_carousel('setSlidePosition', Math.ceil( galleryWidth - (screenPadding * 0.75 ) ) ).show();
|
| 621 |
|
| 622 |
-
gallery.jp_carousel('resetButtons', current);
|
| 623 |
-
container.trigger('jp_carousel.selectSlide', [current]);
|
| 624 |
|
| 625 |
-
gallery.jp_carousel( 'getTitleDesc', {
|
|
|
|
|
|
|
|
|
|
| 626 |
|
| 627 |
// Lazy-load the Likes iframe for the current, next, and previous slides.
|
| 628 |
gallery.jp_carousel( 'loadLikes', attachmentId );
|
| 629 |
-
gallery.jp_carousel( 'updateLikesWidgetVisibility', attachmentId )
|
| 630 |
|
| 631 |
-
if ( next.length > 0 )
|
| 632 |
gallery.jp_carousel( 'loadLikes', next.data( 'attachment-id' ) );
|
|
|
|
| 633 |
|
| 634 |
-
if ( previous.length > 0 )
|
| 635 |
gallery.jp_carousel( 'loadLikes', previous.data( 'attachment-id' ) );
|
|
|
|
| 636 |
|
| 637 |
var imageMeta = current.data( 'image-meta' );
|
| 638 |
gallery.jp_carousel( 'updateExif', imageMeta );
|
| 639 |
gallery.jp_carousel( 'updateFullSizeLink', current );
|
| 640 |
gallery.jp_carousel( 'updateMap', imageMeta );
|
| 641 |
gallery.jp_carousel( 'testCommentsOpened', current.data( 'comments-opened' ) );
|
| 642 |
-
gallery.jp_carousel( 'getComments', {
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 652 |
} else {
|
| 653 |
-
caption.fadeOut('fast').empty();
|
| 654 |
}
|
| 655 |
|
| 656 |
|
| 657 |
// Load the images for the next and previous slides.
|
| 658 |
-
$( next ).add( previous ).each( function
|
| 659 |
gallery.jp_carousel( 'loadFullImage', $( this ) );
|
| 660 |
-
}
|
| 661 |
|
| 662 |
window.location.hash = last_known_location_hash = '#jp-carousel-' + attachmentId;
|
| 663 |
},
|
|
@@ -690,12 +747,15 @@ jQuery(document).ready(function($) {
|
|
| 690 |
orig = this.jp_carousel('originalDimensions'),
|
| 691 |
orig_ratio = orig.width / orig.height,
|
| 692 |
w_ratio = 1,
|
| 693 |
-
h_ratio = 1
|
|
|
|
| 694 |
|
| 695 |
-
if ( orig.width > max.width )
|
| 696 |
w_ratio = max.width / orig.width;
|
| 697 |
-
|
|
|
|
| 698 |
h_ratio = max.height / orig.height;
|
|
|
|
| 699 |
|
| 700 |
if ( w_ratio < h_ratio ) {
|
| 701 |
width = max.width;
|
|
@@ -714,7 +774,7 @@ jQuery(document).ready(function($) {
|
|
| 714 |
};
|
| 715 |
},
|
| 716 |
|
| 717 |
-
fitInfo : function(animated){
|
| 718 |
var current = this.jp_carousel('selectedSlide'),
|
| 719 |
size = current.jp_carousel('bestFit');
|
| 720 |
|
|
@@ -739,10 +799,9 @@ jQuery(document).ready(function($) {
|
|
| 739 |
}
|
| 740 |
},
|
| 741 |
|
| 742 |
-
fitSlide : function(animated){
|
| 743 |
return this.each(function(){
|
| 744 |
-
var
|
| 745 |
-
$this = $(this),
|
| 746 |
dimensions = $this.jp_carousel('bestFit'),
|
| 747 |
method = 'css',
|
| 748 |
max = gallery.jp_carousel('slideDimensions');
|
|
@@ -754,7 +813,7 @@ jQuery(document).ready(function($) {
|
|
| 754 |
},
|
| 755 |
|
| 756 |
texturize : function(text) {
|
| 757 |
-
text =
|
| 758 |
text = text.replace(/'/g, '’').replace(/'/g, '’').replace(/[\u2019]/g, '’');
|
| 759 |
text = text.replace(/"/g, '”').replace(/"/g, '”').replace(/"/g, '”').replace(/[\u201D]/g, '”');
|
| 760 |
text = text.replace(/([\w]+)=&#[\d]+;(.+?)&#[\d]+;/g, '$1="$2"'); // untexturize allowed HTML tags params double-quotes
|
|
@@ -762,25 +821,22 @@ jQuery(document).ready(function($) {
|
|
| 762 |
},
|
| 763 |
|
| 764 |
initSlides : function(items, start_index){
|
| 765 |
-
var width = this.jp_carousel('slideDimensions').width,
|
| 766 |
-
x = 0;
|
| 767 |
-
|
| 768 |
if ( items.length < 2 ) {
|
| 769 |
$( '.jp-carousel-next-button, .jp-carousel-previous-button' ).hide();
|
| 770 |
-
}
|
| 771 |
-
else {
|
| 772 |
$( '.jp-carousel-next-button, .jp-carousel-previous-button' ).show();
|
| 773 |
}
|
| 774 |
|
| 775 |
// Calculate the new src.
|
| 776 |
-
items.each(function(i){
|
| 777 |
var src_item = $(this),
|
| 778 |
orig_size = src_item.data('orig-size') || '',
|
| 779 |
max = gallery.jp_carousel('slideDimensions'),
|
| 780 |
-
parts = orig_size.split(',')
|
| 781 |
-
orig_size = {width: parseInt(parts[0], 10), height: parseInt(parts[1], 10)},
|
| 782 |
medium_file = src_item.data('medium-file') || '',
|
| 783 |
-
large_file = src_item.data('large-file') || ''
|
|
|
|
|
|
|
| 784 |
|
| 785 |
src = src_item.data('orig-file');
|
| 786 |
|
|
@@ -799,8 +855,9 @@ jQuery(document).ready(function($) {
|
|
| 799 |
});
|
| 800 |
|
| 801 |
// If the start_index is not 0 then preload the clicked image first.
|
| 802 |
-
if ( 0 !== start_index )
|
| 803 |
$('<img/>')[0].src = $(items[start_index]).data('gallery-src');
|
|
|
|
| 804 |
|
| 805 |
var useInPageThumbnails = items.first().closest( '.tiled-gallery.type-rectangular' ).length > 0;
|
| 806 |
|
|
@@ -821,8 +878,9 @@ jQuery(document).ready(function($) {
|
|
| 821 |
orig_file = src_item.data('orig-file') || '';
|
| 822 |
|
| 823 |
var tiledCaption = src_item.parents('div.tiled-gallery-item').find('div.tiled-gallery-caption').html();
|
| 824 |
-
if ( tiledCaption )
|
| 825 |
caption = tiledCaption;
|
|
|
|
| 826 |
|
| 827 |
if ( attachment_id && orig_size.length ) {
|
| 828 |
title = gallery.jp_carousel('texturize', title);
|
|
@@ -876,70 +934,78 @@ jQuery(document).ready(function($) {
|
|
| 876 |
},
|
| 877 |
|
| 878 |
selectBestImageSize: function(args) {
|
| 879 |
-
if ( 'object'
|
| 880 |
args = {};
|
|
|
|
| 881 |
|
| 882 |
-
if ( 'undefined'
|
| 883 |
return '';
|
|
|
|
| 884 |
|
| 885 |
-
if ( 'undefined'
|
| 886 |
return args.orig_file;
|
|
|
|
| 887 |
|
| 888 |
-
if ( 'undefined'
|
| 889 |
return args.orig_file;
|
|
|
|
| 890 |
|
| 891 |
var medium_size = args.medium_file.replace(/-([\d]+x[\d]+)\..+$/, '$1'),
|
| 892 |
-
medium_size_parts = (medium_size
|
| 893 |
medium_width = parseInt( medium_size_parts[0], 10 ),
|
| 894 |
medium_height = parseInt( medium_size_parts[1], 10 ),
|
| 895 |
large_size = args.large_file.replace(/-([\d]+x[\d]+)\..+$/, '$1'),
|
| 896 |
-
large_size_parts = (large_size
|
| 897 |
large_width = parseInt( large_size_parts[0], 10 ),
|
| 898 |
large_height = parseInt( large_size_parts[1], 10 );
|
| 899 |
|
| 900 |
// Give devices with a higher devicePixelRatio higher-res images (Retina display = 2, Android phones = 1.5, etc)
|
| 901 |
-
if ('undefined'
|
| 902 |
args.max_width = args.max_width * window.devicePixelRatio;
|
| 903 |
args.max_height = args.max_height * window.devicePixelRatio;
|
| 904 |
}
|
| 905 |
|
| 906 |
-
if ( large_width >= args.max_width || large_height >= args.max_height )
|
| 907 |
return args.large_file;
|
|
|
|
| 908 |
|
| 909 |
-
if ( medium_width >= args.max_width || medium_height >= args.max_height )
|
| 910 |
return args.medium_file;
|
|
|
|
| 911 |
|
| 912 |
return args.orig_file;
|
| 913 |
},
|
| 914 |
|
| 915 |
-
|
| 916 |
originalDimensions: function() {
|
| 917 |
var splitted = $(this).data('orig-size').split(',');
|
| 918 |
return {width: parseInt(splitted[0], 10), height: parseInt(splitted[1], 10)};
|
| 919 |
},
|
| 920 |
|
| 921 |
format: function( args ) {
|
| 922 |
-
if ( 'object'
|
| 923 |
args = {};
|
| 924 |
-
|
|
|
|
| 925 |
return;
|
| 926 |
-
|
|
|
|
| 927 |
return args.text;
|
| 928 |
-
|
| 929 |
-
|
|
|
|
| 930 |
});
|
| 931 |
},
|
| 932 |
|
| 933 |
shutterSpeed: function(d) {
|
| 934 |
-
if (d >= 1)
|
| 935 |
return Math.round(d) + 's';
|
|
|
|
| 936 |
var df = 1, top = 1, bot = 1;
|
| 937 |
var limit = 1e3;
|
| 938 |
-
while (df
|
| 939 |
if (df < d) {
|
| 940 |
top += 1;
|
| 941 |
-
}
|
| 942 |
-
else {
|
| 943 |
bot += 1;
|
| 944 |
top = parseInt(d * bot, 10);
|
| 945 |
}
|
|
@@ -949,16 +1015,18 @@ jQuery(document).ready(function($) {
|
|
| 949 |
bot = Math.round(bot / top);
|
| 950 |
top = 1;
|
| 951 |
}
|
| 952 |
-
if (bot <= 1)
|
| 953 |
return '1s';
|
|
|
|
| 954 |
return top + '/' + bot + 's';
|
| 955 |
},
|
| 956 |
|
| 957 |
parseTitleDesc: function( value ) {
|
| 958 |
-
if ( !value.match(' ') && value.match('_') )
|
| 959 |
return '';
|
|
|
|
| 960 |
// Prefix list originally based on http://commons.wikimedia.org/wiki/MediaWiki:Filename-prefix-blacklist
|
| 961 |
-
|
| 962 |
'CIMG', // Casio
|
| 963 |
'DSC_', // Nikon
|
| 964 |
'DSCF', // Fuji
|
|
@@ -978,7 +1046,7 @@ jQuery(document).ready(function($) {
|
|
| 978 |
'Screen Shot [0-9]+' // Mac screenshots
|
| 979 |
])
|
| 980 |
.each(function(key, val){
|
| 981 |
-
regex = new RegExp('^' + val);
|
| 982 |
if ( regex.test(value) ) {
|
| 983 |
value = '';
|
| 984 |
return;
|
|
@@ -988,7 +1056,7 @@ jQuery(document).ready(function($) {
|
|
| 988 |
},
|
| 989 |
|
| 990 |
getTitleDesc: function( data ) {
|
| 991 |
-
var title ='', desc = '', markup = '', target
|
| 992 |
|
| 993 |
target = $( 'div.jp-carousel-titleanddesc', 'div.jp-carousel-wrap' );
|
| 994 |
target.hide();
|
|
@@ -998,8 +1066,9 @@ jQuery(document).ready(function($) {
|
|
| 998 |
|
| 999 |
if ( title.length || desc.length ) {
|
| 1000 |
// $('<div />').text(sometext).html() is a trick to go to HTML to plain text (including HTML entities decode, etc)
|
| 1001 |
-
if ( $('<div />').text(title).html()
|
| 1002 |
title = '';
|
|
|
|
| 1003 |
|
| 1004 |
markup = ( title.length ) ? '<div class="jp-carousel-titleanddesc-title">' + title + '</div>' : '';
|
| 1005 |
markup += ( desc.length ) ? '<div class="jp-carousel-titleanddesc-desc">' + desc + '</div>' : '';
|
|
@@ -1013,13 +1082,14 @@ jQuery(document).ready(function($) {
|
|
| 1013 |
|
| 1014 |
updateLikesWidgetVisibility: function ( attachmentId ) {
|
| 1015 |
// Only do this if likes is enabled
|
| 1016 |
-
if (
|
| 1017 |
return;
|
|
|
|
| 1018 |
|
| 1019 |
// Hide all likes widgets except for the one for the attachmentId passed in
|
| 1020 |
$( '.jp-carousel-buttons .jetpack-likes-widget-wrapper' ).css( 'display', 'none' ).each( function () {
|
| 1021 |
var widgetWrapper = $( this );
|
| 1022 |
-
if ( widgetWrapper.attr( 'data-attachment-id' ) == attachmentId ) {
|
| 1023 |
widgetWrapper.css( 'display', 'inline-block' );
|
| 1024 |
return false;
|
| 1025 |
}
|
|
@@ -1030,45 +1100,48 @@ jQuery(document).ready(function($) {
|
|
| 1030 |
var dataCarouselExtra = $( '.jp-carousel-wrap' ).data( 'carousel-extra' );
|
| 1031 |
var blogId = dataCarouselExtra.likes_blog_id;
|
| 1032 |
|
| 1033 |
-
if ( $(
|
| 1034 |
// Add the iframe the first time the slide is shown.
|
| 1035 |
var protocol = 'http';
|
| 1036 |
var originDomain = 'http://wordpress.com';
|
| 1037 |
|
| 1038 |
if ( dataCarouselExtra.permalink.length ) {
|
| 1039 |
-
|
| 1040 |
|
| 1041 |
-
if ( ( protocol
|
| 1042 |
protocol = 'http';
|
|
|
|
| 1043 |
|
| 1044 |
var parts = dataCarouselExtra.permalink.split( '/' );
|
| 1045 |
|
| 1046 |
-
if ( parts.length >= 2 )
|
| 1047 |
-
originDomain = protocol +
|
|
|
|
| 1048 |
}
|
| 1049 |
|
| 1050 |
-
var dataSource = protocol +
|
| 1051 |
-
|
| 1052 |
-
|
| 1053 |
|
| 1054 |
-
if ( 'en' !== jetpackCarouselStrings.lang )
|
| 1055 |
-
dataSource +=
|
|
|
|
| 1056 |
|
| 1057 |
-
var likesWidget = $(
|
| 1058 |
-
.attr(
|
| 1059 |
.attr( 'src', dataSource )
|
| 1060 |
-
.css(
|
| 1061 |
-
|
| 1062 |
-
var likesWidgetWrapper = $(
|
| 1063 |
-
.addClass(
|
| 1064 |
-
.attr(
|
| 1065 |
-
.attr(
|
| 1066 |
-
.attr(
|
| 1067 |
-
.attr(
|
| 1068 |
-
.css(
|
| 1069 |
-
.css(
|
| 1070 |
.append( likesWidget )
|
| 1071 |
-
.append(
|
| 1072 |
|
| 1073 |
$( '.jp-carousel-buttons' ).append( likesWidgetWrapper );
|
| 1074 |
}
|
|
@@ -1077,14 +1150,16 @@ jQuery(document).ready(function($) {
|
|
| 1077 |
|
| 1078 |
// updateExif updates the contents of the exif UL (.jp-carousel-image-exif)
|
| 1079 |
updateExif: function( meta ) {
|
| 1080 |
-
if ( !meta || 1
|
| 1081 |
return false;
|
|
|
|
| 1082 |
|
| 1083 |
-
var $ul = $(
|
| 1084 |
|
| 1085 |
$.each( meta, function( key, val ) {
|
| 1086 |
-
if ( 0 === parseFloat(val) || !val.length || -1 === $.inArray( key, [ 'camera', 'aperture', 'shutter_speed', 'focal_length' ] ) )
|
| 1087 |
return;
|
|
|
|
| 1088 |
|
| 1089 |
switch( key ) {
|
| 1090 |
case 'focal_length':
|
|
@@ -1107,8 +1182,9 @@ jQuery(document).ready(function($) {
|
|
| 1107 |
|
| 1108 |
// updateFullSizeLink updates the contents of the jp-carousel-image-download link
|
| 1109 |
updateFullSizeLink: function(current) {
|
| 1110 |
-
if(!current || !current.data)
|
| 1111 |
return false;
|
|
|
|
| 1112 |
var original = current.data('orig-file').replace(/\?.+$/, ''),
|
| 1113 |
origSize = current.data('orig-size').split(','),
|
| 1114 |
permalink = $( '<a>'+gallery.jp_carousel('format', {'text': jetpackCarouselStrings.download_original, 'replacements': origSize})+'</a>' )
|
|
@@ -1121,8 +1197,9 @@ jQuery(document).ready(function($) {
|
|
| 1121 |
},
|
| 1122 |
|
| 1123 |
updateMap: function( meta ) {
|
| 1124 |
-
if ( !meta.latitude || !meta.longitude || 1
|
| 1125 |
return;
|
|
|
|
| 1126 |
|
| 1127 |
var latitude = meta.latitude,
|
| 1128 |
longitude = meta.longitude,
|
|
@@ -1151,7 +1228,7 @@ jQuery(document).ready(function($) {
|
|
| 1151 |
},
|
| 1152 |
|
| 1153 |
testCommentsOpened: function( opened ) {
|
| 1154 |
-
if ( 1
|
| 1155 |
$('.jp-carousel-buttons').fadeIn('fast');
|
| 1156 |
commentForm.fadeIn('fast');
|
| 1157 |
} else {
|
|
@@ -1163,20 +1240,24 @@ jQuery(document).ready(function($) {
|
|
| 1163 |
getComments: function( args ) {
|
| 1164 |
clearInterval( commentInterval );
|
| 1165 |
|
| 1166 |
-
if ( 'object'
|
| 1167 |
return;
|
|
|
|
| 1168 |
|
| 1169 |
-
if ( 'undefined'
|
| 1170 |
return;
|
|
|
|
| 1171 |
|
| 1172 |
-
if ( ! args.offset || 'undefined'
|
| 1173 |
args.offset = 0;
|
|
|
|
| 1174 |
|
| 1175 |
var comments = $('.jp-carousel-comments'),
|
| 1176 |
commentsLoading = $('#jp-carousel-comments-loading').show();
|
| 1177 |
|
| 1178 |
-
if ( args.clear )
|
| 1179 |
comments.hide().empty();
|
|
|
|
| 1180 |
|
| 1181 |
$.ajax({
|
| 1182 |
type: 'GET',
|
|
@@ -1188,27 +1269,28 @@ jQuery(document).ready(function($) {
|
|
| 1188 |
id: args.attachment_id,
|
| 1189 |
offset: args.offset
|
| 1190 |
},
|
| 1191 |
-
success: function(data
|
| 1192 |
-
if ( args.clear )
|
| 1193 |
comments.fadeOut('fast').empty();
|
|
|
|
| 1194 |
|
| 1195 |
$( data ).each(function(){
|
| 1196 |
var comment = $('<div></div>')
|
| 1197 |
.addClass('jp-carousel-comment')
|
| 1198 |
.attr('id', 'jp-carousel-comment-' + this['id'])
|
| 1199 |
.html(
|
| 1200 |
-
'<div class="comment-gravatar">'
|
| 1201 |
-
|
| 1202 |
-
|
| 1203 |
-
|
| 1204 |
-
|
| 1205 |
-
|
| 1206 |
-
|
| 1207 |
-
|
| 1208 |
-
|
| 1209 |
-
|
| 1210 |
-
|
| 1211 |
-
|
| 1212 |
);
|
| 1213 |
comments.append(comment);
|
| 1214 |
|
|
@@ -1226,7 +1308,7 @@ jQuery(document).ready(function($) {
|
|
| 1226 |
// attachment id might no longer match the current attachment id by the time we get the data back or a now
|
| 1227 |
// registered infiniscroll event kicks in, so we don't ever display comments for the wrong image by mistake.
|
| 1228 |
var current = $('.jp-carousel div.selected');
|
| 1229 |
-
if ( current && current.data && current.data('attachment-id') != args.attachment_id ) {
|
| 1230 |
comments.fadeOut('fast');
|
| 1231 |
comments.empty();
|
| 1232 |
return;
|
|
@@ -1248,10 +1330,12 @@ jQuery(document).ready(function($) {
|
|
| 1248 |
},
|
| 1249 |
|
| 1250 |
postCommentError: function(args) {
|
| 1251 |
-
if ( 'object'
|
| 1252 |
args = {};
|
| 1253 |
-
|
|
|
|
| 1254 |
return;
|
|
|
|
| 1255 |
$('#jp-carousel-comment-post-results').slideUp('fast').html('<span class="jp-carousel-comment-post-error">'+args.error+'</span>').slideDown('fast');
|
| 1256 |
$('#jp-carousel-comment-form-spinner').spin(false);
|
| 1257 |
},
|
|
@@ -1267,16 +1351,18 @@ jQuery(document).ready(function($) {
|
|
| 1267 |
|
| 1268 |
clearCommentTextAreaValue: function() {
|
| 1269 |
var commentTextArea = $('#jp-carousel-comment-form-comment-field');
|
| 1270 |
-
if ( commentTextArea )
|
| 1271 |
commentTextArea.val('');
|
|
|
|
| 1272 |
},
|
| 1273 |
|
| 1274 |
nextSlide : function () {
|
| 1275 |
var slides = this.jp_carousel( 'slides' );
|
| 1276 |
var selected = this.jp_carousel( 'selectedSlide' );
|
| 1277 |
|
| 1278 |
-
if ( selected.length
|
| 1279 |
return slides.first();
|
|
|
|
| 1280 |
|
| 1281 |
return selected.next();
|
| 1282 |
},
|
|
@@ -1285,8 +1371,9 @@ jQuery(document).ready(function($) {
|
|
| 1285 |
var slides = this.jp_carousel( 'slides' );
|
| 1286 |
var selected = this.jp_carousel( 'selectedSlide' );
|
| 1287 |
|
| 1288 |
-
if ( selected.length
|
| 1289 |
return slides.last();
|
|
|
|
| 1290 |
|
| 1291 |
return selected.prev();
|
| 1292 |
},
|
|
@@ -1303,10 +1390,11 @@ jQuery(document).ready(function($) {
|
|
| 1303 |
$( this ).closest( '.jp-carousel-slide' ).css( 'background-image', '' );
|
| 1304 |
} );
|
| 1305 |
|
| 1306 |
-
if ( ! slide.data( 'preview-image' ) || ( slide.data( 'thumb-size' ) && slide.width() > slide.data( 'thumb-size' ).width ) )
|
| 1307 |
image.attr( 'src', image.closest( '.jp-carousel-slide' ).data( 'src' ) );
|
| 1308 |
-
else
|
| 1309 |
image.attr( 'src', slide.data( 'preview-image' ) );
|
|
|
|
| 1310 |
|
| 1311 |
image.data( 'loaded', 1 );
|
| 1312 |
}
|
|
@@ -1328,44 +1416,52 @@ jQuery(document).ready(function($) {
|
|
| 1328 |
|
| 1329 |
// register the event listener for starting the gallery
|
| 1330 |
$( document.body ).on( 'click', 'div.gallery,div.tiled-gallery', function(e) {
|
| 1331 |
-
if ( ! $(this).jp_carousel( 'testForData', e.currentTarget ) )
|
| 1332 |
return;
|
| 1333 |
-
|
|
|
|
| 1334 |
return;
|
|
|
|
| 1335 |
e.preventDefault();
|
| 1336 |
$(this).jp_carousel('open', {start_index: $(this).find('.gallery-item, .tiled-gallery-item').index($(e.target).parents('.gallery-item, .tiled-gallery-item'))});
|
| 1337 |
});
|
| 1338 |
|
| 1339 |
// Makes carousel work on page load and when back button leads to same URL with carousel hash (ie: no actual document.ready trigger)
|
| 1340 |
$( window ).on( 'hashchange', function () {
|
| 1341 |
-
if ( ! window.location.hash || ! window.location.hash.match(/jp-carousel-(\d+)/) )
|
| 1342 |
return;
|
|
|
|
| 1343 |
|
| 1344 |
-
if ( window.location.hash
|
| 1345 |
return;
|
|
|
|
| 1346 |
|
| 1347 |
last_known_location_hash = window.location.hash;
|
| 1348 |
|
| 1349 |
var gallery = $('div.gallery, div.tiled-gallery'), index = -1, n = window.location.hash.match(/jp-carousel-(\d+)/);
|
| 1350 |
|
| 1351 |
-
if ( ! $(this).jp_carousel( 'testForData', gallery ) )
|
| 1352 |
return;
|
|
|
|
| 1353 |
|
| 1354 |
n = parseInt(n[1], 10);
|
| 1355 |
|
| 1356 |
gallery.find('img').each(function(num, el){
|
| 1357 |
-
|
|
|
|
| 1358 |
index = num;
|
| 1359 |
return false;
|
| 1360 |
}
|
| 1361 |
});
|
| 1362 |
|
| 1363 |
-
if ( index
|
| 1364 |
-
gallery.jp_carousel('
|
|
|
|
| 1365 |
});
|
| 1366 |
|
| 1367 |
-
if ( window.location.hash )
|
| 1368 |
$( window ).trigger( 'hashchange' );
|
|
|
|
| 1369 |
});
|
| 1370 |
|
| 1371 |
/**
|
|
@@ -1380,14 +1476,16 @@ $.fn.touchwipe = function(settings) {
|
|
| 1380 |
var config = {
|
| 1381 |
min_move_x: 20,
|
| 1382 |
min_move_y: 20,
|
| 1383 |
-
wipeLeft: function(e) { },
|
| 1384 |
-
wipeRight: function(e) { },
|
| 1385 |
-
wipeUp: function(e) { },
|
| 1386 |
-
wipeDown: function(e) { },
|
| 1387 |
preventDefaultEvents: true
|
| 1388 |
};
|
| 1389 |
|
| 1390 |
-
if (settings)
|
|
|
|
|
|
|
| 1391 |
|
| 1392 |
this.each(function() {
|
| 1393 |
var startX;
|
|
@@ -1413,8 +1511,7 @@ $.fn.touchwipe = function(settings) {
|
|
| 1413 |
cancelTouch();
|
| 1414 |
if(dx > 0) {
|
| 1415 |
config.wipeLeft(e);
|
| 1416 |
-
}
|
| 1417 |
-
else {
|
| 1418 |
config.wipeRight(e);
|
| 1419 |
}
|
| 1420 |
}
|
|
@@ -1422,8 +1519,7 @@ $.fn.touchwipe = function(settings) {
|
|
| 1422 |
cancelTouch();
|
| 1423 |
if(dy > 0) {
|
| 1424 |
config.wipeDown(e);
|
| 1425 |
-
}
|
| 1426 |
-
else {
|
| 1427 |
config.wipeUp(e);
|
| 1428 |
}
|
| 1429 |
}
|
|
@@ -1432,7 +1528,7 @@ $.fn.touchwipe = function(settings) {
|
|
| 1432 |
|
| 1433 |
function onTouchStart(e)
|
| 1434 |
{
|
| 1435 |
-
if (e.touches.length
|
| 1436 |
startX = e.touches[0].pageX;
|
| 1437 |
startY = e.touches[0].pageY;
|
| 1438 |
isMoving = true;
|
| 1 |
+
/* jshint sub: true, onevar: false, multistr: true, devel: true, smarttabs: true */
|
| 2 |
+
/* global jetpackCarouselStrings, DocumentTouch, jetpackLikesWidgetQueue */
|
| 3 |
+
|
| 4 |
|
| 5 |
jQuery(document).ready(function($) {
|
| 6 |
|
| 7 |
// gallery faded layer and container elements
|
| 8 |
+
var overlay, comments, gallery, container, nextButton, previousButton, info, transitionBegin,
|
| 9 |
+
caption, resizeTimeout, photo_info, close_hint, commentInterval, lastSelectedSlide,
|
| 10 |
screenPadding = 110, originalOverflow = $('body').css('overflow'), originalHOverflow = $('html').css('overflow'), proportion = 85,
|
| 11 |
+
last_known_location_hash = '', imageMeta, titleAndDescription, commentForm, leftColWrapper;
|
| 12 |
|
| 13 |
if ( window.innerWidth <= 760 ) {
|
| 14 |
screenPadding = Math.round( ( window.innerWidth / 760 ) * 110 );
|
| 15 |
|
| 16 |
+
if ( screenPadding < 40 && ( ( 'ontouchstart' in window ) || window.DocumentTouch && document instanceof DocumentTouch ) ) {
|
| 17 |
screenPadding = 0;
|
| 18 |
+
}
|
| 19 |
}
|
| 20 |
|
| 21 |
var keyListener = function(e){
|
| 50 |
}
|
| 51 |
};
|
| 52 |
|
| 53 |
+
var resizeListener = function(/*e*/){
|
| 54 |
clearTimeout(resizeTimeout);
|
| 55 |
resizeTimeout = setTimeout(function(){
|
| 56 |
gallery
|
| 57 |
.jp_carousel('slides')
|
| 58 |
.jp_carousel('fitSlide', true);
|
| 59 |
+
gallery.jp_carousel('updateSlidePositions', true);
|
| 60 |
+
gallery.jp_carousel('fitMeta', true);
|
|
|
|
| 61 |
}, 200);
|
| 62 |
};
|
| 63 |
|
| 64 |
+
var prepareGallery = function( /*dataCarouselExtra*/ ){
|
| 65 |
if (!overlay) {
|
| 66 |
overlay = $('<div></div>')
|
| 67 |
.addClass('jp-carousel-overlay')
|
| 74 |
});
|
| 75 |
|
| 76 |
var buttons = '<a class="jp-carousel-commentlink" href="#">' + jetpackCarouselStrings.comment + '</a>';
|
| 77 |
+
if ( 1 === Number( jetpackCarouselStrings.is_logged_in ) ) {
|
| 78 |
}
|
| 79 |
|
| 80 |
buttons = $('<div class="jp-carousel-buttons">' + buttons + '</div>');
|
| 92 |
|
| 93 |
imageMeta
|
| 94 |
.append( buttons )
|
| 95 |
+
.append( '<ul class=\'jp-carousel-image-exif\' style=\'display:none;\'></ul>' )
|
| 96 |
+
.append( '<a class=\'jp-carousel-image-download\' style=\'display:none;\'></a>' )
|
| 97 |
+
.append( '<div class=\'jp-carousel-image-map\' style=\'display:none;\'></div>' );
|
| 98 |
|
| 99 |
titleAndDescription = $('<div></div>')
|
| 100 |
.addClass('jp-carousel-titleanddesc')
|
| 108 |
if ( jetpackCarouselStrings.local_comments_commenting_as && jetpackCarouselStrings.local_comments_commenting_as.length ) {
|
| 109 |
// Jetpack comments not enabled, fallback to local comments
|
| 110 |
|
| 111 |
+
if ( 1 !== Number( jetpackCarouselStrings.is_logged_in ) && 1 === Number( jetpackCarouselStrings.comment_registration ) ) {
|
| 112 |
commentFormMarkup += '<div id="jp-carousel-comment-form-commenting-as">' + jetpackCarouselStrings.local_comments_commenting_as + '</div>';
|
| 113 |
} else {
|
| 114 |
commentFormMarkup += '<form id="jp-carousel-comment-form">';
|
| 139 |
'margin-top' : '20px'
|
| 140 |
});
|
| 141 |
|
| 142 |
+
var commentsLoading = $('<div id="jp-carousel-comments-loading"><span>'+jetpackCarouselStrings.loading_comments+'</span></div>')
|
| 143 |
.css({
|
| 144 |
'width' : '100%',
|
| 145 |
'bottom' : '10px',
|
| 146 |
'margin-top' : '20px'
|
| 147 |
});
|
| 148 |
|
| 149 |
+
var leftWidth = ( $(window).width() - ( screenPadding * 2 ) ) - (imageMeta.width() + 40);
|
| 150 |
leftWidth += 'px';
|
| 151 |
|
| 152 |
leftColWrapper = $('<div></div>')
|
| 159 |
.append(comments)
|
| 160 |
.append(commentsLoading);
|
| 161 |
|
| 162 |
+
var fadeaway = $('<div></div>')
|
| 163 |
.addClass('jp-carousel-fadeaway');
|
| 164 |
|
| 165 |
info = $('<div></div>')
|
| 180 |
info.append( leftColWrapper );
|
| 181 |
}
|
| 182 |
|
| 183 |
+
var targetBottomPos = ( $(window).height() - parseInt( info.css('top'), 10 ) ) + 'px';
|
| 184 |
|
| 185 |
+
nextButton = $('<div><span></span></div>')
|
| 186 |
.addClass('jp-carousel-next-button')
|
| 187 |
.css({
|
| 188 |
+
'right' : '15px'
|
| 189 |
});
|
| 190 |
|
| 191 |
+
previousButton = $('<div><span></span></div>')
|
| 192 |
.addClass('jp-carousel-previous-button')
|
| 193 |
.css({
|
| 194 |
+
'left' : 0
|
| 195 |
});
|
| 196 |
|
| 197 |
nextButton.add( previousButton ).css( {
|
| 216 |
position : 'fixed'
|
| 217 |
});
|
| 218 |
|
| 219 |
+
container = $('<div></div>')
|
| 220 |
.addClass('jp-carousel-wrap')
|
| 221 |
.addClass( 'jp-carousel-transitions' );
|
| 222 |
|
| 223 |
+
if ( 'white' === jetpackCarouselStrings.background_color ) {
|
| 224 |
container.addClass('jp-carousel-light');
|
| 225 |
+
}
|
| 226 |
|
| 227 |
container.css({
|
| 228 |
'position' : 'fixed',
|
| 295 |
$(window).unbind('keydown', keyListener);
|
| 296 |
});
|
| 297 |
|
| 298 |
+
if ( textarea && textarea.attr('id') === target.attr('id')) {
|
| 299 |
// For first page load
|
| 300 |
$(window).unbind('keydown', keyListener);
|
| 301 |
$('#jp-carousel-comment-form-submit-and-info-wrapper').slideDown('fast');
|
| 318 |
return;
|
| 319 |
}
|
| 320 |
|
| 321 |
+
if ( 1 !== Number( jetpackCarouselStrings.is_logged_in ) ) {
|
| 322 |
ajaxData['email'] = emailField.val();
|
| 323 |
ajaxData['author'] = authorField.val();
|
| 324 |
ajaxData['url'] = urlField.val();
|
| 325 |
|
| 326 |
+
if ( 1 === Number( jetpackCarouselStrings.require_name_email ) ) {
|
| 327 |
if ( ! ajaxData['email'].length || ! ajaxData['email'].match('@') ) {
|
| 328 |
gallery.jp_carousel('postCommentError', {'field': 'jp-carousel-comment-form-email-field', 'error': jetpackCarouselStrings.no_comment_email});
|
| 329 |
return;
|
| 339 |
url: jetpackCarouselStrings.ajaxurl,
|
| 340 |
data: ajaxData,
|
| 341 |
dataType: 'json',
|
| 342 |
+
success: function(response/*, status, xhr*/) {
|
| 343 |
+
if ( 'approved' === response.comment_status ) {
|
| 344 |
$('#jp-carousel-comment-post-results').slideUp('fast').html('<span class="jp-carousel-comment-post-success">' + jetpackCarouselStrings.comment_approved + '</span>').slideDown('fast');
|
| 345 |
+
} else if ( 'unapproved' === response.comment_status ) {
|
| 346 |
$('#jp-carousel-comment-post-results').slideUp('fast').html('<span class="jp-carousel-comment-post-success">' + jetpackCarouselStrings.comment_unapproved + '</span>').slideDown('fast');
|
| 347 |
} else {
|
| 348 |
// 'deleted', 'spam', false
|
| 353 |
$('#jp-carousel-comment-form-button-submit').val(jetpackCarouselStrings.post_comment);
|
| 354 |
$('#jp-carousel-comment-form-spinner').spin(false);
|
| 355 |
},
|
| 356 |
+
error: function(/*xhr, status, error*/) {
|
| 357 |
// TODO: Add error handling and display here
|
| 358 |
gallery.jp_carousel('postCommentError', {'field': 'jp-carousel-comment-form-comment-field', 'error': jetpackCarouselStrings.comment_post_error});
|
| 359 |
return;
|
| 380 |
})
|
| 381 |
.bind('jp_carousel.afterClose', function(){
|
| 382 |
if ( history.pushState ) {
|
| 383 |
+
history.pushState('', document.title, window.location.pathname + window.location.search);
|
| 384 |
} else {
|
| 385 |
last_known_location_hash = '';
|
| 386 |
window.location.hash = '';
|
| 391 |
// If the movement transitions take more than twice the allotted time, disable them.
|
| 392 |
// There is some wiggle room in the 2x, since some of that time is taken up in
|
| 393 |
// JavaScript, setting up the transition and calling the events.
|
| 394 |
+
if ( 'transform' === e.originalEvent.propertyName ) {
|
| 395 |
var transitionMultiplier = ( ( Date.now() - transitionBegin ) / 1000 ) / e.originalEvent.elapsedTime;
|
| 396 |
|
| 397 |
container.off( 'transitionend.jp-carousel' );
|
| 398 |
|
| 399 |
+
if ( transitionMultiplier >= 2 ) {
|
| 400 |
$( '.jp-carousel-transitions' ).removeClass( 'jp-carousel-transitions' );
|
| 401 |
+
}
|
| 402 |
}
|
| 403 |
} );
|
| 404 |
|
| 433 |
var methods = {
|
| 434 |
testForData: function(gallery) {
|
| 435 |
gallery = $( gallery ); // make sure we have it as a jQuery object.
|
| 436 |
+
return !( ! gallery.length || ! gallery.data( 'carousel-extra' ) );
|
|
|
|
|
|
|
|
|
|
| 437 |
},
|
| 438 |
|
| 439 |
testIfOpened: function() {
|
| 440 |
+
return !!( 'undefined' !== typeof(gallery) && 'undefined' !== typeof(gallery.opened) && gallery.opened );
|
| 441 |
+
},
|
| 442 |
+
|
| 443 |
+
openOrSelectSlide: function( index ) {
|
| 444 |
+
// The `open` method triggers an asynchronous effect, so we will get an
|
| 445 |
+
// error if we try to use `open` then `selectSlideAtIndex` immediately
|
| 446 |
+
// after it. We can only use `selectSlideAtIndex` if the carousel is
|
| 447 |
+
// already open.
|
| 448 |
+
if ( ! $( this ).jp_carousel( 'testIfOpened' ) ) {
|
| 449 |
+
// The `open` method selects the correct slide during the
|
| 450 |
+
// initialization.
|
| 451 |
+
$( this ).jp_carousel( 'open', { start_index: index } );
|
| 452 |
+
} else {
|
| 453 |
+
gallery.jp_carousel( 'selectSlideAtIndex', index );
|
| 454 |
+
}
|
| 455 |
},
|
| 456 |
|
| 457 |
open: function(options) {
|
| 458 |
var settings = {
|
| 459 |
+
'items_selector' : '.gallery-item [data-attachment-id], .tiled-gallery-item [data-attachment-id]',
|
| 460 |
'start_index': 0
|
| 461 |
},
|
| 462 |
data = $(this).data('carousel-extra');
|
| 463 |
|
| 464 |
+
if ( !data ) {
|
| 465 |
return; // don't run if the default gallery functions weren't used
|
| 466 |
+
}
|
| 467 |
|
| 468 |
prepareGallery( data );
|
| 469 |
|
| 470 |
+
if ( gallery.jp_carousel( 'testIfOpened' ) ) {
|
| 471 |
return; // don't open if already opened
|
| 472 |
+
}
|
| 473 |
|
| 474 |
// make sure to stop the page from scrolling behind the carousel overlay, so we don't trigger
|
| 475 |
// infiniscroll for it when enabled (Reader, theme infiniscroll, etc).
|
| 491 |
// with our default settings
|
| 492 |
var $this = $(this);
|
| 493 |
|
| 494 |
+
if ( options ) {
|
| 495 |
$.extend( settings, options );
|
| 496 |
+
}
|
| 497 |
+
if ( -1 === settings.start_index ) {
|
| 498 |
settings.start_index = 0; //-1 returned if can't find index, so start from beginning
|
| 499 |
+
}
|
| 500 |
|
| 501 |
container.trigger('jp_carousel.beforeOpen').fadeIn('fast',function(){
|
| 502 |
container.trigger('jp_carousel.afterOpen');
|
| 503 |
gallery
|
| 504 |
.jp_carousel('initSlides', $this.find(settings.items_selector), settings.start_index)
|
| 505 |
+
.jp_carousel('selectSlideAtIndex', settings.start_index);
|
| 506 |
});
|
| 507 |
gallery.html('');
|
| 508 |
});
|
| 509 |
},
|
| 510 |
|
| 511 |
+
selectSlideAtIndex : function(index){
|
| 512 |
+
var slides = this.jp_carousel('slides'), selected = slides.eq(index);
|
| 513 |
|
| 514 |
+
if ( 0 === selected.length ) {
|
| 515 |
selected = slides.eq(0);
|
| 516 |
+
}
|
| 517 |
|
| 518 |
gallery.jp_carousel('selectSlide', selected, false);
|
| 519 |
return this;
|
| 550 |
},
|
| 551 |
|
| 552 |
resetButtons : function(current) {
|
| 553 |
+
if ( current.data('liked') ) {
|
| 554 |
$('.jp-carousel-buttons a.jp-carousel-like').addClass('liked').text(jetpackCarouselStrings.unlike);
|
| 555 |
+
} else {
|
| 556 |
$('.jp-carousel-buttons a.jp-carousel-like').removeClass('liked').text(jetpackCarouselStrings.like);
|
| 557 |
+
}
|
| 558 |
},
|
| 559 |
|
| 560 |
selectedSlide : function(){
|
| 573 |
});
|
| 574 |
},
|
| 575 |
|
| 576 |
+
updateSlidePositions : function(animate) {
|
| 577 |
+
var current = this.jp_carousel( 'selectedSlide' ),
|
| 578 |
+
galleryWidth = gallery.width(),
|
| 579 |
+
currentWidth = current.width(),
|
| 580 |
+
previous = gallery.jp_carousel( 'prevSlide' ),
|
| 581 |
+
next = gallery.jp_carousel( 'nextSlide' ),
|
| 582 |
+
previousPrevious = previous.prev(),
|
| 583 |
+
nextNext = next.next(),
|
| 584 |
+
left = Math.floor( ( galleryWidth - currentWidth ) * 0.5 );
|
| 585 |
+
|
| 586 |
+
current.jp_carousel( 'setSlidePosition', left ).show();
|
| 587 |
+
|
| 588 |
+
// minimum width
|
| 589 |
+
gallery.jp_carousel( 'fitInfo', animate );
|
| 590 |
+
|
| 591 |
+
// prep the slides
|
| 592 |
+
var direction = lastSelectedSlide.is( current.prevAll() ) ? 1 : -1;
|
| 593 |
+
|
| 594 |
+
// Since we preload the `previousPrevious` and `nextNext` slides, we need
|
| 595 |
+
// to make sure they technically visible in the DOM, but invisible to the
|
| 596 |
+
// user. To hide them from the user, we position them outside the edges
|
| 597 |
+
// of the window.
|
| 598 |
+
//
|
| 599 |
+
// This section of code only applies when there are more than three
|
| 600 |
+
// slides. Otherwise, the `previousPrevious` and `nextNext` slides will
|
| 601 |
+
// overlap with the `previous` and `next` slides which must be visible
|
| 602 |
+
// regardless.
|
| 603 |
+
if ( 1 === direction ) {
|
| 604 |
+
if ( ! nextNext.is( previous ) ) {
|
| 605 |
+
nextNext.jp_carousel( 'setSlidePosition', galleryWidth + next.width() ).show();
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
if ( ! previousPrevious.is( next ) ) {
|
| 609 |
+
previousPrevious.jp_carousel( 'setSlidePosition', -previousPrevious.width() - currentWidth ).show();
|
| 610 |
+
}
|
| 611 |
+
} else {
|
| 612 |
+
if ( ! nextNext.is( previous ) ) {
|
| 613 |
+
nextNext.jp_carousel( 'setSlidePosition', galleryWidth + currentWidth ).show();
|
| 614 |
+
}
|
| 615 |
+
}
|
| 616 |
+
|
| 617 |
+
previous.jp_carousel( 'setSlidePosition', Math.floor( -previous.width() + ( screenPadding * 0.75 ) ) ).show();
|
| 618 |
+
next.jp_carousel( 'setSlidePosition', Math.ceil( galleryWidth - ( screenPadding * 0.75 ) ) ).show();
|
| 619 |
+
},
|
| 620 |
+
|
| 621 |
selectSlide : function(slide, animate){
|
| 622 |
+
lastSelectedSlide = this.find( '.selected' ).removeClass( 'selected' );
|
| 623 |
+
|
| 624 |
+
var slides = gallery.jp_carousel( 'slides' ).css({ 'position': 'fixed' }),
|
| 625 |
+
current = $( slide ).addClass( 'selected' ).css({ 'position': 'relative' }),
|
| 626 |
attachmentId = current.data( 'attachment-id' ),
|
| 627 |
previous = gallery.jp_carousel( 'prevSlide' ),
|
| 628 |
next = gallery.jp_carousel( 'nextSlide' ),
|
| 629 |
+
previousPrevious = previous.prev(),
|
| 630 |
+
nextNext = next.next(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 631 |
animated,
|
| 632 |
+
captionHtml;
|
|
|
|
| 633 |
|
| 634 |
+
// center the main image
|
| 635 |
gallery.jp_carousel( 'loadFullImage', current );
|
| 636 |
|
| 637 |
caption.hide();
|
| 638 |
|
| 639 |
+
if ( next.length === 0 && slides.length <= 2 ) {
|
| 640 |
$( '.jp-carousel-next-button' ).hide();
|
| 641 |
+
} else {
|
| 642 |
$( '.jp-carousel-next-button' ).show();
|
| 643 |
+
}
|
| 644 |
|
| 645 |
+
if ( previous.length === 0 && slides.length <= 2 ) {
|
| 646 |
$( '.jp-carousel-previous-button' ).hide();
|
| 647 |
+
} else {
|
| 648 |
$( '.jp-carousel-previous-button' ).show();
|
| 649 |
+
}
|
| 650 |
|
|
|
|
| 651 |
animated = current
|
| 652 |
+
.add( previous )
|
| 653 |
+
.add( previousPrevious )
|
| 654 |
+
.add( next )
|
| 655 |
+
.add( nextNext )
|
| 656 |
+
.jp_carousel( 'loadSlide' );
|
|
|
|
|
|
|
| 657 |
|
| 658 |
+
// slide the whole view to the x we want
|
| 659 |
+
slides.not( animated ).hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 660 |
|
| 661 |
+
gallery.jp_carousel( 'updateSlidePositions', animate );
|
|
|
|
| 662 |
|
| 663 |
+
gallery.jp_carousel( 'resetButtons', current );
|
| 664 |
+
container.trigger( 'jp_carousel.selectSlide', [current] );
|
| 665 |
|
| 666 |
+
gallery.jp_carousel( 'getTitleDesc', {
|
| 667 |
+
title: current.data( 'title' ),
|
| 668 |
+
desc: current.data( 'desc' )
|
| 669 |
+
});
|
| 670 |
|
| 671 |
// Lazy-load the Likes iframe for the current, next, and previous slides.
|
| 672 |
gallery.jp_carousel( 'loadLikes', attachmentId );
|
| 673 |
+
gallery.jp_carousel( 'updateLikesWidgetVisibility', attachmentId );
|
| 674 |
|
| 675 |
+
if ( next.length > 0 ) {
|
| 676 |
gallery.jp_carousel( 'loadLikes', next.data( 'attachment-id' ) );
|
| 677 |
+
}
|
| 678 |
|
| 679 |
+
if ( previous.length > 0 ) {
|
| 680 |
gallery.jp_carousel( 'loadLikes', previous.data( 'attachment-id' ) );
|
| 681 |
+
}
|
| 682 |
|
| 683 |
var imageMeta = current.data( 'image-meta' );
|
| 684 |
gallery.jp_carousel( 'updateExif', imageMeta );
|
| 685 |
gallery.jp_carousel( 'updateFullSizeLink', current );
|
| 686 |
gallery.jp_carousel( 'updateMap', imageMeta );
|
| 687 |
gallery.jp_carousel( 'testCommentsOpened', current.data( 'comments-opened' ) );
|
| 688 |
+
gallery.jp_carousel( 'getComments', {
|
| 689 |
+
'attachment_id': attachmentId,
|
| 690 |
+
'offset': 0,
|
| 691 |
+
'clear': true
|
| 692 |
+
});
|
| 693 |
+
$( '#jp-carousel-comment-post-results' ).slideUp();
|
| 694 |
+
|
| 695 |
+
// $('<div />').text(sometext).html() is a trick to go to HTML to plain
|
| 696 |
+
// text (including HTML entities decode, etc)
|
| 697 |
+
if ( current.data( 'caption' ) ) {
|
| 698 |
+
captionHtml = $( '<div />' ).text( current.data( 'caption' ) ).html();
|
| 699 |
+
|
| 700 |
+
if ( captionHtml === $( '<div />' ).text( current.data( 'title' ) ).html() ) {
|
| 701 |
+
$( '.jp-carousel-titleanddesc-title' ).fadeOut( 'fast' ).empty();
|
| 702 |
+
}
|
| 703 |
+
|
| 704 |
+
if ( captionHtml === $( '<div />' ).text( current.data( 'desc' ) ).html() ) {
|
| 705 |
+
$( '.jp-carousel-titleanddesc-desc' ).fadeOut( 'fast' ).empty();
|
| 706 |
+
}
|
| 707 |
+
|
| 708 |
+
caption.html( current.data( 'caption' ) ).fadeIn( 'slow' );
|
| 709 |
} else {
|
| 710 |
+
caption.fadeOut( 'fast' ).empty();
|
| 711 |
}
|
| 712 |
|
| 713 |
|
| 714 |
// Load the images for the next and previous slides.
|
| 715 |
+
$( next ).add( previous ).each( function() {
|
| 716 |
gallery.jp_carousel( 'loadFullImage', $( this ) );
|
| 717 |
+
});
|
| 718 |
|
| 719 |
window.location.hash = last_known_location_hash = '#jp-carousel-' + attachmentId;
|
| 720 |
},
|
| 747 |
orig = this.jp_carousel('originalDimensions'),
|
| 748 |
orig_ratio = orig.width / orig.height,
|
| 749 |
w_ratio = 1,
|
| 750 |
+
h_ratio = 1,
|
| 751 |
+
width, height;
|
| 752 |
|
| 753 |
+
if ( orig.width > max.width ) {
|
| 754 |
w_ratio = max.width / orig.width;
|
| 755 |
+
}
|
| 756 |
+
if ( orig.height > max.height ) {
|
| 757 |
h_ratio = max.height / orig.height;
|
| 758 |
+
}
|
| 759 |
|
| 760 |
if ( w_ratio < h_ratio ) {
|
| 761 |
width = max.width;
|
| 774 |
};
|
| 775 |
},
|
| 776 |
|
| 777 |
+
fitInfo : function(/*animated*/){
|
| 778 |
var current = this.jp_carousel('selectedSlide'),
|
| 779 |
size = current.jp_carousel('bestFit');
|
| 780 |
|
| 799 |
}
|
| 800 |
},
|
| 801 |
|
| 802 |
+
fitSlide : function(/*animated*/){
|
| 803 |
return this.each(function(){
|
| 804 |
+
var $this = $(this),
|
|
|
|
| 805 |
dimensions = $this.jp_carousel('bestFit'),
|
| 806 |
method = 'css',
|
| 807 |
max = gallery.jp_carousel('slideDimensions');
|
| 813 |
},
|
| 814 |
|
| 815 |
texturize : function(text) {
|
| 816 |
+
text = '' + text; // make sure we get a string. Title "1" came in as int 1, for example, which did not support .replace().
|
| 817 |
text = text.replace(/'/g, '’').replace(/'/g, '’').replace(/[\u2019]/g, '’');
|
| 818 |
text = text.replace(/"/g, '”').replace(/"/g, '”').replace(/"/g, '”').replace(/[\u201D]/g, '”');
|
| 819 |
text = text.replace(/([\w]+)=&#[\d]+;(.+?)&#[\d]+;/g, '$1="$2"'); // untexturize allowed HTML tags params double-quotes
|
| 821 |
},
|
| 822 |
|
| 823 |
initSlides : function(items, start_index){
|
|
|
|
|
|
|
|
|
|
| 824 |
if ( items.length < 2 ) {
|
| 825 |
$( '.jp-carousel-next-button, .jp-carousel-previous-button' ).hide();
|
| 826 |
+
} else {
|
|
|
|
| 827 |
$( '.jp-carousel-next-button, .jp-carousel-previous-button' ).show();
|
| 828 |
}
|
| 829 |
|
| 830 |
// Calculate the new src.
|
| 831 |
+
items.each(function(/*i*/){
|
| 832 |
var src_item = $(this),
|
| 833 |
orig_size = src_item.data('orig-size') || '',
|
| 834 |
max = gallery.jp_carousel('slideDimensions'),
|
| 835 |
+
parts = orig_size.split(','),
|
|
|
|
| 836 |
medium_file = src_item.data('medium-file') || '',
|
| 837 |
+
large_file = src_item.data('large-file') || '',
|
| 838 |
+
src;
|
| 839 |
+
orig_size = {width: parseInt(parts[0], 10), height: parseInt(parts[1], 10)};
|
| 840 |
|
| 841 |
src = src_item.data('orig-file');
|
| 842 |
|
| 855 |
});
|
| 856 |
|
| 857 |
// If the start_index is not 0 then preload the clicked image first.
|
| 858 |
+
if ( 0 !== start_index ) {
|
| 859 |
$('<img/>')[0].src = $(items[start_index]).data('gallery-src');
|
| 860 |
+
}
|
| 861 |
|
| 862 |
var useInPageThumbnails = items.first().closest( '.tiled-gallery.type-rectangular' ).length > 0;
|
| 863 |
|
| 878 |
orig_file = src_item.data('orig-file') || '';
|
| 879 |
|
| 880 |
var tiledCaption = src_item.parents('div.tiled-gallery-item').find('div.tiled-gallery-caption').html();
|
| 881 |
+
if ( tiledCaption ) {
|
| 882 |
caption = tiledCaption;
|
| 883 |
+
}
|
| 884 |
|
| 885 |
if ( attachment_id && orig_size.length ) {
|
| 886 |
title = gallery.jp_carousel('texturize', title);
|
| 934 |
},
|
| 935 |
|
| 936 |
selectBestImageSize: function(args) {
|
| 937 |
+
if ( 'object' !== typeof args ) {
|
| 938 |
args = {};
|
| 939 |
+
}
|
| 940 |
|
| 941 |
+
if ( 'undefined' === typeof args.orig_file ) {
|
| 942 |
return '';
|
| 943 |
+
}
|
| 944 |
|
| 945 |
+
if ( 'undefined' === typeof args.orig_width || 'undefined' === typeof args.max_width ) {
|
| 946 |
return args.orig_file;
|
| 947 |
+
}
|
| 948 |
|
| 949 |
+
if ( 'undefined' === typeof args.medium_file || 'undefined' === typeof args.large_file ) {
|
| 950 |
return args.orig_file;
|
| 951 |
+
}
|
| 952 |
|
| 953 |
var medium_size = args.medium_file.replace(/-([\d]+x[\d]+)\..+$/, '$1'),
|
| 954 |
+
medium_size_parts = (medium_size !== args.medium_file) ? medium_size.split('x') : [args.orig_width, 0],
|
| 955 |
medium_width = parseInt( medium_size_parts[0], 10 ),
|
| 956 |
medium_height = parseInt( medium_size_parts[1], 10 ),
|
| 957 |
large_size = args.large_file.replace(/-([\d]+x[\d]+)\..+$/, '$1'),
|
| 958 |
+
large_size_parts = (large_size !== args.large_file) ? large_size.split('x') : [args.orig_width, 0],
|
| 959 |
large_width = parseInt( large_size_parts[0], 10 ),
|
| 960 |
large_height = parseInt( large_size_parts[1], 10 );
|
| 961 |
|
| 962 |
// Give devices with a higher devicePixelRatio higher-res images (Retina display = 2, Android phones = 1.5, etc)
|
| 963 |
+
if ( 'undefined' !== typeof window.devicePixelRatio && window.devicePixelRatio > 1 ) {
|
| 964 |
args.max_width = args.max_width * window.devicePixelRatio;
|
| 965 |
args.max_height = args.max_height * window.devicePixelRatio;
|
| 966 |
}
|
| 967 |
|
| 968 |
+
if ( large_width >= args.max_width || large_height >= args.max_height ) {
|
| 969 |
return args.large_file;
|
| 970 |
+
}
|
| 971 |
|
| 972 |
+
if ( medium_width >= args.max_width || medium_height >= args.max_height ) {
|
| 973 |
return args.medium_file;
|
| 974 |
+
}
|
| 975 |
|
| 976 |
return args.orig_file;
|
| 977 |
},
|
| 978 |
|
|
|
|
| 979 |
originalDimensions: function() {
|
| 980 |
var splitted = $(this).data('orig-size').split(',');
|
| 981 |
return {width: parseInt(splitted[0], 10), height: parseInt(splitted[1], 10)};
|
| 982 |
},
|
| 983 |
|
| 984 |
format: function( args ) {
|
| 985 |
+
if ( 'object' !== typeof args ) {
|
| 986 |
args = {};
|
| 987 |
+
}
|
| 988 |
+
if ( ! args.text || 'undefined' === typeof args.text ) {
|
| 989 |
return;
|
| 990 |
+
}
|
| 991 |
+
if ( ! args.replacements || 'undefined' === typeof args.replacements ) {
|
| 992 |
return args.text;
|
| 993 |
+
}
|
| 994 |
+
return args.text.replace(/{(\d+)}/g, function( match, number ) {
|
| 995 |
+
return typeof args.replacements[number] !== 'undefined' ? args.replacements[number] : match;
|
| 996 |
});
|
| 997 |
},
|
| 998 |
|
| 999 |
shutterSpeed: function(d) {
|
| 1000 |
+
if (d >= 1) {
|
| 1001 |
return Math.round(d) + 's';
|
| 1002 |
+
}
|
| 1003 |
var df = 1, top = 1, bot = 1;
|
| 1004 |
var limit = 1e3;
|
| 1005 |
+
while (df !== d && limit-- > 0) {
|
| 1006 |
if (df < d) {
|
| 1007 |
top += 1;
|
| 1008 |
+
} else {
|
|
|
|
| 1009 |
bot += 1;
|
| 1010 |
top = parseInt(d * bot, 10);
|
| 1011 |
}
|
| 1015 |
bot = Math.round(bot / top);
|
| 1016 |
top = 1;
|
| 1017 |
}
|
| 1018 |
+
if (bot <= 1) {
|
| 1019 |
return '1s';
|
| 1020 |
+
}
|
| 1021 |
return top + '/' + bot + 's';
|
| 1022 |
},
|
| 1023 |
|
| 1024 |
parseTitleDesc: function( value ) {
|
| 1025 |
+
if ( !value.match(' ') && value.match('_') ) {
|
| 1026 |
return '';
|
| 1027 |
+
}
|
| 1028 |
// Prefix list originally based on http://commons.wikimedia.org/wiki/MediaWiki:Filename-prefix-blacklist
|
| 1029 |
+
$([
|
| 1030 |
'CIMG', // Casio
|
| 1031 |
'DSC_', // Nikon
|
| 1032 |
'DSCF', // Fuji
|
| 1046 |
'Screen Shot [0-9]+' // Mac screenshots
|
| 1047 |
])
|
| 1048 |
.each(function(key, val){
|
| 1049 |
+
var regex = new RegExp('^' + val);
|
| 1050 |
if ( regex.test(value) ) {
|
| 1051 |
value = '';
|
| 1052 |
return;
|
| 1056 |
},
|
| 1057 |
|
| 1058 |
getTitleDesc: function( data ) {
|
| 1059 |
+
var title ='', desc = '', markup = '', target;
|
| 1060 |
|
| 1061 |
target = $( 'div.jp-carousel-titleanddesc', 'div.jp-carousel-wrap' );
|
| 1062 |
target.hide();
|
| 1066 |
|
| 1067 |
if ( title.length || desc.length ) {
|
| 1068 |
// $('<div />').text(sometext).html() is a trick to go to HTML to plain text (including HTML entities decode, etc)
|
| 1069 |
+
if ( $('<div />').text(title).html() === $('<div />').text(desc).html() ) {
|
| 1070 |
title = '';
|
| 1071 |
+
}
|
| 1072 |
|
| 1073 |
markup = ( title.length ) ? '<div class="jp-carousel-titleanddesc-title">' + title + '</div>' : '';
|
| 1074 |
markup += ( desc.length ) ? '<div class="jp-carousel-titleanddesc-desc">' + desc + '</div>' : '';
|
| 1082 |
|
| 1083 |
updateLikesWidgetVisibility: function ( attachmentId ) {
|
| 1084 |
// Only do this if likes is enabled
|
| 1085 |
+
if ( 'undefined' === typeof jetpackLikesWidgetQueue ) {
|
| 1086 |
return;
|
| 1087 |
+
}
|
| 1088 |
|
| 1089 |
// Hide all likes widgets except for the one for the attachmentId passed in
|
| 1090 |
$( '.jp-carousel-buttons .jetpack-likes-widget-wrapper' ).css( 'display', 'none' ).each( function () {
|
| 1091 |
var widgetWrapper = $( this );
|
| 1092 |
+
if ( widgetWrapper.attr( 'data-attachment-id' ) == attachmentId ) { // jshint ignore:line
|
| 1093 |
widgetWrapper.css( 'display', 'inline-block' );
|
| 1094 |
return false;
|
| 1095 |
}
|
| 1100 |
var dataCarouselExtra = $( '.jp-carousel-wrap' ).data( 'carousel-extra' );
|
| 1101 |
var blogId = dataCarouselExtra.likes_blog_id;
|
| 1102 |
|
| 1103 |
+
if ( $( '#like-post-wrapper-' + blogId + '-' + attachmentId ).length === 0 ) {
|
| 1104 |
// Add the iframe the first time the slide is shown.
|
| 1105 |
var protocol = 'http';
|
| 1106 |
var originDomain = 'http://wordpress.com';
|
| 1107 |
|
| 1108 |
if ( dataCarouselExtra.permalink.length ) {
|
| 1109 |
+
protocol = dataCarouselExtra.permalink.split( ':' )[0];
|
| 1110 |
|
| 1111 |
+
if ( ( protocol !== 'http' ) && ( protocol !== 'https' ) ) {
|
| 1112 |
protocol = 'http';
|
| 1113 |
+
}
|
| 1114 |
|
| 1115 |
var parts = dataCarouselExtra.permalink.split( '/' );
|
| 1116 |
|
| 1117 |
+
if ( parts.length >= 2 ) {
|
| 1118 |
+
originDomain = protocol + '://' + parts[2];
|
| 1119 |
+
}
|
| 1120 |
}
|
| 1121 |
|
| 1122 |
+
var dataSource = protocol + '://widgets.wp.com/likes/#blog_id=' + encodeURIComponent( blogId ) +
|
| 1123 |
+
'&post_id=' + encodeURIComponent( attachmentId ) +
|
| 1124 |
+
'&slim=1&origin=' + encodeURIComponent( originDomain );
|
| 1125 |
|
| 1126 |
+
if ( 'en' !== jetpackCarouselStrings.lang ) {
|
| 1127 |
+
dataSource += '&lang=' + encodeURIComponent( jetpackCarouselStrings.lang );
|
| 1128 |
+
}
|
| 1129 |
|
| 1130 |
+
var likesWidget = $( '<iframe class=\'post-likes-widget jetpack-likes-widget jetpack-resizeable\'></iframe>' )
|
| 1131 |
+
.attr( 'name', 'like-post-frame-' + blogId + '-' + attachmentId )
|
| 1132 |
.attr( 'src', dataSource )
|
| 1133 |
+
.css( 'display', 'inline-block' );
|
| 1134 |
+
|
| 1135 |
+
var likesWidgetWrapper = $( '<div/>' )
|
| 1136 |
+
.addClass( 'jetpack-likes-widget-wrapper jetpack-likes-widget-unloaded slim-likes-widget' )
|
| 1137 |
+
.attr( 'id', 'like-post-wrapper-' + blogId + '-' + attachmentId )
|
| 1138 |
+
.attr( 'data-src', dataSource )
|
| 1139 |
+
.attr( 'data-name', 'like-post-frame-' + blogId + '-' + attachmentId )
|
| 1140 |
+
.attr( 'data-attachment-id', attachmentId )
|
| 1141 |
+
.css( 'display', 'none' )
|
| 1142 |
+
.css( 'vertical-align', 'middle' )
|
| 1143 |
.append( likesWidget )
|
| 1144 |
+
.append( '<div class=\'post-likes-widget-placeholder\'></div>' );
|
| 1145 |
|
| 1146 |
$( '.jp-carousel-buttons' ).append( likesWidgetWrapper );
|
| 1147 |
}
|
| 1150 |
|
| 1151 |
// updateExif updates the contents of the exif UL (.jp-carousel-image-exif)
|
| 1152 |
updateExif: function( meta ) {
|
| 1153 |
+
if ( !meta || 1 !== Number( jetpackCarouselStrings.display_exif ) ) {
|
| 1154 |
return false;
|
| 1155 |
+
}
|
| 1156 |
|
| 1157 |
+
var $ul = $( '<ul class=\'jp-carousel-image-exif\'></ul>' );
|
| 1158 |
|
| 1159 |
$.each( meta, function( key, val ) {
|
| 1160 |
+
if ( 0 === parseFloat(val) || !val.length || -1 === $.inArray( key, [ 'camera', 'aperture', 'shutter_speed', 'focal_length' ] ) ) {
|
| 1161 |
return;
|
| 1162 |
+
}
|
| 1163 |
|
| 1164 |
switch( key ) {
|
| 1165 |
case 'focal_length':
|
| 1182 |
|
| 1183 |
// updateFullSizeLink updates the contents of the jp-carousel-image-download link
|
| 1184 |
updateFullSizeLink: function(current) {
|
| 1185 |
+
if(!current || !current.data) {
|
| 1186 |
return false;
|
| 1187 |
+
}
|
| 1188 |
var original = current.data('orig-file').replace(/\?.+$/, ''),
|
| 1189 |
origSize = current.data('orig-size').split(','),
|
| 1190 |
permalink = $( '<a>'+gallery.jp_carousel('format', {'text': jetpackCarouselStrings.download_original, 'replacements': origSize})+'</a>' )
|
| 1197 |
},
|
| 1198 |
|
| 1199 |
updateMap: function( meta ) {
|
| 1200 |
+
if ( !meta.latitude || !meta.longitude || 1 !== Number( jetpackCarouselStrings.display_geo ) ) {
|
| 1201 |
return;
|
| 1202 |
+
}
|
| 1203 |
|
| 1204 |
var latitude = meta.latitude,
|
| 1205 |
longitude = meta.longitude,
|
| 1228 |
},
|
| 1229 |
|
| 1230 |
testCommentsOpened: function( opened ) {
|
| 1231 |
+
if ( 1 === parseInt( opened, 10 ) ) {
|
| 1232 |
$('.jp-carousel-buttons').fadeIn('fast');
|
| 1233 |
commentForm.fadeIn('fast');
|
| 1234 |
} else {
|
| 1240 |
getComments: function( args ) {
|
| 1241 |
clearInterval( commentInterval );
|
| 1242 |
|
| 1243 |
+
if ( 'object' !== typeof args ) {
|
| 1244 |
return;
|
| 1245 |
+
}
|
| 1246 |
|
| 1247 |
+
if ( 'undefined' === typeof args.attachment_id || ! args.attachment_id ) {
|
| 1248 |
return;
|
| 1249 |
+
}
|
| 1250 |
|
| 1251 |
+
if ( ! args.offset || 'undefined' === typeof args.offset || args.offset < 1 ) {
|
| 1252 |
args.offset = 0;
|
| 1253 |
+
}
|
| 1254 |
|
| 1255 |
var comments = $('.jp-carousel-comments'),
|
| 1256 |
commentsLoading = $('#jp-carousel-comments-loading').show();
|
| 1257 |
|
| 1258 |
+
if ( args.clear ) {
|
| 1259 |
comments.hide().empty();
|
| 1260 |
+
}
|
| 1261 |
|
| 1262 |
$.ajax({
|
| 1263 |
type: 'GET',
|
| 1269 |
id: args.attachment_id,
|
| 1270 |
offset: args.offset
|
| 1271 |
},
|
| 1272 |
+
success: function(data/*, status, xhr*/) {
|
| 1273 |
+
if ( args.clear ) {
|
| 1274 |
comments.fadeOut('fast').empty();
|
| 1275 |
+
}
|
| 1276 |
|
| 1277 |
$( data ).each(function(){
|
| 1278 |
var comment = $('<div></div>')
|
| 1279 |
.addClass('jp-carousel-comment')
|
| 1280 |
.attr('id', 'jp-carousel-comment-' + this['id'])
|
| 1281 |
.html(
|
| 1282 |
+
'<div class="comment-gravatar">' +
|
| 1283 |
+
this['gravatar_markup'] +
|
| 1284 |
+
'</div>' +
|
| 1285 |
+
'<div class="comment-author">' +
|
| 1286 |
+
this['author_markup'] +
|
| 1287 |
+
'</div>' +
|
| 1288 |
+
'<div class="comment-date">' +
|
| 1289 |
+
this['date_gmt'] +
|
| 1290 |
+
'</div>' +
|
| 1291 |
+
'<div class="comment-content">' +
|
| 1292 |
+
this['content'] +
|
| 1293 |
+
'</div>'
|
| 1294 |
);
|
| 1295 |
comments.append(comment);
|
| 1296 |
|
| 1308 |
// attachment id might no longer match the current attachment id by the time we get the data back or a now
|
| 1309 |
// registered infiniscroll event kicks in, so we don't ever display comments for the wrong image by mistake.
|
| 1310 |
var current = $('.jp-carousel div.selected');
|
| 1311 |
+
if ( current && current.data && current.data('attachment-id') != args.attachment_id ) { // jshint ignore:line
|
| 1312 |
comments.fadeOut('fast');
|
| 1313 |
comments.empty();
|
| 1314 |
return;
|
| 1330 |
},
|
| 1331 |
|
| 1332 |
postCommentError: function(args) {
|
| 1333 |
+
if ( 'object' !== typeof args ) {
|
| 1334 |
args = {};
|
| 1335 |
+
}
|
| 1336 |
+
if ( ! args.field || 'undefined' === typeof args.field || ! args.error || 'undefined' === typeof args.error ) {
|
| 1337 |
return;
|
| 1338 |
+
}
|
| 1339 |
$('#jp-carousel-comment-post-results').slideUp('fast').html('<span class="jp-carousel-comment-post-error">'+args.error+'</span>').slideDown('fast');
|
| 1340 |
$('#jp-carousel-comment-form-spinner').spin(false);
|
| 1341 |
},
|
| 1351 |
|
| 1352 |
clearCommentTextAreaValue: function() {
|
| 1353 |
var commentTextArea = $('#jp-carousel-comment-form-comment-field');
|
| 1354 |
+
if ( commentTextArea ) {
|
| 1355 |
commentTextArea.val('');
|
| 1356 |
+
}
|
| 1357 |
},
|
| 1358 |
|
| 1359 |
nextSlide : function () {
|
| 1360 |
var slides = this.jp_carousel( 'slides' );
|
| 1361 |
var selected = this.jp_carousel( 'selectedSlide' );
|
| 1362 |
|
| 1363 |
+
if ( selected.length === 0 || ( slides.length > 2 && selected.is( slides.last() ) ) ) {
|
| 1364 |
return slides.first();
|
| 1365 |
+
}
|
| 1366 |
|
| 1367 |
return selected.next();
|
| 1368 |
},
|
| 1371 |
var slides = this.jp_carousel( 'slides' );
|
| 1372 |
var selected = this.jp_carousel( 'selectedSlide' );
|
| 1373 |
|
| 1374 |
+
if ( selected.length === 0 || ( slides.length > 2 && selected.is( slides.first() ) ) ) {
|
| 1375 |
return slides.last();
|
| 1376 |
+
}
|
| 1377 |
|
| 1378 |
return selected.prev();
|
| 1379 |
},
|
| 1390 |
$( this ).closest( '.jp-carousel-slide' ).css( 'background-image', '' );
|
| 1391 |
} );
|
| 1392 |
|
| 1393 |
+
if ( ! slide.data( 'preview-image' ) || ( slide.data( 'thumb-size' ) && slide.width() > slide.data( 'thumb-size' ).width ) ) {
|
| 1394 |
image.attr( 'src', image.closest( '.jp-carousel-slide' ).data( 'src' ) );
|
| 1395 |
+
} else {
|
| 1396 |
image.attr( 'src', slide.data( 'preview-image' ) );
|
| 1397 |
+
}
|
| 1398 |
|
| 1399 |
image.data( 'loaded', 1 );
|
| 1400 |
}
|
| 1416 |
|
| 1417 |
// register the event listener for starting the gallery
|
| 1418 |
$( document.body ).on( 'click', 'div.gallery,div.tiled-gallery', function(e) {
|
| 1419 |
+
if ( ! $(this).jp_carousel( 'testForData', e.currentTarget ) ) {
|
| 1420 |
return;
|
| 1421 |
+
}
|
| 1422 |
+
if ( $(e.target).parent().hasClass('gallery-caption') ) {
|
| 1423 |
return;
|
| 1424 |
+
}
|
| 1425 |
e.preventDefault();
|
| 1426 |
$(this).jp_carousel('open', {start_index: $(this).find('.gallery-item, .tiled-gallery-item').index($(e.target).parents('.gallery-item, .tiled-gallery-item'))});
|
| 1427 |
});
|
| 1428 |
|
| 1429 |
// Makes carousel work on page load and when back button leads to same URL with carousel hash (ie: no actual document.ready trigger)
|
| 1430 |
$( window ).on( 'hashchange', function () {
|
| 1431 |
+
if ( ! window.location.hash || ! window.location.hash.match(/jp-carousel-(\d+)/) ) {
|
| 1432 |
return;
|
| 1433 |
+
}
|
| 1434 |
|
| 1435 |
+
if ( window.location.hash === last_known_location_hash ) {
|
| 1436 |
return;
|
| 1437 |
+
}
|
| 1438 |
|
| 1439 |
last_known_location_hash = window.location.hash;
|
| 1440 |
|
| 1441 |
var gallery = $('div.gallery, div.tiled-gallery'), index = -1, n = window.location.hash.match(/jp-carousel-(\d+)/);
|
| 1442 |
|
| 1443 |
+
if ( ! $(this).jp_carousel( 'testForData', gallery ) ) {
|
| 1444 |
return;
|
| 1445 |
+
}
|
| 1446 |
|
| 1447 |
n = parseInt(n[1], 10);
|
| 1448 |
|
| 1449 |
gallery.find('img').each(function(num, el){
|
| 1450 |
+
// n cannot be 0 (zero)
|
| 1451 |
+
if ( n && Number( $(el).data('attachment-id') ) === n ) {
|
| 1452 |
index = num;
|
| 1453 |
return false;
|
| 1454 |
}
|
| 1455 |
});
|
| 1456 |
|
| 1457 |
+
if ( index !== -1 ) {
|
| 1458 |
+
gallery.jp_carousel('openOrSelectSlide', index);
|
| 1459 |
+
}
|
| 1460 |
});
|
| 1461 |
|
| 1462 |
+
if ( window.location.hash ) {
|
| 1463 |
$( window ).trigger( 'hashchange' );
|
| 1464 |
+
}
|
| 1465 |
});
|
| 1466 |
|
| 1467 |
/**
|
| 1476 |
var config = {
|
| 1477 |
min_move_x: 20,
|
| 1478 |
min_move_y: 20,
|
| 1479 |
+
wipeLeft: function(/*e*/) { },
|
| 1480 |
+
wipeRight: function(/*e*/) { },
|
| 1481 |
+
wipeUp: function(/*e*/) { },
|
| 1482 |
+
wipeDown: function(/*e*/) { },
|
| 1483 |
preventDefaultEvents: true
|
| 1484 |
};
|
| 1485 |
|
| 1486 |
+
if (settings) {
|
| 1487 |
+
$.extend(config, settings);
|
| 1488 |
+
}
|
| 1489 |
|
| 1490 |
this.each(function() {
|
| 1491 |
var startX;
|
| 1511 |
cancelTouch();
|
| 1512 |
if(dx > 0) {
|
| 1513 |
config.wipeLeft(e);
|
| 1514 |
+
} else {
|
|
|
|
| 1515 |
config.wipeRight(e);
|
| 1516 |
}
|
| 1517 |
}
|
| 1519 |
cancelTouch();
|
| 1520 |
if(dy > 0) {
|
| 1521 |
config.wipeDown(e);
|
| 1522 |
+
} else {
|
|
|
|
| 1523 |
config.wipeUp(e);
|
| 1524 |
}
|
| 1525 |
}
|
| 1528 |
|
| 1529 |
function onTouchStart(e)
|
| 1530 |
{
|
| 1531 |
+
if (e.touches.length === 1) {
|
| 1532 |
startX = e.touches[0].pageX;
|
| 1533 |
startY = e.touches[0].pageY;
|
| 1534 |
isMoving = true;
|
carousel/jetpack-carousel.php
CHANGED
|
@@ -1,5 +1,20 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
var $prebuilt_widths = array( 370, 700, 1000, 1200, 1400, 2000 );
|
| 5 |
|
|
@@ -71,7 +86,7 @@ class No_Jetpack_Carousel {
|
|
| 71 |
do_action( 'jp_carousel_thumbnails_shown' );
|
| 72 |
|
| 73 |
if ( $this->first_run ) {
|
| 74 |
-
wp_enqueue_script( 'jetpack-carousel', plugins_url( 'jetpack-carousel.js', __FILE__ ), array( 'jquery.spin' ), $this->asset_version( '
|
| 75 |
|
| 76 |
// Note: using home_url() instead of admin_url() for ajaxurl to be sure to get same domain on wpcom when using mapped domains (also works on self-hosted)
|
| 77 |
// Also: not hardcoding path since there is no guarantee site is running on site root in self-hosted context.
|
|
@@ -83,26 +98,26 @@ class No_Jetpack_Carousel {
|
|
| 83 |
'widths' => $this->prebuilt_widths,
|
| 84 |
'is_logged_in' => $is_logged_in,
|
| 85 |
'lang' => strtolower( substr( get_locale(), 0, 2 ) ),
|
| 86 |
-
'ajaxurl' => admin_url( 'admin-ajax.php'
|
| 87 |
'nonce' => wp_create_nonce( 'carousel_nonce' ),
|
| 88 |
'display_exif' => $this->test_1or0_option( get_option( 'carousel_display_exif' ), true ),
|
| 89 |
'display_geo' => $this->test_1or0_option( get_option( 'carousel_display_geo' ), true ),
|
| 90 |
'background_color' => $this->carousel_background_color_sanitize( get_option( 'carousel_background_color' ) ),
|
| 91 |
-
'comment' => __( 'Comment', '
|
| 92 |
-
'post_comment' => __( 'Post Comment', '
|
| 93 |
-
'write_comment' => __( 'Write a Comment...', '
|
| 94 |
-
'loading_comments' => __( 'Loading Comments...', '
|
| 95 |
-
'download_original' => sprintf( __( 'View full size <span class="photo-size">%1$s<span class="photo-size-times">×</span>%2$s</span>', '
|
| 96 |
-
'no_comment_text' => __( 'Please be sure to submit some text with your comment.', '
|
| 97 |
-
'no_comment_email' => __( 'Please provide an email address to comment.', '
|
| 98 |
-
'no_comment_author' => __( 'Please provide your name to comment.', '
|
| 99 |
-
'comment_post_error' => __( 'Sorry, but there was an error posting your comment. Please try again later.', '
|
| 100 |
-
'comment_approved' => __( 'Your comment was approved.', '
|
| 101 |
-
'comment_unapproved' => __( 'Your comment is in moderation.', '
|
| 102 |
-
'camera' => __( 'Camera', '
|
| 103 |
-
'aperture' => __( 'Aperture', '
|
| 104 |
-
'shutter_speed' => __( 'Shutter Speed', '
|
| 105 |
-
'focal_length' => __( 'Focal Length', '
|
| 106 |
'comment_registration' => $comment_registration,
|
| 107 |
'require_name_email' => $require_name_email,
|
| 108 |
'login_url' => wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ),
|
|
@@ -112,18 +127,18 @@ class No_Jetpack_Carousel {
|
|
| 112 |
// We're not using Jetpack comments after all, so fallback to standard local comments.
|
| 113 |
|
| 114 |
if ( $is_logged_in ) {
|
| 115 |
-
$localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . sprintf( __( 'Commenting as %s', '
|
| 116 |
} else {
|
| 117 |
if ( $comment_registration ) {
|
| 118 |
-
$localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . __( 'You must be <a href="#" class="jp-carousel-comment-login">logged in</a> to post a comment.', '
|
| 119 |
} else {
|
| 120 |
-
$required = ( $require_name_email ) ? __( '%s (Required)', '
|
| 121 |
$localize_strings['local_comments_commenting_as'] = ''
|
| 122 |
-
. '<fieldset><label for="email">' . sprintf( $required, __( 'Email', '
|
| 123 |
. '<input type="text" name="email" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-email-field" /></fieldset>'
|
| 124 |
-
. '<fieldset><label for="author">' . sprintf( $required, __( 'Name', '
|
| 125 |
. '<input type="text" name="author" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-author-field" /></fieldset>'
|
| 126 |
-
. '<fieldset><label for="url">' . __( 'Website', '
|
| 127 |
. '<input type="text" name="url" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-url-field" /></fieldset>';
|
| 128 |
}
|
| 129 |
}
|
|
@@ -131,15 +146,16 @@ class No_Jetpack_Carousel {
|
|
| 131 |
|
| 132 |
$localize_strings = apply_filters( 'jp_carousel_localize_strings', $localize_strings );
|
| 133 |
wp_localize_script( 'jetpack-carousel', 'jetpackCarouselStrings', $localize_strings );
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
$msie = strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) + 4;
|
| 139 |
-
$version = (float) substr( $_SERVER['HTTP_USER_AGENT'], $msie, strpos( $_SERVER['HTTP_USER_AGENT'], ';', $msie ) - $msie );
|
| 140 |
-
if( $version < 9 )
|
| 141 |
-
wp_enqueue_style( 'jetpack-carousel-ie8fix', plugins_url( 'jetpack-carousel-ie8fix.css', __FILE__ ), array(), $this->asset_version( '20121024' ) );
|
| 142 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
do_action( 'jp_carousel_enqueue_assets', $this->first_run, $localize_strings );
|
| 144 |
|
| 145 |
$this->first_run = false;
|
|
@@ -248,7 +264,7 @@ class No_Jetpack_Carousel {
|
|
| 248 |
$offset = ( isset( $_REQUEST['offset'] ) ) ? (int) $_REQUEST['offset'] : 0;
|
| 249 |
|
| 250 |
if ( ! $attachment_id ) {
|
| 251 |
-
echo json_encode( __( 'Missing attachment ID.', '
|
| 252 |
die();
|
| 253 |
}
|
| 254 |
|
|
@@ -267,11 +283,14 @@ class No_Jetpack_Carousel {
|
|
| 267 |
|
| 268 |
// Can't just send the results, they contain the commenter's email address.
|
| 269 |
foreach ( $comments as $comment ) {
|
|
|
|
|
|
|
|
|
|
| 270 |
$out[] = array(
|
| 271 |
'id' => $comment->comment_ID,
|
| 272 |
'parent_id' => $comment->comment_parent,
|
| 273 |
'author_markup' => get_comment_author_link( $comment->comment_ID ),
|
| 274 |
-
'gravatar_markup' =>
|
| 275 |
'date_gmt' => $comment->comment_date_gmt,
|
| 276 |
'content' => wpautop($comment->comment_content),
|
| 277 |
);
|
|
@@ -285,20 +304,20 @@ class No_Jetpack_Carousel {
|
|
| 285 |
header('Content-type: text/javascript');
|
| 286 |
|
| 287 |
if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce($_POST['nonce'], 'carousel_nonce') )
|
| 288 |
-
die( json_encode( array( 'error' => __( 'Nonce verification failed.', '
|
| 289 |
|
| 290 |
$_blog_id = (int) $_POST['blog_id'];
|
| 291 |
$_post_id = (int) $_POST['id'];
|
| 292 |
$comment = $_POST['comment'];
|
| 293 |
|
| 294 |
if ( empty( $_blog_id ) )
|
| 295 |
-
die( json_encode( array( 'error' => __( 'Missing target blog ID.', '
|
| 296 |
|
| 297 |
if ( empty( $_post_id ) )
|
| 298 |
-
die( json_encode( array( 'error' => __( 'Missing target post ID.', '
|
| 299 |
|
| 300 |
if ( empty( $comment ) )
|
| 301 |
-
die( json_encode( array( 'error' => __( 'No comment text was submitted.', '
|
| 302 |
|
| 303 |
// Used in context like NewDash
|
| 304 |
$switched = false;
|
|
@@ -310,7 +329,7 @@ class No_Jetpack_Carousel {
|
|
| 310 |
do_action('jp_carousel_check_blog_user_privileges');
|
| 311 |
|
| 312 |
if ( ! comments_open( $_post_id ) )
|
| 313 |
-
die( json_encode( array( 'error' => __( 'Comments on this post are closed.', '
|
| 314 |
|
| 315 |
if ( is_user_logged_in() ) {
|
| 316 |
$user = wp_get_current_user();
|
|
@@ -320,7 +339,7 @@ class No_Jetpack_Carousel {
|
|
| 320 |
$url = $user->user_url;
|
| 321 |
|
| 322 |
if ( empty( $user_id ) )
|
| 323 |
-
die( json_encode( array( 'error' => __( 'Sorry, but we could not authenticate your request.', '
|
| 324 |
} else {
|
| 325 |
$user_id = 0;
|
| 326 |
$display_name = $_POST['author'];
|
|
@@ -329,13 +348,13 @@ class No_Jetpack_Carousel {
|
|
| 329 |
|
| 330 |
if ( get_option( 'require_name_email' ) ) {
|
| 331 |
if ( empty( $display_name ) )
|
| 332 |
-
die( json_encode( array( 'error' => __( 'Please provide your name.', '
|
| 333 |
|
| 334 |
if ( empty( $email ) )
|
| 335 |
-
die( json_encode( array( 'error' => __( 'Please provide an email address.', '
|
| 336 |
|
| 337 |
if ( ! is_email( $email ) )
|
| 338 |
-
die( json_encode( array( 'error' => __( 'Please provide a valid email address.', '
|
| 339 |
}
|
| 340 |
}
|
| 341 |
|
|
@@ -364,21 +383,21 @@ class No_Jetpack_Carousel {
|
|
| 364 |
}
|
| 365 |
|
| 366 |
function register_settings() {
|
| 367 |
-
add_settings_section('carousel_section', __( 'Image Gallery Carousel', '
|
| 368 |
|
| 369 |
if ( ! $this->in_jetpack ) {
|
| 370 |
-
add_settings_field('carousel_enable_it', __( 'Enable carousel', '
|
| 371 |
register_setting( 'media', 'carousel_enable_it', array( $this, 'carousel_enable_it_sanitize' ) );
|
| 372 |
}
|
| 373 |
|
| 374 |
-
add_settings_field('carousel_background_color', __( 'Background color', '
|
| 375 |
register_setting( 'media', 'carousel_background_color', array( $this, 'carousel_background_color_sanitize' ) );
|
| 376 |
|
| 377 |
add_settings_field('carousel_display_exif', __( 'Metadata', 'jetpack'), array( $this, 'carousel_display_exif_callback' ), 'media', 'carousel_section' );
|
| 378 |
register_setting( 'media', 'carousel_display_exif', array( $this, 'carousel_display_exif_sanitize' ) );
|
| 379 |
|
| 380 |
// No geo setting yet, need to "fuzzify" data first, for privacy
|
| 381 |
-
// add_settings_field('carousel_display_geo', __( 'Geolocation', '
|
| 382 |
// register_setting( 'media', 'carousel_display_geo', array( $this, 'carousel_display_geo_sanitize' ) );
|
| 383 |
}
|
| 384 |
|
|
@@ -431,7 +450,7 @@ class No_Jetpack_Carousel {
|
|
| 431 |
}
|
| 432 |
|
| 433 |
function carousel_display_exif_callback() {
|
| 434 |
-
$this->settings_checkbox( 'carousel_display_exif', __( 'Show photo metadata (<a href="http://en.wikipedia.org/wiki/Exchangeable_image_file_format" target="_blank">Exif</a>) in carousel, when available.', '
|
| 435 |
}
|
| 436 |
|
| 437 |
function carousel_display_exif_sanitize( $value ) {
|
|
@@ -439,7 +458,7 @@ class No_Jetpack_Carousel {
|
|
| 439 |
}
|
| 440 |
|
| 441 |
function carousel_display_geo_callback() {
|
| 442 |
-
$this->settings_checkbox( 'carousel_display_geo', __( 'Show map of photo location in carousel, when available.', '
|
| 443 |
}
|
| 444 |
|
| 445 |
function carousel_display_geo_sanitize( $value ) {
|
|
@@ -447,7 +466,7 @@ class No_Jetpack_Carousel {
|
|
| 447 |
}
|
| 448 |
|
| 449 |
function carousel_background_color_callback() {
|
| 450 |
-
$this->settings_select( 'carousel_background_color', array( 'black' => __( 'Black', '
|
| 451 |
}
|
| 452 |
|
| 453 |
function carousel_background_color_sanitize( $value ) {
|
|
@@ -455,7 +474,7 @@ class No_Jetpack_Carousel {
|
|
| 455 |
}
|
| 456 |
|
| 457 |
function carousel_enable_it_callback() {
|
| 458 |
-
$this->settings_checkbox( 'carousel_enable_it', __( 'Display images in full-size carousel slideshow.', '
|
| 459 |
}
|
| 460 |
|
| 461 |
function carousel_enable_it_sanitize( $value ) {
|
|
@@ -463,4 +482,4 @@ class No_Jetpack_Carousel {
|
|
| 463 |
}
|
| 464 |
}
|
| 465 |
|
| 466 |
-
new
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
+
/*
|
| 4 |
+
Plugin Name: Jetpack Carousel
|
| 5 |
+
Plugin URL: http://wordpress.com/
|
| 6 |
+
Description: Transform your standard image galleries into an immersive full-screen experience.
|
| 7 |
+
Version: 0.1
|
| 8 |
+
Author: Automattic
|
| 9 |
+
|
| 10 |
+
Released under the GPL v.2 license.
|
| 11 |
+
|
| 12 |
+
This program is distributed in the hope that it will be useful,
|
| 13 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 |
+
GNU General Public License for more details.
|
| 16 |
+
*/
|
| 17 |
+
class Jetpack_Carousel {
|
| 18 |
|
| 19 |
var $prebuilt_widths = array( 370, 700, 1000, 1200, 1400, 2000 );
|
| 20 |
|
| 86 |
do_action( 'jp_carousel_thumbnails_shown' );
|
| 87 |
|
| 88 |
if ( $this->first_run ) {
|
| 89 |
+
wp_enqueue_script( 'jetpack-carousel', plugins_url( 'jetpack-carousel.js', __FILE__ ), array( 'jquery.spin' ), $this->asset_version( '20140505' ), true );
|
| 90 |
|
| 91 |
// Note: using home_url() instead of admin_url() for ajaxurl to be sure to get same domain on wpcom when using mapped domains (also works on self-hosted)
|
| 92 |
// Also: not hardcoding path since there is no guarantee site is running on site root in self-hosted context.
|
| 98 |
'widths' => $this->prebuilt_widths,
|
| 99 |
'is_logged_in' => $is_logged_in,
|
| 100 |
'lang' => strtolower( substr( get_locale(), 0, 2 ) ),
|
| 101 |
+
'ajaxurl' => set_url_scheme( admin_url( 'admin-ajax.php' ) ),
|
| 102 |
'nonce' => wp_create_nonce( 'carousel_nonce' ),
|
| 103 |
'display_exif' => $this->test_1or0_option( get_option( 'carousel_display_exif' ), true ),
|
| 104 |
'display_geo' => $this->test_1or0_option( get_option( 'carousel_display_geo' ), true ),
|
| 105 |
'background_color' => $this->carousel_background_color_sanitize( get_option( 'carousel_background_color' ) ),
|
| 106 |
+
'comment' => __( 'Comment', 'jetpack' ),
|
| 107 |
+
'post_comment' => __( 'Post Comment', 'jetpack' ),
|
| 108 |
+
'write_comment' => __( 'Write a Comment...', 'jetpack' ),
|
| 109 |
+
'loading_comments' => __( 'Loading Comments...', 'jetpack' ),
|
| 110 |
+
'download_original' => sprintf( __( 'View full size <span class="photo-size">%1$s<span class="photo-size-times">×</span>%2$s</span>', 'jetpack' ), '{0}', '{1}' ),
|
| 111 |
+
'no_comment_text' => __( 'Please be sure to submit some text with your comment.', 'jetpack' ),
|
| 112 |
+
'no_comment_email' => __( 'Please provide an email address to comment.', 'jetpack' ),
|
| 113 |
+
'no_comment_author' => __( 'Please provide your name to comment.', 'jetpack' ),
|
| 114 |
+
'comment_post_error' => __( 'Sorry, but there was an error posting your comment. Please try again later.', 'jetpack' ),
|
| 115 |
+
'comment_approved' => __( 'Your comment was approved.', 'jetpack' ),
|
| 116 |
+
'comment_unapproved' => __( 'Your comment is in moderation.', 'jetpack' ),
|
| 117 |
+
'camera' => __( 'Camera', 'jetpack' ),
|
| 118 |
+
'aperture' => __( 'Aperture', 'jetpack' ),
|
| 119 |
+
'shutter_speed' => __( 'Shutter Speed', 'jetpack' ),
|
| 120 |
+
'focal_length' => __( 'Focal Length', 'jetpack' ),
|
| 121 |
'comment_registration' => $comment_registration,
|
| 122 |
'require_name_email' => $require_name_email,
|
| 123 |
'login_url' => wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ),
|
| 127 |
// We're not using Jetpack comments after all, so fallback to standard local comments.
|
| 128 |
|
| 129 |
if ( $is_logged_in ) {
|
| 130 |
+
$localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . sprintf( __( 'Commenting as %s', 'jetpack' ), $current_user->data->display_name ) . '</p>';
|
| 131 |
} else {
|
| 132 |
if ( $comment_registration ) {
|
| 133 |
+
$localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . __( 'You must be <a href="#" class="jp-carousel-comment-login">logged in</a> to post a comment.', 'jetpack' ) . '</p>';
|
| 134 |
} else {
|
| 135 |
+
$required = ( $require_name_email ) ? __( '%s (Required)', 'jetpack' ) : '%s';
|
| 136 |
$localize_strings['local_comments_commenting_as'] = ''
|
| 137 |
+
. '<fieldset><label for="email">' . sprintf( $required, __( 'Email', 'jetpack' ) ) . '</label> '
|
| 138 |
. '<input type="text" name="email" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-email-field" /></fieldset>'
|
| 139 |
+
. '<fieldset><label for="author">' . sprintf( $required, __( 'Name', 'jetpack' ) ) . '</label> '
|
| 140 |
. '<input type="text" name="author" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-author-field" /></fieldset>'
|
| 141 |
+
. '<fieldset><label for="url">' . __( 'Website', 'jetpack' ) . '</label> '
|
| 142 |
. '<input type="text" name="url" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-url-field" /></fieldset>';
|
| 143 |
}
|
| 144 |
}
|
| 146 |
|
| 147 |
$localize_strings = apply_filters( 'jp_carousel_localize_strings', $localize_strings );
|
| 148 |
wp_localize_script( 'jetpack-carousel', 'jetpackCarouselStrings', $localize_strings );
|
| 149 |
+
if( is_rtl() ) {
|
| 150 |
+
wp_enqueue_style( 'jetpack-carousel', plugins_url( '/rtl/jetpack-carousel-rtl.css', __FILE__ ), array(), $this->asset_version( '20120629' ) );
|
| 151 |
+
} else {
|
| 152 |
+
wp_enqueue_style( 'jetpack-carousel', plugins_url( 'jetpack-carousel.css', __FILE__ ), array(), $this->asset_version( '20120629' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
}
|
| 154 |
+
|
| 155 |
+
wp_register_style( 'jetpack-carousel-ie8fix', plugins_url( 'jetpack-carousel-ie8fix.css', __FILE__ ), array(), $this->asset_version( '20121024' ) );
|
| 156 |
+
$GLOBALS['wp_styles']->add_data( 'jetpack-carousel-ie8fix', 'conditional', 'lte IE 8' );
|
| 157 |
+
wp_enqueue_style( 'jetpack-carousel-ie8fix' );
|
| 158 |
+
|
| 159 |
do_action( 'jp_carousel_enqueue_assets', $this->first_run, $localize_strings );
|
| 160 |
|
| 161 |
$this->first_run = false;
|
| 264 |
$offset = ( isset( $_REQUEST['offset'] ) ) ? (int) $_REQUEST['offset'] : 0;
|
| 265 |
|
| 266 |
if ( ! $attachment_id ) {
|
| 267 |
+
echo json_encode( __( 'Missing attachment ID.', 'jetpack' ) );
|
| 268 |
die();
|
| 269 |
}
|
| 270 |
|
| 283 |
|
| 284 |
// Can't just send the results, they contain the commenter's email address.
|
| 285 |
foreach ( $comments as $comment ) {
|
| 286 |
+
$avatar = get_avatar( $comment->comment_author_email, 64 );
|
| 287 |
+
if( ! $avatar )
|
| 288 |
+
$avatar = '';
|
| 289 |
$out[] = array(
|
| 290 |
'id' => $comment->comment_ID,
|
| 291 |
'parent_id' => $comment->comment_parent,
|
| 292 |
'author_markup' => get_comment_author_link( $comment->comment_ID ),
|
| 293 |
+
'gravatar_markup' => $avatar,
|
| 294 |
'date_gmt' => $comment->comment_date_gmt,
|
| 295 |
'content' => wpautop($comment->comment_content),
|
| 296 |
);
|
| 304 |
header('Content-type: text/javascript');
|
| 305 |
|
| 306 |
if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce($_POST['nonce'], 'carousel_nonce') )
|
| 307 |
+
die( json_encode( array( 'error' => __( 'Nonce verification failed.', 'jetpack' ) ) ) );
|
| 308 |
|
| 309 |
$_blog_id = (int) $_POST['blog_id'];
|
| 310 |
$_post_id = (int) $_POST['id'];
|
| 311 |
$comment = $_POST['comment'];
|
| 312 |
|
| 313 |
if ( empty( $_blog_id ) )
|
| 314 |
+
die( json_encode( array( 'error' => __( 'Missing target blog ID.', 'jetpack' ) ) ) );
|
| 315 |
|
| 316 |
if ( empty( $_post_id ) )
|
| 317 |
+
die( json_encode( array( 'error' => __( 'Missing target post ID.', 'jetpack' ) ) ) );
|
| 318 |
|
| 319 |
if ( empty( $comment ) )
|
| 320 |
+
die( json_encode( array( 'error' => __( 'No comment text was submitted.', 'jetpack' ) ) ) );
|
| 321 |
|
| 322 |
// Used in context like NewDash
|
| 323 |
$switched = false;
|
| 329 |
do_action('jp_carousel_check_blog_user_privileges');
|
| 330 |
|
| 331 |
if ( ! comments_open( $_post_id ) )
|
| 332 |
+
die( json_encode( array( 'error' => __( 'Comments on this post are closed.', 'jetpack' ) ) ) );
|
| 333 |
|
| 334 |
if ( is_user_logged_in() ) {
|
| 335 |
$user = wp_get_current_user();
|
| 339 |
$url = $user->user_url;
|
| 340 |
|
| 341 |
if ( empty( $user_id ) )
|
| 342 |
+
die( json_encode( array( 'error' => __( 'Sorry, but we could not authenticate your request.', 'jetpack' ) ) ) );
|
| 343 |
} else {
|
| 344 |
$user_id = 0;
|
| 345 |
$display_name = $_POST['author'];
|
| 348 |
|
| 349 |
if ( get_option( 'require_name_email' ) ) {
|
| 350 |
if ( empty( $display_name ) )
|
| 351 |
+
die( json_encode( array( 'error' => __( 'Please provide your name.', 'jetpack' ) ) ) );
|
| 352 |
|
| 353 |
if ( empty( $email ) )
|
| 354 |
+
die( json_encode( array( 'error' => __( 'Please provide an email address.', 'jetpack' ) ) ) );
|
| 355 |
|
| 356 |
if ( ! is_email( $email ) )
|
| 357 |
+
die( json_encode( array( 'error' => __( 'Please provide a valid email address.', 'jetpack' ) ) ) );
|
| 358 |
}
|
| 359 |
}
|
| 360 |
|
| 383 |
}
|
| 384 |
|
| 385 |
function register_settings() {
|
| 386 |
+
add_settings_section('carousel_section', __( 'Image Gallery Carousel', 'jetpack' ), array( $this, 'carousel_section_callback' ), 'media');
|
| 387 |
|
| 388 |
if ( ! $this->in_jetpack ) {
|
| 389 |
+
add_settings_field('carousel_enable_it', __( 'Enable carousel', 'jetpack' ), array( $this, 'carousel_enable_it_callback' ), 'media', 'carousel_section' );
|
| 390 |
register_setting( 'media', 'carousel_enable_it', array( $this, 'carousel_enable_it_sanitize' ) );
|
| 391 |
}
|
| 392 |
|
| 393 |
+
add_settings_field('carousel_background_color', __( 'Background color', 'jetpack' ), array( $this, 'carousel_background_color_callback' ), 'media', 'carousel_section' );
|
| 394 |
register_setting( 'media', 'carousel_background_color', array( $this, 'carousel_background_color_sanitize' ) );
|
| 395 |
|
| 396 |
add_settings_field('carousel_display_exif', __( 'Metadata', 'jetpack'), array( $this, 'carousel_display_exif_callback' ), 'media', 'carousel_section' );
|
| 397 |
register_setting( 'media', 'carousel_display_exif', array( $this, 'carousel_display_exif_sanitize' ) );
|
| 398 |
|
| 399 |
// No geo setting yet, need to "fuzzify" data first, for privacy
|
| 400 |
+
// add_settings_field('carousel_display_geo', __( 'Geolocation', 'jetpack' ), array( $this, 'carousel_display_geo_callback' ), 'media', 'carousel_section' );
|
| 401 |
// register_setting( 'media', 'carousel_display_geo', array( $this, 'carousel_display_geo_sanitize' ) );
|
| 402 |
}
|
| 403 |
|
| 450 |
}
|
| 451 |
|
| 452 |
function carousel_display_exif_callback() {
|
| 453 |
+
$this->settings_checkbox( 'carousel_display_exif', __( 'Show photo metadata (<a href="http://en.wikipedia.org/wiki/Exchangeable_image_file_format" target="_blank">Exif</a>) in carousel, when available.', 'jetpack' ) );
|
| 454 |
}
|
| 455 |
|
| 456 |
function carousel_display_exif_sanitize( $value ) {
|
| 458 |
}
|
| 459 |
|
| 460 |
function carousel_display_geo_callback() {
|
| 461 |
+
$this->settings_checkbox( 'carousel_display_geo', __( 'Show map of photo location in carousel, when available.', 'jetpack' ) );
|
| 462 |
}
|
| 463 |
|
| 464 |
function carousel_display_geo_sanitize( $value ) {
|
| 466 |
}
|
| 467 |
|
| 468 |
function carousel_background_color_callback() {
|
| 469 |
+
$this->settings_select( 'carousel_background_color', array( 'black' => __( 'Black', 'jetpack' ), 'white' => __( 'White', 'jetpack', 'jetpack' ) ) );
|
| 470 |
}
|
| 471 |
|
| 472 |
function carousel_background_color_sanitize( $value ) {
|
| 474 |
}
|
| 475 |
|
| 476 |
function carousel_enable_it_callback() {
|
| 477 |
+
$this->settings_checkbox( 'carousel_enable_it', __( 'Display images in full-size carousel slideshow.', 'jetpack' ) );
|
| 478 |
}
|
| 479 |
|
| 480 |
function carousel_enable_it_sanitize( $value ) {
|
| 482 |
}
|
| 483 |
}
|
| 484 |
|
| 485 |
+
new Jetpack_Carousel;
|
carousel/rtl/jetpack-carousel-rtl.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
/* This file was automatically generated on
|
| 2 |
|
| 3 |
-
* {
|
| 4 |
line-height:inherit; /* prevent declarations of line-height in the universal selector */
|
| 5 |
}
|
| 6 |
|
|
@@ -186,7 +186,9 @@ div.jp-carousel-buttons a:hover {
|
|
| 186 |
}
|
| 187 |
|
| 188 |
.jp-carousel-slide.selected {
|
| 189 |
-
position: absolute;
|
|
|
|
|
|
|
| 190 |
}
|
| 191 |
|
| 192 |
.jp-carousel-slide {
|
|
@@ -216,11 +218,6 @@ div.jp-carousel-buttons a:hover {
|
|
| 216 |
transition: opacity 400ms linear;
|
| 217 |
}
|
| 218 |
|
| 219 |
-
.jp-carousel-slide.selected {
|
| 220 |
-
filter: alpha(opacity=100);
|
| 221 |
-
opacity: 1;
|
| 222 |
-
}
|
| 223 |
-
|
| 224 |
.jp-carousel-close-hint {
|
| 225 |
color: #999;
|
| 226 |
cursor: default;
|
|
@@ -275,8 +272,8 @@ div.jp-carousel-buttons a.jp-carousel-like,
|
|
| 275 |
div.jp-carousel-buttons a.jp-carousel-reblog,
|
| 276 |
div.jp-carousel-buttons a.jp-carousel-commentlink,
|
| 277 |
a.jp-carousel-image-download {
|
| 278 |
-
background: url(.././images/carousel-sprite.png?
|
| 279 |
-
background-size: 16px
|
| 280 |
}
|
| 281 |
|
| 282 |
div.jp-carousel-buttons a.jp-carousel-reblog,
|
|
@@ -309,9 +306,16 @@ div.jp-carousel-buttons a.jp-carousel-reblog.reblogged:hover {
|
|
| 309 |
}
|
| 310 |
|
| 311 |
div.jp-carousel-buttons a.jp-carousel-commentlink {
|
| 312 |
-
background-position: 0px -
|
| 313 |
padding-right: 19px !important;
|
| 314 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
|
| 316 |
div.jp-carousel-buttons a.jp-carousel-reblog.reblogged:hover {
|
| 317 |
cursor: default;
|
|
@@ -340,7 +344,7 @@ only screen and (min-device-pixel-ratio: 1.5) {
|
|
| 340 |
div.jp-carousel-buttons a.jp-carousel-reblog,
|
| 341 |
div.jp-carousel-buttons a.jp-carousel-commentlink,
|
| 342 |
a.jp-carousel-image-download {
|
| 343 |
-
background-image: url(.././images/carousel-sprite-2x.png?
|
| 344 |
}
|
| 345 |
}
|
| 346 |
|
|
@@ -579,6 +583,9 @@ a.jp-carousel-image-download {
|
|
| 579 |
text-decoration: none;
|
| 580 |
background-position: 0 -82px;
|
| 581 |
}
|
|
|
|
|
|
|
|
|
|
| 582 |
|
| 583 |
a.jp-carousel-image-download span.photo-size {
|
| 584 |
font-size: 11px;
|
|
@@ -592,10 +599,13 @@ a.jp-carousel-image-download span.photo-size-times {
|
|
| 592 |
}
|
| 593 |
|
| 594 |
a.jp-carousel-image-download:hover {
|
| 595 |
-
background-position: 0 -
|
| 596 |
color: #68c9e8;
|
| 597 |
border: none !important;
|
| 598 |
}
|
|
|
|
|
|
|
|
|
|
| 599 |
|
| 600 |
/** Meta Box End **/
|
| 601 |
|
|
@@ -935,7 +945,10 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
|
|
| 935 |
}
|
| 936 |
|
| 937 |
.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-commentlink {
|
| 938 |
-
background-position: 0px -
|
|
|
|
|
|
|
|
|
|
| 939 |
}
|
| 940 |
|
| 941 |
.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-like,
|
|
@@ -1025,14 +1038,22 @@ textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder
|
|
| 1025 |
}
|
| 1026 |
|
| 1027 |
.jp-carousel-light a.jp-carousel-image-download {
|
| 1028 |
-
background-position: 0 -
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1029 |
}
|
| 1030 |
|
| 1031 |
.jp-carousel-light a.jp-carousel-image-download:hover {
|
| 1032 |
-
background-position: 0 -
|
| 1033 |
color: #f1831e;
|
| 1034 |
}
|
| 1035 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1036 |
.jp-carousel-light textarea#jp-carousel-comment-form-comment-field {
|
| 1037 |
background: #fbfbfb;
|
| 1038 |
color: #333;
|
| 1 |
+
/* This file was automatically generated on Jul 14 2014 00:33:37 */
|
| 2 |
|
| 3 |
+
.jp-carousel-wrap * {
|
| 4 |
line-height:inherit; /* prevent declarations of line-height in the universal selector */
|
| 5 |
}
|
| 6 |
|
| 186 |
}
|
| 187 |
|
| 188 |
.jp-carousel-slide.selected {
|
| 189 |
+
position: absolute !important;
|
| 190 |
+
filter: alpha(opacity=100);
|
| 191 |
+
opacity: 1;
|
| 192 |
}
|
| 193 |
|
| 194 |
.jp-carousel-slide {
|
| 218 |
transition: opacity 400ms linear;
|
| 219 |
}
|
| 220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
.jp-carousel-close-hint {
|
| 222 |
color: #999;
|
| 223 |
cursor: default;
|
| 272 |
div.jp-carousel-buttons a.jp-carousel-reblog,
|
| 273 |
div.jp-carousel-buttons a.jp-carousel-commentlink,
|
| 274 |
a.jp-carousel-image-download {
|
| 275 |
+
background: url(.././images/carousel-sprite.png?5) no-repeat;
|
| 276 |
+
background-size: 16px 200px;
|
| 277 |
}
|
| 278 |
|
| 279 |
div.jp-carousel-buttons a.jp-carousel-reblog,
|
| 306 |
}
|
| 307 |
|
| 308 |
div.jp-carousel-buttons a.jp-carousel-commentlink {
|
| 309 |
+
background-position: 0px -156px;
|
| 310 |
padding-right: 19px !important;
|
| 311 |
}
|
| 312 |
+
.rtl div.jp-carousel-buttons a.jp-carousel-commentlink{
|
| 313 |
+
background-position: 100% -156px;
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
.rtl div.jp-carousel-buttons a.jp-carousel-commentlink{
|
| 317 |
+
background-position: 100% -156px;
|
| 318 |
+
}
|
| 319 |
|
| 320 |
div.jp-carousel-buttons a.jp-carousel-reblog.reblogged:hover {
|
| 321 |
cursor: default;
|
| 344 |
div.jp-carousel-buttons a.jp-carousel-reblog,
|
| 345 |
div.jp-carousel-buttons a.jp-carousel-commentlink,
|
| 346 |
a.jp-carousel-image-download {
|
| 347 |
+
background-image: url(.././images/carousel-sprite-2x.png?5);
|
| 348 |
}
|
| 349 |
}
|
| 350 |
|
| 583 |
text-decoration: none;
|
| 584 |
background-position: 0 -82px;
|
| 585 |
}
|
| 586 |
+
.rtl a.jp-carousel-image-download{
|
| 587 |
+
background-position: 100% -82px;
|
| 588 |
+
}
|
| 589 |
|
| 590 |
a.jp-carousel-image-download span.photo-size {
|
| 591 |
font-size: 11px;
|
| 599 |
}
|
| 600 |
|
| 601 |
a.jp-carousel-image-download:hover {
|
| 602 |
+
background-position: 0 -122px;
|
| 603 |
color: #68c9e8;
|
| 604 |
border: none !important;
|
| 605 |
}
|
| 606 |
+
.rtl a.jp-carousel-image-download:hover{
|
| 607 |
+
background-position: 100% -122px;
|
| 608 |
+
}
|
| 609 |
|
| 610 |
/** Meta Box End **/
|
| 611 |
|
| 945 |
}
|
| 946 |
|
| 947 |
.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-commentlink {
|
| 948 |
+
background-position: 0px -176px;
|
| 949 |
+
}
|
| 950 |
+
.rtl .jp-carousel-light div.jp-carousel-buttons a.jp-carousel-commentlink{
|
| 951 |
+
background-position: 100% -176px;
|
| 952 |
}
|
| 953 |
|
| 954 |
.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-like,
|
| 1038 |
}
|
| 1039 |
|
| 1040 |
.jp-carousel-light a.jp-carousel-image-download {
|
| 1041 |
+
background-position: 0 -122px;
|
| 1042 |
+
}
|
| 1043 |
+
|
| 1044 |
+
.rtl .jp-carousel-light a.jp-carousel-image-download {
|
| 1045 |
+
background-position: 100% -122px;
|
| 1046 |
}
|
| 1047 |
|
| 1048 |
.jp-carousel-light a.jp-carousel-image-download:hover {
|
| 1049 |
+
background-position: 0 -122px;
|
| 1050 |
color: #f1831e;
|
| 1051 |
}
|
| 1052 |
|
| 1053 |
+
.rtl .jp-carousel-light a.jp-carousel-image-download:hover {
|
| 1054 |
+
background-position: 100% -122px;
|
| 1055 |
+
}
|
| 1056 |
+
|
| 1057 |
.jp-carousel-light textarea#jp-carousel-comment-form-comment-field {
|
| 1058 |
background: #fbfbfb;
|
| 1059 |
color: #333;
|
languages/carousel-without-jetpack.pot
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2014 Gallery Carousel Without JetPack
|
| 2 |
+
# This file is distributed under the same license as the Gallery Carousel Without JetPack package.
|
| 3 |
+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"Project-Id-Version: Gallery Carousel Without JetPack 0.7.3\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/carousel-without-"
|
| 7 |
+
"jetpack\n"
|
| 8 |
+
"POT-Creation-Date: 2014-08-28 11:24:39+00:00\n"
|
| 9 |
+
"MIME-Version: 1.0\n"
|
| 10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
| 11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
| 12 |
+
"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
|
| 13 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
| 14 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
| 15 |
+
|
| 16 |
+
#: carousel/jetpack-carousel.php:106
|
| 17 |
+
msgid "Comment"
|
| 18 |
+
msgstr ""
|
| 19 |
+
|
| 20 |
+
#: carousel/jetpack-carousel.php:107
|
| 21 |
+
msgid "Post Comment"
|
| 22 |
+
msgstr ""
|
| 23 |
+
|
| 24 |
+
#: carousel/jetpack-carousel.php:108
|
| 25 |
+
msgid "Write a Comment..."
|
| 26 |
+
msgstr ""
|
| 27 |
+
|
| 28 |
+
#: carousel/jetpack-carousel.php:109
|
| 29 |
+
msgid "Loading Comments..."
|
| 30 |
+
msgstr ""
|
| 31 |
+
|
| 32 |
+
#: carousel/jetpack-carousel.php:110
|
| 33 |
+
msgid ""
|
| 34 |
+
"View full size <span class=\"photo-size\">%1$s<span class=\"photo-size-times"
|
| 35 |
+
"\">×</span>%2$s</span>"
|
| 36 |
+
msgstr ""
|
| 37 |
+
|
| 38 |
+
#: carousel/jetpack-carousel.php:111
|
| 39 |
+
msgid "Please be sure to submit some text with your comment."
|
| 40 |
+
msgstr ""
|
| 41 |
+
|
| 42 |
+
#: carousel/jetpack-carousel.php:112
|
| 43 |
+
msgid "Please provide an email address to comment."
|
| 44 |
+
msgstr ""
|
| 45 |
+
|
| 46 |
+
#: carousel/jetpack-carousel.php:113
|
| 47 |
+
msgid "Please provide your name to comment."
|
| 48 |
+
msgstr ""
|
| 49 |
+
|
| 50 |
+
#: carousel/jetpack-carousel.php:114
|
| 51 |
+
msgid ""
|
| 52 |
+
"Sorry, but there was an error posting your comment. Please try again later."
|
| 53 |
+
msgstr ""
|
| 54 |
+
|
| 55 |
+
#: carousel/jetpack-carousel.php:115
|
| 56 |
+
msgid "Your comment was approved."
|
| 57 |
+
msgstr ""
|
| 58 |
+
|
| 59 |
+
#: carousel/jetpack-carousel.php:116
|
| 60 |
+
msgid "Your comment is in moderation."
|
| 61 |
+
msgstr ""
|
| 62 |
+
|
| 63 |
+
#: carousel/jetpack-carousel.php:117
|
| 64 |
+
msgid "Camera"
|
| 65 |
+
msgstr ""
|
| 66 |
+
|
| 67 |
+
#: carousel/jetpack-carousel.php:118
|
| 68 |
+
msgid "Aperture"
|
| 69 |
+
msgstr ""
|
| 70 |
+
|
| 71 |
+
#: carousel/jetpack-carousel.php:119
|
| 72 |
+
msgid "Shutter Speed"
|
| 73 |
+
msgstr ""
|
| 74 |
+
|
| 75 |
+
#: carousel/jetpack-carousel.php:120
|
| 76 |
+
msgid "Focal Length"
|
| 77 |
+
msgstr ""
|
| 78 |
+
|
| 79 |
+
#: carousel/jetpack-carousel.php:130
|
| 80 |
+
msgid "Commenting as %s"
|
| 81 |
+
msgstr ""
|
| 82 |
+
|
| 83 |
+
#: carousel/jetpack-carousel.php:133
|
| 84 |
+
msgid ""
|
| 85 |
+
"You must be <a href=\"#\" class=\"jp-carousel-comment-login\">logged in</a> "
|
| 86 |
+
"to post a comment."
|
| 87 |
+
msgstr ""
|
| 88 |
+
|
| 89 |
+
#: carousel/jetpack-carousel.php:135
|
| 90 |
+
msgid "%s (Required)"
|
| 91 |
+
msgstr ""
|
| 92 |
+
|
| 93 |
+
#: carousel/jetpack-carousel.php:137
|
| 94 |
+
msgid "Email"
|
| 95 |
+
msgstr ""
|
| 96 |
+
|
| 97 |
+
#: carousel/jetpack-carousel.php:139
|
| 98 |
+
msgid "Name"
|
| 99 |
+
msgstr ""
|
| 100 |
+
|
| 101 |
+
#: carousel/jetpack-carousel.php:141
|
| 102 |
+
msgid "Website"
|
| 103 |
+
msgstr ""
|
| 104 |
+
|
| 105 |
+
#: carousel/jetpack-carousel.php:267
|
| 106 |
+
msgid "Missing attachment ID."
|
| 107 |
+
msgstr ""
|
| 108 |
+
|
| 109 |
+
#: carousel/jetpack-carousel.php:307
|
| 110 |
+
msgid "Nonce verification failed."
|
| 111 |
+
msgstr ""
|
| 112 |
+
|
| 113 |
+
#: carousel/jetpack-carousel.php:314
|
| 114 |
+
msgid "Missing target blog ID."
|
| 115 |
+
msgstr ""
|
| 116 |
+
|
| 117 |
+
#: carousel/jetpack-carousel.php:317
|
| 118 |
+
msgid "Missing target post ID."
|
| 119 |
+
msgstr ""
|
| 120 |
+
|
| 121 |
+
#: carousel/jetpack-carousel.php:320
|
| 122 |
+
msgid "No comment text was submitted."
|
| 123 |
+
msgstr ""
|
| 124 |
+
|
| 125 |
+
#: carousel/jetpack-carousel.php:332
|
| 126 |
+
msgid "Comments on this post are closed."
|
| 127 |
+
msgstr ""
|
| 128 |
+
|
| 129 |
+
#: carousel/jetpack-carousel.php:342
|
| 130 |
+
msgid "Sorry, but we could not authenticate your request."
|
| 131 |
+
msgstr ""
|
| 132 |
+
|
| 133 |
+
#: carousel/jetpack-carousel.php:351
|
| 134 |
+
msgid "Please provide your name."
|
| 135 |
+
msgstr ""
|
| 136 |
+
|
| 137 |
+
#: carousel/jetpack-carousel.php:354
|
| 138 |
+
msgid "Please provide an email address."
|
| 139 |
+
msgstr ""
|
| 140 |
+
|
| 141 |
+
#: carousel/jetpack-carousel.php:357
|
| 142 |
+
msgid "Please provide a valid email address."
|
| 143 |
+
msgstr ""
|
| 144 |
+
|
| 145 |
+
#: carousel/jetpack-carousel.php:386
|
| 146 |
+
msgid "Image Gallery Carousel"
|
| 147 |
+
msgstr ""
|
| 148 |
+
|
| 149 |
+
#: carousel/jetpack-carousel.php:389
|
| 150 |
+
msgid "Enable carousel"
|
| 151 |
+
msgstr ""
|
| 152 |
+
|
| 153 |
+
#: carousel/jetpack-carousel.php:393
|
| 154 |
+
msgid "Background color"
|
| 155 |
+
msgstr ""
|
| 156 |
+
|
| 157 |
+
#: carousel/jetpack-carousel.php:396
|
| 158 |
+
msgid "Metadata"
|
| 159 |
+
msgstr ""
|
| 160 |
+
|
| 161 |
+
#: carousel/jetpack-carousel.php:453
|
| 162 |
+
msgid ""
|
| 163 |
+
"Show photo metadata (<a href=\"http://en.wikipedia.org/wiki/"
|
| 164 |
+
"Exchangeable_image_file_format\" target=\"_blank\">Exif</a>) in carousel, "
|
| 165 |
+
"when available."
|
| 166 |
+
msgstr ""
|
| 167 |
+
|
| 168 |
+
#: carousel/jetpack-carousel.php:461
|
| 169 |
+
msgid "Show map of photo location in carousel, when available."
|
| 170 |
+
msgstr ""
|
| 171 |
+
|
| 172 |
+
#: carousel/jetpack-carousel.php:469
|
| 173 |
+
msgid "Black"
|
| 174 |
+
msgstr ""
|
| 175 |
+
|
| 176 |
+
#: carousel/jetpack-carousel.php:469
|
| 177 |
+
msgid "White"
|
| 178 |
+
msgstr ""
|
| 179 |
+
|
| 180 |
+
#: carousel/jetpack-carousel.php:477
|
| 181 |
+
msgid "Display images in full-size carousel slideshow."
|
| 182 |
+
msgstr ""
|
| 183 |
+
|
| 184 |
+
#. Plugin Name of the plugin/theme
|
| 185 |
+
msgid "Gallery Carousel Without JetPack"
|
| 186 |
+
msgstr ""
|
| 187 |
+
|
| 188 |
+
#. Plugin URI of the plugin/theme
|
| 189 |
+
msgid "http://www.wpbeginner.com/"
|
| 190 |
+
msgstr ""
|
| 191 |
+
|
| 192 |
+
#. Description of the plugin/theme
|
| 193 |
+
msgid ""
|
| 194 |
+
"Transform your standard galleries into an immersive full-screen experience "
|
| 195 |
+
"without requiring you to connect to WordPress.com"
|
| 196 |
+
msgstr ""
|
| 197 |
+
|
| 198 |
+
#. Author of the plugin/theme
|
| 199 |
+
msgid "Syed Balkhi"
|
| 200 |
+
msgstr ""
|
| 201 |
+
|
| 202 |
+
#. Author URI of the plugin/theme
|
| 203 |
+
msgid "http://www.wpbeginner.com"
|
| 204 |
+
msgstr ""
|
languages/carousel-xx_XX.pot
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
msgid ""
|
| 2 |
-
msgstr ""
|
| 3 |
-
"Project-Id-Version: PlaceHolder\n"
|
| 4 |
-
"Report-Msgid-Bugs-To: \n"
|
| 5 |
-
"POT-Creation-Date: \n"
|
| 6 |
-
"PO-Revision-Date: 2012-07-24 23:19:21+0000\n"
|
| 7 |
-
"Last-Translator: none\n"
|
| 8 |
-
"Language-Team: \n"
|
| 9 |
-
"MIME-Version: 1.0\n"
|
| 10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
| 11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
| 12 |
-
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
| 13 |
-
"X-Poedit-Language: English\n"
|
| 14 |
-
"X-Poedit-Country: UNITED STATES\n"
|
| 15 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
| 16 |
-
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
| 17 |
-
"X-Poedit-Basepath: ../\n"
|
| 18 |
-
"X-Poedit-Bookmarks: \n"
|
| 19 |
-
"X-Poedit-SearchPath-0: .\n"
|
| 20 |
-
"X-Textdomain-Support: yes"
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: WPbeginner, smub, iamdpegg, n7studios
|
|
| 3 |
Donate link:http://www.wpbeginner.com/wpbeginner-needs-your-help/
|
| 4 |
Tags: gallery, lightbox, carousel, gallery carousel, jetpack, image gallery, wordpress gallery plugin, wordpress image gallery plugin, responsive gallery
|
| 5 |
Requires at least: 3.4.1
|
| 6 |
-
Tested up to:
|
| 7 |
Stable tag: trunk
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
@@ -65,6 +65,11 @@ However, if you want to turn off comments on Media attachments, you can follow t
|
|
| 65 |
|
| 66 |
== Changelog ==
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
= 0.7.2 =
|
| 69 |
* Added Russian translation (props: Andrey Maier)
|
| 70 |
|
| 3 |
Donate link:http://www.wpbeginner.com/wpbeginner-needs-your-help/
|
| 4 |
Tags: gallery, lightbox, carousel, gallery carousel, jetpack, image gallery, wordpress gallery plugin, wordpress image gallery plugin, responsive gallery
|
| 5 |
Requires at least: 3.4.1
|
| 6 |
+
Tested up to: 4.0
|
| 7 |
Stable tag: trunk
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 65 |
|
| 66 |
== Changelog ==
|
| 67 |
|
| 68 |
+
= 0.7.3 =
|
| 69 |
+
* Updated it to match original JetPack plugin updates from 3.1.1
|
| 70 |
+
* Fix: Language POT file
|
| 71 |
+
* Fix: WordPress 4.0 compatibility
|
| 72 |
+
|
| 73 |
= 0.7.2 =
|
| 74 |
* Added Russian translation (props: Andrey Maier)
|
| 75 |
|
