Changeset 29915


Ignore:
Timestamp:
Oct 7, 2014, 2:02:08 PM (10 years ago)
Author:
JanisV
Message:

Added period parameter for autoplay

Location:
extensions/Fotorama
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/Fotorama/admin.php

    r29732 r29915  
    3232  if (isset($_POST['thumbheight']))
    3333    $conf['Fotorama']['thumbheight'] = $_POST['thumbheight'];
     34  if (isset($_POST['period']))
     35    $conf['Fotorama']['period'] = $_POST['period'];
    3436
    3537  conf_update_param('Fotorama', serialize($conf['Fotorama']));
  • extensions/Fotorama/main.inc.php

    r29732 r29915  
    4646        $conf['Fotorama']['close_button'] = false;
    4747        $conf['Fotorama']['resize'] = false;
     48  }
     49  // Upgrade params from 2.7.n
     50  if (!isset($conf['Fotorama']['period'])) {
     51        $conf['Fotorama']['period'] = 4000;
    4852  }
    4953
  • extensions/Fotorama/maintain.inc.php

    r29732 r29915  
    2525    'close_button' => false,
    2626    'resize' => false,
     27    'period' => 4000,
    2728  );
    2829
  • extensions/Fotorama/template/admin.tpl

    r29732 r29915  
    8787      <b>{'Thumbnail height (when present)'|translate}</b>
    8888    </label>
    89     <input type="number" size="2" maxlength="3" name="thumbheight" value="{$Fotorama.thumbheight}" min="5" max="300" style="width: 50px;">&nbsp;px
     89    <input type="number" size="2" maxlength="3" name="thumbheight" id="thumbheight" value="{$Fotorama.thumbheight}" min="5" max="300" style="width: 50px;">&nbsp;px
    9090  </li>
    9191  <li>
     
    100100      <b>{'Enables autoplay'|translate}</b>
    101101    </label>
     102  </li>
     103  <li>
     104    <label for="period">
     105      <b>{'Waiting time before loading a new picture'|translate}</b>
     106    </label>
     107    <input type="number" size="4" maxlength="5" name="period" id="period" value="{$Fotorama.period}" min="0" max="10000" style="width: 50px;">&nbsp;{'milliseconds'|translate}
    102108  </li>
    103109  <li>
     
    181187      jQuery('#replace_picture_only_users').removeAttr('checked');
    182188    }
     189
     190    if(jQuery('#autoplay').is(":checked")) {
     191      jQuery('#period').prop('disabled', false);
     192    }
     193    else {
     194      jQuery('#period').prop('disabled', true);
     195    }
    183196  }
    184197  jQuery().ready(function() {
     
    197210    update_Fotorama_state();
    198211  });
     212  jQuery('#autoplay').change(function() {
     213    update_Fotorama_state();
     214  });
    199215 
    200216{/literal}{/footer_script}
  • extensions/Fotorama/template/fotorama-content.tpl

    r29914 r29915  
    99  data-width="100%" data-maxheight="100%" data-minheight="200" data-height="{$item_height}"
    1010  data-shadows="{if $Fotorama.shadows}true{else}false{/if}" data-nav="{$Fotorama.nav}" data-fit="{$Fotorama.fit}"
    11   data-allowfullscreen="{$Fotorama.allowfullscreen}" data-autoplay="{if $Fotorama.autoplay}true{else}false{/if}"
     11  data-allowfullscreen="{$Fotorama.allowfullscreen}" data-autoplay="{if $Fotorama.autoplay}{$Fotorama.period}{else}false{/if}"
    1212  data-transition="{$Fotorama.transition}" data-stopautoplayontouch="{if $Fotorama.stopautoplayontouch}true{else}false{/if}"
    1313  data-loop="{if $Fotorama.loop}true{else}false{/if}" data-captions="false" data-thumbheight="{$Fotorama.thumbheight}"
     
    5656              });
    5757              {if $Fotorama.autoplay or not $Fotorama.only_fullscreen}
    58               fotorama.startAutoplay();
     58//              fotorama.startAutoplay();
    5959              {/if}
    6060
     
    116116  });
    117117  {/if}
     118 
     119  {if $Fotorama.autoplay}
     120  $(document).keypress(function(e) {
     121    if(e.which == 43) {
     122      jQuery('.fotorama').data('fotorama').setOptions({
     123        autoplay: jQuery('.fotorama').data('fotorama').options['autoplay'] * 1.4
     124      });
     125    }
     126    if(e.which == 45) {
     127      jQuery('.fotorama').data('fotorama').setOptions({
     128        autoplay: jQuery('.fotorama').data('fotorama').options['autoplay'] / 1.4
     129      });
     130    }
     131  });
     132  {/if}
    118133{/footer_script}
Note: See TracChangeset for help on using the changeset viewer.