Fixed Youtube videos appearing on top of compose panel (props to @hrobertson)
This commit is contained in:
parent
4863c4517a
commit
8d47215ea5
|
@ -37,6 +37,11 @@ module Oneboxer
|
|||
var.gsub! /https?:\/\//, '//' if var.is_a? String
|
||||
end
|
||||
|
||||
# Add wmode=opaque to the iframe src URL so that the flash player is rendered within the document flow instead of on top
|
||||
def append_embed_wmode(var)
|
||||
var.gsub! /(src="[^"]+)/, '\1&wmode=opaque"' if var.is_a? String
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def initialize(url, opts={})
|
||||
|
|
|
@ -7,7 +7,7 @@ module Oneboxer
|
|||
|
||||
def onebox
|
||||
if SiteSetting.enable_flash_video_onebox
|
||||
"<object width='100%' height='100%'><param name='#{@url}' value='#{@url}'><embed src='#{@url}' width='100%' height='100%'></embed></object>"
|
||||
"<object width='100%' height='100%' wmode='opaque'><param name='#{@url}' value='#{@url}'><embed src='#{@url}' width='100%' height='100%' wmode='opaque'></embed></object>"
|
||||
else
|
||||
"<a href='#{@url}'>#{@url}</a>"
|
||||
end
|
||||
|
|
|
@ -8,8 +8,12 @@ module Oneboxer
|
|||
end
|
||||
|
||||
def onebox
|
||||
super.each do |entry|
|
||||
# Youtube allows HTTP and HTTPS, so replace them with the protocol-agnostic variant
|
||||
super.each { |entry| BaseOnebox.replace_agnostic entry }
|
||||
BaseOnebox.replace_agnostic entry
|
||||
# Add wmode=opaque to the iframe src URL so that the flash player is rendered within the document flow instead of on top
|
||||
BaseOnebox.append_embed_wmode entry
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ describe Oneboxer::FlashVideoOnebox do
|
|||
|
||||
it "generates a flash video" do
|
||||
expect(@o.onebox).to match_html(
|
||||
"<object width='100%' height='100%'><param name='http://player.56.com/v_OTMyNTk1MzE.swf' value='http://player.56.com/v_OTMyNTk1MzE.swf'><embed src='http://player.56.com/v_OTMyNTk1MzE.swf' width='100%' height='100%'></embed></object>"
|
||||
"<object width='100%' height='100%' wmode='opaque'><param name='http://player.56.com/v_OTMyNTk1MzE.swf' value='http://player.56.com/v_OTMyNTk1MzE.swf'><embed src='http://player.56.com/v_OTMyNTk1MzE.swf' width='100%' height='100%' wmode='opaque'></embed></object>"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue