1/* 2* 2007-2017 PrestaShop 3* 4* NOTICE OF LICENSE 5* 6* This source file is subject to the Academic Free License (AFL 3.0) 7* that is bundled with this package in the file LICENSE.txt. 8* It is also available through the world-wide-web at this URL: 9* http://opensource.org/licenses/afl-3.0.php 10* If you did not receive a copy of the license and are unable to 11* obtain it through the world-wide-web, please send an email 12* to [email protected] so we can send you a copy immediately. 13* 14* DISCLAIMER 15* 16* Do not edit or add to this file if you wish to upgrade PrestaShop to newer 17* versions in the future. If you wish to customize PrestaShop for your 18* needs please refer to http://www.prestashop.com for more information. 19* 20* @author ST-themes <[email protected]> 21* @copyright 2007-2017 ST-themes 22* @license Use, by you or one client for one Prestashop instance. 23*/ 24 25var st_owl_progressBar = [], st_owl_bar = [], st_owl_elem= [], st_owl_isPause= [], st_owl_tick=[], st_owl_percentTime=[]; 26//Init progressBar where elem is $("#owl-demo") 27function st_owl_progressBar_init(elem){ 28 //for some reason data() does not work. 29 var id_st = elem.attr('id').replace(/\D*/g,''); 30 id_st = parseInt(id_st); 31 st_owl_elem[id_st] = elem; 32 33 //build progress bar elements 34 st_owl_buildProgressBar(id_st); 35 //start counting 36 st_owl_start(id_st); 37}; 38 39//create div#progressBar and div#bar then prepend to $("#owl-demo") 40function st_owl_buildProgressBar(id_st){ 41 st_owl_progressBar[id_st] = $("<div>",{ 42 class:"owl_progressBar" 43 }); 44 st_owl_bar[id_st] = $("<div>",{ 45 class:"owl_bar" 46 }); 47 if(stowlcarousel_array[id_st].progress_bar==1) 48 st_owl_progressBar[id_st].append(st_owl_bar[id_st]).prependTo(st_owl_elem[id_st]); 49 else 50 st_owl_progressBar[id_st].append(st_owl_bar[id_st]).appendTo(st_owl_elem[id_st]); 51 52}; 53 54function st_owl_start(id_st) { 55 //reset timer 56 st_owl_percentTime[id_st] = 0; 57 st_owl_isPause[id_st] = false; 58 //run interval every 0.01 second 59 st_owl_tick[id_st] = setInterval(function(){ 60 if(st_owl_isPause[id_st] === false){ 61 st_owl_percentTime[id_st] += 1000 / stowlcarousel_array[id_st].bar_time; 62 st_owl_bar[id_st].css({ 63 width: st_owl_percentTime[id_st]+"%" 64 }); 65 //if st_owl_percentTime is equal or greater than 100 66 if(st_owl_percentTime[id_st] >= 100){ 67 //slide to next item 68 st_owl_elem[id_st].trigger('owl.next') 69 } 70 } 71 }, 10); 72}; 73 74 75//pause while dragging 76function st_owl_pauseOnDragging(elem){ 77 var id_st = elem.attr('id').replace(/\D*/g,''); 78 st_owl_isPause[id_st] = true; 79}; 80 81//moved callback 82function st_owl_moved(elem){ 83 var id_st = elem.attr('id').replace(/\D*/g,''); 84 //clear interval 85 clearTimeout(st_owl_tick[id_st]); 86 //start again 87 st_owl_start(id_st); 88}; 89jQuery(function($) { 90 if(typeof(stowlcarousel_array)!='undefined') 91 { 92 $.each(stowlcarousel_array, function(key, value){ 93 if(value) 94 { 95 if(typeof(value.progress_bar)!=='undefined' && value.progress_bar) 96 { 97 value.afterInit = st_owl_progressBar_init; 98 value.afterMove = st_owl_moved; 99 value.startDragging = st_owl_pauseOnDragging; 100 } 101 $("#st_owl_carousel-"+key).owlCarousel(value); 102 } 103 }); 104 } 105});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.