From 4bea142d2a996945de01066d1254a6431aa18990 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 13:12:33 +0800 Subject: [PATCH] fix error --- app/views/admin/ad_images/_jplayer.html.erb | 8 +++---- .../_ad_banner_widget2_video.html.erb | 23 ++++++++++++++++++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/app/views/admin/ad_images/_jplayer.html.erb b/app/views/admin/ad_images/_jplayer.html.erb index 584ae3b..5e5046f 100644 --- a/app/views/admin/ad_images/_jplayer.html.erb +++ b/app/views/admin/ad_images/_jplayer.html.erb @@ -178,16 +178,12 @@ var jpalyer_video = $(ele).parents('.jp-video').eq(0); jpalyer_video.find(".jp-gui").css("display",""); jpalyer_video.addClass('hide-ui'); - <% if @hide_video_tools %> - ad_audio_button(ele,false); - <% end %> } function show_jplayer_ui_<%= i %>(ele) { <% unless @hide_video_tools %> var jpalyer_video = $(ele).parents('.jp-video').eq(0); jpalyer_video.removeClass('hide-ui'); <% end %> - ad_audio_button(ele,true); } function click_jplayer_<%= i %>(){ $("#jp_container_<%= i %> .jp-video-play").css('display','') @@ -232,6 +228,9 @@ play_<%= i %>_flag = true; ad_call_on_play_jplayer_<%= i %>(this); jplayer_center_video_front($(this).find('video')); + <% if @hide_video_tools %> + ad_audio_button(ele,false); + <% end %> }, click: function(){ click_jplayer_<%= i %>(); @@ -241,6 +240,7 @@ $(this).jPlayer("pause"); ad_call_on_pause_jplayer_<%= i %>(this); window.console.log("pause"); + ad_audio_button(ele,true); }, abort: function(){ play_<%= i %>_flag = false; diff --git a/modules/ad_banner/_ad_banner_widget2_video.html.erb b/modules/ad_banner/_ad_banner_widget2_video.html.erb index 489fc97..74ddfa7 100644 --- a/modules/ad_banner/_ad_banner_widget2_video.html.erb +++ b/modules/ad_banner/_ad_banner_widget2_video.html.erb @@ -41,7 +41,28 @@ if (is_stop){ $(ele).find('.jarallax-video-audio').remove(); }else{ - $(ele).append('
'); + var audio_div; + if ($(ele).hasClass('have-audio')){ + audio_div = $('
'); + }else{ + audio_div = $('
'); + } + audio_div.click(function(){ + var $video = $(ele).find('video'); + if ($(ele).hasClass('have-audio')){ + $(ele).removeClass('have-audio'); + $(this).find('i.fas').attr('class','fas fa-volume-mute'); + }else{ + $(ele).addClass('have-audio'); + $(this).find('i.fas').attr('class','fas fa-volume-up'); + } + if ($video.length>0){ + $video[0].muted = !$video[0].muted; + }else{//youtube + + } + }) + $(ele).append(audio_div); } } if(document.getElementById("youtube-iframe-api") == null){