embeditor-rails 0.1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +16 -2
- data/app/assets/javascripts/embeditor/adapter.js.coffee +2 -1
- data/app/assets/javascripts/embeditor/adapters/brightcove.js.coffee +25 -0
- data/app/assets/javascripts/embeditor/adapters/cover_it_live.js.coffee +5 -5
- data/app/assets/javascripts/embeditor/adapters/instagram.js.coffee +3 -3
- data/app/assets/javascripts/embeditor/adapters/polldaddy.js.coffee +35 -7
- data/app/assets/javascripts/embeditor/adapters/rebel_mouse.js.coffee +22 -1
- data/app/assets/javascripts/embeditor/adapters/static_template.js.coffee +2 -3
- data/app/assets/javascripts/embeditor/embeditor.js.coffee +4 -3
- data/app/assets/javascripts/embeditor/templates/brightcove.jst.eco +11 -0
- data/app/assets/javascripts/embeditor/templates/cover_it_live.jst.eco +3 -3
- data/app/assets/javascripts/embeditor/templates/instagram.jst.eco +1 -1
- data/app/assets/javascripts/embeditor/templates/polldaddy_poll.jst.eco +1 -0
- data/app/assets/javascripts/embeditor/templates/{polldaddy.jst.eco → polldaddy_survey.jst.eco} +1 -1
- data/app/assets/javascripts/embeditor/templates/rebel_mouse.jst.eco +1 -0
- data/lib/embeditor-rails/version.rb +1 -1
- metadata +7 -5
- data/app/assets/javascripts/embeditor/adapters/facebook.js.coffee +0 -18
- data/app/assets/javascripts/embeditor/templates/facebook.jst.eco +0 -2
data/README.md
CHANGED
@@ -59,8 +59,9 @@ There are several adapters included with this engine:
|
|
59
59
|
* **Facebook**
|
60
60
|
* **Twitter**
|
61
61
|
* **Storify**
|
62
|
+
* **Brightcove**
|
62
63
|
* **Document Cloud** - Not yet supported.
|
63
|
-
* **Rebel Mouse**
|
64
|
+
* **Rebel Mouse**
|
64
65
|
|
65
66
|
None of these are included automatically. To install just the ones you need,
|
66
67
|
add them to your `application.js` :
|
@@ -192,7 +193,14 @@ class Embeditor.Adapters.Twitter extends Embeditor.Adapter
|
|
192
193
|
|
193
194
|
### Embedly
|
194
195
|
|
195
|
-
|
196
|
+
If you're using the Embedly adapter, you need two things:
|
197
|
+
|
198
|
+
1. [embedly-jquery](https://github.com/embedly/embedly-jquery). This is a jquery
|
199
|
+
adapter for the embedly API. Really all you need is a jquery plugin which
|
200
|
+
adds the `embedly()` function, but the `embedly-jquery` library does a nice
|
201
|
+
job.
|
202
|
+
2. Embedly requires a key. You can provide it while initializing
|
203
|
+
`Embeditor.Base`:
|
196
204
|
|
197
205
|
```javascript
|
198
206
|
new Embeditor.Base({
|
@@ -229,6 +237,12 @@ You can extend your adapter from:
|
|
229
237
|
stored in the `/templates` directory and rendered with JST.
|
230
238
|
|
231
239
|
|
240
|
+
## Known Issues
|
241
|
+
|
242
|
+
* Cover It Live and Facebook embeds don't currently work together on the same
|
243
|
+
page, due to a javascript conflict between the two.
|
244
|
+
|
245
|
+
|
232
246
|
## Contributing
|
233
247
|
|
234
248
|
If you have an adapter that you think would be useful for many, please open
|
@@ -12,13 +12,14 @@ class Embeditor.Adapter
|
|
12
12
|
@dataOptions = @_extractData()
|
13
13
|
@queryParams = @_buildParams(@dataOptions, options)
|
14
14
|
|
15
|
+
@wrapper = $("<div />", class: @options.wrapperClass)
|
16
|
+
|
15
17
|
|
16
18
|
swap: ->
|
17
19
|
return
|
18
20
|
|
19
21
|
|
20
22
|
embed: (html) ->
|
21
|
-
@wrapper = $("<div />", class: @options.wrapperClass)
|
22
23
|
@wrapper.html(html)
|
23
24
|
@element.after @wrapper
|
24
25
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class Embeditor.Adapters.Brightcove extends Embeditor.Adapters.StaticTemplate
|
2
|
+
className: "Brightcove"
|
3
|
+
|
4
|
+
@Template = Embeditor.Template('brightcove')
|
5
|
+
|
6
|
+
@QueryDefaults =
|
7
|
+
maxwidth : 620
|
8
|
+
maxheight : 550
|
9
|
+
|
10
|
+
@Matchers = [
|
11
|
+
new RegExp /bcpid(\d+)\?bckey=([^&]+)/i
|
12
|
+
]
|
13
|
+
|
14
|
+
swap: ->
|
15
|
+
match = @_parseUrl()
|
16
|
+
return false if not match
|
17
|
+
|
18
|
+
playerId = match[1]
|
19
|
+
playerKey = match[2]
|
20
|
+
|
21
|
+
@embed Brightcove.Template
|
22
|
+
maxheight : @queryParams.maxheight
|
23
|
+
maxwidth : @queryParams.maxwidth
|
24
|
+
playerId : playerId
|
25
|
+
playerKey : playerKey
|
@@ -8,7 +8,7 @@ class Embeditor.Adapters.CoverItLive extends Embeditor.Adapters.StaticTemplate
|
|
8
8
|
maxheight : 550
|
9
9
|
|
10
10
|
@Matchers = [
|
11
|
-
new RegExp
|
11
|
+
new RegExp /\/altcast_code=([^\/]+)\//i
|
12
12
|
]
|
13
13
|
|
14
14
|
swap: ->
|
@@ -17,9 +17,9 @@ class Embeditor.Adapters.CoverItLive extends Embeditor.Adapters.StaticTemplate
|
|
17
17
|
match = @_parseUrl()
|
18
18
|
return false if not match
|
19
19
|
|
20
|
-
|
20
|
+
eventId = match[1]
|
21
21
|
|
22
22
|
@embed CoverItLive.Template
|
23
|
-
maxheight : @queryParams.maxheight
|
24
|
-
maxwidth : @queryParams.maxwidth
|
25
|
-
|
23
|
+
maxheight : @queryParams.maxheight
|
24
|
+
maxwidth : @queryParams.maxwidth
|
25
|
+
eventId : eventId
|
@@ -12,7 +12,7 @@ class Embeditor.Adapters.Instagram extends Embeditor.Adapters.StaticTemplate
|
|
12
12
|
|
13
13
|
@Matchers = [
|
14
14
|
# http://instagram.com/p/e8hJe6CvTW/
|
15
|
-
new RegExp
|
15
|
+
new RegExp /instagram\.com\/p\/([^\/]+)/i
|
16
16
|
]
|
17
17
|
|
18
18
|
|
@@ -20,9 +20,9 @@ class Embeditor.Adapters.Instagram extends Embeditor.Adapters.StaticTemplate
|
|
20
20
|
match = @_parseUrl()
|
21
21
|
return false if not match
|
22
22
|
|
23
|
-
|
23
|
+
photoId = match[1]
|
24
24
|
|
25
25
|
@embed Instagram.Template
|
26
26
|
maxheight : @queryParams.maxheight
|
27
27
|
maxwidth : @queryParams.maxwidth
|
28
|
-
|
28
|
+
photoId : photoId
|
@@ -1,17 +1,45 @@
|
|
1
|
-
class Embeditor.Adapters.Polldaddy extends Embeditor.Adapters.
|
1
|
+
class Embeditor.Adapters.Polldaddy extends Embeditor.Adapters.StaticTemplate
|
2
2
|
className: "Polldaddy"
|
3
3
|
|
4
|
-
|
4
|
+
# We have to figure out the template dynamically.
|
5
|
+
@Template = null
|
5
6
|
|
6
7
|
@QueryDefaults =
|
7
8
|
maxwidth : 620
|
8
9
|
maxheight : 550
|
9
10
|
format : 'json'
|
10
11
|
|
12
|
+
@Matchers = [
|
13
|
+
new RegExp /https?:\/\/([^\/]+)\/([^\/]+)\/([^\/]+)\/?/i
|
14
|
+
]
|
11
15
|
|
12
|
-
constructor: (@element, @options={}) ->
|
13
|
-
super
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
swap: ->
|
18
|
+
match = @_parseUrl()
|
19
|
+
return false if not match
|
20
|
+
|
21
|
+
domain = match[1]
|
22
|
+
type = match[2]
|
23
|
+
id = match[3]
|
24
|
+
|
25
|
+
template = @_findTemplate(type)
|
26
|
+
|
27
|
+
oldDocumentWrite = document.write
|
28
|
+
document.write = (html) => @wrapper.append(html)
|
29
|
+
|
30
|
+
@embed template
|
31
|
+
maxheight : @queryParams.maxheight
|
32
|
+
maxwidth : @queryParams.maxwidth
|
33
|
+
domain : domain
|
34
|
+
id : id
|
35
|
+
|
36
|
+
setTimeout ->
|
37
|
+
document.write = oldDocumentWrite
|
38
|
+
, 500
|
39
|
+
|
40
|
+
_findTemplate: (type) ->
|
41
|
+
template = switch type
|
42
|
+
when 's' then 'polldaddy_survey'
|
43
|
+
when 'poll', 'p' then 'polldaddy_poll'
|
44
|
+
|
45
|
+
Embeditor.Template(template)
|
@@ -1,2 +1,23 @@
|
|
1
|
-
class Embeditor.Adapters.RebelMouse extends Embeditor.
|
1
|
+
class Embeditor.Adapters.RebelMouse extends Embeditor.Adapters.StaticTemplate
|
2
2
|
className: "RebelMouse"
|
3
|
+
|
4
|
+
@Template = Embeditor.Template('rebel_mouse')
|
5
|
+
|
6
|
+
@QueryDefaults =
|
7
|
+
maxwidth : 620
|
8
|
+
maxheight : 1000
|
9
|
+
|
10
|
+
@Matchers = [
|
11
|
+
new RegExp /rebelmouse\.com\/(.+?)\/?$/i
|
12
|
+
]
|
13
|
+
|
14
|
+
swap: ->
|
15
|
+
match = @_parseUrl()
|
16
|
+
return false if not match
|
17
|
+
|
18
|
+
site = encodeURIComponent(match[1])
|
19
|
+
|
20
|
+
@embed RebelMouse.Template
|
21
|
+
maxheight : @queryParams.maxheight
|
22
|
+
maxwidth : @queryParams.maxwidth
|
23
|
+
site : site
|
@@ -3,10 +3,9 @@
|
|
3
3
|
# call to an oEmbed endpoint, or if there simply isn't another way to
|
4
4
|
# programatically retrieve the embed code.
|
5
5
|
#
|
6
|
-
# Your StaticTemplate adapter MUST define:
|
7
|
-
# * @Tempalte - The name of the template to use (in the templates directory)
|
8
|
-
#
|
9
6
|
# Your StaticTemplate adapter SHOULD define:
|
7
|
+
# * @Template - The name of the template to use (in the templates
|
8
|
+
# directory)
|
10
9
|
# * @QueryDefaults - The default query paramters if no others are passed in.
|
11
10
|
#
|
12
11
|
# Your StaticTemplate adapter MAY define:
|
@@ -4,17 +4,18 @@ window.Embeditor = {
|
|
4
4
|
DefaultAdapters :
|
5
5
|
'youtube' : 'Embedly'
|
6
6
|
'vimeo' : 'Embedly'
|
7
|
-
|
7
|
+
'brightcove' : 'Brightcove'
|
8
8
|
'ustream' : 'Embedly'
|
9
|
+
'livestream' : 'Embedly'
|
9
10
|
'vine' : 'Embedly'
|
10
11
|
'googlemaps' : 'Embedly'
|
11
12
|
'scribd' : 'Embedly'
|
12
13
|
# 'documentcloud' : 'DocumentCloud'
|
13
14
|
'polldaddy' : 'Polldaddy'
|
14
|
-
'facebook' : '
|
15
|
+
'facebook' : 'Embedly'
|
15
16
|
'storify' : 'Storify'
|
16
17
|
'coveritlive' : 'CoverItLive'
|
17
|
-
|
18
|
+
'rebelmouse' : 'RebelMouse'
|
18
19
|
'firetracker' : 'FireTracker'
|
19
20
|
'twitter' : 'Twitter'
|
20
21
|
'instagram' : 'Instagram'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<object id="flashObj" width="330" height="320" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0">
|
2
|
+
<param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9?isVid=1&isUI=1" />
|
3
|
+
<param name="bgcolor" value="#FFFFFF" />
|
4
|
+
<param name="flashVars" value="playerID=<%=@playerId%>&playerKey=<%=@playerKey%>&domain=embed&dynamicStreaming=true" />
|
5
|
+
<param name="base" value="http://admin.brightcove.com" />
|
6
|
+
<param name="seamlesstabbing" value="false" />
|
7
|
+
<param name="allowFullScreen" value="true" />
|
8
|
+
<param name="swLiveConnect" value="true" />
|
9
|
+
<param name="allowScriptAccess" value="always" />
|
10
|
+
<embed src="http://c.brightcove.com/services/viewer/federated_f9?isVid=1&isUI=1" bgcolor="#FFFFFF" flashVars="playerID=<%=@playerId%>&playerKey=<%=@playerKey%>&domain=embed&dynamicStreaming=true" base="http://admin.brightcove.com" name="flashObj" width="330" height="320" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always" swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>
|
11
|
+
</object>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id='cil-root-<%=@
|
2
|
-
<span class='cil-config-data' title='{"altcastCode":"<%=@
|
1
|
+
<div id='cil-root-<%=@eventId%>' class='cil-root'>
|
2
|
+
<span class='cil-config-data' title='{"altcastCode":"<%=@eventId%>","server":"www.coveritlive.com","geometry":{"width":<%=@maxwidth%>,"height":<%=@maxheight%>},"configuration":{"newEntryLocation":"bottom","pinsGrowSize":"on","titlePage":"on","skinOverride":"2"}}'> </span>
|
3
3
|
</div>
|
4
|
-
<script type='text/javascript'>window.cilAsyncInit = function() {cilEmbedManager.init()};(function() {var e = document.createElement('script');e.async = true;var domain = (document.location.protocol == 'http:') ? '//cdnsl.coveritlive.com' : '//cdnslssl.coveritlive.com';e.src = document.location.protocol + domain + '/vw.js?v=' + Math.floor(Math.random()*10000000);e.id = 'cilScript-<%=@
|
4
|
+
<script type='text/javascript'>window.cilAsyncInit = function() {cilEmbedManager.init()};(function() {var e = document.createElement('script');e.async = true;var domain = (document.location.protocol == 'http:') ? '//cdnsl.coveritlive.com' : '//cdnslssl.coveritlive.com';e.src = document.location.protocol + domain + '/vw.js?v=' + Math.floor(Math.random()*10000000);e.id = 'cilScript-<%=@eventId%>';document.getElementById('cil-root-<%=@eventId%>').appendChild(e);}());</script>
|
@@ -1 +1 @@
|
|
1
|
-
<iframe src="//instagram.com/p/<%=@
|
1
|
+
<iframe src="//instagram.com/p/<%=@photoId%>/embed/" width="<%=@maxwidth%>" height="<%=@maxheight%>" frameborder="0" scrolling="no" allowtransparency="true"></iframe>
|
@@ -0,0 +1 @@
|
|
1
|
+
<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/<%=@id%>.js"></script><noscript><a href="http://polldaddy.com/poll/<%=@id%>/">View Poll</a></noscript>
|
data/app/assets/javascripts/embeditor/templates/{polldaddy.jst.eco → polldaddy_survey.jst.eco}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="pd-embed" data-settings="{"type":"iframe","auto":true,"domain":"<%=@domain%>\/s\/","id":"<%=@
|
1
|
+
<div class="pd-embed" data-settings="{"type":"iframe","auto":true,"domain":"<%=@domain%>\/s\/","id":"<%=@id%>"}"></div>
|
2
2
|
<script type="text/javascript">
|
3
3
|
(function(d,c,j){if(!document.getElementById(j)){var pd=d.createElement(c),s;pd.id=j;pd.src=('https:'==document.location.protocol)?'https://polldaddy.com/survey.js':'http://i0.poll.fm/survey.js';s=document.getElementsByTagName(c)[0];s.parentNode.insertBefore(pd,s);}}(document,'script','pd-embed'));
|
4
4
|
</script>
|
@@ -0,0 +1 @@
|
|
1
|
+
<script type="text/javascript" class="rebelmouse-embed-script" src="https://www.rebelmouse.com/static/js-build/embed/embed.js?site=<%=@site%>&height=<%=@maxheight%>&flexible=0&scrollbar_theme=dark"></script>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embeditor-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -69,10 +69,10 @@ extensions: []
|
|
69
69
|
extra_rdoc_files: []
|
70
70
|
files:
|
71
71
|
- app/assets/javascripts/embeditor/adapter.js.coffee
|
72
|
+
- app/assets/javascripts/embeditor/adapters/brightcove.js.coffee
|
72
73
|
- app/assets/javascripts/embeditor/adapters/cover_it_live.js.coffee
|
73
74
|
- app/assets/javascripts/embeditor/adapters/document_cloud.js.coffee
|
74
75
|
- app/assets/javascripts/embeditor/adapters/embedly.js.coffee
|
75
|
-
- app/assets/javascripts/embeditor/adapters/facebook.js.coffee
|
76
76
|
- app/assets/javascripts/embeditor/adapters/fire_tracker.js.coffee
|
77
77
|
- app/assets/javascripts/embeditor/adapters/instagram.js.coffee
|
78
78
|
- app/assets/javascripts/embeditor/adapters/oembed.js.coffee
|
@@ -83,10 +83,12 @@ files:
|
|
83
83
|
- app/assets/javascripts/embeditor/adapters/twitter.js.coffee
|
84
84
|
- app/assets/javascripts/embeditor/adapters.js
|
85
85
|
- app/assets/javascripts/embeditor/embeditor.js.coffee
|
86
|
+
- app/assets/javascripts/embeditor/templates/brightcove.jst.eco
|
86
87
|
- app/assets/javascripts/embeditor/templates/cover_it_live.jst.eco
|
87
|
-
- app/assets/javascripts/embeditor/templates/facebook.jst.eco
|
88
88
|
- app/assets/javascripts/embeditor/templates/instagram.jst.eco
|
89
|
-
- app/assets/javascripts/embeditor/templates/
|
89
|
+
- app/assets/javascripts/embeditor/templates/polldaddy_poll.jst.eco
|
90
|
+
- app/assets/javascripts/embeditor/templates/polldaddy_survey.jst.eco
|
91
|
+
- app/assets/javascripts/embeditor/templates/rebel_mouse.jst.eco
|
90
92
|
- app/assets/javascripts/embeditor/templates/storify.jst.eco
|
91
93
|
- app/assets/javascripts/embeditor/templates/twitter.jst.eco
|
92
94
|
- app/assets/javascripts/embeditor/templates.js
|
@@ -1,18 +0,0 @@
|
|
1
|
-
class Embeditor.Adapters.Facebook extends Embeditor.Adapters.StaticTemplate
|
2
|
-
className: "Facebook"
|
3
|
-
|
4
|
-
@Template = Embeditor.Template('facebook')
|
5
|
-
|
6
|
-
@QueryDefaults =
|
7
|
-
maxwidth : 550
|
8
|
-
maxheight : 600
|
9
|
-
|
10
|
-
# For facebook, we just use the full URL, so no matchers are needed.
|
11
|
-
@Matchers = []
|
12
|
-
|
13
|
-
|
14
|
-
swap: ->
|
15
|
-
@embed Facebook.Template
|
16
|
-
maxheight : @queryParams.maxheight,
|
17
|
-
maxwidth : @queryParams.maxwidth,
|
18
|
-
url : @href
|
@@ -1,2 +0,0 @@
|
|
1
|
-
<div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
|
2
|
-
<div class="fb-post" data-href="<%=@url%>" data-width="<%=@maxwidth%>"></div>
|