Skip to content

Commit 07267de

Browse files
committed
Patch v3.0.3: Id bugfix, add bare iframe feature
Found significant bug while adding bare iframe feature. Corrected that bug which prevented initialization on element by id. Also added the feature ;)
1 parent 8e968c4 commit 07267de

8 files changed

+95
-22
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
Turn any element into a lightbox or popover link for Youtube and Vimeo videos.
55

6+
### MAJOR BUG IN (3.0 - 3.0.2)
7+
If you are using these versions you will be unable to initialize on elements specified by id rather than a class.
8+
9+
**Corrected in version 3.0.3**, so upgrading is highly recommended.
10+
611
### 3.0 is a significant update (complete re-write).
712
Some things have changed, though the only real non-backward compatible change is a couple updated defaults.
813
Everything else (such as renamed options and updated params) has shims in place to maintain compatibility.
@@ -266,6 +271,12 @@ Some of Youtube's options are not listed below, but everything on their params p
266271
Changes
267272
----
268273
274+
### Patch [3.0.3]
275+
3.0.3:
276+
- [BUG FIX] corrects bug preventing initializing on element by id rather than class
277+
- [FEATURE] by request bare iframe option was added for embedding a webpage in a VL driven iframe
278+
- usage: set vendor + video id to `'f-{url}'`, for example `'f-http://musocrat.github.io/jquery-video-lightning/'`
279+
269280
### General Updates
270281
3.0:
271282
- complete re-write removing the dependency on jQuery while still supporting jQuery initialization

demo/index.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ <h2>
121121
</h2>
122122

123123
<p>
124-
Docs can be found at <a href="https://github.com/musocrat/jquery-video-lightning#readme">the repo</a>.
124+
Docs can be found at <a id="bare-iframe-link">the repo</a>.
125125
</p>
126126
<hr>
127127

@@ -168,6 +168,18 @@ <h2>
168168
xColor: "#7FFF00",
169169
color: "#fff"
170170
}
171+
},
172+
{
173+
"#bare-iframe-link": {
174+
//id: 'f-https://github.com/musocrat/jquery-video-lightning#readme',
175+
id: 'y-z-D1PJ1cMXs',
176+
backdrop_color: "#7FFF00",
177+
backdrop_opacity: 0.7,
178+
glow: 150,
179+
glow_color: "#fff",
180+
xColor: "#7FFF00",
181+
color: "#fff"
182+
}
171183
}
172184
]
173185
});

demo/javascripts/videoLightning.js

Lines changed: 18 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/videoLightning.js

Lines changed: 18 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/videoLightning.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "video-lightning",
33
"title": "Video Lightning",
4-
"version": "3.0.2",
4+
"version": "3.0.3",
55
"description": "Turn any element into a lightbox or popover link for Youtube and Vimeo videos.",
66
"keywords": [
77
"jquery",

src/videoLightning.coffee

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
if _isAry(optEls) then (pushRawEls(e) for e in optEls) else pushRawEls(optEls)
1414
for el in rawEls
1515
if (domEls = _getEl(el.el))
16-
(if _isElAry(domEls) then (els.push(el: de, opts: el.opts) for de in domEls) else els.push(el: domEls, el.opts))
16+
if _isElAry(domEls) then (els.push(el: de, opts: el.opts) for de in domEls)
17+
else els.push(el: domEls, opts: el.opts)
1718
return noElErr() if els.length == 0
1819
settings = obj.settings || {}
1920
(@vlData.instances.push(new VideoLightning(el, settings))) for el in els when el
@@ -42,9 +43,11 @@
4243
@opts.width = if @opts.width then parseInt(@opts.width, 10) else 640
4344
@opts.height = if @opts.height then parseInt(@opts.height, 10) else 390
4445
@opts.id ?= 'y-dQw4w9WgXcQ'
45-
if @opts.id.match(/^v/) then (@vendor = 'vimeo'; @vm = true) else (@vendor = 'youtube'; @yt = true)
46+
if @opts.id.match(/^v/) then (@vendor = 'vimeo'; @vm = true)
47+
else if @opts.id.match(/^f/) then (@vendor = 'iframe'; @ifr = true)
48+
else (@vendor = 'youtube'; @yt = true)
4649
window.vlData[@vendor] = true
47-
@id = @opts.id.replace(/([vy]-)/i, '')
50+
@id = @opts.id.replace(/([vyf]-)/i, '')
4851
(@opts[key[1]] ?= @opts[key[0]]) for key in remap
4952

5053
buildEls: =>
@@ -139,7 +142,15 @@
139142
play: =>
140143
@popoverPos() if _boolify(@opts.popover, false)
141144
@show()
142-
if @ready && !@playing && @iframe.src != 'about:blank'
145+
if @ifr
146+
_setSrc(@iframe,
147+
url: encodeURI(@id)
148+
attrs:
149+
width: @opts.width
150+
height: @opts.height
151+
frameBorder: 0
152+
)
153+
else if @ready && !@playing && @iframe.src != 'about:blank'
143154
@ytPlay() if @yt
144155
@vmPlay() if @vm
145156
else if !@playing

src/videoLightning.js

Lines changed: 17 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)