blueimp-gallery 2.11.0.0 → 2.11.0.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10dc91eb860532983fb100083a720de840e45389
|
4
|
+
data.tar.gz: 8608b73ef2004ccb28171769e14616e891526469
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e24e3c0cfedfaf373e79a4e6765601e339cd85d1b428da8a24ae19447fc81c51cea85113d017144740ae38b55b6f5f5ae93f75f60dc34680f5758f5e869ec97e
|
7
|
+
data.tar.gz: eefa9cf934a6194bfbb21dfd8d8a6b3d460529109a6a261bea96b07913a1291a8f12183e29658b65048a910cb78124a56b0ac13e81da605ba3d5d9a61ec990e8
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,212 @@
|
|
1
|
+
/*
|
2
|
+
* blueimp Gallery Vimeo Video Factory JS 1.1.0
|
3
|
+
* https://github.com/blueimp/Gallery
|
4
|
+
*
|
5
|
+
* Copyright 2013, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*/
|
11
|
+
|
12
|
+
/*jslint regexp: true */
|
13
|
+
/*global define, window, document, location, $f */
|
14
|
+
|
15
|
+
(function (factory) {
|
16
|
+
'use strict';
|
17
|
+
if (typeof define === 'function' && define.amd) {
|
18
|
+
// Register as an anonymous AMD module:
|
19
|
+
define([
|
20
|
+
'./blueimp-helper',
|
21
|
+
'./blueimp-gallery-video'
|
22
|
+
], factory);
|
23
|
+
} else {
|
24
|
+
// Browser globals:
|
25
|
+
factory(
|
26
|
+
window.blueimp.helper || window.jQuery,
|
27
|
+
window.blueimp.Gallery
|
28
|
+
);
|
29
|
+
}
|
30
|
+
}(function ($, Gallery) {
|
31
|
+
'use strict';
|
32
|
+
|
33
|
+
if (!window.postMessage) {
|
34
|
+
return Gallery;
|
35
|
+
}
|
36
|
+
|
37
|
+
$.extend(Gallery.prototype.options, {
|
38
|
+
// The list object property (or data attribute) with the Vimeo video id:
|
39
|
+
vimeoVideoIdProperty: 'vimeo',
|
40
|
+
// The URL for the Vimeo video player, can be extended with custom parameters:
|
41
|
+
// https://developer.vimeo.com/player/embedding
|
42
|
+
vimeoPlayerUrl: '//player.vimeo.com/video/VIDEO_ID?api=1&player_id=PLAYER_ID',
|
43
|
+
// The prefix for the Vimeo video player ID:
|
44
|
+
vimeoPlayerIdPrefix: 'vimeo-player-',
|
45
|
+
// Require a click on the native Vimeo player for the initial playback:
|
46
|
+
vimeoClickToPlay: true
|
47
|
+
});
|
48
|
+
|
49
|
+
var textFactory = Gallery.prototype.textFactory || Gallery.prototype.imageFactory,
|
50
|
+
VimeoPlayer = function (url, videoId, playerId, clickToPlay) {
|
51
|
+
this.url = url;
|
52
|
+
this.videoId = videoId;
|
53
|
+
this.playerId = playerId;
|
54
|
+
this.clickToPlay = clickToPlay;
|
55
|
+
this.element = document.createElement('div');
|
56
|
+
this.listeners = {};
|
57
|
+
},
|
58
|
+
counter = 0;
|
59
|
+
|
60
|
+
$.extend(VimeoPlayer.prototype, {
|
61
|
+
|
62
|
+
canPlayType: function () {
|
63
|
+
return true;
|
64
|
+
},
|
65
|
+
|
66
|
+
on: function (type, func) {
|
67
|
+
this.listeners[type] = func;
|
68
|
+
return this;
|
69
|
+
},
|
70
|
+
|
71
|
+
loadAPI: function () {
|
72
|
+
var that = this,
|
73
|
+
apiUrl = '//' + (location.protocol === 'https' ? 'secure-' : '') +
|
74
|
+
'a.vimeocdn.com/js/froogaloop2.min.js',
|
75
|
+
scriptTags = document.getElementsByTagName('script'),
|
76
|
+
i = scriptTags.length,
|
77
|
+
scriptTag,
|
78
|
+
called,
|
79
|
+
callback = function () {
|
80
|
+
if (!called && that.playOnReady) {
|
81
|
+
that.play();
|
82
|
+
}
|
83
|
+
called = true;
|
84
|
+
};
|
85
|
+
while (i) {
|
86
|
+
i -= 1;
|
87
|
+
if (scriptTags[i].src === apiUrl) {
|
88
|
+
scriptTag = scriptTags[i];
|
89
|
+
break;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
if (!scriptTag) {
|
93
|
+
scriptTag = document.createElement('script');
|
94
|
+
scriptTag.src = apiUrl;
|
95
|
+
}
|
96
|
+
$(scriptTag).on('load', callback);
|
97
|
+
scriptTags[0].parentNode.insertBefore(scriptTag, scriptTags[0]);
|
98
|
+
// Fix for cached scripts on IE 8:
|
99
|
+
if (/loaded|complete/.test(scriptTag.readyState)) {
|
100
|
+
callback();
|
101
|
+
}
|
102
|
+
},
|
103
|
+
|
104
|
+
onReady: function () {
|
105
|
+
var that = this;
|
106
|
+
this.ready = true;
|
107
|
+
this.player.addEvent('play', function () {
|
108
|
+
that.hasPlayed = true;
|
109
|
+
that.onPlaying();
|
110
|
+
});
|
111
|
+
this.player.addEvent('pause', function () {
|
112
|
+
that.onPause();
|
113
|
+
});
|
114
|
+
this.player.addEvent('finish', function () {
|
115
|
+
that.onPause();
|
116
|
+
});
|
117
|
+
if (this.playOnReady) {
|
118
|
+
this.play();
|
119
|
+
}
|
120
|
+
},
|
121
|
+
|
122
|
+
onPlaying: function () {
|
123
|
+
if (this.playStatus < 2) {
|
124
|
+
this.listeners.playing();
|
125
|
+
this.playStatus = 2;
|
126
|
+
}
|
127
|
+
},
|
128
|
+
|
129
|
+
onPause: function () {
|
130
|
+
this.listeners.pause();
|
131
|
+
delete this.playStatus;
|
132
|
+
},
|
133
|
+
|
134
|
+
insertIframe: function () {
|
135
|
+
var iframe = document.createElement('iframe');
|
136
|
+
iframe.src = this.url
|
137
|
+
.replace('VIDEO_ID', this.videoId)
|
138
|
+
.replace('PLAYER_ID', this.playerId);
|
139
|
+
iframe.id = this.playerId;
|
140
|
+
this.element.parentNode.replaceChild(iframe, this.element);
|
141
|
+
this.element = iframe;
|
142
|
+
},
|
143
|
+
|
144
|
+
play: function () {
|
145
|
+
var that = this;
|
146
|
+
if (!this.playStatus) {
|
147
|
+
this.listeners.play();
|
148
|
+
this.playStatus = 1;
|
149
|
+
}
|
150
|
+
if (this.ready) {
|
151
|
+
if (!this.hasPlayed && (this.clickToPlay || (window.navigator &&
|
152
|
+
/iP(hone|od|ad)/.test(window.navigator.platform)))) {
|
153
|
+
// Manually trigger the playing callback if clickToPlay
|
154
|
+
// is enabled and to workaround a limitation in iOS,
|
155
|
+
// which requires synchronous user interaction to start
|
156
|
+
// the video playback:
|
157
|
+
this.onPlaying();
|
158
|
+
} else {
|
159
|
+
this.player.api('play');
|
160
|
+
}
|
161
|
+
} else {
|
162
|
+
this.playOnReady = true;
|
163
|
+
if (!window.$f) {
|
164
|
+
this.loadAPI();
|
165
|
+
} else if (!this.player) {
|
166
|
+
this.insertIframe();
|
167
|
+
this.player = $f(this.element);
|
168
|
+
this.player.addEvent('ready', function () {
|
169
|
+
that.onReady();
|
170
|
+
});
|
171
|
+
}
|
172
|
+
}
|
173
|
+
},
|
174
|
+
|
175
|
+
pause: function () {
|
176
|
+
if (this.ready) {
|
177
|
+
this.player.api('pause');
|
178
|
+
} else if (this.playStatus) {
|
179
|
+
delete this.playOnReady;
|
180
|
+
this.listeners.pause();
|
181
|
+
delete this.playStatus;
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
});
|
186
|
+
|
187
|
+
$.extend(Gallery.prototype, {
|
188
|
+
|
189
|
+
VimeoPlayer: VimeoPlayer,
|
190
|
+
|
191
|
+
textFactory: function (obj, callback) {
|
192
|
+
var videoId = this.getItemProperty(obj, this.options.vimeoVideoIdProperty);
|
193
|
+
if (videoId) {
|
194
|
+
counter += 1;
|
195
|
+
return this.videoFactory(
|
196
|
+
obj,
|
197
|
+
callback,
|
198
|
+
new VimeoPlayer(
|
199
|
+
this.options.vimeoPlayerUrl,
|
200
|
+
videoId,
|
201
|
+
this.options.vimeoPlayerIdPrefix + counter,
|
202
|
+
this.options.vimeoClickToPlay
|
203
|
+
)
|
204
|
+
);
|
205
|
+
}
|
206
|
+
return textFactory.call(this, obj, callback);
|
207
|
+
}
|
208
|
+
|
209
|
+
});
|
210
|
+
|
211
|
+
return Gallery;
|
212
|
+
}));
|
@@ -0,0 +1,205 @@
|
|
1
|
+
/*
|
2
|
+
* blueimp Gallery YouTube Video Factory JS 1.1.0
|
3
|
+
* https://github.com/blueimp/Gallery
|
4
|
+
*
|
5
|
+
* Copyright 2013, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*/
|
11
|
+
|
12
|
+
/*jslint regexp: true */
|
13
|
+
/*global define, window, document, YT */
|
14
|
+
|
15
|
+
(function (factory) {
|
16
|
+
'use strict';
|
17
|
+
if (typeof define === 'function' && define.amd) {
|
18
|
+
// Register as an anonymous AMD module:
|
19
|
+
define([
|
20
|
+
'./blueimp-helper',
|
21
|
+
'./blueimp-gallery-video'
|
22
|
+
], factory);
|
23
|
+
} else {
|
24
|
+
// Browser globals:
|
25
|
+
factory(
|
26
|
+
window.blueimp.helper || window.jQuery,
|
27
|
+
window.blueimp.Gallery
|
28
|
+
);
|
29
|
+
}
|
30
|
+
}(function ($, Gallery) {
|
31
|
+
'use strict';
|
32
|
+
|
33
|
+
if (!window.postMessage) {
|
34
|
+
return Gallery;
|
35
|
+
}
|
36
|
+
|
37
|
+
$.extend(Gallery.prototype.options, {
|
38
|
+
// The list object property (or data attribute) with the YouTube video id:
|
39
|
+
youTubeVideoIdProperty: 'youtube',
|
40
|
+
// Optional object with parameters passed to the YouTube video player:
|
41
|
+
// https://developers.google.com/youtube/player_parameters
|
42
|
+
youTubePlayerVars: undefined,
|
43
|
+
// Require a click on the native YouTube player for the initial playback:
|
44
|
+
youTubeClickToPlay: true
|
45
|
+
});
|
46
|
+
|
47
|
+
var textFactory = Gallery.prototype.textFactory || Gallery.prototype.imageFactory,
|
48
|
+
YouTubePlayer = function (videoId, playerVars, clickToPlay) {
|
49
|
+
this.videoId = videoId;
|
50
|
+
this.playerVars = playerVars;
|
51
|
+
this.clickToPlay = clickToPlay;
|
52
|
+
this.element = document.createElement('div');
|
53
|
+
this.listeners = {};
|
54
|
+
};
|
55
|
+
|
56
|
+
$.extend(YouTubePlayer.prototype, {
|
57
|
+
|
58
|
+
canPlayType: function () {
|
59
|
+
return true;
|
60
|
+
},
|
61
|
+
|
62
|
+
on: function (type, func) {
|
63
|
+
this.listeners[type] = func;
|
64
|
+
return this;
|
65
|
+
},
|
66
|
+
|
67
|
+
loadAPI: function () {
|
68
|
+
var that = this,
|
69
|
+
onYouTubeIframeAPIReady = window.onYouTubeIframeAPIReady,
|
70
|
+
apiUrl = '//www.youtube.com/iframe_api',
|
71
|
+
scriptTags = document.getElementsByTagName('script'),
|
72
|
+
i = scriptTags.length,
|
73
|
+
scriptTag;
|
74
|
+
window.onYouTubeIframeAPIReady = function () {
|
75
|
+
if (onYouTubeIframeAPIReady) {
|
76
|
+
onYouTubeIframeAPIReady.apply(this);
|
77
|
+
}
|
78
|
+
if (that.playOnReady) {
|
79
|
+
that.play();
|
80
|
+
}
|
81
|
+
};
|
82
|
+
while (i) {
|
83
|
+
i -= 1;
|
84
|
+
if (scriptTags[i].src === apiUrl) {
|
85
|
+
return;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
scriptTag = document.createElement('script');
|
89
|
+
scriptTag.src = apiUrl;
|
90
|
+
scriptTags[0].parentNode.insertBefore(scriptTag, scriptTags[0]);
|
91
|
+
},
|
92
|
+
|
93
|
+
onReady: function () {
|
94
|
+
this.ready = true;
|
95
|
+
if (this.playOnReady) {
|
96
|
+
this.play();
|
97
|
+
}
|
98
|
+
},
|
99
|
+
|
100
|
+
onPlaying: function () {
|
101
|
+
if (this.playStatus < 2) {
|
102
|
+
this.listeners.playing();
|
103
|
+
this.playStatus = 2;
|
104
|
+
}
|
105
|
+
},
|
106
|
+
|
107
|
+
onPause: function () {
|
108
|
+
this.listeners.pause();
|
109
|
+
delete this.playStatus;
|
110
|
+
},
|
111
|
+
|
112
|
+
onStateChange: function (event) {
|
113
|
+
switch (event.data) {
|
114
|
+
case YT.PlayerState.PLAYING:
|
115
|
+
this.hasPlayed = true;
|
116
|
+
this.onPlaying();
|
117
|
+
break;
|
118
|
+
case YT.PlayerState.PAUSED:
|
119
|
+
case YT.PlayerState.ENDED:
|
120
|
+
this.onPause();
|
121
|
+
break;
|
122
|
+
}
|
123
|
+
},
|
124
|
+
|
125
|
+
onError: function (event) {
|
126
|
+
this.listeners.error(event);
|
127
|
+
},
|
128
|
+
|
129
|
+
play: function () {
|
130
|
+
var that = this;
|
131
|
+
if (!this.playStatus) {
|
132
|
+
this.listeners.play();
|
133
|
+
this.playStatus = 1;
|
134
|
+
}
|
135
|
+
if (this.ready) {
|
136
|
+
if (!this.hasPlayed && (this.clickToPlay || (window.navigator &&
|
137
|
+
/iP(hone|od|ad)/.test(window.navigator.platform)))) {
|
138
|
+
// Manually trigger the playing callback if clickToPlay
|
139
|
+
// is enabled and to workaround a limitation in iOS,
|
140
|
+
// which requires synchronous user interaction to start
|
141
|
+
// the video playback:
|
142
|
+
this.onPlaying();
|
143
|
+
} else {
|
144
|
+
this.player.playVideo();
|
145
|
+
}
|
146
|
+
} else {
|
147
|
+
this.playOnReady = true;
|
148
|
+
if (!(window.YT && YT.Player)) {
|
149
|
+
this.loadAPI();
|
150
|
+
} else if (!this.player) {
|
151
|
+
this.player = new YT.Player(this.element, {
|
152
|
+
videoId: this.videoId,
|
153
|
+
playerVars: this.playerVars,
|
154
|
+
events: {
|
155
|
+
onReady: function () {
|
156
|
+
that.onReady();
|
157
|
+
},
|
158
|
+
onStateChange: function (event) {
|
159
|
+
that.onStateChange(event);
|
160
|
+
},
|
161
|
+
onError: function (event) {
|
162
|
+
that.onError(event);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
});
|
166
|
+
}
|
167
|
+
}
|
168
|
+
},
|
169
|
+
|
170
|
+
pause: function () {
|
171
|
+
if (this.ready) {
|
172
|
+
this.player.pauseVideo();
|
173
|
+
} else if (this.playStatus) {
|
174
|
+
delete this.playOnReady;
|
175
|
+
this.listeners.pause();
|
176
|
+
delete this.playStatus;
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
});
|
181
|
+
|
182
|
+
$.extend(Gallery.prototype, {
|
183
|
+
|
184
|
+
YouTubePlayer: YouTubePlayer,
|
185
|
+
|
186
|
+
textFactory: function (obj, callback) {
|
187
|
+
var videoId = this.getItemProperty(obj, this.options.youTubeVideoIdProperty);
|
188
|
+
if (videoId) {
|
189
|
+
return this.videoFactory(
|
190
|
+
obj,
|
191
|
+
callback,
|
192
|
+
new YouTubePlayer(
|
193
|
+
videoId,
|
194
|
+
this.options.youTubePlayerVars,
|
195
|
+
this.options.youTubeClickToPlay
|
196
|
+
)
|
197
|
+
);
|
198
|
+
}
|
199
|
+
return textFactory.call(this, obj, callback);
|
200
|
+
}
|
201
|
+
|
202
|
+
});
|
203
|
+
|
204
|
+
return Gallery;
|
205
|
+
}));
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blueimp-gallery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.11.0.
|
4
|
+
version: 2.11.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Fernández
|
@@ -82,6 +82,8 @@ files:
|
|
82
82
|
- vendor/assets/javascripts/blueimp-gallery-fullscreen.js
|
83
83
|
- vendor/assets/javascripts/blueimp-gallery-indicator.js
|
84
84
|
- vendor/assets/javascripts/blueimp-gallery-video.js
|
85
|
+
- vendor/assets/javascripts/blueimp-gallery-vimeo.js
|
86
|
+
- vendor/assets/javascripts/blueimp-gallery-youtube.js
|
85
87
|
- vendor/assets/javascripts/blueimp-gallery.js
|
86
88
|
- vendor/assets/javascripts/blueimp-helper.js
|
87
89
|
- vendor/assets/javascripts/jquery.blueimp-gallery.js
|