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
|
var.gsub! /https?:\/\//, '//' if var.is_a? String
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
def initialize(url, opts={})
|
def initialize(url, opts={})
|
||||||
|
|
|
@ -2,12 +2,12 @@ require_dependency 'oneboxer/base_onebox'
|
||||||
|
|
||||||
module Oneboxer
|
module Oneboxer
|
||||||
class FlashVideoOnebox < BaseOnebox
|
class FlashVideoOnebox < BaseOnebox
|
||||||
|
|
||||||
matcher /^https?:\/\/.*\.(swf|flv)$/
|
matcher /^https?:\/\/.*\.(swf|flv)$/
|
||||||
|
|
||||||
def onebox
|
def onebox
|
||||||
if SiteSetting.enable_flash_video_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
|
else
|
||||||
"<a href='#{@url}'>#{@url}</a>"
|
"<a href='#{@url}'>#{@url}</a>"
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,8 +8,12 @@ module Oneboxer
|
||||||
end
|
end
|
||||||
|
|
||||||
def onebox
|
def onebox
|
||||||
# Youtube allows HTTP and HTTPS, so replace them with the protocol-agnostic variant
|
super.each do |entry|
|
||||||
super.each { |entry| BaseOnebox.replace_agnostic entry }
|
# Youtube allows HTTP and HTTPS, so replace them with the protocol-agnostic variant
|
||||||
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe Oneboxer::FlashVideoOnebox do
|
||||||
|
|
||||||
it "generates a flash video" do
|
it "generates a flash video" do
|
||||||
expect(@o.onebox).to match_html(
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue