Bootstrap-Image-Gallery-rails 1.0.0.3.1.0 → 1.0.1.3.1.0
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 +4 -4
- data/README.md +30 -5
- data/lib/Bootstrap/Image/Gallery/rails/version.rb +1 -1
- data/lib/Bootstrap/Image/Gallery/rails/version.rb~ +9 -0
- data/vendor/assets/images/Gallery/error.png +0 -0
- data/vendor/assets/images/Gallery/error.svg +5 -0
- data/vendor/assets/images/Gallery/loading.gif +0 -0
- data/vendor/assets/images/Gallery/play-pause.png +0 -0
- data/vendor/assets/images/Gallery/play-pause.svg +6 -0
- data/vendor/assets/images/Gallery/video-play.png +0 -0
- data/vendor/assets/images/Gallery/video-play.svg +5 -0
- data/vendor/assets/images/twitter/fonts/glyphicons-halflings-regular.eot +0 -0
- data/vendor/assets/images/twitter/fonts/glyphicons-halflings-regular.svg +229 -0
- data/vendor/assets/images/twitter/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/vendor/assets/images/twitter/fonts/glyphicons-halflings-regular.woff +0 -0
- data/vendor/assets/javascripts/blueimp-gallery-niconico.coffee~ +209 -0
- data/vendor/assets/javascripts/blueimp-gallery-niconico.js.coffee~ +179 -0
- data/vendor/assets/javascripts/blueimp-gallery-niconico.js~ +233 -0
- data/vendor/assets/javascripts/dummy.js~ +159 -0
- data/vendor/assets/stylesheets/blueimp-gallery-video.css~ +87 -0
- metadata +61 -2
@@ -0,0 +1,179 @@
|
|
1
|
+
#
|
2
|
+
# * blueimp Gallery Vimeo Video Factory JS 1.2.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
|
+
# global define, window, document, location, $f
|
13
|
+
((factory) ->
|
14
|
+
"use strict"
|
15
|
+
if typeof define is "function" and define.amd
|
16
|
+
|
17
|
+
# Register as an anonymous AMD module:
|
18
|
+
define [
|
19
|
+
"./blueimp-helper"
|
20
|
+
"./blueimp-gallery-video"
|
21
|
+
], factory
|
22
|
+
else
|
23
|
+
|
24
|
+
# Browser globals:
|
25
|
+
factory window.blueimp.helper or window.jQuery, window.blueimp.Gallery
|
26
|
+
return
|
27
|
+
) ($, Gallery) ->
|
28
|
+
"use strict"
|
29
|
+
return Gallery unless window.postMessage
|
30
|
+
$.extend Gallery::options,
|
31
|
+
|
32
|
+
# The list object property (or data attribute) with the Vimeo video id:
|
33
|
+
vimeoVideoIdProperty: "vimeo"
|
34
|
+
|
35
|
+
# The URL for the Vimeo video player, can be extended with custom parameters:
|
36
|
+
# https://developer.vimeo.com/player/embedding
|
37
|
+
vimeoPlayerUrl: "//player.vimeo.com/video/VIDEO_ID?api=1&player_id=PLAYER_ID"
|
38
|
+
|
39
|
+
# The prefix for the Vimeo video player ID:
|
40
|
+
vimeoPlayerIdPrefix: "vimeo-player-"
|
41
|
+
|
42
|
+
# Require a click on the native Vimeo player for the initial playback:
|
43
|
+
vimeoClickToPlay: true
|
44
|
+
|
45
|
+
textFactory = Gallery::textFactory or Gallery::imageFactory
|
46
|
+
VimeoPlayer = (url, videoId, playerId, clickToPlay) ->
|
47
|
+
@url = url
|
48
|
+
@videoId = videoId
|
49
|
+
@playerId = playerId
|
50
|
+
@clickToPlay = clickToPlay
|
51
|
+
@element = document.createElement("div")
|
52
|
+
@listeners = {}
|
53
|
+
return
|
54
|
+
|
55
|
+
counter = 0
|
56
|
+
$.extend VimeoPlayer::,
|
57
|
+
canPlayType: ->
|
58
|
+
true
|
59
|
+
|
60
|
+
on: (type, func) ->
|
61
|
+
@listeners[type] = func
|
62
|
+
this
|
63
|
+
|
64
|
+
loadAPI: ->
|
65
|
+
that = this
|
66
|
+
apiUrl = "//" + ((if location.protocol is "https" then "secure-" else "")) + "a.vimeocdn.com/js/froogaloop2.min.js"
|
67
|
+
scriptTags = document.getElementsByTagName("script")
|
68
|
+
i = scriptTags.length
|
69
|
+
scriptTag = undefined
|
70
|
+
called = undefined
|
71
|
+
callback = ->
|
72
|
+
that.play() if not called and that.playOnReady
|
73
|
+
called = true
|
74
|
+
return
|
75
|
+
|
76
|
+
while i
|
77
|
+
i -= 1
|
78
|
+
if scriptTags[i].src is apiUrl
|
79
|
+
scriptTag = scriptTags[i]
|
80
|
+
break
|
81
|
+
unless scriptTag
|
82
|
+
scriptTag = document.createElement("script")
|
83
|
+
scriptTag.src = apiUrl
|
84
|
+
$(scriptTag).on "load", callback
|
85
|
+
scriptTags[0].parentNode.insertBefore scriptTag, scriptTags[0]
|
86
|
+
|
87
|
+
# Fix for cached scripts on IE 8:
|
88
|
+
callback() if /loaded|complete/.test(scriptTag.readyState)
|
89
|
+
return
|
90
|
+
|
91
|
+
onReady: ->
|
92
|
+
that = this
|
93
|
+
@ready = true
|
94
|
+
@player.addEvent "play", ->
|
95
|
+
that.hasPlayed = true
|
96
|
+
that.onPlaying()
|
97
|
+
return
|
98
|
+
|
99
|
+
@player.addEvent "pause", ->
|
100
|
+
that.onPause()
|
101
|
+
return
|
102
|
+
|
103
|
+
@player.addEvent "finish", ->
|
104
|
+
that.onPause()
|
105
|
+
return
|
106
|
+
|
107
|
+
@play() if @playOnReady
|
108
|
+
return
|
109
|
+
|
110
|
+
onPlaying: ->
|
111
|
+
if @playStatus < 2
|
112
|
+
@listeners.playing()
|
113
|
+
@playStatus = 2
|
114
|
+
return
|
115
|
+
|
116
|
+
onPause: ->
|
117
|
+
@listeners.pause()
|
118
|
+
delete @playStatus
|
119
|
+
|
120
|
+
return
|
121
|
+
|
122
|
+
insertIframe: ->
|
123
|
+
iframe = document.createElement("iframe")
|
124
|
+
iframe.src = @url.replace("VIDEO_ID", @videoId).replace("PLAYER_ID", @playerId)
|
125
|
+
iframe.id = @playerId
|
126
|
+
@element.parentNode.replaceChild iframe, @element
|
127
|
+
@element = iframe
|
128
|
+
return
|
129
|
+
|
130
|
+
play: ->
|
131
|
+
that = this
|
132
|
+
unless @playStatus
|
133
|
+
@listeners.play()
|
134
|
+
@playStatus = 1
|
135
|
+
if @ready
|
136
|
+
if not @hasPlayed and (@clickToPlay or (window.navigator and /iP(hone|od|ad)/.test(window.navigator.platform)))
|
137
|
+
|
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
|
+
@onPlaying()
|
143
|
+
else
|
144
|
+
@player.api "play"
|
145
|
+
else
|
146
|
+
@playOnReady = true
|
147
|
+
unless window.$f
|
148
|
+
@loadAPI()
|
149
|
+
else unless @player
|
150
|
+
@insertIframe()
|
151
|
+
@player = $f(@element)
|
152
|
+
@player.addEvent "ready", ->
|
153
|
+
that.onReady()
|
154
|
+
return
|
155
|
+
|
156
|
+
return
|
157
|
+
|
158
|
+
pause: ->
|
159
|
+
if @ready
|
160
|
+
@player.api "pause"
|
161
|
+
else if @playStatus
|
162
|
+
delete @playOnReady
|
163
|
+
|
164
|
+
@listeners.pause()
|
165
|
+
delete @playStatus
|
166
|
+
return
|
167
|
+
|
168
|
+
$.extend Gallery::,
|
169
|
+
VimeoPlayer: VimeoPlayer
|
170
|
+
textFactory: (obj, callback) ->
|
171
|
+
options = @options
|
172
|
+
videoId = @getItemProperty(obj, options.vimeoVideoIdProperty)
|
173
|
+
if videoId
|
174
|
+
obj[options.urlProperty] = "//vimeo.com/" + videoId if @getItemProperty(obj, options.urlProperty) is `undefined`
|
175
|
+
counter += 1
|
176
|
+
return @videoFactory(obj, callback, new VimeoPlayer(options.vimeoPlayerUrl, videoId, options.vimeoPlayerIdPrefix + counter, options.vimeoClickToPlay))
|
177
|
+
textFactory.call this, obj, callback
|
178
|
+
|
179
|
+
Gallery
|
@@ -0,0 +1,233 @@
|
|
1
|
+
/*
|
2
|
+
* blueimp Gallery NicoNico Video Factory JS 1.2.0
|
3
|
+
* https://github.com/blueimp/Gallery
|
4
|
+
*
|
5
|
+
* Copyright 2013, dogwood008
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*/
|
11
|
+
|
12
|
+
/* global define, window, document, YT */
|
13
|
+
|
14
|
+
(function (factory) {
|
15
|
+
'use strict';
|
16
|
+
if (typeof define === 'function' && define.amd) {
|
17
|
+
// Register as an anonymous AMD module:
|
18
|
+
define([
|
19
|
+
'./blueimp-helper',
|
20
|
+
'./blueimp-gallery-video'
|
21
|
+
], factory);
|
22
|
+
} else {
|
23
|
+
// Browser globals:
|
24
|
+
factory(
|
25
|
+
window.blueimp.helper || window.jQuery,
|
26
|
+
window.blueimp.Gallery
|
27
|
+
);
|
28
|
+
}
|
29
|
+
}(function ($, Gallery) {
|
30
|
+
'use strict';
|
31
|
+
|
32
|
+
if (!window.postMessage) {
|
33
|
+
return Gallery;
|
34
|
+
}
|
35
|
+
|
36
|
+
$.extend(Gallery.prototype.options, {
|
37
|
+
// The list object property (or data attribute) with the Niconico video id:
|
38
|
+
nicoNicoVideoIdProperty: 'niconico',
|
39
|
+
// Optional object with parameters passed to the Niconico video player:
|
40
|
+
// https://developers.google.com/youtube/player_parameters
|
41
|
+
nicoNicoPlayerVars: {
|
42
|
+
wmode: 'transparent'
|
43
|
+
},
|
44
|
+
// Require a click on the native YouTube player for the initial playback:
|
45
|
+
nicoNicoClickToPlay: true
|
46
|
+
});
|
47
|
+
|
48
|
+
var textFactory = Gallery.prototype.textFactory || Gallery.prototype.imageFactory,
|
49
|
+
NicoNicoPlayer = function (videoId, playerVars, clickToPlay) {
|
50
|
+
this.videoId = videoId;
|
51
|
+
this.playerVars = playerVars;
|
52
|
+
this.clickToPlay = clickToPlay;
|
53
|
+
this.element = document.createElement('div');
|
54
|
+
this.listeners = {};
|
55
|
+
};
|
56
|
+
|
57
|
+
$.extend(NicoNicoPlayer.prototype, {
|
58
|
+
|
59
|
+
canPlayType: function () {
|
60
|
+
return true;
|
61
|
+
},
|
62
|
+
|
63
|
+
on: function (type, func) {
|
64
|
+
this.listeners[type] = func;
|
65
|
+
return this;
|
66
|
+
},
|
67
|
+
|
68
|
+
loadAPI: function () {
|
69
|
+
/* iframe html code */
|
70
|
+
/*
|
71
|
+
* <script type="text/javascript" src="http://ext.nicovideo.jp/thumb_watch/sm23915389?w=490&h=307"></script><noscript><a href="http://www.nicovideo.jp/watch/sm23915389">【ニコニコ動画】【水曜激情】半沢と大和田常務に挟まれ折り合いがつかない野々村議員</a></noscript>
|
72
|
+
*/
|
73
|
+
var that = this,
|
74
|
+
onNicoNicoIframeAPIReady = window.onNicoNicoIframeAPIReady,
|
75
|
+
apiUrl = '//ext.nicovideo.jp/thumb_watch/sm23915389?w=490&h=307';
|
76
|
+
scriptTags = document.getElementsByTagName('script'),
|
77
|
+
i = scriptTags.length,
|
78
|
+
scriptTag;
|
79
|
+
window.onNicoNicoIframeAPIReady = function () {
|
80
|
+
if (onNicoNicoIframeAPIReady) {
|
81
|
+
onNicoNicoIframeAPIReady.apply(this);
|
82
|
+
}
|
83
|
+
if (that.playOnReady) {
|
84
|
+
that.play();
|
85
|
+
}
|
86
|
+
};
|
87
|
+
while (i) {
|
88
|
+
i -= 1;
|
89
|
+
if (scriptTags[i].src === apiUrl) {
|
90
|
+
return;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
scriptTag = document.createElement('script');
|
94
|
+
scriptTag.src = apiUrl;
|
95
|
+
scriptTags[0].parentNode.insertBefore(scriptTag, scriptTags[0]);
|
96
|
+
},
|
97
|
+
|
98
|
+
onReady: function () {
|
99
|
+
this.ready = true;
|
100
|
+
if (this.playOnReady) {
|
101
|
+
this.play();
|
102
|
+
}
|
103
|
+
},
|
104
|
+
|
105
|
+
onPlaying: function () {
|
106
|
+
if (this.playStatus < 2) {
|
107
|
+
this.listeners.playing();
|
108
|
+
this.playStatus = 2;
|
109
|
+
}
|
110
|
+
},
|
111
|
+
|
112
|
+
onPause: function () {
|
113
|
+
Gallery.prototype.setTimeout.call(
|
114
|
+
this,
|
115
|
+
this.checkSeek,
|
116
|
+
null,
|
117
|
+
2000
|
118
|
+
);
|
119
|
+
},
|
120
|
+
|
121
|
+
checkSeek: function () {
|
122
|
+
if (this.stateChange === YT.PlayerState.PAUSED ||
|
123
|
+
this.stateChange === YT.PlayerState.ENDED) {
|
124
|
+
// check if current state change is actually paused
|
125
|
+
this.listeners.pause();
|
126
|
+
delete this.playStatus;
|
127
|
+
}
|
128
|
+
},
|
129
|
+
|
130
|
+
onStateChange: function (event) {
|
131
|
+
switch (event.data) {
|
132
|
+
case YT.PlayerState.PLAYING:
|
133
|
+
this.hasPlayed = true;
|
134
|
+
this.onPlaying();
|
135
|
+
break;
|
136
|
+
case YT.PlayerState.PAUSED:
|
137
|
+
case YT.PlayerState.ENDED:
|
138
|
+
this.onPause();
|
139
|
+
break;
|
140
|
+
}
|
141
|
+
// Save most recent state change to this.stateChange
|
142
|
+
this.stateChange = event.data;
|
143
|
+
},
|
144
|
+
|
145
|
+
onError: function (event) {
|
146
|
+
this.listeners.error(event);
|
147
|
+
},
|
148
|
+
|
149
|
+
play: function () {
|
150
|
+
var that = this;
|
151
|
+
if (!this.playStatus) {
|
152
|
+
this.listeners.play();
|
153
|
+
this.playStatus = 1;
|
154
|
+
}
|
155
|
+
if (this.ready) {
|
156
|
+
if (!this.hasPlayed && (this.clickToPlay || (window.navigator &&
|
157
|
+
/iP(hone|od|ad)/.test(window.navigator.platform)))) {
|
158
|
+
// Manually trigger the playing callback if clickToPlay
|
159
|
+
// is enabled and to workaround a limitation in iOS,
|
160
|
+
// which requires synchronous user interaction to start
|
161
|
+
// the video playback:
|
162
|
+
this.onPlaying();
|
163
|
+
} else {
|
164
|
+
this.player.playVideo();
|
165
|
+
}
|
166
|
+
} else {
|
167
|
+
this.playOnReady = true;
|
168
|
+
if (!(window.YT && YT.Player)) {
|
169
|
+
this.loadAPI();
|
170
|
+
} else if (!this.player) {
|
171
|
+
this.player = new YT.Player(this.element, {
|
172
|
+
videoId: this.videoId,
|
173
|
+
playerVars: this.playerVars,
|
174
|
+
events: {
|
175
|
+
onReady: function () {
|
176
|
+
that.onReady();
|
177
|
+
},
|
178
|
+
onStateChange: function (event) {
|
179
|
+
that.onStateChange(event);
|
180
|
+
},
|
181
|
+
onError: function (event) {
|
182
|
+
that.onError(event);
|
183
|
+
}
|
184
|
+
}
|
185
|
+
});
|
186
|
+
}
|
187
|
+
}
|
188
|
+
},
|
189
|
+
|
190
|
+
pause: function () {
|
191
|
+
if (this.ready) {
|
192
|
+
this.player.pauseVideo();
|
193
|
+
} else if (this.playStatus) {
|
194
|
+
delete this.playOnReady;
|
195
|
+
this.listeners.pause();
|
196
|
+
delete this.playStatus;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
});
|
201
|
+
|
202
|
+
$.extend(Gallery.prototype, {
|
203
|
+
|
204
|
+
NicoNicoPlayer: NicoNicoPlayer,
|
205
|
+
|
206
|
+
textFactory: function (obj, callback) {
|
207
|
+
var options = this.options,
|
208
|
+
videoId = this.getItemProperty(obj, options.nicoNicoVideoIdProperty);
|
209
|
+
if (videoId) {
|
210
|
+
if (this.getItemProperty(obj, options.urlProperty) === undefined) {
|
211
|
+
obj[options.urlProperty] = '//www.youtube.com/watch?v=' + videoId;
|
212
|
+
}
|
213
|
+
if (this.getItemProperty(obj, options.videoPosterProperty) === undefined) {
|
214
|
+
obj[options.videoPosterProperty] = '//img.youtube.com/vi/' + videoId +
|
215
|
+
'/maxresdefault.jpg';
|
216
|
+
}
|
217
|
+
return this.videoFactory(
|
218
|
+
obj,
|
219
|
+
callback,
|
220
|
+
new NicoNicoPlayer(
|
221
|
+
videoId,
|
222
|
+
options.nicoNicoPlayerVars,
|
223
|
+
options.nicoNicoClickToPlay
|
224
|
+
)
|
225
|
+
);
|
226
|
+
}
|
227
|
+
return textFactory.call(this, obj, callback);
|
228
|
+
}
|
229
|
+
|
230
|
+
});
|
231
|
+
|
232
|
+
return Gallery;
|
233
|
+
}));
|
@@ -0,0 +1,159 @@
|
|
1
|
+
// Generated by CoffeeScript 1.7.1
|
2
|
+
(function(factory) {
|
3
|
+
"use strict";
|
4
|
+
if (typeof define === "function" && define.amd) {
|
5
|
+
define(["./blueimp-helper", "./blueimp-gallery-video"], factory);
|
6
|
+
} else {
|
7
|
+
factory(window.blueimp.helper || window.jQuery, window.blueimp.Gallery);
|
8
|
+
}
|
9
|
+
})(function($, Gallery) {
|
10
|
+
"use strict";
|
11
|
+
var NiconicoPlayer, counter, textFactory;
|
12
|
+
if (!window.postMessage) {
|
13
|
+
return Gallery;
|
14
|
+
}
|
15
|
+
$.extend(Gallery.prototype.options, {
|
16
|
+
niconicoVideoIdProperty: "niconico",
|
17
|
+
niconicoPlayerUrl: "//ext.nicovideo.jp/thumb_watch/VIDEO_ID?w=490&h=307",
|
18
|
+
niconicoPlayerIdPrefix: "niconico-player-",
|
19
|
+
niconicoClickToPlay: true
|
20
|
+
});
|
21
|
+
textFactory = Gallery.prototype.textFactory || Gallery.prototype.imageFactory;
|
22
|
+
NiconicoPlayer = function(url, videoId, playerId, clickToPlay) {
|
23
|
+
this.url = url;
|
24
|
+
this.videoId = videoId;
|
25
|
+
this.playerId = playerId;
|
26
|
+
this.clickToPlay = clickToPlay;
|
27
|
+
this.element = document.createElement("div");
|
28
|
+
this.listeners = {};
|
29
|
+
};
|
30
|
+
counter = 0;
|
31
|
+
$.extend(NiconicoPlayer.prototype, {
|
32
|
+
canPlayType: function() {
|
33
|
+
return true;
|
34
|
+
},
|
35
|
+
on: function(type, func) {
|
36
|
+
this.listeners[type] = func;
|
37
|
+
return this;
|
38
|
+
},
|
39
|
+
loadAPI: function() {
|
40
|
+
var apiUrl, callback, called, i, scriptTag, scriptTags, that;
|
41
|
+
that = this;
|
42
|
+
apiUrl = "//ext.nicovideo.jp/api/getthumbinfo/VIDEO_ID";
|
43
|
+
scriptTags = document.getElementsByTagName("script");
|
44
|
+
i = scriptTags.length;
|
45
|
+
scriptTag = void 0;
|
46
|
+
called = void 0;
|
47
|
+
callback = function() {
|
48
|
+
if (!called && that.playOnReady) {
|
49
|
+
that.play();
|
50
|
+
}
|
51
|
+
called = true;
|
52
|
+
};
|
53
|
+
while (i) {
|
54
|
+
i -= 1;
|
55
|
+
if (scriptTags[i].src === apiUrl) {
|
56
|
+
scriptTag = scriptTags[i];
|
57
|
+
break;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
if (!scriptTag) {
|
61
|
+
scriptTag = document.createElement("script");
|
62
|
+
scriptTag.src = apiUrl;
|
63
|
+
}
|
64
|
+
$(scriptTag).on("load", callback);
|
65
|
+
scriptTags[0].parentNode.insertBefore(scriptTag, scriptTags[0]);
|
66
|
+
if (/loaded|complete/.test(scriptTag.readyState)) {
|
67
|
+
callback();
|
68
|
+
}
|
69
|
+
},
|
70
|
+
onReady: function() {
|
71
|
+
var that;
|
72
|
+
that = this;
|
73
|
+
this.ready = true;
|
74
|
+
this.player.addEvent("play", function() {
|
75
|
+
that.hasPlayed = true;
|
76
|
+
that.onPlaying();
|
77
|
+
});
|
78
|
+
this.player.addEvent("pause", function() {
|
79
|
+
that.onPause();
|
80
|
+
});
|
81
|
+
this.player.addEvent("finish", function() {
|
82
|
+
that.onPause();
|
83
|
+
});
|
84
|
+
if (this.playOnReady) {
|
85
|
+
this.play();
|
86
|
+
}
|
87
|
+
},
|
88
|
+
onPlaying: function() {
|
89
|
+
if (this.playStatus < 2) {
|
90
|
+
this.listeners.playing();
|
91
|
+
this.playStatus = 2;
|
92
|
+
}
|
93
|
+
},
|
94
|
+
onPause: function() {
|
95
|
+
this.listeners.pause();
|
96
|
+
delete this.playStatus;
|
97
|
+
},
|
98
|
+
insertIframe: function() {
|
99
|
+
var iframe;
|
100
|
+
iframe = document.createElement("iframe");
|
101
|
+
iframe.src = this.url.replace("VIDEO_ID", this.videoId).replace("PLAYER_ID", this.playerId);
|
102
|
+
iframe.id = this.playerId;
|
103
|
+
this.element.parentNode.replaceChild(iframe, this.element);
|
104
|
+
this.element = iframe;
|
105
|
+
},
|
106
|
+
play: function() {
|
107
|
+
var that;
|
108
|
+
that = this;
|
109
|
+
if (!this.playStatus) {
|
110
|
+
this.listeners.play();
|
111
|
+
this.playStatus = 1;
|
112
|
+
}
|
113
|
+
if (this.ready) {
|
114
|
+
if (!this.hasPlayed && (this.clickToPlay || (window.navigator && /iP(hone|od|ad)/.test(window.navigator.platform)))) {
|
115
|
+
this.onPlaying();
|
116
|
+
} else {
|
117
|
+
this.player.api("play");
|
118
|
+
}
|
119
|
+
} else {
|
120
|
+
this.playOnReady = true;
|
121
|
+
if (!window.$f) {
|
122
|
+
this.loadAPI();
|
123
|
+
} else if (!this.player) {
|
124
|
+
this.insertIframe();
|
125
|
+
this.player = $f(this.element);
|
126
|
+
this.player.addEvent("ready", function() {
|
127
|
+
that.onReady();
|
128
|
+
});
|
129
|
+
}
|
130
|
+
}
|
131
|
+
},
|
132
|
+
pause: function() {
|
133
|
+
if (this.ready) {
|
134
|
+
this.player.api("pause");
|
135
|
+
} else if (this.playStatus) {
|
136
|
+
delete this.playOnReady;
|
137
|
+
this.listeners.pause();
|
138
|
+
delete this.playStatus;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
});
|
142
|
+
$.extend(Gallery.prototype, {
|
143
|
+
NiconicoPlayer: NiconicoPlayer,
|
144
|
+
textFactory: function(obj, callback) {
|
145
|
+
var options, videoId;
|
146
|
+
options = this.options;
|
147
|
+
videoId = this.getItemProperty(obj, options.niconicoVideoIdProperty);
|
148
|
+
if (videoId) {
|
149
|
+
if (this.getItemProperty(obj, options.urlProperty) === undefined) {
|
150
|
+
obj[options.urlProperty] = "//niconico.com/" + videoId;
|
151
|
+
}
|
152
|
+
counter += 1;
|
153
|
+
return this.videoFactory(obj, callback, new NiconicoPlayer(options.niconicoPlayerUrl, videoId, options.niconicoPlayerIdPrefix + counter, options.niconicoClickToPlay));
|
154
|
+
}
|
155
|
+
return textFactory.call(this, obj, callback);
|
156
|
+
}
|
157
|
+
});
|
158
|
+
return Gallery;
|
159
|
+
});
|