Changeset 26836 for extensions/modus


Ignore:
Timestamp:
Jan 17, 2014, 11:10:30 PM (11 years ago)
Author:
rvelices
Message:

modus ui simplification

Location:
extensions/modus
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/modus/admin/admin.inc.php

    r25794 r26836  
    1616}
    1717
    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');
    1919$bool_values = array();
    2020
     
    2828        // int/double
    2929        $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']) );
    3230  $my_conf = array_intersect_key($my_conf, $default_conf);
    3331  conf_update_param('modus_theme', addslashes(serialize($my_conf)) );
  • extensions/modus/admin/modus_admin.tpl

    r25794 r26836  
    3131<fieldset><legend>Full row thumbnail layout</legend>
    3232Automatically applied for selected derivatives if max_width > max_height*1.5
    33 <br>
    3433
    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]) then
    37 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>
    3934</fieldset>
    4035
  • extensions/modus/css/picture.css.tpl

    r25976 r26836  
    169169        display: block;
    170170        padding: 0 5px 0 10px;
    171         margin: 0;
     171        margin: 0; /*need this for ie7 override in fix-ie7*/
    172172}
    173173
  • extensions/modus/functions.inc.php

    r25794 r26836  
    2121  'index_photo_deriv'=>'',
    2222  'index_photo_deriv_hdpi'=>'',
    23   'resize_threshold' => 1,
    24   'resize_factor' => 0,
    2523);
    2624}
  • extensions/modus/js/thumb.arrange.js

    r25794 r26836  
    6464                this.opts.rowHeight = Math.round(this.opts.rowHeight / dpr ) + this.opts.extraRowHeight;
    6565        }
     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        }
    6670        this.process();
    6771
     
    7478                        that.process( down && that.$thumbs.width() == that.prevContainerWidth ? that.prevLastLineFirstThumbIndex : 0);
    7579                } );
     80
     81        if (!$.isReady) {
     82                $(document).ready( function() {
     83                        if ( that.$thumbs.width() < that.prevContainerWidth )
     84                                that.process();
     85                        } );
     86        }
    7687}
    7788
  • extensions/modus/js/thumb.arrange.min.js

    r25794 r26836  
    22RVGTLine.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=
    330,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)})}}
     4function 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()-
     5c.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()})}}
    66RVGThumbs.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:
    77a.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  
    256256'#thumbnails{text-align:justify;overflow:hidden;margin-left:'.($container_margin-$horizontal_margin).'px;margin-right:'.$container_margin.'px}
    257257#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.'});');
    259259
    260260        $my_base_name = basename(dirname(__FILE__));
Note: See TracChangeset for help on using the changeset viewer.