From 3db8cb4f8325922fd56e260b21c067b7332051b6 Mon Sep 17 00:00:00 2001 From: Alessandro Berbenni Date: Mon, 8 Apr 2013 11:43:36 +0300 Subject: [PATCH 1/3] Update jquery.prettyPhoto.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Script modified as reported in forum: http://forums.no-margin-for-errors.com/discussion/12504/pretty-photo-very-small-on-mobile-device#Item_2 --- js/jquery.prettyPhoto.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/jquery.prettyPhoto.js b/js/jquery.prettyPhoto.js index 0436a49..6a15e95 100644 --- a/js/jquery.prettyPhoto.js +++ b/js/jquery.prettyPhoto.js @@ -9,6 +9,8 @@ $.fn.prettyPhoto = function(pp_settings) { pp_settings = jQuery.extend({ + horizontal_margin: 150, /* default 150, min 25*/ + vertical_margin: 150, /** default 150, min 50*/ hook: 'rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */ animation_speed: 'fast', /* fast/slow/normal */ ajaxcallback: function() {}, @@ -223,8 +225,8 @@ // If the size is % based, calculate according to window dimensions percentBased=false; - if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); percentBased = true; } - if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); percentBased = true; } + if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - (pp_settings.vertical_margin<50?50:pp_settings.vertical_margin)); percentBased = true; } + if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - (pp_settings.horizontal_margin<25?25:pp_settings.horizontal_margin)); percentBased = true; } // Fade the holder $pp_pic_holder.fadeIn(function(){ From 900a22330b487859167d00da906f75123b8c9960 Mon Sep 17 00:00:00 2001 From: Alessandro Berbenni Date: Mon, 8 Apr 2013 11:44:20 +0300 Subject: [PATCH 2/3] Update README --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 1e56842..4c598c9 100755 --- a/README +++ b/README @@ -1,4 +1,4 @@ -prettyPhoto v3.1.4 +prettyPhoto v3.1.5 © Copyright, Stephane Caron http://www.no-margin-for-errors.com From 647506a5f92ca8ff37cc81c5f87065736de3b907 Mon Sep 17 00:00:00 2001 From: aberbenni Date: Tue, 16 Apr 2013 14:45:03 +0200 Subject: [PATCH 3/3] added support for pdf --- js/jquery.prettyPhoto.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/js/jquery.prettyPhoto.js b/js/jquery.prettyPhoto.js index 6a15e95..9986ba4 100644 --- a/js/jquery.prettyPhoto.js +++ b/js/jquery.prettyPhoto.js @@ -9,8 +9,8 @@ $.fn.prettyPhoto = function(pp_settings) { pp_settings = jQuery.extend({ - horizontal_margin: 150, /* default 150, min 25*/ - vertical_margin: 150, /** default 150, min 50*/ + horizontal_margin: 150, /* default 150, min 25 */ + vertical_margin: 150, /* default 150, min 50 */ hook: 'rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */ animation_speed: 'fast', /* fast/slow/normal */ ajaxcallback: function() {}, @@ -227,7 +227,7 @@ percentBased=false; if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - (pp_settings.vertical_margin<50?50:pp_settings.vertical_margin)); percentBased = true; } if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - (pp_settings.horizontal_margin<25?25:pp_settings.horizontal_margin)); percentBased = true; } - + // Fade the holder $pp_pic_holder.fadeIn(function(){ // Set the title @@ -322,7 +322,15 @@ 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); break; - + + case 'pdf': + pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport + + frame_url = pp_images[set_position]; + + toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url); + break; + case 'iframe': pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport @@ -569,7 +577,7 @@ */ function _fitToViewport(width,height){ resized = false; - + _getDimensions(width,height); // Define them in case there's no resize needed @@ -600,7 +608,7 @@ _getDimensions(imageWidth,imageHeight); }; - + return { width:Math.floor(imageWidth), height:Math.floor(imageHeight), @@ -669,6 +677,8 @@ return 'custom'; }else if(itemSrc.substr(0,1) == '#'){ return 'inline'; + }else if(itemSrc.match(/\b.pdf\b/i)){ + return 'pdf'; }else{ return 'image'; };