Changeset 31245 for extensions/GDThumb/js
- Timestamp:
- Jul 20, 2015, 1:45:59 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GDThumb/js/gdthumb.js
r31060 r31245 64 64 GDThumb.big_thumb.crop = GDThumb.big_thumb.height; 65 65 GDThumb.max_height = thumb_width; 66 } 66 } else if (GDThumb.method == 'slide') { 67 var main_width = jQuery('ul.thumbnails').width(); 68 var max_col_count = Math.floor(main_width / GDThumb.max_height); 69 var thumb_width = Math.floor(main_width / max_col_count) - GDThumb.margin; 70 GDThumb.max_height = thumb_width; 71 } 67 72 68 73 GDThumb.t = new Array; … … 71 76 height = parseInt(jQuery(this).attr('height')); 72 77 th = {index: index, width: width, height: height, real_width: width, real_height: height}; 78 73 79 if (GDThumb.check_pv) { 74 80 var ratio = th.width / th.height; 75 81 GDThumb.big_thumb_block = (ratio > 2.2) || (ratio < 0.455); 76 82 } 77 if ((GDThumb.method == 'square') && (th.height != th.width)) { 83 84 if (((GDThumb.method == 'square') || (GDThumb.method == 'slide')) && (th.height != th.width)) { 85 th.width = GDThumb.max_height; 78 86 th.height = GDThumb.max_height; 79 th.width = GDThumb.max_height;80 87 th.crop = GDThumb.max_height; 81 88 } else if (height < GDThumb.max_height) { … … 110 117 var best_size = {width: 1, height: 1}; 111 118 112 if (GDThumb.method == 'square') { 119 if (GDThumb.method == 'slide') { 120 best_size.width = GDThumb.max_height; 121 best_size.height = GDThumb.max_height; 122 123 GDThumb.resize(first_thumb, GDThumb.t[0].real_width, GDThumb.t[0].real_height, GDThumb.t[0].width, GDThumb.t[0].height, false); 124 } else if (GDThumb.method == 'square') { 113 125 if (GDThumb.big_thumb != null) { 114 126 best_size.width = GDThumb.big_thumb.width; … … 215 227 for (j=0;j<thumb_process.length;j++) { 216 228 217 if ( GDThumb.method == 'square') {229 if ((GDThumb.method == 'square') || (GDThumb.method == 'slide')) { 218 230 new_width = GDThumb.max_height; 219 231 new_height = GDThumb.max_height; … … 254 266 255 267 resize: function(thumb, width, height, new_width, new_height, is_big) { 256 if ((!is_big) && (GDThumb.method == 'square')) { 268 269 use_crop = true; 270 if (GDThumb.method == 'slide') { 271 use_crop = false; 257 272 thumb.css({height: '', width: ''}); 258 273 new_width = new_height; … … 268 283 height_crop = Math.round((real_height - new_height) / 2); 269 284 width_crop = Math.round((real_width - new_height) / 2); 285 thumb.css({ 286 height: real_height+'px', 287 width: real_width+'px' 288 }); 289 } else if ((!is_big) && (GDThumb.method == 'square')) { 290 thumb.css({height: '', width: ''}); 291 new_width = new_height; 292 293 if (width < height) { 294 real_height = Math.round(height * new_width / width); 295 real_width = new_width; 296 } else { 297 real_height = new_width; 298 real_width = Math.round(width * new_height / height); 299 } 300 301 height_crop = Math.round((real_height - new_height) / 2); 302 width_crop = Math.round((real_width - new_width) / 2); 270 303 thumb.css({ 271 304 height: real_height+'px', … … 298 331 299 332 thumb.parents('li').css({ height: new_height+'px', width: new_width+'px' }); 300 thumb.parent('a').css({ clip: 'rect('+height_crop+'px, '+(new_width+width_crop)+'px, '+(new_height+height_crop)+'px, '+width_crop+'px)', top: -height_crop+'px', left: -width_crop+'px' }); 333 if (use_crop) { 334 thumb.parent('a').css({ clip: 'rect('+height_crop+'px, '+(new_width+width_crop)+'px, '+(new_height+height_crop)+'px, '+width_crop+'px)', top: -height_crop+'px', left: -width_crop+'px' }); 335 } else { 336 thumb.parent('a').css({ top: -height_crop+'px', left: -width_crop+'px' }); 337 } 301 338 } 302 339 }
Note: See TracChangeset
for help on using the changeset viewer.