onebox 1.5.36 → 1.5.37

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb07f9ec00a95d8a8247d010c04a22fceb4b242d
4
- data.tar.gz: 2cb0aedd6352c878611604c063c87563ef007240
3
+ metadata.gz: b1576d08884bfa434b9bd3448ad8e961f67927d0
4
+ data.tar.gz: 665f05efa8854392a32f73604d01e363dd40d7c2
5
5
  SHA512:
6
- metadata.gz: 6cd4b8c587b4f6dece85cbdc518c4ecab43d71ca9eaf7059f0761fd76e5f163d09b620b1dfb56cb6b20648ff12cdd2c5dcc809601e251a9bf1d0223f842cfd84
7
- data.tar.gz: 9515d8b35ab81a113e1ac8f409639fee03b5eef23b06052bc37a236ae2c2cf417e4f78bd83a755b5da2dfe8018210429ecf1dbc6157f4b493a68d11dbf1a0de7
6
+ metadata.gz: c02bcbd0202b81ab2e04f0764d5145fb1ed43db4c519fa208200569be4832bb74418c7b4e9425ad54a7757cafccd9860bad4d2b5dafdd2aa9c890d00f0742e05
7
+ data.tar.gz: ff0de27100b65d232d6274e3a862c8e6d5ecdbda2907cffae3e82f87a033d977ac744b9dec3aec10e871cae7703eeddc28d14566766b8d48c7e502e68c4e63cf
@@ -10,16 +10,15 @@ module Onebox
10
10
  def to_html
11
11
  imgur_data = get_imgur_data
12
12
  return "<video width='#{imgur_data[:"player:width"]}' height='#{imgur_data[:"player:height"]}' controls autoplay loop><source src='#{imgur_data[:"player:stream"]}' type='video/mp4'><source src='#{imgur_data[:"player:stream"].gsub('mp4', 'webm')}' type='video/webm'></video>" if imgur_data[:"player:stream"]
13
+ return "<div class='onebox imgur-album'><a href='#{url}' target='_blank'><span class='outer-box'><span class='inner-box'><span class='album-title'>[Album] #{imgur_data[:title]}</span></span></span><img src='#{imgur_data[:image]}' alt='Imgur'></a></div>" if is_album?
13
14
  return "<a href='#{url}' target='_blank'><img src='#{imgur_data[:image]}' alt='Imgur' height='#{imgur_data[:"image:height"]}' width='#{imgur_data[:"image:width"]}'></a>" if imgur_data[:image]
14
- return "<div class='onebox imgur-album'><a href='#{url}' target='_blank'><span class='outer-box'><span class='inner-box'><span class='album-title'>[Album] #{imgur_data[:title]}</span></span></span><img src='#{imgur_data[:"image0:src"]}' alt='Imgur'></a></div>" if imgur_data[:"image0:src"]
15
15
  return nil
16
16
  end
17
17
 
18
18
  def placeholder_html
19
19
  imgur_data = get_imgur_data
20
20
  return "<video width='#{imgur_data[:"player:width"]}' height='#{imgur_data[:"player:height"]}' controls autoplay loop><source src='#{imgur_data[:"player:stream"]}' type='video/mp4'><source src='#{imgur_data[:"player:stream"].gsub('mp4', 'webm')}' type='video/webm'></video>" if imgur_data[:"player:stream"]
21
- return "<img src='#{imgur_data[:image]}' alt='Imgur' height='#{imgur_data[:"image:height"]}' width='#{imgur_data[:"image:width"]}'>" if imgur_data[:image]
22
- return "<img src='#{imgur_data[:"image0:src"]}' alt='Imgur'>" if imgur_data[:"image0:src"]
21
+ return "<img src='#{imgur_data[:image]}' alt='Imgur' height='#{imgur_data[:"image:height"]}' width='#{imgur_data[:"image:width"]}'>"
23
22
  return nil
24
23
  end
25
24
 
@@ -37,6 +36,12 @@ module Onebox
37
36
  end
38
37
  return imgur_data
39
38
  end
39
+
40
+ def is_album?
41
+ oembed_data = Onebox::Helpers.symbolize_keys(::MultiJson.load(Onebox::Helpers.fetch_response("http://api.imgur.com/oembed.json?url=#{url}").body))
42
+ imgur_data_id = Nokogiri::HTML(oembed_data[:html]).xpath("//blockquote").attr("data-id")
43
+ return !!(imgur_data_id.to_s =~ /a\//)
44
+ end
40
45
  end
41
46
  end
42
47
  end
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.5.36"
2
+ VERSION = "1.5.37"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.36
4
+ version: 1.5.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-03-28 00:00:00.000000000 Z
13
+ date: 2016-03-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json