1$(document).ready(function(){ 2 st_pro_videos.init(); 3 if(!stprovideos.st_is_16){ 4 prestashop.on('updatedProduct', function (event) { 5 st_pro_videos.run({yi:0}); 6 }); 7 /*if(stprovideos.quick_view){ 8 prestashop.on('quickViewLoaded', function(event){ 9 var id_array = event.quickview_id.split('-'); 10 if(id_array.length!=4) 11 return ; 12 $.post(stprovideos.get_videos_url, {'id_product': id_array[2]}).then(function (resp) { 13 if(resp.videos){ 14 stprovideos.videos = resp.videos; 15 stprovideos.gallery_image_url = resp.gallery_image_url; 16 stprovideos.thumbnail_image_url = resp.thumbnail_image_url; 17 st_pro_videos.run({yi:1}); 18 } 19 }).fail(function (resp) { 20 console.log('stprovideos-quick-view: can\'t get videos.'); 21 }); 22 }); 23 }*/ 24 } 25}); 26 27var st_pro_videos = { 28 options: { 29 'autoplay': 1, 30 'muted' : 0, 31 'controls_youtube' : 0, 32 'controls': 1, 33 'loop': 1 34 }, 35 init: function() { 36 if(typeof(stprovideos)=='undefined') 37 return false; 38 if(!stprovideos.st_is_16 && stprovideos.quick_view && typeof(stprovidequickview)!='undefined'){ 39 stprovideos.videos = stprovidequickview ? stprovidequickview.videos : undefined; 40 } 41 this.options = $.extend(this.options, { 42 'autoplay': stprovideos.autoplay, 43 'muted' : stprovideos.muted, 44 'controls_youtube' : stprovideos.controls_youtube, 45 'controls': stprovideos.controls, 46 'loop': stprovideos.loop 47 }); 48 if(typeof(sttheme)!='undefined' && typeof(sttheme.product_thumbnails)!='undefined' && sttheme.product_thumbnails==3) 49 stprovideos.thumb_slider = 0; 50 51 $(document).on('click','.st_pro_video_play', function(e){ 52 e.preventDefault(); 53 st_pro_videos.st_pro_manually_play($(this).data('video-id')); 54 return false; 55 }); 56 57 $(document).on('click','.st_pro_video_stop', function(e){ 58 e.preventDefault(); 59 st_pro_videos.st_pro_videos_remove(0); 60 return false; 61 }); 62 st_pro_videos.run({yi:1}); 63 }, 64 run: function(params){ 65 if(typeof(stprovideos.videos)=='undefined') 66 return false; 67 if(stprovideos.how_to_display==0){ 68 this.append_player(); 69 this.append_static_paly(0); 70 this.handle_click_on_thumb(0); 71 }else if(stprovideos.how_to_display==2){ 72 this.append_player(); 73 this.append_static_paly(1); 74 this.append_paly_on_first_thumb(); 75 this.handle_click_on_thumb(1); 76 }else if(stprovideos.how_to_display==7 || stprovideos.how_to_display==8){ 77 if(params.yi==1) 78 this.append_desc_player(); 79 }else{// if(!stprovideos._st_themes_17) 80 this.init_classic_pro_video(params); 81 } 82 this.init_st_pro_videos(params); 83 }, 84 append_player: function(){ 85 var $pc_container = $(stprovideos.video_container); 86 if($pc_container.length) 87 $pc_container.append('<button class="st_pro_video_stop st_pro_video_btn st_pro_videos_invisible" type="button" aria-disabled="false"><span aria-hidden="true" class="vjs-icon-placeholder"></span></button>'+this.bulid_video_html(stprovideos.videos[0], false)); 88 }, 89 append_desc_player: function(){ 90 var $pc_container = $(stprovideos.desc_container); 91 if($pc_container.length){ 92 var x = '<div class="st_pro_video_miaoshu">'+this.bulid_video_html(stprovideos.videos[0], false)+'</div>'; 93 if(stprovideos.how_to_display==8) 94 $pc_container.append(x); 95 else 96 $pc_container.prepend(x); 97 } 98 }, 99 bulid_video_html: function(video, lazy){ 100 return '<div id="st_pro_video_'+video.id_st_pro_video+'" data-video-id="'+video.id_st_pro_video+'" class="st_pro_videos_box '+(stprovideos.slider ? 'st_pro_videos_box_static' : 'st_pro_videos_invisible')+' st_pro_video_flex"><video class="st_pro_videos video-js vjs-big-play-centered" data-autoplay="'+video.autoplay+'" data-muted="'+video.muted+'" data-loop="'+video.loop+'"><source '+(lazy?'data-':'')+'src="'+video.url+'" type="video/'+(/youtu(\.be|be\.com)/.test(video.url) ? 'youtube' : 'mp4')+'"></video></div>'; 101 }, 102 append_static_paly: function(type){ 103 var $container = $(stprovideos.video_container); 104 if($container.length) 105 $container.append('<button class="st_pro_video_play '+(type ? 'st_pro_video_play_on_first_gallery' : 'st_pro_video_play_static')+' st_pro_video_btn '+(stprovideos.how_to_display==2 ? ' st_pro_videos_invisible ' : '')+'" type="button" aria-disabled="false" data-video-id="'+stprovideos.videos[0].id_st_pro_video+'"><span aria-hidden="true" class="vjs-icon-placeholder"></span>'+(stprovideos.play_video_text ? '<span class="st_play_video_text">'+stprovideos.play_video_text+'</span>' : '')+'</button>'); 106 107 }, 108 /*append_paly_on_first: function(){ 109 var $container = $(stprovideos.video_selector); 110 if($container.length) 111 $container.append('<button class="st_pro_video_play st_pro_video_play_on_first st_pro_video_btn" type="button" aria-disabled="false"><span aria-hidden="true" class="vjs-icon-placeholder"></span></button>'); 112 },*/ 113 append_paly_on_first_thumb: function(){ 114 var $container = $(stprovideos.thumbnail_selector).first(); 115 if(!$container.length) 116 return false;
117 if(typeof(stprovideos.videos)!=='undefined') 118 $container.addClass('st_pro_video_relative').append('<button class="st_pro_video_play_on_first_thumb st_pro_video_btn st_pro_video_play_icon" type="button" aria-disabled="false"><span aria-hidden="true" class="vjs-icon-placeholder"></span></button>'); 119 }, 120 handle_click_on_thumb: function(type){ 121 if(stprovideos.how_to_display!=0 && stprovideos.how_to_display!=2) 122 return false; 123 var classname = type ? '.st_pro_video_play_on_first_gallery' : '.st_pro_video_play_static'; 124 switch(stprovideos.slider){ 125 case 0: 126 break; 127 case 1: 128 if(stprovideos.how_to_display==2 && $(stprovideos.gallery_container).length && typeof($(stprovideos.gallery_container)[0].swiper)!='undefined'){ 129 $(classname).toggleClass('st_pro_videos_invisible', !$(stprovideos.gallery_container)[0].swiper.isBeginning); 130 $(stprovideos.gallery_container)[0].swiper.on('onSlideChangeEnd', function(swiper){ 131 $(classname).toggleClass('st_pro_videos_invisible', !swiper.isBeginning); 132 }); 133 } 134 if(stprovideos.how_to_display==0){ 135 $(classname).addClass('st_pro_videos_invisible'); 136 } 137 break; 138 case 2: 139 break; 140 case 3: 141 if(typeof($(stprovideos.gallery_container).slick)!='undefined'){ 142 $(classname).toggleClass('st_pro_videos_invisible', $(stprovideos.gallery_container).slick('slickCurrentSlide')!=0); 143 $(stprovideos.gallery_container).on('afterChange', function(event, slick, currentSlide, nextSlide){ 144 if($(stprovideos.gallery_container).slick('slickCurrentSlide')==0) 145 $(classname).removeClass('st_pro_videos_invisible'); 146 else{ 147 $(classname).addClass('st_pro_videos_invisible'); 148 st_pro_videos.st_pro_videos_remove(2); 149 } 150 }); 151 } 152 break; 153 case 4: 154 if(stprovideos.how_to_display==2 && $(stprovideos.gallery_container).length && typeof($(stprovideos.gallery_container).data("owlCarousel"))!='undefined'){ 155 $(classname).toggleClass('st_pro_videos_invisible', $(stprovideos.gallery_container).data("owlCarousel").owl.currentItem!=0); 156 $(document).on('main_gallery_after_action', function(){ 157 $(classname).toggleClass('st_pro_videos_invisible', $(stprovideos.gallery_container).data("owlCarousel").owl.currentItem!=0); 158 }); 159 } 160 if(stprovideos.how_to_display==0){ 161 $(classname).addClass('st_pro_videos_invisible'); 162 } 163 break; 164 } 165 switch(stprovideos.thumb_slider){ 166 case 0: 167 $(stprovideos.thumbnail_selector).on('click', function(){ 168 if(stprovideos.how_to_display==2){ 169 if($(this).find('.st_pro_video_play_on_first_thumb').length){ 170 if($(classname).siblings('.st_pro_videos_box').hasClass('st_pro_videos_invisible')) 171 $(classname).removeClass('st_pro_videos_invisible'); 172 }else{ 173 $(classname).addClass('st_pro_videos_invisible'); 174 st_pro_videos.st_pro_videos_remove(2); 175 } 176 } 177 if(stprovideos.how_to_display==0){ 178 st_pro_videos.st_pro_videos_remove(0); 179 } 180 }); 181 break; 182 case 1: 183 if($(stprovideos.thumbnail_container).length && typeof($(stprovideos.thumbnail_container)[0].swiper)!='undefined'){ 184 $(stprovideos.thumbnail_container)[0].swiper.on('onClick', function(swiper){ 185 if(stprovideos.how_to_display==2){ 186 if($(swiper.slides).eq(swiper.clickedIndex).find('.st_pro_video_play_on_first_thumb').length==1){ 187 if($(classname).siblings('.st_pro_videos_box').hasClass('st_pro_videos_invisible')){ 188 $(classname).removeClass('st_pro_videos_invisible'); 189 } 190 } 191 else{ 192 $(classname).addClass('st_pro_videos_invisible'); 193 st_pro_videos.st_pro_videos_remove(2); 194 } 195 } 196 if(stprovideos.how_to_display==0){//why && stprovideos.slider!=1 2019 03 13 dao zhi panda dian ji thumb, video bu guan bi. 197 st_pro_videos.st_pro_videos_remove(0); 198 } 199 }); 200 } 201 break; 202 case 2: 203 break; 204 case 3: 205 break; 206 case 4: 207 if($(stprovideos.thumbnail_container).length && typeof($(stprovideos.thumbnail_container).data("owlCarousel"))!='undefined'){ 208 $(stprovideos.thumbnail_container).on("click", ".owl-item", function(e){ 209 e.preventDefault(); 210 if(stprovideos.how_to_display==2){ 211 if($(this).find('.st_pro_video_play_on_first_thumb').length==1){ 212 if($(classname).siblings('.st_pro_videos_box').hasClass('st_pro_videos_invisible')){ 213 $(classname).removeClass('st_pro_videos_invisible'); 214 } 215 } 216 else{ 217 $(classname).addClass('st_pro_videos_invisible'); 218 st_pro_videos.st_pro_videos_remove(2); 219 } 220 } 221 }); 222 } 223 break; 224 case 5: 225 $(document).on('hover', stprovideos.thumbnail_selector, function(){ 226 if(stprovideos.how_to_display==2){ 227 if($(this).find('.st_pro_video_play_on_first_thumb').length){ 228 if($(classname).siblings('.st_pro_videos_box').hasClass('st_pro_videos_invisible')) 229 $(classname).removeClass('st_pro_videos_invisible'); 230 }else{ 231 $(classname).addClass('st_pro_videos_invisible'); 232 st_pro_videos.st_pro_videos_remove(2); 233 } 234 } 235 if(stprovideos.how_to_display==0){ 236 st_pro_videos.st_pro_videos_remove(0); 237 } 238 }); 239 break; 240 } 241 }, 242 st_pro_manually_play: function(id){ 243 var video = $('#st_pro_video_'+id+' .st_pro_videos');
244 if(!video.length) 245 return false; 246 st_pro_videos.st_pro_videos_toggle_btns(1, id); 247 248 var player = videojs.getPlayer(video[0]); 249 if(player && !player.paused()) 250 player.pause(); 251 else if(player && (video.data('autoplay')==1 || (this.options.autoplay==1 && video.data('autoplay')==4)) || stprovideos.how_to_display==0 || stprovideos.how_to_display==2){ 252 player.ready(function(){ 253 setTimeout(function(){ 254 if(!$('#st_pro_video_'+id).hasClass('.st_pro_videos_invisible')){ 255 player.play(); 256 } 257 },100); 258 }); 259 if(stprovideos.how_to_display!=0 && stprovideos.how_to_display!=2){ 260 switch(stprovideos.thumb_slider){ 261 case 0: 262 if($(stprovideos.thumbnail_selector).filter('[data-video-id="'+id+'"]').length){ 263 $(stprovideos.thumbnail_selector).find('.selected').removeClass('selected'); 264 $(stprovideos.thumbnail_selector).filter('[data-video-id="'+id+'"]').find('.thumb').addClass('selected'); 265 } 266 break; 267 } 268 } 269 } 270 }, 271 init_st_pro_videos: function(params){ 272 $('.st_pro_videos').each(function(k,v){ 273 var is_youtube = $(this).find('source').attr('type').indexOf('youtube')!==-1; 274 var options = st_pro_videos.options; 275 if($(this).data('autoplay')!=4) 276 options = $.extend(options, {'autoplay': $(this).data('autoplay')}); 277 if($(this).data('muted')!=4) 278 options = $.extend(options, {'muted': $(this).data('muted')}); 279 if($(this).data('loop')!=4) 280 options = $.extend(options, {'loop': $(this).data('loop')}); 281 var myPlayer = videojs(this, { 282 controls: is_youtube && options.controls_youtube ? false : options.controls, 283 fluid: true, 284 autoplay: false, 285 loop: options.loop===1, 286 muted: options.muted, 287 techOrder: is_youtube ? ['youtube'] : ['html5'], 288 "youtube": is_youtube && options.controls_youtube ? { "ytControls": 2 } : {}, 289 "playsinline": "playsinline", 290 preload: (stprovideos.how_to_display==0 || stprovideos.how_to_display==2 ? 'none' : 'metadata') 291 }).on("ended",function(){ 292 if(typeof(stprovideos.auto_close_at_end)!='undefined' && stprovideos.auto_close_at_end) 293 st_pro_videos.st_pro_videos_remove(0); 294 }); 295 }); 296 if(stprovideos.how_to_display==0 || stprovideos.how_to_display==2){ 297 var video = $('#st_pro_video_'+stprovideos.videos[0].id_st_pro_video+' .st_pro_videos'); 298 if(params.yi==1 && (video.data('autoplay')==1 || (st_pro_videos.options.autoplay==1 && video.data('autoplay')==4))) 299 st_pro_videos.st_pro_manually_play(stprovideos.videos[0].id_st_pro_video); 300 else 301 st_pro_videos.st_pro_videos_remove(0); 302 }else{ 303 switch(stprovideos.slider){ 304 case 0: 305 if(params.yi==1 && (stprovideos.how_to_display==1 || stprovideos.how_to_display==4)){ 306 var key = stprovideos.videos.length-1; 307 st_pro_videos.st_pro_manually_play(stprovideos.videos[key].id_st_pro_video); 308 } 309 else 310 st_pro_videos.st_pro_videos_remove(0); 311 break; 312 case 1://Swiper 313 if($(stprovideos.gallery_container).length && typeof($(stprovideos.gallery_container)[0].swiper)!='undefined'){ 314 if(stprovideos.videos.length==$(stprovideos.gallery_container)[0].swiper.slides.length)//ugly way to tell if a product has no images, because changeStart will not run in this case. 315 st_pro_videos.swiper_video($(stprovideos.gallery_container)[0].swiper); 316 else if((stprovideos.how_to_display==1 || stprovideos.how_to_display==4)){ 317 $(stprovideos.gallery_container)[0].swiper.slideTo(0); 318 } 319 st_pro_videos.swiper_sticker($(stprovideos.gallery_container)[0].swiper); 320 } 321 break; 322 case 3: 323 if(typeof($(stprovideos.gallery_container).slick)!='undefined'){ 324 st_pro_videos.slick_video($(stprovideos.gallery_container).slick('getSlick').$slides, $(stprovideos.gallery_container).slick('getSlick').$slides[0]); 325 st_pro_videos.slick_sticker($(stprovideos.gallery_container).slick('getSlick').$slides[0]); 326 } 327 break; 328 case 4://Owl1 329 if($(stprovideos.gallery_container).length && typeof($(stprovideos.gallery_container).data("owlCarousel"))!='undefined'){ 330 if((stprovideos.how_to_display==1 || stprovideos.how_to_display==4)){ 331 // $(stprovideos.gallery_container).trigger("owl.goTo", 0); 332 $(stprovideos.gallery_container).trigger("main_gallery_after_action", [$(stprovideos.gallery_container).data("owlCarousel")]); 333 } 334 st_pro_videos.owl1_sticker($(stprovideos.gallery_container).data("owlCarousel")); 335 } 336 break; 337 } 338 switch(stprovideos.thumb_slider){ 339 case 0: 340 break; 341 case 1://Swiper requests to scroll to the first manually 342 if((stprovideos.how_to_display==1 || stprovideos.how_to_display==4) && $(stprovideos.thumbnail_container).length && typeof($(stprovideos.thumbnail_container)[0].swiper)!='undefined') 343 $(stprovideos.thumbnail_container)[0].swiper.slideTo(0); 344 break; 345 case 3://Slick, it's show the first slide by default 346 break; 347 case 4://Owl1 348 break; 349 } 350 } 351 }, 352 append_item: function(type,slider,html){ 353 var pre = (stprovideos.how_to_display==1 || stprovideos.how_to_display==4); 354 switch(type){ 355 case 0: 356 case 5: 357 pre ? slider.prepend(html) : slider.append(html); 358 break; 359 case 1://Swiper 360 if(typeof(slider[0].swiper)!='undefined'){ 361 pre ? slider[0].swiper.prependSlide(html) : slider[0].swiper.appendSlide(html); 362 } 363 break; 364 case 2://Owl 2 365 pre ? slider.trigger('add.owl.carousel', [html, 0]) : slider.trigger('add.owl.carousel', [html]); 366 break; 367 case 3://Slick 368 pre ? slider.slick('slickAdd', html, 0, true) : slider.slick('slickAdd', html); 369 break; 370 case 4://Owl 1 371 pre ? slider.data("owlCarousel").addItem(html, 0) : slider.data("owlCarousel").addItem(html, -1); 372 break; 373 } 374 }, 375 slider_reinit: function(type,slider){ 376 switch(type){ 377 case 0: 378 if ($('#main .js-qv-product-images li').length > 2) { 379 $('#main .js-qv-mask').addClass('scroll'); 380 $('.scroll-box-arrows').addClass('scroll'); 381 $('#main .js-qv-mask').scrollbox({ 382 direction: 'h', 383 distance: 113,
384 autoPlay: false 385 }); 386 $('.scroll-box-arrows .left').click(function () { 387 $('#main .js-qv-mask').trigger('backward'); 388 }); 389 $('.scroll-box-arrows .right').click(function () { 390 $('#main .js-qv-mask').trigger('forward'); 391 }); 392 } else { 393 $('#main .js-qv-mask').removeClass('scroll'); 394 $('.scroll-box-arrows').removeClass('scroll'); 395 } 396 break; 397 case 1://Swiper 398 if(typeof(slider[0].swiper)!='undefined'){ 399 slider[0].swiper.update(true); 400 if(stprovideos._st_themes_17){ 401 if($(slider[0].swiper.slides).length==$(slider[0].swiper.slides).filter('.swiper-slide-visible').length) 402 { 403 $(slider[0].swiper.params.nextButton).hide(); 404 $(slider[0].swiper.params.prevButton).hide(); 405 } 406 else 407 { 408 $(slider[0].swiper.params.nextButton).show(); 409 $(slider[0].swiper.params.prevButton).show(); 410 } 411 } 412 } 413 break; 414 case 2://Owl 2 415 slider.trigger('refresh.owl.carousel'); 416 break; 417 case 3://Slick 418 break; 419 case 4://Owl 1 420 slider.data("owlCarousel").isTransition=false;// sometimes the ge shi 1, daozhi next prev yong buqi. 421 break; 422 case 5:// 423 $('#thumbs_list_frame').width(parseInt($('#thumbs_list_frame >li').outerWidth(true) * $('#thumbs_list_frame >li').length) + 'px'); 424 $('#thumbs_list').trigger('goto', 0); 425 serialScrollFixLock('', '', '', '', 0); 426 if(stprovideos.how_to_display==1 || stprovideos.how_to_display==4) 427 $('#views_block .shown').removeClass('shown'); 428 break; 429 } 430 }, 431 slider_init: function(type,slider,gt){ 432 var pre = (stprovideos.how_to_display==1 || stprovideos.how_to_display==4); 433 switch(type){ 434 case 0: 435 st_pro_videos.chu_shi_hua[gt](slider); 436 break; 437 case 1://Swiper 438 if(typeof(slider[0].swiper)!='undefined'){ 439 st_pro_videos.chu_shi_hua[gt](slider); 440 } 441 break; 442 case 2://Owl 2 443 st_pro_videos.chu_shi_hua[gt](slider); 444 break; 445 case 3://Slick 446 st_pro_videos.chu_shi_hua[gt](slider); 447 break; 448 case 4://Owl 1 449 if(typeof(slider.data("owlCarousel"))!='undefined') 450 st_pro_videos.chu_shi_hua[gt](slider); 451 break; 452 case 5://serialScroll 453 st_pro_videos.chu_shi_hua[gt](slider); 454 break; 455 } 456 }, 457 init_classic_pro_video: function(params){ 458 var gallery_container = $(stprovideos.gallery_container); 459 var thumb_container = $(stprovideos.thumbnail_container); 460 if(gallery_container.length) 461 this.slider_init(stprovideos.slider, gallery_container,'slider'); 462 if(thumb_container.length) 463 this.slider_init(stprovideos.thumb_slider, thumb_container, 'thumb'); 464 }, 465 swiper_sticker: function(swiper){ 466 if(!stprovideos._st_themes_17) 467 return false; 468 var active_video = $(swiper.slides).eq(swiper.activeIndex).find('.st_pro_videos'); 469 $(stprovideos.video_container+' .st_sticker_block').toggle(!active_video.length); 470 }, 471 swiper_video: function(swiper){ 472 $(swiper.wrapper).find('.st_pro_videos').each(function(){ 473 var player = videojs.getPlayer(this); 474 if(player){ 475 player.pause(); 476 } 477 }); 478 var active_video = $(swiper.slides).eq(swiper.activeIndex).find('.st_pro_videos'); 479 if(active_video.length){ 480 if(active_video.data('autoplay')==1 || (active_video.data('autoplay')==4 && stprovideos.autoplay==1)){ 481 var player = videojs.getPlayer(active_video[0]); 482 if(player){ 483 player.ready(function(){ 484 setTimeout(function(){ 485 if(active_video.closest('.swiper-slide').hasClass('swiper-slide-active')){ 486 player.play(); 487 } 488 },100); 489 }); 490 } 491 } 492 } 493 }, 494 slick_video: function(slides,nextSlide){ 495 $(slides).each(function(){ 496 var player = videojs.getPlayer($(this).find('.st_pro_videos')[0]); 497 if(player){ 498 player.pause(); 499 } 500 }); 501 502 var active_video = $(nextSlide).find('.st_pro_videos'); 503 if(active_video.length && (active_video.data('autoplay')==1 || (active_video.data('autoplay')==4 && stprovideos.autoplay==1))){ 504 var player = videojs.getPlayer(active_video[0]); 505 if(player){ 506 player.ready(function(){ 507 setTimeout(function(){ 508 if(active_video.closest('.slick-slide').hasClass('slick-current')) 509 player.play(); 510 },100); 511 }); 512 } 513 } 514 }, 515 slick_sticker: function(nextSlide){ 516 var active_video = $(nextSlide).find('.st_pro_videos'); 517 $('.product-cover .expander, .product-cover .product-flags').toggle(!active_video.length); 518 }, 519 owl1_video: function(owl1){ 520 owl1.$elem.find('.st_pro_videos').each(function(){ 521 var player = videojs.getPlayer(this); 522 if(player){ 523 player.pause(); 524 } 525 }); 526 var active_video = owl1.$owlItems.eq(owl1.currentItem).find('.st_pro_videos'); 527 if(active_video.length){ 528 if(active_video.data('autoplay')==1 || (active_video.data('autoplay')==4 && stprovideos.autoplay==1)){ 529 var player = videojs.getPlayer(active_video[0]); 530 if(player){ 531 player.ready(function(){ 532 setTimeout(function(){ 533 if(active_video.closest('.owl-item').hasClass('active')){ 534 player.play(); 535 } 536 },100); 537 }); 538 } 539 } 540 } 541 }, 542 owl1_sticker: function(owl1){ 543 if(!stprovideos._st_themes_16) 544 return false;
545 var active_video = owl1.$owlItems.eq(owl1.currentItem).find('.st_pro_videos'); 546 $(stprovideos.video_container+' .new, '+stprovideos.video_container+' #reduction_percent').toggle(!active_video.length); 547 }, 548 chu_shi_hua:{ 549 slider: function(gallery_container){ 550 if(!stprovideos.slider) 551 gallery_container.append('<button class="st_pro_video_stop st_pro_video_btn st_pro_videos_invisible" type="button" aria-disabled="false"><span aria-hidden="true" class="vjs-icon-placeholder"></span></button>'); 552 $.each(stprovideos.videos, function(){ 553 var html = st_pro_videos.bulid_video_html(this, false); 554 switch(stprovideos.slider){ 555 case 1://Swiper 556 html = '<div class="swiper-slide"><img src="'+stprovideos.gallery_image_url+'">'+html+'</div>'; 557 break; 558 case 2://Owl 2 559 break; 560 case 3://Slick 561 html = '<div><img src="'+stprovideos.gallery_image_url+'" class="img-fluid">'+html+'</div>'; 562 break; 563 case 4://Owl 1 564 html = '<div class="item"><img src="'+stprovideos.gallery_image_url+'" class="img-responsive">'+html+'</div>'; 565 break; 566 } 567 st_pro_videos.append_item(stprovideos.slider, gallery_container, html); 568 if(stprovideos._st_themes_17){ 569 var pre = (stprovideos.how_to_display==1 || stprovideos.how_to_display==4); 570 var invisible_trigger = '<a href="javascript:;" class="st_pro_videos_invisible"></a>';; 571 pre ? $('.pro_popup_trigger_box').prepend(invisible_trigger) : $('.pro_popup_trigger_box').append(invisible_trigger); 572 } 573 }); 574 st_pro_videos.slider_reinit(stprovideos.slider, gallery_container); 575 if(stprovideos.slider){ 576 switch(stprovideos.slider){ 577 case 1://Swiper 578 if(typeof(gallery_container[0].swiper)!='undefined'){ 579 gallery_container[0].swiper.on('onSlideChangeStart', function(swiper){ 580 st_pro_videos.swiper_video(swiper); 581 st_pro_videos.swiper_sticker(swiper); 582 }); 583 } 584 break; 585 case 2://Owl 2 586 gallery_container.on('changed.owl.carousel', function(event) { 587 $(gallery_container).find('.st_pro_videos').each(function(){ 588 var player = videojs.getPlayer(this); 589 if(player) 590 player.pause(); 591 }); 592 593 var active_video = event.item.find('.st_pro_videos'); 594 if(active_video.length && (active_video.data('autoplay')==1 || (active_video.data('autoplay')==4 && stprovideos.autoplay==1))){ 595 var player = videojs.getPlayer(active_video[0]); 596 if(player){ 597 player.ready(function(){ 598 setTimeout(function(){ 599 if(active_video.closest('.owl-item').hasClass('active')) 600 player.play(); 601 },100); 602 }); 603 } 604 } 605 }); 606 break; 607 case 3://Slick 608 gallery_container.on('beforeChange', function(event, slick, currentSlide, nextSlide){ 609 st_pro_videos.slick_video(slick.$slides, slick.$slides[nextSlide]); 610 st_pro_videos.slick_sticker(slick.$slides[nextSlide]); 611 }); 612 break; 613 case 4://Owl 1 614 $(document).on('main_gallery_after_action', function(event, owl1){ 615 st_pro_videos.owl1_video(owl1); 616 st_pro_videos.owl1_sticker(owl1); 617 }); 618 break; 619 } 620 } 621 },
622 thumb: function(thumb_container){ 623 $.each(stprovideos.videos, function(){ 624 st_pro_videos.append_item(stprovideos.thumb_slider, thumb_container, this.thumbnail_html); 625 }); 626 st_pro_videos.slider_reinit(stprovideos.thumb_slider, thumb_container); 627 628 if(stprovideos.slider){ 629 }else{ 630 $(stprovideos.thumbnail_selector).on((((stprovideos.st_is_16 && stprovideos.thumbnail_event==0) || stprovideos.thumbnail_event==2) ? 'mouseenter' : 'click'), function(e){ 631 var id = $(this).data('video-id'); 632 if(id){ 633 st_pro_videos.st_pro_videos_remove(0,id); 634 st_pro_videos.st_pro_manually_play(id); 635 if(stprovideos.st_is_16) 636 $('#views_block .shown').removeClass('shown'); 637 } 638 else 639 st_pro_videos.st_pro_videos_remove(0,id); 640 }); 641 } 642 }, 643 }, 644 st_pro_videos_toggle_btns: function(status, id) { 645 if(status===1) 646 { 647 $('.st_pro_video_stop, #st_pro_video_'+id).removeClass('st_pro_videos_invisible'); 648 $('.st_pro_video_play').addClass('st_pro_videos_invisible'); 649 } 650 else 651 { 652 if(status!==2) 653 $('.st_pro_video_play').removeClass('st_pro_videos_invisible'); 654 $('.st_pro_video_stop').addClass('st_pro_videos_invisible'); 655 if(!stprovideos.slider || stprovideos.how_to_display==0 || stprovideos.how_to_display==2) 656 $('.st_pro_videos_box').addClass('st_pro_videos_invisible'); 657 } 658 }, 659 st_pro_videos_remove: function(status,id) { 660 if(typeof(id)=='undefined') 661 id=0; 662 $.each($('.st_pro_videos'), function(){ 663 if($(this).parent().data('video-id')==id) 664 return true; 665 var player = videojs.getPlayer(this); 666 if(player) 667 player.pause(); 668 }); 669 st_pro_videos.st_pro_videos_toggle_btns(status,id); 670 } 671};
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.