videawesome 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/videawesome.rb +2 -2
- metadata +5 -6
- data/lib/#videawesome.rb# +0 -29
data/lib/videawesome.rb
CHANGED
@@ -6,12 +6,12 @@ module Videawesome
|
|
6
6
|
|
7
7
|
def self.youtube_video(url, text, height, width)
|
8
8
|
url_ident =url.scan(IDENT).to_s
|
9
|
-
altered_text = text.gsub(url,"<iframe title='YouTube video player' class='youtube-player' type='text/html' width='#{width}' height='#{height}' src='http://www.youtube.com/v
|
9
|
+
altered_text = text.gsub(url,"<iframe title='YouTube video player' class='youtube-player' type='text/html' width='#{width}' height='#{height}' src='http://www.youtube.com/v#{url_ident}' frameborder='0'></iframe><br /><small> dont have flash player installed? <a href=\"http://www.youtube.com/v#{url_ident}\" target=\"_blank\">click here</a></small>")
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.vimeo_video(url, text, height, width)
|
13
13
|
url_ident = url.scan(IDENT).to_s
|
14
|
-
altered_text = text.gsub(url,"<iframe title='Vimeo Video Player' src='http://player.vimeo.com/video
|
14
|
+
altered_text = text.gsub(url,"<iframe title='Vimeo Video Player' src='http://player.vimeo.com/video#{url_ident}' width='#{width}' height='#{height}' frameborder='0'></iframe><br /> <small>dont have flash player installed? <a href=\"http://player.vimeo.com/video#{url_ident}\" target=\"_blank\">click here</a></small>")
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.parse_video(text, height, width)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: videawesome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 17
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lee
|
@@ -28,7 +28,6 @@ extensions: []
|
|
28
28
|
extra_rdoc_files: []
|
29
29
|
|
30
30
|
files:
|
31
|
-
- lib/#videawesome.rb#
|
32
31
|
- lib/videawesome.rb
|
33
32
|
has_rdoc: true
|
34
33
|
homepage:
|
@@ -60,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
59
|
requirements: []
|
61
60
|
|
62
61
|
rubyforge_project:
|
63
|
-
rubygems_version: 1.
|
62
|
+
rubygems_version: 1.3.7
|
64
63
|
signing_key:
|
65
64
|
specification_version: 3
|
66
65
|
summary: An awesome video helper for Ruby and Rails apps
|
data/lib/#videawesome.rb#
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module Videawesome
|
2
|
-
class Convertor
|
3
|
-
|
4
|
-
URL = /http\:\/\/[www.youtube||a-z]+\.[a-z]{2,3}\/[a-zA-Z0-9*\D]{3,15}$/
|
5
|
-
IDENT = /\/[a-zA-Z0-9\D]{3,15}$/
|
6
|
-
|
7
|
-
def self.youtube_video(url, text, height, width)
|
8
|
-
url_ident =url.scan(IDENT).to_s
|
9
|
-
altered_text = text.gsub(url,"<iframe title='YouTube video player' class='youtube-player' type='text/html' width='#{width}' height='#{height}' src='http://www.youtube.com/v#{url_ident}' frameborder='0'></iframe><br /><small> dont have flash player installed? <a href=\"http://www.youtube.com/v#{url_ident}\" target=\"_blank\">click here</a></small>")
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.vimeo_video(url, text, height, width)
|
13
|
-
url_ident = url.scan(IDENT).to_s
|
14
|
-
altered_text = text.gsub(url,"<iframe title='Vimeo Video Player' src='http://player.vimeo.com/video#{url_ident}' width='#{width}' height='#{height}' frameborder='0'></iframe><br /> <small>dont have flash player installed? <a href=\"http://player.vimeo.com/video#{url_ident}\" target=\"_blank\">click here</a></small>")
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.parse_video(text, height, width)
|
18
|
-
url = text.split.grep(URL).to_s
|
19
|
-
|
20
|
-
if url != "" && url.match("youtube.com") || url.match("youtu.be")
|
21
|
-
text = youtube_video(url, text, height, width)
|
22
|
-
elsif url != "" && url.match("vimeo.com")
|
23
|
-
text = vimeo_video(url, text, height, width)
|
24
|
-
end
|
25
|
-
return text
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|