Fix bug.
This commit is contained in:
parent
c952afb56d
commit
56a4f3a3f8
|
@ -91,9 +91,17 @@ class AdImage
|
||||||
def embed_url
|
def embed_url
|
||||||
uri = URI.parse(self.youtube) rescue nil
|
uri = URI.parse(self.youtube) rescue nil
|
||||||
if !uri.nil? && uri.host == "www.youtube.com"
|
if !uri.nil? && uri.host == "www.youtube.com"
|
||||||
params = CGI.parse(uri.query)
|
if uri.path.start_with?('/embed/')
|
||||||
v = params['v'].first
|
return self.youtube.sub(/http(s|):\/\//,'//')
|
||||||
|
else
|
||||||
|
params = CGI.parse(uri.query.to_s)
|
||||||
|
v = params.blank? ? nil : params['v'].first
|
||||||
|
if v.blank?
|
||||||
|
return ""
|
||||||
|
else
|
||||||
return "//www.youtube.com/embed/#{v}"
|
return "//www.youtube.com/embed/#{v}"
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
|
@ -171,7 +171,7 @@
|
||||||
$("*[data-yt-binded=0]").each(function(){
|
$("*[data-yt-binded=0]").each(function(){
|
||||||
init_yt_banner(this);
|
init_yt_banner(this);
|
||||||
})
|
})
|
||||||
if (typeof onYouTubeIframeAPIReady !== 'function'){
|
if (typeof onYouTubeIframeAPIReady !== 'function'){
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$(document).on('touchstart click mousedown',".jarallax-video-audio",function(){
|
$(document).on('touchstart click mousedown',".jarallax-video-audio",function(){
|
||||||
$(this).trigger('click');
|
$(this).trigger('click');
|
||||||
|
@ -357,7 +357,7 @@ if (typeof onYouTubeIframeAPIReady !== 'function'){
|
||||||
}
|
}
|
||||||
{{extra_state_chnage_script}}
|
{{extra_state_chnage_script}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
window.onYouTubePlayerAPIReady = function() {
|
window.onYouTubePlayerAPIReady = function() {
|
||||||
onYouTubeIframeAPIReady.apply(this,arguments);
|
onYouTubeIframeAPIReady.apply(this,arguments);
|
||||||
|
|
Loading…
Reference in New Issue