1 | {strip}{html_style} |
---|
2 | .thumbnailCategory .illustration{ldelim} |
---|
3 | width: {$derivative_params->max_width()+5}px; |
---|
4 | } |
---|
5 | |
---|
6 | .content .thumbnailCategory .description{ldelim} |
---|
7 | height: {$derivative_params->max_height()+5}px; |
---|
8 | } |
---|
9 | {/html_style}{/strip} |
---|
10 | <div class="loader" style="display: none; position: fixed; right: 0;bottom: 0;"><img src="{$ROOT_URL}{$themeconf.img_dir}/ajax_loader.gif"></div> |
---|
11 | <ul class="thumbnailCategories"> |
---|
12 | {foreach from=$category_thumbnails item=cat name=cat_loop} |
---|
13 | {assign var=derivative value=$pwg->derivative($derivative_params, $cat.representative.src_image)} |
---|
14 | {if !$derivative->is_cached() and !$js_loaded} |
---|
15 | {combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'} |
---|
16 | {*combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'*} |
---|
17 | {footer_script}{literal} |
---|
18 | var thumbnails_queue = jQuery.manageAjax.create('queued', { |
---|
19 | queue: true, |
---|
20 | cacheResponse: false, |
---|
21 | maxRequests: {/literal}{$maxRequests}{literal}, |
---|
22 | preventDoubleRequests: false |
---|
23 | }); |
---|
24 | |
---|
25 | function add_thumbnail_to_queue(img, loop) { |
---|
26 | thumbnails_queue.add({ |
---|
27 | type: 'GET', |
---|
28 | url: img.data('src'), |
---|
29 | data: { ajaxload: 'true' }, |
---|
30 | dataType: 'json', |
---|
31 | beforeSend: function(){jQuery('.loader').show()}, |
---|
32 | success: function(result) { |
---|
33 | img.attr('src', result.url); |
---|
34 | jQuery('.loader').hide(); |
---|
35 | }, |
---|
36 | error: function() { |
---|
37 | if (loop < 3) |
---|
38 | add_thumbnail_to_queue(img, ++loop); // Retry 3 times |
---|
39 | img.attr('src', {/literal}"{$ROOT_URL}{$themeconf.icon_dir}/errors_small.png"{literal}); |
---|
40 | jQuery('.loader').hide(); |
---|
41 | } |
---|
42 | }); |
---|
43 | } |
---|
44 | |
---|
45 | function pwg_ajax_thumbnails_loader() { |
---|
46 | jQuery('img[data-src]').each(function() { |
---|
47 | add_thumbnail_to_queue(jQuery(this), 0); |
---|
48 | }); |
---|
49 | } |
---|
50 | jQuery(document).ready(pwg_ajax_thumbnails_loader); |
---|
51 | {/literal}{/footer_script} |
---|
52 | {assign var=js_loaded value=true} |
---|
53 | {/if} |
---|
54 | <li class="{if $smarty.foreach.cat_loop.index is odd}odd{else}even{/if}"> |
---|
55 | <div class="thumbnailCategory"> |
---|
56 | <div class="illustration"> |
---|
57 | <a href="{$cat.URL}"> |
---|
58 | <img {if $derivative->is_cached()}src="{$derivative->get_url()}"{else}src="{$ROOT_URL}{$themeconf.icon_dir}/img_small.png" data-src="{$derivative->get_url()}"{/if} alt="{$cat.TN_ALT}" title="{$cat.NAME|@replace:'"':' '|@strip_tags:false} - {'display this album'|@translate}"> |
---|
59 | </a> |
---|
60 | </div> |
---|
61 | <div class="description"> |
---|
62 | <h3> |
---|
63 | <a href="{$cat.URL}">{$cat.NAME}</a> |
---|
64 | {if !empty($cat.icon_ts)} |
---|
65 | <img title="{$cat.icon_ts.TITLE}" src="{$ROOT_URL}{$themeconf.icon_dir}/recent{if $cat.icon_ts.IS_CHILD_DATE}_by_child{/if}.png" alt="(!)"> |
---|
66 | {/if} |
---|
67 | </h3> |
---|
68 | <div class="text"> |
---|
69 | {if isset($cat.INFO_DATES) } |
---|
70 | <p class="dates">{$cat.INFO_DATES}</p> |
---|
71 | {/if} |
---|
72 | <p class="Nb_images">{$cat.CAPTION_NB_IMAGES}</p> |
---|
73 | {if not empty($cat.DESCRIPTION)} |
---|
74 | <p>{$cat.DESCRIPTION}</p> |
---|
75 | {/if} |
---|
76 | </div> |
---|
77 | </div> |
---|
78 | </div> |
---|
79 | </li> |
---|
80 | {/foreach} |
---|
81 | </ul> |
---|