Fix bug.
This commit is contained in:
parent
56a4f3a3f8
commit
aeb4baf741
|
@ -34,9 +34,9 @@ if bundle_update_flag
|
||||||
FileUtils.mkdir_p("#{ENV['PWD']}/tmp")
|
FileUtils.mkdir_p("#{ENV['PWD']}/tmp")
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
if RUBY_VERSION.to_f >= 2.7
|
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
|
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
|
end
|
||||||
save_zip_name = "#{ENV['PWD']}/tmp/ffmpeg-4.2-linux-64.zip"
|
save_zip_name = "#{ENV['PWD']}/tmp/ffmpeg-4.2-linux-64.zip"
|
||||||
IO.copy_stream(download, save_zip_name)
|
IO.copy_stream(download, save_zip_name)
|
||||||
|
|
|
@ -191,11 +191,15 @@ class AdBannersController < ApplicationController
|
||||||
|
|
||||||
def format_url(url,index)
|
def format_url(url,index)
|
||||||
uri = URI.parse(url)
|
uri = URI.parse(url)
|
||||||
ps = uri.query.to_s.split("&")
|
|
||||||
url_params = {}
|
url_params = {}
|
||||||
ps.each do |p|
|
if !uri.nil? && uri.host == "www.youtube.com"
|
||||||
x = p.split("=")
|
if uri.path.start_with?('/embed/')
|
||||||
url_params[x.first] = x.last
|
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
|
end
|
||||||
# url = "http://www.youtube.com/v/#{url_params["v"]}/?version=3&playerapiid=ytplayer#{index}"
|
# url = "http://www.youtube.com/v/#{url_params["v"]}/?version=3&playerapiid=ytplayer#{index}"
|
||||||
url = "https://www.youtube.com/embed/#{url_params["v"]}"
|
url = "https://www.youtube.com/embed/#{url_params["v"]}"
|
||||||
|
|
|
@ -274,7 +274,7 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
jplayer_ready_func();
|
jplayer_ready_func_1();
|
||||||
$('#ad_image_video_file').change(function(){
|
$('#ad_image_video_file').change(function(){
|
||||||
var file = this.files ? this.files[0] : null;
|
var file = this.files ? this.files[0] : null;
|
||||||
var value = this.value;
|
var value = this.value;
|
||||||
|
|
|
@ -383,7 +383,7 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
var jPlayer_<%= i %> = default_video_data;
|
var jPlayer_<%= i %> = default_video_data;
|
||||||
<% end %>
|
<% end %>
|
||||||
function jplayer_ready_func(){
|
function jplayer_ready_func_<%= i %>(){
|
||||||
$("#jquery_jplayer_<%= i %>").jPlayer(jPlayer_<%= i %>);
|
$("#jquery_jplayer_<%= i %>").jPlayer(jPlayer_<%= i %>);
|
||||||
if ($("#jquery_jplayer_<%= i %>").parents("div.cycle-slideshow").length>0){
|
if ($("#jquery_jplayer_<%= i %>").parents("div.cycle-slideshow").length>0){
|
||||||
$("#jquery_jplayer_<%= i %>").addClass("hide-ui");
|
$("#jquery_jplayer_<%= i %>").addClass("hide-ui");
|
||||||
|
@ -431,7 +431,7 @@
|
||||||
}
|
}
|
||||||
<% if defined?(not_ready).nil? || !not_ready %>
|
<% if defined?(not_ready).nil? || !not_ready %>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
jplayer_ready_func();
|
jplayer_ready_func_<%= i %>();
|
||||||
})
|
})
|
||||||
<% end %>
|
<% end %>
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -283,21 +283,26 @@
|
||||||
delete yt_players[id][k];
|
delete yt_players[id][k];
|
||||||
})
|
})
|
||||||
iframes.each(function(i,iframe){
|
iframes.each(function(i,iframe){
|
||||||
var yt_id = $(iframe).attr("id");
|
var $iframe = $(iframe);
|
||||||
var yt_player = yt_players[id][$(iframe).attr("id")];
|
var yt_id = $iframe.attr("id");
|
||||||
|
var yt_player = yt_players[id][yt_id];
|
||||||
if(yt_player){
|
if(yt_player){
|
||||||
}else{
|
}else{
|
||||||
yt_player = new YT.Player($(iframe).attr("id"), {
|
yt_player = new YT.Player(yt_id, {
|
||||||
events: {
|
events: {
|
||||||
'onReady': function(event){
|
'onReady': function(event){
|
||||||
var yt_player = event.target;
|
var yt_player = event.target;
|
||||||
var height = $(yt_player.getIframe()).height();
|
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");
|
var carousel_wrap = banner_wrap.find(".cycle-carousel-wrap");
|
||||||
if(carousel_wrap.length){
|
if(carousel_wrap.length){
|
||||||
carousel_wrap.css("top","3em");
|
carousel_wrap.css("top","3em");
|
||||||
height += parseInt(carousel_wrap.css('font-size')) * 3;
|
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":""});
|
banner_wrap.height(height).css({"padding-bottom":"","padding-top":""});
|
||||||
var init_key = find_out_yt_event_relation_key(yt_player, false);
|
var init_key = find_out_yt_event_relation_key(yt_player, false);
|
||||||
if(init_key){
|
if(init_key){
|
||||||
|
@ -330,8 +335,8 @@
|
||||||
'onStateChange': onPlayerStateChange
|
'onStateChange': onPlayerStateChange
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
yt_players[id][$(iframe).attr("id")] = yt_player;
|
yt_players[id][yt_id] = yt_player;
|
||||||
$(iframe).data("yt_player",yt_player);
|
$iframe.data("yt_player",yt_player);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -401,18 +406,6 @@
|
||||||
$('[data-subpart-id="{{subpart-id}}"] .prev-button').click(function(){
|
$('[data-subpart-id="{{subpart-id}}"] .prev-button').click(function(){
|
||||||
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev");
|
$(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>
|
</script>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
@ -461,13 +454,6 @@
|
||||||
.w-ba-banner .controlplay{
|
.w-ba-banner .controlplay{
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
.w-ba-banner .button-mid{
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
.next-button,.prev-button{
|
.next-button,.prev-button{
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue