lib/onebox/engine/youtube_onebox.rb in onebox-1.3.6 vs lib/onebox/engine/youtube_onebox.rb in onebox-1.3.7

- old
+ new

@@ -37,11 +37,17 @@ end def append_params(html) result = html.dup result.gsub! /(src="[^"]+)/, '\1&wmode=opaque' - if url =~ /t=(\d+)/ - result.gsub! /(src="[^"]+)/, '\1&start=' + Regexp.last_match[1] + if url =~ /t=(\d+h)?(\d+m)?(\d+s?)?/ + h = Regexp.last_match[1].to_i + m = Regexp.last_match[2].to_i + s = Regexp.last_match[3].to_i + + total = (h * 60 * 60) + (m * 60) + s + + result.gsub! /(src="[^"]+)/, '\1&start=' + total.to_s end result end def rewrite_agnostic(html)