zemus 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +0 -10
- data/lib/generators/zemus/install_generator.rb +0 -5
- data/lib/zemus/parser.rb +1 -8
- data/lib/zemus/version.rb +1 -1
- data/spec/zemus_spec.rb +0 -20
- metadata +16 -34
- data/app/assets/javascripts/zemus.js +0 -30
- data/app/assets/stylesheets/zemus.css +0 -7
- data/lib/generators/zemus/templates/zemus.css +0 -7
- data/lib/generators/zemus/templates/zemus.js +0 -30
- data/lib/zemus/twitch.rb +0 -31
- data/spec/zemus/twitch_spec.rb +0 -20
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a97775bb39a50d8ecec9a0ef2dbd2779e23e9aaf
|
4
|
+
data.tar.gz: b8a1aa0f4f158d878d2c21ef56270fca220bb283
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5cc379a42405710134b988d691b4a4a7f66eb905bb3bd2a9db696ed80ad999bb9af0cfaa1595656545b691b7ef96c500b8c595375e936133b6f859eecd642fed
|
7
|
+
data.tar.gz: c0a9969ee5971a1287be4cbad5639b0b4c68b806d43fee74bb1de8d08115c914923a3e435536f0824f7d01180e74bb57e5957c1f44a86789b1576c3aae3ef503
|
data/README.md
CHANGED
@@ -12,12 +12,6 @@ Zemus translates the following URLs to embedabble HTML in standard HTML5 mode:
|
|
12
12
|
* kickstarter
|
13
13
|
* soundcloud
|
14
14
|
|
15
|
-
For embeddable elements that require flash, we have implemented a "dirty mode" that will allow these objects to be displayed in browsers that support it.
|
16
|
-
|
17
|
-
Zemus translates the following URLs to embeddable Flash HTML in dirty mode:
|
18
|
-
|
19
|
-
* twitch
|
20
|
-
|
21
15
|
## Installation
|
22
16
|
|
23
17
|
Add this line to your application's Gemfile:
|
@@ -27,10 +21,6 @@ Add this line to your application's Gemfile:
|
|
27
21
|
And then execute:
|
28
22
|
|
29
23
|
bundle
|
30
|
-
|
31
|
-
To enable dirty mode, enter the following command:
|
32
|
-
|
33
|
-
rails g zemus:install
|
34
24
|
|
35
25
|
This will install the necessary javascript and css files to your project's app/assets directory.
|
36
26
|
|
@@ -3,11 +3,6 @@ module Zemus
|
|
3
3
|
class InstallGenerator < Rails::Generators::Base
|
4
4
|
source_root File.expand_path("../templates", __FILE__)
|
5
5
|
def install_assets
|
6
|
-
zemus_js_dir = 'app/assets/javascripts/zemus.js'
|
7
|
-
copy_file "zemus.js", zemus_js_dir
|
8
|
-
|
9
|
-
zemus_css_dir = 'app/assets/stylesheets/zemus.css'
|
10
|
-
copy_file "zemus.css", zemus_css_dir
|
11
6
|
end
|
12
7
|
end
|
13
8
|
end
|
data/lib/zemus/parser.rb
CHANGED
@@ -2,14 +2,7 @@ module Zemus
|
|
2
2
|
class Parser
|
3
3
|
|
4
4
|
def self.url_classes
|
5
|
-
|
6
|
-
if File.exist?(zemus_js_dir)
|
7
|
-
[Image, Kickstarter, Sound, Soundcloud, Vimeo,
|
8
|
-
Vine, Youtube, Twitch]
|
9
|
-
else
|
10
|
-
[Image, Kickstarter, Sound, Soundcloud, Vimeo,
|
11
|
-
Vine, Youtube]
|
12
|
-
end
|
5
|
+
[Image, Kickstarter, Sound, Soundcloud, Vimeo, Vine, Youtube]
|
13
6
|
end
|
14
7
|
|
15
8
|
def self.build_embedder(url)
|
data/lib/zemus/version.rb
CHANGED
data/spec/zemus_spec.rb
CHANGED
@@ -58,26 +58,6 @@ describe Zemus do
|
|
58
58
|
Zemus.embed(url).should eq("<iframe class='vine-embed' src='https://vine.co/v/bFPjjheVnau/embed/simple' width='100%' height='600px' frameborder='0'></iframe><script async src='//platform.vine.co/static/scripts/embed.js' charset='utf-8'></script>")
|
59
59
|
end
|
60
60
|
|
61
|
-
it "acceptance test for twitch stream" do
|
62
|
-
url = "http://www.twitch.tv/awesomeguy"
|
63
|
-
|
64
|
-
Zemus.embed(url).should eq("<div class='zemusflashembed'><object type='application/x-shockwave-flash' height='378' id='live_embed_player_flash' data='http://www.twitch.tv/widgets/live_embed_player.swf?channel=awesomeguy'><param name='allowFullScreen' value='true' /><param name='allowScriptAccess' value='always' /><param name='allowNetworking' value='all' /><param name='movie' value='http://www.twitch.tv/widgets/live_embed_player.swf' /><param name='flashvars' value='hostname=www.twitch.tv&channel=awesomeguy&auto_play=true&start_volume=25' /></object></div><div class='zemusnoflash'><a href='http://www.twitch.tv/awesomeguy'>Your browser cannot display this embedded Twitch stream</a></div>")
|
65
|
-
end
|
66
|
-
|
67
|
-
it "acceptance test for twitch /b/" do
|
68
|
-
url = "http://www.twitch.tv/awesomeguy/b/123456789"
|
69
|
-
|
70
|
-
Zemus.embed(url).should eq("<div class='zemusflashembed'><object data='http://www.twitch.tv/widgets/archive_embed_player.swf' height='378' id='clip_embed_player_flash' type='application/x-shockwave-flash' ><param name='movie' value='http://www.twitch.tv/widgets/archive_embed_player.swf'><param name='allowScriptAccess' value='always'><param name='allowNetworking' value='all'><param name='allowFullScreen' value='true'><param name='flashvars' value='channel=awesomeguy&auto_play=false&start_volume=25&archive_id=123456789'></object></div>
|
71
|
-
<div class='zemusnoflash'><a href='http://www.twitch.tv/awesomeguy/b/123456789'>Your browser cannot display this embedded Twitch video</a></div>")
|
72
|
-
end
|
73
|
-
|
74
|
-
it "acceptance test for twitch /c/" do
|
75
|
-
url = "http://www.twitch.tv/awesomeguy/c/123456789"
|
76
|
-
|
77
|
-
Zemus.embed(url).should eq("<div class='zemusflashembed'><object data='http://www.twitch.tv/widgets/archive_embed_player.swf' height='378' id='clip_embed_player_flash' type='application/x-shockwave-flash' ><param name='movie' value='http://www.twitch.tv/widgets/archive_embed_player.swf'><param name='allowScriptAccess' value='always'><param name='allowNetworking' value='all'><param name='allowFullScreen' value='true'><param name='flashvars' value='channel=awesomeguy&auto_play=false&start_volume=25&chapter_id=123456789'></object></div>
|
78
|
-
<div class='zemusnoflash'><a href='http://www.twitch.tv/awesomeguy/c/123456789'>Your browser cannot display this embedded Twitch video</a></div>")
|
79
|
-
end
|
80
|
-
|
81
61
|
it "acceptance test for the generic fallback" do
|
82
62
|
url = "http://google.com/asdfhjklkjsdf/43123123/32124lkjklj123123/foo.html"
|
83
63
|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zemus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.10
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jon Dodson
|
@@ -10,70 +9,62 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2016-03-18 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: railties
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - ">="
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '0'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - ">="
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '0'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: bundler
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- - ~>
|
32
|
+
- - "~>"
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '1.3'
|
39
35
|
type: :development
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- - ~>
|
39
|
+
- - "~>"
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '1.3'
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: rake
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
|
-
- -
|
46
|
+
- - ">="
|
53
47
|
- !ruby/object:Gem::Version
|
54
48
|
version: '0'
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
|
-
- -
|
53
|
+
- - ">="
|
61
54
|
- !ruby/object:Gem::Version
|
62
55
|
version: '0'
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
57
|
name: rspec
|
65
58
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
59
|
requirements:
|
68
|
-
- -
|
60
|
+
- - ">="
|
69
61
|
- !ruby/object:Gem::Version
|
70
62
|
version: '0'
|
71
63
|
type: :development
|
72
64
|
prerelease: false
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
|
-
- -
|
67
|
+
- - ">="
|
77
68
|
- !ruby/object:Gem::Version
|
78
69
|
version: '0'
|
79
70
|
description: Embeds various media URLs as viewable content
|
@@ -84,16 +75,12 @@ executables: []
|
|
84
75
|
extensions: []
|
85
76
|
extra_rdoc_files: []
|
86
77
|
files:
|
87
|
-
- .gitignore
|
78
|
+
- ".gitignore"
|
88
79
|
- Gemfile
|
89
80
|
- LICENSE.txt
|
90
81
|
- README.md
|
91
82
|
- Rakefile
|
92
|
-
- app/assets/javascripts/zemus.js
|
93
|
-
- app/assets/stylesheets/zemus.css
|
94
83
|
- lib/generators/zemus/install_generator.rb
|
95
|
-
- lib/generators/zemus/templates/zemus.css
|
96
|
-
- lib/generators/zemus/templates/zemus.js
|
97
84
|
- lib/zemus.rb
|
98
85
|
- lib/zemus/generic.rb
|
99
86
|
- lib/zemus/image.rb
|
@@ -101,7 +88,6 @@ files:
|
|
101
88
|
- lib/zemus/parser.rb
|
102
89
|
- lib/zemus/sound.rb
|
103
90
|
- lib/zemus/soundcloud.rb
|
104
|
-
- lib/zemus/twitch.rb
|
105
91
|
- lib/zemus/version.rb
|
106
92
|
- lib/zemus/vimeo.rb
|
107
93
|
- lib/zemus/vine.rb
|
@@ -111,7 +97,6 @@ files:
|
|
111
97
|
- spec/zemus/kickstarter_spec.rb
|
112
98
|
- spec/zemus/sound_spec.rb
|
113
99
|
- spec/zemus/soundcloud_spec.rb
|
114
|
-
- spec/zemus/twitch_spec.rb
|
115
100
|
- spec/zemus/version_spec.rb
|
116
101
|
- spec/zemus/vimeo_spec.rb
|
117
102
|
- spec/zemus/vine_spec.rb
|
@@ -121,27 +106,26 @@ files:
|
|
121
106
|
homepage: https://github.com/jdodson/zemus
|
122
107
|
licenses:
|
123
108
|
- MIT
|
109
|
+
metadata: {}
|
124
110
|
post_install_message:
|
125
111
|
rdoc_options: []
|
126
112
|
require_paths:
|
127
113
|
- lib
|
128
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
115
|
requirements:
|
131
|
-
- -
|
116
|
+
- - ">="
|
132
117
|
- !ruby/object:Gem::Version
|
133
118
|
version: '0'
|
134
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
-
none: false
|
136
120
|
requirements:
|
137
|
-
- -
|
121
|
+
- - ">="
|
138
122
|
- !ruby/object:Gem::Version
|
139
123
|
version: '0'
|
140
124
|
requirements: []
|
141
125
|
rubyforge_project:
|
142
|
-
rubygems_version:
|
126
|
+
rubygems_version: 2.4.5
|
143
127
|
signing_key:
|
144
|
-
specification_version:
|
128
|
+
specification_version: 4
|
145
129
|
summary: Parses and embeds various media URLs as viewable content
|
146
130
|
test_files:
|
147
131
|
- spec/spec_helper.rb
|
@@ -149,10 +133,8 @@ test_files:
|
|
149
133
|
- spec/zemus/kickstarter_spec.rb
|
150
134
|
- spec/zemus/sound_spec.rb
|
151
135
|
- spec/zemus/soundcloud_spec.rb
|
152
|
-
- spec/zemus/twitch_spec.rb
|
153
136
|
- spec/zemus/version_spec.rb
|
154
137
|
- spec/zemus/vimeo_spec.rb
|
155
138
|
- spec/zemus/vine_spec.rb
|
156
139
|
- spec/zemus/youtube_spec.rb
|
157
140
|
- spec/zemus_spec.rb
|
158
|
-
has_rdoc:
|
@@ -1,30 +0,0 @@
|
|
1
|
-
// Detect whether displaying *.swf is possible
|
2
|
-
// https://stackoverflow.com/questions/998245
|
3
|
-
|
4
|
-
var hasFlash = false;
|
5
|
-
try {
|
6
|
-
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
|
7
|
-
if (fo) {
|
8
|
-
hasFlash = true;
|
9
|
-
}
|
10
|
-
} catch (e) {
|
11
|
-
if (navigator.mimeTypes
|
12
|
-
&& navigator.mimeTypes['application/x-shockwave-flash'] != undefined
|
13
|
-
&& navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin) {
|
14
|
-
hasFlash = true;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
|
19
|
-
// Show the proper div
|
20
|
-
|
21
|
-
$(document).ready(function(){
|
22
|
-
|
23
|
-
if (hasFlash == true) {
|
24
|
-
$('.zemusflashembed').show();
|
25
|
-
}
|
26
|
-
else {
|
27
|
-
$('.zemusnoflash').show();
|
28
|
-
}
|
29
|
-
|
30
|
-
});
|
@@ -1,30 +0,0 @@
|
|
1
|
-
// Detect whether displaying *.swf is possible
|
2
|
-
// https://stackoverflow.com/questions/998245
|
3
|
-
|
4
|
-
var hasFlash = false;
|
5
|
-
try {
|
6
|
-
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
|
7
|
-
if (fo) {
|
8
|
-
hasFlash = true;
|
9
|
-
}
|
10
|
-
} catch (e) {
|
11
|
-
if (navigator.mimeTypes
|
12
|
-
&& navigator.mimeTypes['application/x-shockwave-flash'] != undefined
|
13
|
-
&& navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin) {
|
14
|
-
hasFlash = true;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
|
19
|
-
// Show the proper div
|
20
|
-
|
21
|
-
$(document).ready(function(){
|
22
|
-
|
23
|
-
if (hasFlash == true) {
|
24
|
-
$('.zemusflashembed').show();
|
25
|
-
}
|
26
|
-
else {
|
27
|
-
$('.zemusnoflash').show();
|
28
|
-
}
|
29
|
-
|
30
|
-
});
|
data/lib/zemus/twitch.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
module Zemus
|
2
|
-
class Twitch
|
3
|
-
|
4
|
-
def self.valid?(url)
|
5
|
-
url =~ /www.twitch.tv/
|
6
|
-
end
|
7
|
-
|
8
|
-
def initialize(url)
|
9
|
-
@url = url
|
10
|
-
end
|
11
|
-
|
12
|
-
def to_embed
|
13
|
-
id = @url.split('/').last
|
14
|
-
if @url.split('/')[4] == "b"
|
15
|
-
chan = @url.split('/')[3]
|
16
|
-
"<div class='zemusflashembed'><object data='http://www.twitch.tv/widgets/archive_embed_player.swf' height='378' id='clip_embed_player_flash' type='application/x-shockwave-flash' ><param name='movie' value='http://www.twitch.tv/widgets/archive_embed_player.swf'><param name='allowScriptAccess' value='always'><param name='allowNetworking' value='all'><param name='allowFullScreen' value='true'><param name='flashvars' value='channel=#{chan}&auto_play=false&start_volume=25&archive_id=#{id}'></object></div>
|
17
|
-
<div class='zemusnoflash'><a href='#{@url}'>Your browser cannot display this embedded Twitch video</a></div>"
|
18
|
-
|
19
|
-
elsif @url.split('/')[4] == "c"
|
20
|
-
chan = @url.split('/')[3]
|
21
|
-
"<div class='zemusflashembed'><object data='http://www.twitch.tv/widgets/archive_embed_player.swf' height='378' id='clip_embed_player_flash' type='application/x-shockwave-flash' ><param name='movie' value='http://www.twitch.tv/widgets/archive_embed_player.swf'><param name='allowScriptAccess' value='always'><param name='allowNetworking' value='all'><param name='allowFullScreen' value='true'><param name='flashvars' value='channel=#{chan}&auto_play=false&start_volume=25&chapter_id=#{id}'></object></div>
|
22
|
-
<div class='zemusnoflash'><a href='#{@url}'>Your browser cannot display this embedded Twitch video</a></div>"
|
23
|
-
else
|
24
|
-
chan = @url.split('/')[3]
|
25
|
-
"<div class='zemusflashembed'><object type='application/x-shockwave-flash' height='378' id='live_embed_player_flash' data='http://www.twitch.tv/widgets/live_embed_player.swf?channel=#{chan}'><param name='allowFullScreen' value='true' /><param name='allowScriptAccess' value='always' /><param name='allowNetworking' value='all' /><param name='movie' value='http://www.twitch.tv/widgets/live_embed_player.swf' /><param name='flashvars' value='hostname=www.twitch.tv&channel=#{chan}&auto_play=true&start_volume=25' /></object></div><div class='zemusnoflash'><a href='#{@url}'>Your browser cannot display this embedded Twitch stream</a></div>"
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
data/spec/zemus/twitch_spec.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require_relative('../spec_helper')
|
2
|
-
|
3
|
-
describe Zemus::Twitch do
|
4
|
-
it "embeds twitch stream" do
|
5
|
-
Zemus::Twitch.new("http://www.twitch.tv/awesomeguy").to_embed.
|
6
|
-
should eq("<div class='zemusflashembed'><object type='application/x-shockwave-flash' height='378' id='live_embed_player_flash' data='http://www.twitch.tv/widgets/live_embed_player.swf?channel=awesomeguy'><param name='allowFullScreen' value='true' /><param name='allowScriptAccess' value='always' /><param name='allowNetworking' value='all' /><param name='movie' value='http://www.twitch.tv/widgets/live_embed_player.swf' /><param name='flashvars' value='hostname=www.twitch.tv&channel=awesomeguy&auto_play=true&start_volume=25' /></object></div><div class='zemusnoflash'><a href='http://www.twitch.tv/awesomeguy'>Your browser cannot display this embedded Twitch stream</a></div>")
|
7
|
-
end
|
8
|
-
|
9
|
-
it "embeds twitch /b/" do
|
10
|
-
Zemus::Twitch.new("http://www.twitch.tv/awesomeguy/b/123456789").to_embed.
|
11
|
-
should eq("<div class='zemusflashembed'><object data='http://www.twitch.tv/widgets/archive_embed_player.swf' height='378' id='clip_embed_player_flash' type='application/x-shockwave-flash' ><param name='movie' value='http://www.twitch.tv/widgets/archive_embed_player.swf'><param name='allowScriptAccess' value='always'><param name='allowNetworking' value='all'><param name='allowFullScreen' value='true'><param name='flashvars' value='channel=awesomeguy&auto_play=false&start_volume=25&archive_id=123456789'></object></div>
|
12
|
-
<div class='zemusnoflash'><a href='http://www.twitch.tv/awesomeguy/b/123456789'>Your browser cannot display this embedded Twitch video</a></div>")
|
13
|
-
end
|
14
|
-
|
15
|
-
it "embeds twitch /c/" do
|
16
|
-
Zemus::Twitch.new("http://www.twitch.tv/awesomeguy/c/123456789").to_embed.
|
17
|
-
should eq("<div class='zemusflashembed'><object data='http://www.twitch.tv/widgets/archive_embed_player.swf' height='378' id='clip_embed_player_flash' type='application/x-shockwave-flash' ><param name='movie' value='http://www.twitch.tv/widgets/archive_embed_player.swf'><param name='allowScriptAccess' value='always'><param name='allowNetworking' value='all'><param name='allowFullScreen' value='true'><param name='flashvars' value='channel=awesomeguy&auto_play=false&start_volume=25&chapter_id=123456789'></object></div>
|
18
|
-
<div class='zemusnoflash'><a href='http://www.twitch.tv/awesomeguy/c/123456789'>Your browser cannot display this embedded Twitch video</a></div>")
|
19
|
-
end
|
20
|
-
end
|