Changeset 29984 for extensions/Fotorama


Ignore:
Timestamp:
Oct 10, 2014, 4:18:37 PM (10 years ago)
Author:
JanisV
Message:

Improve JS code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Fotorama/template/fotorama-content.tpl

    r29982 r29984  
    2626{footer_script require='jquery'}
    2727  window.blockFotoramaData = true;
     28 
     29  function update_picture(fotorama) {
     30    {if isset($replace_picture)}
     31    if (history.replaceState)
     32      history.replaceState(null, null, fotorama.activeFrame['url']);
     33    {else}
     34    if (history.replaceState)
     35      history.replaceState(null, null, fotorama.activeFrame['url']+(fotorama.activeFrame['url'].indexOf('?')==-1 ? '?' : '&')+'slideshow=');
     36    jQuery('#slideshow .browsePath a').attr('href', fotorama.activeFrame['url']);
     37    {/if}
     38
     39    jQuery('a.fotorama__info-icon').attr('href', fotorama.activeFrame['url']+(fotorama.activeFrame['url'].indexOf('?')==-1 ? '?' : '&')+'slidestop=');
     40
     41    jQuery('#slideshow .showtitle').text(fotorama.activeFrame['caption']);
     42    jQuery('#slideshow .imageNumber').text((fotorama.activeFrame['i'])+'/{count($items)}');
     43    document.title = fotorama.activeFrame['caption'] + ' | {$GALLERY_TITLE|escape:javascript}';
     44  }
    2845
    2946  var fullscreen = false;
     
    3451            function (e, fotorama, extra) {
    3552              if (!fullscreen) {
    36                 {if isset($replace_picture)}
    37                 history.replaceState(null, null, fotorama.activeFrame['url']);
    38                 {else}
    39                 history.replaceState(null, null, fotorama.activeFrame['url']+(fotorama.activeFrame['url'].indexOf('?')==-1 ? '?' : '&')+'slideshow=');
    40                 jQuery('#slideshow .browsePath a').attr('href', fotorama.activeFrame['url']);
    41                 {/if}
    42 
    43                 jQuery('a.fotorama__info-icon').attr('href', fotorama.activeFrame['url']+(fotorama.activeFrame['url'].indexOf('?')==-1 ? '?' : '&')+'slidestop=');
    44 
    45                 jQuery('#slideshow .showtitle').text(fotorama.activeFrame['caption']);
    46                 jQuery('#slideshow .imageNumber').text((fotorama.activeFrame['i'])+'/{count($items)}');
    47                 document.title = fotorama.activeFrame['caption'] + ' | {$GALLERY_TITLE|escape:javascript}';
     53                update_picture(fotorama);
    4854              }
    4955            }
     
    8288              });
    8389
    84               {if isset($replace_picture)}
    85               history.replaceState(null, null, fotorama.activeFrame['url']);
    86               {else}
    87               history.replaceState(null, null, fotorama.activeFrame['url']+(fotorama.activeFrame['url'].indexOf('?')==-1 ? '?' : '&')+'slideshow=');
    88               jQuery('#slideshow .browsePath a').attr('href', fotorama.activeFrame['url']);
    89               {/if}
    90 
    91               jQuery('#slideshow .showtitle').text(fotorama.activeFrame['caption']);
    92               jQuery('#slideshow .imageNumber').text((fotorama.activeFrame['i'])+'/{count($items)}');
    93               document.title = fotorama.activeFrame['caption'] + ' | {$GALLERY_TITLE|escape:javascript}';
     90              update_picture(fotorama);
    9491
    9592              fullscreen = false;
Note: See TracChangeset for help on using the changeset viewer.