Add audio onebox

http://meta.discourse.org/t/audio-html5-tag/8168
This commit is contained in:
James Anderson 2013-07-25 19:03:23 -07:00
parent 9c617d051e
commit d7d3be1130
4 changed files with 19 additions and 1 deletions

View File

@ -299,6 +299,9 @@
webkit-border-radius: 4px;
ms-border-radius: 4px;
}
audio {
max-width: 100%;
}
}
#wmd-preview {
border: 1px dashed $gray;

View File

@ -515,6 +515,9 @@
img {
max-width: 100%;
}
audio {
max-width: 100%;
}
.topic-body {
position: relative;
.contents {

View File

@ -0,0 +1,12 @@
require_dependency 'oneboxer/base_onebox'
module Oneboxer
class AudioOnebox < BaseOnebox
matcher /^https?:\/\/.*\.mp3$/
def onebox
"<audio controls><source src='#{@url}'><a href='#{@url}'>#{@url}</a></audio>"
end
end
end

View File

@ -3,7 +3,7 @@ require_dependency 'oneboxer/base_onebox'
module Oneboxer
class VideoOnebox < BaseOnebox
matcher /^https?:\/\/.*\.(mov|mp4|ogg)$/
matcher /^https?:\/\/.*\.(mov|mp4)$/
def onebox
"<video width='100%' height='100%' controls><source src='#{@url}'><a href='#{@url}'>#{@url}</a></video>"