This commit is contained in:
BoHung Chiu 2022-10-04 13:14:34 +08:00
parent 56a4f3a3f8
commit aeb4baf741
5 changed files with 24 additions and 34 deletions

View File

@ -34,9 +34,9 @@ if bundle_update_flag
FileUtils.mkdir_p("#{ENV['PWD']}/tmp")
require 'open-uri'
if RUBY_VERSION.to_f >= 2.7
download = URI.open('https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v4.2/ffmpeg-4.2-linux-64.zip')
download = URI.open('https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v4.2/ffmpeg-4.2-linux-64.zip',:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE)
else
download = open('https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v4.2/ffmpeg-4.2-linux-64.zip')
download = open('https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v4.2/ffmpeg-4.2-linux-64.zip',:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE)
end
save_zip_name = "#{ENV['PWD']}/tmp/ffmpeg-4.2-linux-64.zip"
IO.copy_stream(download, save_zip_name)

View File

@ -191,11 +191,15 @@ class AdBannersController < ApplicationController
def format_url(url,index)
uri = URI.parse(url)
ps = uri.query.to_s.split("&")
url_params = {}
ps.each do |p|
x = p.split("=")
url_params[x.first] = x.last
if !uri.nil? && uri.host == "www.youtube.com"
if uri.path.start_with?('/embed/')
url_params['v'] = uri.path.split('/embed/').last
else
params = CGI.parse(uri.query.to_s)
v = params.blank? ? nil : params['v'].first
url_params['v'] = v
end
end
# url = "http://www.youtube.com/v/#{url_params["v"]}/?version=3&playerapiid=ytplayer#{index}"
url = "https://www.youtube.com/embed/#{url_params["v"]}"

View File

@ -274,7 +274,7 @@
return true;
}
$(document).ready(function(){
jplayer_ready_func();
jplayer_ready_func_1();
$('#ad_image_video_file').change(function(){
var file = this.files ? this.files[0] : null;
var value = this.value;

View File

@ -383,7 +383,7 @@
<% else %>
var jPlayer_<%= i %> = default_video_data;
<% end %>
function jplayer_ready_func(){
function jplayer_ready_func_<%= i %>(){
$("#jquery_jplayer_<%= i %>").jPlayer(jPlayer_<%= i %>);
if ($("#jquery_jplayer_<%= i %>").parents("div.cycle-slideshow").length>0){
$("#jquery_jplayer_<%= i %>").addClass("hide-ui");
@ -431,7 +431,7 @@
}
<% if defined?(not_ready).nil? || !not_ready %>
$(document).ready(function(){
jplayer_ready_func();
jplayer_ready_func_<%= i %>();
})
<% end %>
</script>

View File

@ -283,21 +283,26 @@
delete yt_players[id][k];
})
iframes.each(function(i,iframe){
var yt_id = $(iframe).attr("id");
var yt_player = yt_players[id][$(iframe).attr("id")];
var $iframe = $(iframe);
var yt_id = $iframe.attr("id");
var yt_player = yt_players[id][yt_id];
if(yt_player){
}else{
yt_player = new YT.Player($(iframe).attr("id"), {
yt_player = new YT.Player(yt_id, {
events: {
'onReady': function(event){
var yt_player = event.target;
var height = $(yt_player.getIframe()).height();
var banner_wrap = $(iframe).parents('.w-ba-banner__wrap').eq(0);
var banner_wrap = $iframe.parents('.w-ba-banner__wrap').eq(0);
var carousel_wrap = banner_wrap.find(".cycle-carousel-wrap");
if(carousel_wrap.length){
carousel_wrap.css("top","3em");
height += parseInt(carousel_wrap.css('font-size')) * 3;
}
var overlay_in_slide = $iframe.parent().siblings('.ad-overlay,.banner-overlay');
if(overlay_in_slide.length != 0){
height += overlay_in_slide.outerHeight(true);
}
banner_wrap.height(height).css({"padding-bottom":"","padding-top":""});
var init_key = find_out_yt_event_relation_key(yt_player, false);
if(init_key){
@ -330,8 +335,8 @@
'onStateChange': onPlayerStateChange
}
});
yt_players[id][$(iframe).attr("id")] = yt_player;
$(iframe).data("yt_player",yt_player);
yt_players[id][yt_id] = yt_player;
$iframe.data("yt_player",yt_player);
}
})
}
@ -401,18 +406,6 @@
$('[data-subpart-id="{{subpart-id}}"] .prev-button').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev");
})
var resize_timeout_id;
$(window).resize(function(){
if(resize_timeout_id){
window.clearTimeout(resize_timeout_id);
}
resize_timeout_id = window.setTimeout(function(){
var banner_wrap = $(".w-ba-banner__wrap[data-overlay=\".w-ad-banner__overlay_{{subpart-id}}\"]");
var opts = banner_wrap.data('cycle.opts');
var height = opts.slides.filter('.active').height() || opts.slides.height();
banner_wrap.height(height).css("padding-bottom","");
},300);
})
})
</script>
<style type="text/css">
@ -461,13 +454,6 @@
.w-ba-banner .controlplay{
width: auto;
}
.w-ba-banner .button-mid{
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.next-button,.prev-button{
cursor: pointer;
}