This commit is contained in:
BoHung Chiu 2022-07-06 09:23:13 +08:00
parent e48b43937c
commit 71917f80ae
2 changed files with 5 additions and 4 deletions

View File

@ -88,7 +88,7 @@ class AdBannersController < ApplicationController
alt_title = (ad_b.title.blank? ? "ad-banner image" : ad_b.title) alt_title = (ad_b.title.blank? ? "ad-banner image" : ad_b.title)
if ad_b.exchange_item == "1" if ad_b.exchange_item == "1"
image_html = "<div class=\"w-ad-banner__slide w-ba-banner__slide #{klass}\" image_html = "<div class=\"w-ad-banner__slide w-ba-banner__slide #{klass}\"
data-link=\"#{ad_b.out_link || "#"}'\" data-link=\"#{ad_b.out_link || "#"}\"
data-cycle-title=\"#{ad_b.title}\" data-cycle-title=\"#{ad_b.title}\"
data-cycle-desc=\"#{context}\" data-cycle-desc=\"#{context}\"
data-overlay-template=\"<h3>#{ad_b.title}</h3><p>#{context}</p>\" data-overlay-template=\"<h3>#{ad_b.title}</h3><p>#{context}</p>\"
@ -106,7 +106,7 @@ class AdBannersController < ApplicationController
@file_poster = ad_b.video_snapshot.url rescue nil @file_poster = ad_b.video_snapshot.url rescue nil
title = (ad_b.title.blank? ? File.basename(video_url) : ad_b.title) title = (ad_b.title.blank? ? File.basename(video_url) : ad_b.title)
image_html = "<div class=\"w-ad-banner__slide w-ba-banner__slide #{klass} jplayer_slide\" image_html = "<div class=\"w-ad-banner__slide w-ba-banner__slide #{klass} jplayer_slide\"
data-link=\"#{ad_b.out_link || "#"}'\" data-link=\"#{ad_b.out_link || "#"}\"
data-cycle-title=\"#{ad_b.title}\" data-cycle-title=\"#{ad_b.title}\"
data-cycle-desc=\"#{context}\" data-cycle-desc=\"#{context}\"
data-overlay-template=\"<h3>#{ad_b.title}</h3><p>#{context}</p>\" data-overlay-template=\"<h3>#{ad_b.title}</h3><p>#{context}</p>\"
@ -122,7 +122,7 @@ class AdBannersController < ApplicationController
image_html = "<div class=\"w-ad-banner__slide w-ba-banner__slide #{klass} youtube youtube_slide\" image_html = "<div class=\"w-ad-banner__slide w-ba-banner__slide #{klass} youtube youtube_slide\"
data-yt-binded=\"0\" data-yt-binded=\"0\"
data-youtube-id=\"ytplayer#{i}\" data-youtube-id=\"ytplayer#{i}\"
data-link=\"#{ad_b.out_link || "#"}'\" data-link=\"#{ad_b.out_link || "#"}\"
data-cycle-title=\"#{ad_b.title}\" data-cycle-title=\"#{ad_b.title}\"
data-cycle-desc=\"#{context}\" data-cycle-desc=\"#{context}\"
data-overlay-template=\"<h3>#{ad_b.title}</h3><p>#{context}</p>\" data-overlay-template=\"<h3>#{ad_b.title}</h3><p>#{context}</p>\"

View File

@ -189,7 +189,7 @@ if (typeof onYouTubeIframeAPIReady !== 'function'){
} }
function onYouTubeIframeAPIReady(){ function onYouTubeIframeAPIReady(){
$(".w-ba-banner").on('cycle-post-initialize', function(){ $(".w-ba-banner").on('cycle-post-initialize', function(){
init_banner(banner); init_banner(this);
}); });
function init_banner(banner){ function init_banner(banner){
var $banner = $(banner); var $banner = $(banner);
@ -251,6 +251,7 @@ if (typeof onYouTubeIframeAPIReady !== 'function'){
event_dict[relation_key].onStateChange = []; event_dict[relation_key].onStateChange = [];
event_dict[count_key] = event_dict[array_key].length; event_dict[count_key] = event_dict[array_key].length;
yt_player.addEventListener('onStateChange',onPlayerStateChange); yt_player.addEventListener('onStateChange',onPlayerStateChange);
banner_wrap.trigger('resize');
}else{ }else{
console.log("YT player changes its variables!") console.log("YT player changes its variables!")
} }