Skip to content

Commit f14b826

Browse files
Vonktml
authored andcommitted
Move initAllAblePlayers out and exports it
1 parent a767b59 commit f14b826

4 files changed

Lines changed: 28 additions & 30 deletions

File tree

build/ableplayer.dist.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,16 @@ var Cookies = require("js-cookie");
4343
// maintain an array of Able Player instances for use globally (e.g., for keeping prefs in sync)
4444
var AblePlayerInstances = [];
4545

46-
(function ($) {
47-
// Initialise all AblePlayerInstances - this can be called
48-
// by the React component that imports ableplayer
49-
window.initAllAblePlayers = function() {
50-
$("video, audio").each(function(index, element) {
51-
if ($(element).data("able-player") !== undefined) {
52-
AblePlayerInstances.push(new AblePlayer($(this), $(element)));
53-
}
54-
});
55-
};
46+
// Initialise all AblePlayerInstances
47+
exports.initAllAblePlayers = function() {
48+
$("video, audio").each(function(index, element) {
49+
if ($(element).data("able-player") !== undefined) {
50+
AblePlayerInstances.push(new AblePlayer($(this), $(element)));
51+
}
52+
});
53+
};
5654

55+
(function ($) {
5756
// YouTube player support; pass ready event to jQuery so we can catch in player.
5857
window.onYouTubeIframeAPIReady = function() {
5958
AblePlayer.youTubeIframeAPIReady = true;

build/ableplayer.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,16 @@ var Cookies = require("js-cookie");
4343
// maintain an array of Able Player instances for use globally (e.g., for keeping prefs in sync)
4444
var AblePlayerInstances = [];
4545

46-
(function ($) {
47-
// Initialise all AblePlayerInstances - this can be called
48-
// by the React component that imports ableplayer
49-
window.initAllAblePlayers = function() {
50-
$("video, audio").each(function(index, element) {
51-
if ($(element).data("able-player") !== undefined) {
52-
AblePlayerInstances.push(new AblePlayer($(this), $(element)));
53-
}
54-
});
55-
};
46+
// Initialise all AblePlayerInstances
47+
exports.initAllAblePlayers = function() {
48+
$("video, audio").each(function(index, element) {
49+
if ($(element).data("able-player") !== undefined) {
50+
AblePlayerInstances.push(new AblePlayer($(this), $(element)));
51+
}
52+
});
53+
};
5654

55+
(function ($) {
5756
// YouTube player support; pass ready event to jQuery so we can catch in player.
5857
window.onYouTubeIframeAPIReady = function() {
5958
AblePlayer.youTubeIframeAPIReady = true;

build/ableplayer.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/ableplayer-base.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ var Cookies = require("js-cookie");
4343
// maintain an array of Able Player instances for use globally (e.g., for keeping prefs in sync)
4444
var AblePlayerInstances = [];
4545

46-
(function ($) {
47-
// Initialise all AblePlayerInstances
48-
window.initAllAblePlayers = function() {
49-
$("video, audio").each(function(index, element) {
50-
if ($(element).data("able-player") !== undefined) {
51-
AblePlayerInstances.push(new AblePlayer($(this), $(element)));
52-
}
53-
});
54-
};
46+
// Initialise all AblePlayerInstances
47+
exports.initAllAblePlayers = function() {
48+
$("video, audio").each(function(index, element) {
49+
if ($(element).data("able-player") !== undefined) {
50+
AblePlayerInstances.push(new AblePlayer($(this), $(element)));
51+
}
52+
});
53+
};
5554

55+
(function ($) {
5656
// YouTube player support; pass ready event to jQuery so we can catch in player.
5757
window.onYouTubeIframeAPIReady = function() {
5858
AblePlayer.youTubeIframeAPIReady = true;

0 commit comments

Comments
 (0)