From 867d94a980107e420dcb44241f1655df47916289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sun, 14 Nov 2021 12:43:46 +0800 Subject: [PATCH] add audio button --- app/views/admin/ad_images/_jplayer.html.erb | 3 ++ .../_ad_banner_widget2_video.html.erb | 33 +++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/app/views/admin/ad_images/_jplayer.html.erb b/app/views/admin/ad_images/_jplayer.html.erb index abb6c69..a7d8f05 100644 --- a/app/views/admin/ad_images/_jplayer.html.erb +++ b/app/views/admin/ad_images/_jplayer.html.erb @@ -161,6 +161,7 @@ //$(ele).jPlayer("pauseOthers"); hide_jplayer_ui_<%= i %>(ele); } + } function ad_call_on_pause_jplayer_<%= i %>(ele){ var cyclediv = $(ele).parents("div.cycle-slideshow").eq(0); @@ -177,11 +178,13 @@ var jpalyer_video = $(ele).parents('.jp-video').eq(0); jpalyer_video.find(".jp-gui").css("display",""); jpalyer_video.addClass('hide-ui'); + ad_audio_button(ele,true); } function show_jplayer_ui_<%= i %>(ele) { <% unless @hide_video_tools %> var jpalyer_video = $(ele).parents('.jp-video').eq(0); jpalyer_video.removeClass('hide-ui'); + ad_audio_button(ele,false); <% end %> } function click_jplayer_<%= i %>(){ diff --git a/modules/ad_banner/_ad_banner_widget2_video.html.erb b/modules/ad_banner/_ad_banner_widget2_video.html.erb index cb5ee59..63ff25e 100644 --- a/modules/ad_banner/_ad_banner_widget2_video.html.erb +++ b/modules/ad_banner/_ad_banner_widget2_video.html.erb @@ -37,7 +37,13 @@ if (typeof ad_banners_count === 'undefined'){ var ad_banners_count = 0; } - + function ad_audio_button(ele,is_stop){ + if (is_stop){ + $(ele).find('.jarallax-video-audio').remove() + }else{ + $(ele).append('
') + } + } if(document.getElementById("youtube-iframe-api") == null){ var tag = document.createElement('script'); tag.setAttribute("id", "youtube-iframe-api"); @@ -105,7 +111,6 @@ if (typeof onYouTubeIframeAPIReady !== 'function'){ } }) } - function onPlayerStateChange(event){ var iframe = $(event.target.h), cyclediv = iframe.parents("div.cycle-slideshow"); @@ -114,10 +119,12 @@ if (typeof onYouTubeIframeAPIReady !== 'function'){ cyclediv[0].need_resume = !(cyclediv.hasClass("cycle-paused")); cyclediv.cycle("pause"); widget.find('.banner-pager,.controlplay,.button-mid,.ad-overlay').css('visibility','hidden') + ad_audio_button(cyclediv,true); }else if(event.data == YT.PlayerState.UNSTARTED || event.data == YT.PlayerState.PAUSED || event.data == YT.PlayerState.ENDED){ if(cyclediv[0].need_resume) cyclediv.cycle("resume"); widget.find('.banner-pager,.controlplay,.button-mid,.ad-overlay').css('visibility','') + ad_audio_button(cyclediv,false); } {{extra_state_chnage_script}} } @@ -178,6 +185,28 @@ if (typeof onYouTubeIframeAPIReady !== 'function'){ })