Changeset 26836 for extensions/modus
- Timestamp:
- Jan 17, 2014, 11:10:30 PM (11 years ago)
- Location:
- extensions/modus
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/modus/admin/admin.inc.php
r25794 r26836 16 16 } 17 17 18 $text_values = array('skin', 'album_thumb_size', 'index_photo_deriv','index_photo_deriv_hdpi' , 'resize_threshold', 'resize_factor');18 $text_values = array('skin', 'album_thumb_size', 'index_photo_deriv','index_photo_deriv_hdpi'); 19 19 $bool_values = array(); 20 20 … … 28 28 // int/double 29 29 $my_conf['album_thumb_size'] = max(0, $my_conf['album_thumb_size']); 30 $my_conf['resize_threshold'] = max(1, $my_conf['resize_threshold']);31 $my_conf['resize_factor'] = max(0, min(1, $my_conf['resize_factor']) );32 30 $my_conf = array_intersect_key($my_conf, $default_conf); 33 31 conf_update_param('modus_theme', addslashes(serialize($my_conf)) ); -
extensions/modus/admin/modus_admin.tpl
r25794 r26836 31 31 <fieldset><legend>Full row thumbnail layout</legend> 32 32 Automatically applied for selected derivatives if max_width > max_height*1.5 33 <br>34 33 35 <fieldset><legend>Horizontal crop or resize ?</legend>36 If row overflow is > <input name="resize_threshold" value="{$RESIZE_THRESHOLD}" type=number min=1 step=any size=2> (range [1;Inf]) then37 use a factor of the overflow <input name="resize_factor" value="{$RESIZE_FACTOR}"type=number min=0 max=1 step=any size=2> (range [0;1]) for resizing.38 </fieldset>39 34 </fieldset> 40 35 -
extensions/modus/css/picture.css.tpl
r25976 r26836 169 169 display: block; 170 170 padding: 0 5px 0 10px; 171 margin: 0; 171 margin: 0; /*need this for ie7 override in fix-ie7*/ 172 172 } 173 173 -
extensions/modus/functions.inc.php
r25794 r26836 21 21 'index_photo_deriv'=>'', 22 22 'index_photo_deriv_hdpi'=>'', 23 'resize_threshold' => 1,24 'resize_factor' => 0,25 23 ); 26 24 } -
extensions/modus/js/thumb.arrange.js
r25794 r26836 64 64 this.opts.rowHeight = Math.round(this.opts.rowHeight / dpr ) + this.opts.extraRowHeight; 65 65 } 66 else { 67 this.opts.resizeThreshold = 1.1; /*if row is less than 10% larger than available width, distribute extra width through cropping*/ 68 this.opts.resizeFactor = 0.8;/* when row is more than 10% larger than available width, distribute extra width 80% through resizing and 20% through cropping*/ 69 } 66 70 this.process(); 67 71 … … 74 78 that.process( down && that.$thumbs.width() == that.prevContainerWidth ? that.prevLastLineFirstThumbIndex : 0); 75 79 } ); 80 81 if (!$.isReady) { 82 $(document).ready( function() { 83 if ( that.$thumbs.width() < that.prevContainerWidth ) 84 that.process(); 85 } ); 86 } 76 87 } 77 88 -
extensions/modus/js/thumb.arrange.min.js
r25794 r26836 2 2 RVGTLine.prototype={width:0,elementsWidth:0,firstThumbIndex:0,add:function(a,c){0===this.elements.length&&(this.firstThumbIndex=c);if(!a.data("w")){var d=a.width(),b=a.height();b>this.rowHeight&&(d=Math.round(d*this.rowHeight/b),b=this.rowHeight);a.data("w",d).data("h",b)}d={$elt:a,w:a.data("w"),h:a.data("h")};this.elements.push(d);d.h>this.maxHeight&&(this.maxHeight=d.h);this.width+=this.margin+d.w;this.elementsWidth+=d.w},clear:function(){this.elements.length&&(this.maxHeight=this.width=this.elementsWidth= 3 3 0,this.elements.length=0)}}; 4 function RVGThumbs(a){this.opts=a;this.$thumbs=$("#thumbnails");if(0!=this.$thumbs.length){this.$thumbs.css("text-align","left");this.opts.extraRowHeight=0;1<window.devicePixelRatio &&(a=window.devicePixelRatio,this.opts.resizeThreshold=1.01,this.opts.resizeFactor=0.95,this.opts.extraRowHeight=6,this.opts.rowHeight=Math.round(this.opts.rowHeight/a)+this.opts.extraRowHeight);this.process();var c=this;$(window).on("resize",function(){1<Math.abs(c.$thumbs.width()-c.prevContainerWidth)&&c.process()}).on("RVTS_loaded",5 function(a,b){c.process(b&&c.$thumbs.width()==c.prevContainerWidth?c.prevLastLineFirstThumbIndex:0)})}}4 function RVGThumbs(a){this.opts=a;this.$thumbs=$("#thumbnails");if(0!=this.$thumbs.length){this.$thumbs.css("text-align","left");this.opts.extraRowHeight=0;1<window.devicePixelRatio?(a=window.devicePixelRatio,this.opts.resizeThreshold=1.01,this.opts.resizeFactor=0.95,this.opts.extraRowHeight=6,this.opts.rowHeight=Math.round(this.opts.rowHeight/a)+this.opts.extraRowHeight):(this.opts.resizeThreshold=1.1,this.opts.resizeFactor=0.8);this.process();var c=this;$(window).on("resize",function(){1<Math.abs(c.$thumbs.width()- 5 c.prevContainerWidth)&&c.process()}).on("RVTS_loaded",function(a,b){c.process(b&&c.$thumbs.width()==c.prevContainerWidth?c.prevLastLineFirstThumbIndex:0)});$.isReady||$(document).ready(function(){c.$thumbs.width()<c.prevContainerWidth&&c.process()})}} 6 6 RVGThumbs.prototype={prevContainerWidth:0,prevLastLineFirstThumbIndex:0,process:function(a){a=a?a:0;var c=this.$thumbs.width();this.prevContainerWidth=c;for(var d=$("li>a>img",this.$thumbs),b=new RVGTLine(this.opts.hMargin,this.opts.rowHeight);a<d.length;a++){var e=$(d[a]);b.add(e,a);b.width>=c-1*b.elements.length&&(this.processLine(b,c),b.clear())}b.elements.length&&this.processLine(b,c,!0);this.prevLastLineFirstThumbIndex=b.firstThumbIndex},processLine:function(a,c,d){var b,e,f=a.maxHeight?a.maxHeight: 7 7 a.elements[0].h;a.width/c>this.opts.resizeThreshold?(e=a.elementsWidth/(a.elementsWidth+c-a.width),b=f/(1+(e-1)*this.opts.resizeFactor),b=6*Math.round(b/6),b<f/e&&(b=Math.ceil(f/e),e=this.opts.rowHeight-this.opts.extraRowHeight-b,0<e&&6>e&&(b+=e)),b<f&&(f=b)):d&&(f=Math.min(f,this.opts.rowHeight-this.opts.extraRowHeight));c=a.width-c;d&&(c=0);for(var k=0;k<a.elements.length;k++){var h=a.elements[k];b=h.w;e=h.h;var g;g=k==a.elements.length-1?c:Math.round(c*b/a.elementsWidth);c-=g;a.elementsWidth-= -
extensions/modus/themeconf.inc.php
r25794 r26836 256 256 '#thumbnails{text-align:justify;overflow:hidden;margin-left:'.($container_margin-$horizontal_margin).'px;margin-right:'.$container_margin.'px} 257 257 #thumbnails>li{float:left;overflow:hidden;position:relative;margin-bottom:'.$vertical_margin.'px;margin-left:'.$horizontal_margin.'px}#thumbnails>li>a{position:absolute;border:0}'); 258 $template->block_footer_script(null, 'rvgtProcessor=new RVGThumbs({hMargin:'.$horizontal_margin.',rowHeight:'.$row_height.' ,resizeThreshold:'.$conf['modus_theme']['resize_threshold'].',resizeFactor:'.$conf['modus_theme']['resize_factor'].'});');258 $template->block_footer_script(null, 'rvgtProcessor=new RVGThumbs({hMargin:'.$horizontal_margin.',rowHeight:'.$row_height.'});'); 259 259 260 260 $my_base_name = basename(dirname(__FILE__));
Note: See TracChangeset
for help on using the changeset viewer.