Skip to content

Instantly share code, notes, and snippets.

@RebliNk17
Last active May 15, 2018 09:23
Show Gist options
  • Save RebliNk17/0b17822060157e17a32890a9225392a2 to your computer and use it in GitHub Desktop.
Save RebliNk17/0b17822060157e17a32890a9225392a2 to your computer and use it in GitHub Desktop.
{
key: 'initVideo',
value: function (channel, opt, videoId) {
var functionName = channel.charAt(0).toUpperCase() + channel.slice(1).toLowerCase();
if (typeof this["init" + functionName] === "function") {
this["init" + functionName](opt, videoId);
}
}
},
{
key: 'initWistia',
value: function (opt, videoId) {
this.onWistiaScriptLoaded = this.onWistiaScriptLoaded.bind(this, opt, videoId);
if (!window._wq) {
$.getScript("//fast.wistia.com/assets/external/E-v1.js", this.onWistiaScriptLoaded);
} else {
this.onWistiaScriptLoaded();
}
}
},
{
key: "onWistiaScriptLoaded",
value: function (opt, videoId) {
window._wq = window._wq || [];
var options = opt.wistia;
_wq.push(
{
id: videoId,
options: options
// Also possible now to add onReady function and more ...
});
}
},
{
key: 'getWistiaUrl',
value: function getWistiaUrl(wistia, videoId) {
return 'wistia_embed wistia_async_' + videoId;
// return '//fast.wistia.com/embed/medias/' + videoId + '?' + this.getQueryString(wistia);
}
},
{
key: 'getHtml',
value: function getHtml(opt, videoUrl, id, channel) {
var padding = this.getPadding(opt.ratio);
var classNames = opt.classNames;
var html = '\n <div class="' + classNames.modalVideo + '" tabindex="-1" role="dialog" aria-label="' + opt.aria.openMessage + '" id="' + id + '">\n <div class="' + classNames.modalVideoBody + '">\n <div class="' + classNames.modalVideoInner + '">\n <div class="' + classNames.modalVideoIframeWrap + '" style="padding-bottom:' + padding + '">\n <button class="' + classNames.modalVideoCloseBtn + ' js-modal-video-dismiss-btn" aria-label="' + opt.aria.dismissBtnMessage + '"></button>\n';
if (channel === 'wistia') {
html += '<div class="' + videoUrl + '">&nbsp;</div>';
} else {
html += '<iframe width=\'460\' height=\'230\' src="' + videoUrl + '" frameborder=\'0\' allowfullscreen=' + opt.allowFullScreen + ' tabindex="-1"/>\n';
}
html += '</div>\n </div>\n </div>\n </div>\n ';
return html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment