/** * Copyright © 2017 Codazon, Inc. All rights reserved. * See COPYING.txt for license details. */ define(['jquery', 'owlslider', 'themecore', 'Magento_Ui/js/modal/modal'], function($) { var deskPrefix = 'desk_', mobiPrefix = 'mobi_'; var deskEvent = 'cdz_desktop', mobiEvent = 'cdz_mobile'; var $window = $(window); var rtl = $('body').hasClass('rtl-layout'); var mBreakpoint = 768; var winWidthChangedEvent = 'cdz_window_width_changed'; $('body').on('click', '.action-close', function() { $('body').css({paddingRight: '', transition: ''}).removeClass('_has-modal'); }); $.widget('codazon.videoframe', { options: { url: false, dimensionRatio: 0.562, playBtn: '[data-role=play-video]', loader: '[data-role=video-loader]', placeholder: '[data-role=video-placeholder]' }, _create: function() { this._assignVariable(); this._initHTML(); this.element.find(this.options.loader).remove(); this.element.removeClass('video-no-loaded'); this._events(); }, _assignVariable: function() { var self = this, conf = this.options; this.$playBtn = $(conf.playBtn, this.element); this.$placeholder = $(conf.placeholder, this.element); this.$frameVideo = $('#cdz-video-frame'); this.paddingBottom = (conf.dimensionRatio*100) + '%'; this.video = this._getVideo(conf.url); if (this.video.type == 'youtube') { this.video.url = '//www.youtube.com/embed/' + this.video.id + '?autoplay=1'; } else { this.video.url = '//player.vimeo.com/video/' + this.video.id + '?autoplay=1'; } this.scrollBarWidth = this._getScrollBarWidth(); }, _getScrollBarWidth: function () { var $outer = $('