34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/alula/plugins/sublimevideo.rb', line 34
def sublime_videotag(source)
poster = source.gsub(/#{File.extname(source)}$/, '.png')
info = info(poster, :thumbnail)
poster_hires = hires_url(poster, :thumbnail)
poster = attachment_url(poster, :thumbnail)
tag = "<a"
tag += " class=\"sublime zoomable video #{@options["classes"].join(" ")}\""
tag += " href=\"#{sources.first[:url]}\""
tag += " style=\"width: #{info.width}px; height: #{info.height}px;\""
tag += ">"
tag += " <img"
tag += " alt=\"#{@options["alternative"]}\""
tag += " width=\"#{info.width}\" height=\"#{info.height}\""
if context.site.config.attachments.image.lazyload
tag += " src=\"#{asset_url("grey.gif")}\""
tag += " data-original=\"#{poster}\""
else
tag += " src=\"#{poster}\""
end
tag += " data-hires=\"#{poster_hires}\"" if context.site.config.attachments.image.hires and poster_hires
tag += " />"
tag += " <span class=\"zoom_icon\"></span>"
tag += "</a>"
info = info(sources.first[:name], :video)
tag += "<video"
tag += " controls"
tag += " class=\"sublime lightbox\""
tag += " style=\"display: none;\""
tag += " width=\"#{info.width}\""
tag += " height=\"#{info.height}\""
tag += " poster=\"#{poster}\""
tag += " preload=\"none\""
tag += " data-uid=\"#{source}\""
tag += " data-name=\"#{source}\""
tag += ">"
sources.each do |source|
tag += " <source src=\"#{source[:url]}\" #{source[:hires] ? "data-quality=\"hd\"" : ""} />"
end
tag += "</video>"
end
|