Responsive Lightbox & Gallery - Version 1.6.4

Version Description

  • Tweak: prettyPhoto improvements for mobile devices
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Responsive Lightbox & Gallery
Version 1.6.4
Comparing to
See all releases

Code changes from version 1.6.3 to 1.6.4

assets/prettyphoto/js/jquery.prettyPhoto.js CHANGED
@@ -92,7 +92,43 @@
92
  custom_markup: '',
93
  social_tools: '<div class="twitter"><a href="//twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>' /* html or false to disable */
94
  }, pp_settings);
95
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  // Global variables accessible only by prettyPhoto
97
  var matchedObjects = this, percentBased = false, pp_dimensions, pp_open,
98
 
@@ -247,9 +283,12 @@
247
 
248
  $pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g,pp_images[set_position]);
249
 
250
- imgPreloader.onload = function(){
251
  // Fit item to viewport
252
- pp_dimensions = _fitToViewport(imgPreloader.width,imgPreloader.height);
 
 
 
253
 
254
  _showContent();
255
  };
@@ -263,8 +302,12 @@
263
  break;
264
 
265
  case 'youtube':
266
- pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
267
-
 
 
 
 
268
  // Regular youtube link
269
  movie_id = getParam('v',pp_images[set_position]);
270
 
@@ -288,8 +331,12 @@
288
  break;
289
 
290
  case 'vimeo':
291
- pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
292
-
 
 
 
 
293
  movie_id = pp_images[set_position];
294
  var regExp = /http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;
295
  var match = movie_id.match(regExp);
@@ -310,20 +357,28 @@
310
  break;
311
 
312
  case 'flash':
313
- pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
314
-
 
 
 
 
315
  flash_vars = pp_images[set_position];
316
  flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);
317
 
318
  filename = pp_images[set_position];
319
  filename = filename.substring(0,filename.indexOf('?'));
320
-
321
  toInject = settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
322
  break;
323
 
324
  case 'iframe':
325
- pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
326
-
 
 
 
 
327
  frame_url = pp_images[set_position];
328
  frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
329
 
@@ -332,7 +387,13 @@
332
 
333
  case 'ajax':
334
  doresize = false; // Make sure the dimensions are not resized.
335
- pp_dimensions = _fitToViewport(movie_width,movie_height);
 
 
 
 
 
 
336
  doresize = true; // Reset the dimensions
337
 
338
  skipInjection = true;
@@ -345,8 +406,12 @@
345
  break;
346
 
347
  case 'custom':
348
- pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
349
-
 
 
 
 
350
  toInject = settings.custom_markup;
351
  break;
352
 
@@ -354,7 +419,13 @@
354
  // to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
355
  myClone = $(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();
356
  doresize = false; // Make sure the dimensions are not resized.
357
- pp_dimensions = _fitToViewport($(myClone).width(),$(myClone).height());
 
 
 
 
 
 
358
  doresize = true; // Reset the dimensions
359
  $(myClone).remove();
360
  toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
@@ -881,7 +952,7 @@
881
 
882
  return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
883
  };
884
-
885
  function getHashtag(){
886
  var url = location.href;
887
  hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)) : false;
92
  custom_markup: '',
93
  social_tools: '<div class="twitter"><a href="//twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>' /* html or false to disable */
94
  }, pp_settings);
95
+
96
+ var isMobile = {
97
+ Android: function() {
98
+ return navigator.userAgent.match( /Android/i );
99
+ },
100
+ BlackBerry: function() {
101
+ return navigator.userAgent.match( /BlackBerry/i );
102
+ },
103
+ iOS: function() {
104
+ return navigator.userAgent.match( /iPhone|iPad|iPod/i );
105
+ },
106
+ Opera: function() {
107
+ return navigator.userAgent.match( /Opera Mini/i );
108
+ },
109
+ Windows: function() {
110
+ return navigator.userAgent.match( /IEMobile/i );
111
+ },
112
+ any: function() {
113
+ return ( isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows() );
114
+ }
115
+ };
116
+
117
+ function fitToMobileViewport( newWindowWidth, newWindowHeight, imgWidth, imgHeight ) {
118
+ var newHeight = 0,
119
+ newWidth = 0;
120
+
121
+ if ( imgWidth > imgHeight ) {
122
+ newWidth = newWindowWidth;
123
+ newHeight = Math.round( imgHeight * newWindowWidth / imgWidth );
124
+ } else {
125
+ newWidth = Math.round( imgWidth * newWindowHeight / imgHeight );
126
+ newHeight = newWindowHeight;
127
+ }
128
+
129
+ return _fitToViewport( newWidth, newHeight );
130
+ }
131
+
132
  // Global variables accessible only by prettyPhoto
133
  var matchedObjects = this, percentBased = false, pp_dimensions, pp_open,
134
 
283
 
284
  $pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g,pp_images[set_position]);
285
 
286
+ imgPreloader.onload = function() {
287
  // Fit item to viewport
288
+ if ( isMobile.any() )
289
+ pp_dimensions = fitToMobileViewport( Math.round( windowWidth * 0.9 ), Math.round( windowHeight * 0.9 ), imgPreloader.width, imgPreloader.height );
290
+ else
291
+ pp_dimensions = _fitToViewport(imgPreloader.width,imgPreloader.height);
292
 
293
  _showContent();
294
  };
302
  break;
303
 
304
  case 'youtube':
305
+ // Fit item to viewport
306
+ if ( isMobile.any() )
307
+ pp_dimensions = fitToMobileViewport( Math.round( windowWidth * 0.9 ), Math.round( windowHeight * 0.9 ), movie_width, movie_height );
308
+ else
309
+ pp_dimensions = _fitToViewport( movie_width, movie_height );
310
+
311
  // Regular youtube link
312
  movie_id = getParam('v',pp_images[set_position]);
313
 
331
  break;
332
 
333
  case 'vimeo':
334
+ // Fit item to viewport
335
+ if ( isMobile.any() )
336
+ pp_dimensions = fitToMobileViewport( Math.round( windowWidth * 0.9 ), Math.round( windowHeight * 0.9 ), movie_width, movie_height );
337
+ else
338
+ pp_dimensions = _fitToViewport( movie_width, movie_height );
339
+
340
  movie_id = pp_images[set_position];
341
  var regExp = /http(s?):\/\/(www\.)?vimeo.com\/(\d+)/;
342
  var match = movie_id.match(regExp);
357
  break;
358
 
359
  case 'flash':
360
+ // Fit item to viewport
361
+ if ( isMobile.any() )
362
+ pp_dimensions = fitToMobileViewport( Math.round( windowWidth * 0.9 ), Math.round( windowHeight * 0.9 ), movie_width, movie_height );
363
+ else
364
+ pp_dimensions = _fitToViewport( movie_width, movie_height );
365
+
366
  flash_vars = pp_images[set_position];
367
  flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);
368
 
369
  filename = pp_images[set_position];
370
  filename = filename.substring(0,filename.indexOf('?'));
371
+
372
  toInject = settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
373
  break;
374
 
375
  case 'iframe':
376
+ // Fit item to viewport
377
+ if ( isMobile.any() )
378
+ pp_dimensions = fitToMobileViewport( Math.round( windowWidth * 0.9 ), Math.round( windowHeight * 0.9 ), movie_width, movie_height );
379
+ else
380
+ pp_dimensions = _fitToViewport( movie_width, movie_height );
381
+
382
  frame_url = pp_images[set_position];
383
  frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
384
 
387
 
388
  case 'ajax':
389
  doresize = false; // Make sure the dimensions are not resized.
390
+
391
+ // Fit item to viewport
392
+ if ( isMobile.any() )
393
+ pp_dimensions = fitToMobileViewport( Math.round( windowWidth * 0.9 ), Math.round( windowHeight * 0.9 ), movie_width, movie_height );
394
+ else
395
+ pp_dimensions = _fitToViewport( movie_width, movie_height );
396
+
397
  doresize = true; // Reset the dimensions
398
 
399
  skipInjection = true;
406
  break;
407
 
408
  case 'custom':
409
+ // Fit item to viewport
410
+ if ( isMobile.any() )
411
+ pp_dimensions = fitToMobileViewport( Math.round( windowWidth * 0.9 ), Math.round( windowHeight * 0.9 ), movie_width, movie_height );
412
+ else
413
+ pp_dimensions = _fitToViewport( movie_width, movie_height );
414
+
415
  toInject = settings.custom_markup;
416
  break;
417
 
419
  // to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
420
  myClone = $(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();
421
  doresize = false; // Make sure the dimensions are not resized.
422
+
423
+ // Fit item to viewport
424
+ if ( isMobile.any() )
425
+ pp_dimensions = fitToMobileViewport( Math.round( windowWidth * 0.9 ), Math.round( windowHeight * 0.9 ), $(myClone).width(), $(myClone).height() );
426
+ else
427
+ pp_dimensions = _fitToViewport( $(myClone).width(), $(myClone).height() );
428
+
429
  doresize = true; // Reset the dimensions
430
  $(myClone).remove();
431
  toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
952
 
953
  return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
954
  };
955
+
956
  function getHashtag(){
957
  var url = location.href;
958
  hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)) : false;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.dfactory.eu/
4
  Tags: gallery, images, lightbox, links, photos, template, theme, photo, image, picture, slideshow, modal, overlay, YouTube, Vimeo, video, videos
5
  Requires at least: 4.0
6
  Tested up to: 4.3.1
7
- Stable tag: 1.6.3
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -74,6 +74,9 @@ No questions yet.
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 1.6.3 =
78
  * Fix: Tos"R"Us script initialized multiple times in Ajax
79
  * Fix: Regex issue with replacing rel attribute
@@ -264,7 +267,5 @@ Initial release
264
 
265
  == Upgrade Notice ==
266
 
267
- = 1.6.3 =
268
- * Fix: Tos"R"Us script initialized multiple times in Ajax
269
- * Fix: Regex issue with replacing rel attribute
270
- * Tweak: Swipebox updated to 1.4.1
4
  Tags: gallery, images, lightbox, links, photos, template, theme, photo, image, picture, slideshow, modal, overlay, YouTube, Vimeo, video, videos
5
  Requires at least: 4.0
6
  Tested up to: 4.3.1
7
+ Stable tag: 1.6.4
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
74
 
75
  == Changelog ==
76
 
77
+ = 1.6.4 =
78
+ * Tweak: prettyPhoto improvements for mobile devices
79
+
80
  = 1.6.3 =
81
  * Fix: Tos"R"Us script initialized multiple times in Ajax
82
  * Fix: Regex issue with replacing rel attribute
267
 
268
  == Upgrade Notice ==
269
 
270
+ = 1.6.4 =
271
+ * Tweak: prettyPhoto improvements for mobile devices
 
 
responsive-lightbox.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Responsive Lightbox
4
  Description: Responsive Lightbox allows users to view larger versions of images and galleries in a lightbox (overlay) effect optimized for mobile devices.
5
- Version: 1.6.3
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
@@ -36,7 +36,7 @@ include_once( RESPONSIVE_LIGHTBOX_PATH . 'includes/class-settings.php' );
36
  * Responsive Lightbox class.
37
  *
38
  * @class Responsive_Lightbox
39
- * @version 1.6.3
40
  */
41
  class Responsive_Lightbox {
42
 
@@ -146,7 +146,7 @@ class Responsive_Lightbox {
146
  'pagination_type' => 'thumbnails'
147
  )
148
  ),
149
- 'version' => '1.6.3'
150
  );
151
  public $options = array();
152
  private $notices = array();
2
  /*
3
  Plugin Name: Responsive Lightbox
4
  Description: Responsive Lightbox allows users to view larger versions of images and galleries in a lightbox (overlay) effect optimized for mobile devices.
5
+ Version: 1.6.4
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
36
  * Responsive Lightbox class.
37
  *
38
  * @class Responsive_Lightbox
39
+ * @version 1.6.4
40
  */
41
  class Responsive_Lightbox {
42
 
146
  'pagination_type' => 'thumbnails'
147
  )
148
  ),
149
+ 'version' => '1.6.4'
150
  );
151
  public $options = array();
152
  private $notices = array();