Changeset 24514


Ignore:
Timestamp:
09/18/13 18:36:27 (6 years ago)
Author:
rvelices
Message:

smartpocket retina aware thumbnails display on index page

Location:
trunk/themes/smartpocket
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/themes/smartpocket/js/smartpocket.js

    r23745 r24514  
    2121    // onToolbarTap - listen out for when the toolbar is tapped 
    2222    myPhotoSwipe.addEventHandler(PhotoSwipe.EventTypes.onToolbarTap, function(e){ 
    23     if (e.toolbarAction === PhotoSwipe.Toolbar.ToolbarAction.none){ 
    24       if (e.tapTarget === more_link || Util.DOM.isChildOf(e.tapTarget, more_link)){ 
    25         var currentImage = myPhotoSwipe.getCurrentImage(); 
    26         window.location=currentImage.metaData.picture_url; 
    27       } 
    28     } 
    29 });     $(document).bind('orientationchange', set_thumbnails_width); 
    30     set_thumbnails_width(); 
     23                        if (e.toolbarAction === PhotoSwipe.Toolbar.ToolbarAction.none){ 
     24                                if (e.tapTarget === more_link || Util.DOM.isChildOf(e.tapTarget, more_link)){ 
     25                                        var currentImage = myPhotoSwipe.getCurrentImage(); 
     26                                        window.location=currentImage.metaData.picture_url; 
     27                                } 
     28                        } 
     29                }); 
     30                $(window).bind('orientationchange', set_thumbnails_width); 
     31                set_thumbnails_width(); 
    3132  }); 
    3233}(window, window.jQuery, window.Code.PhotoSwipe)); 
    3334 
    3435function set_thumbnails_width() { 
    35   nb_thumbs = Math.max(3, Math.ceil($('.thumbnails').width() / 130)); 
    36   width = Math.floor(1000000 / nb_thumbs) / 10000; 
    37   $('.thumbnails li').css('width', width+'%'); 
     36        var dpr = window.devicePixelRatio>1 ? window.devicePixelRatio : 1 
     37                , nb_thumbs = Math.max(2, Math.ceil($('.thumbnails').width() / (var_thumb_width/dpr+2*5))) 
     38                , width = Math.floor(1000000 / nb_thumbs) / 10000; 
     39        $('.thumbnails li').css('width', width+'%'); 
    3840} 
    3941 
  • trunk/themes/smartpocket/template/thumbnails.tpl

    r23718 r24514  
    66{combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'} 
    77{footer_script} 
    8   var var_loop = {if $smartpocket.loop}true{else}false{/if}, var_autohide = {$smartpocket.autohide}, var_trad = "{'More Information'|@translate}"; 
     8  var var_loop = {if $smartpocket.loop}true{else}false{/if}, var_autohide = {$smartpocket.autohide}, var_trad = "{'More Information'|@translate}", var_thumb_width={$thumbnail_derivative_params->max_width()}; 
    99{/footer_script} 
    1010 
Note: See TracChangeset for help on using the changeset viewer.