Beyond Borders: Gift Giving in Negros Occidental

On December 31, 2019, CJG Digital Marketing, one of the leading Digital Marketing and SEO service provider in the Philippines, successfully conducted its Beyond Borders activity in Negros Occidental.

We were able to impart simple donations to 75 families in Brgy. San Isidro Calatrava Negros Occidental.

The gift-giving activity is part of the company’s bit to give back to others and showcase the holidays’ true spirit.

For more information and updates on CJG Digital Marketing’s Beyond Borders initiatives, follow us on Facebook and LinkedIn

var defaults = { selector: '.glightbox', elements: null, skin: 'clean', theme: 'clean', closeButton: true, startAt: null, autoplayVideos: true, autofocusVideos: true, descPosition: 'bottom', width: '900px', height: '506px', videosWidth: '960px', beforeSlideChange: null, afterSlideChange: null, beforeSlideLoad: null, afterSlideLoad: null, slideInserted: null, slideRemoved: null, slideExtraAttributes: null, onOpen: null, onClose: null, loop: false, zoomable: true, draggable: true, dragAutoSnap: false, dragToleranceX: 40, dragToleranceY: 65, preload: true, oneSlidePerOpen: false, touchNavigation: true, touchFollowAxis: true, keyboardNavigation: true, closeOnOutsideClick: true, plugins: false, plyr: { css: 'https://cdn.plyr.io/3.6.12/plyr.css', js: 'https://cdn.plyr.io/3.6.12/plyr.js', config: { ratio: '16:9', fullscreen: { enabled: true, iosNative: true }, youtube: { noCookie: true, rel: 0, showinfo: 0, iv_load_policy: 3 }, vimeo: { byline: false, portrait: false, title: false, transparent: false } } }, openEffect: 'zoom', closeEffect: 'zoom', slideEffect: 'slide', moreText: 'See more', moreLength: 60, cssEfects: { fade: { "in": 'fadeIn', out: 'fadeOut' }, zoom: { "in": 'zoomIn', out: 'zoomOut' }, slide: { "in": 'slideInRight', out: 'slideOutLeft' }, slideBack: { "in": 'slideInLeft', out: 'slideOutRight' }, none: { "in": 'none', out: 'none' } }, svg: { close: '', next: ' ', prev: '' } }; defaults.slideHTML = "
\n
\n
\n
\n
\n
\n
\n

\n
\n
\n
\n
\n
\n
"; defaults.lightboxHTML = "
\n
\n
\n
\n
\n \n \n \n
\n
"; var GlightboxInit = function () { function GlightboxInit() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, GlightboxInit); this.customOptions = options; this.settings = extend(defaults, options); this.effectsClasses = this.getAnimationClasses(); this.videoPlayers = {}; this.apiEvents = []; this.fullElementsList = false; } return _createClass(GlightboxInit, [{ key: "init", value: function init() { var _this = this; var selector = this.getSelector(); if (selector) { this.baseEvents = addEvent('click', { onElement: selector, withCallback: function withCallback(e, target) { e.preventDefault(); _this.open(target); } }); } this.elements = this.getElements(); } }, { key: "open", value: function open() { var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; if (this.elements.length === 0) { return false; } this.activeSlide = null; this.prevActiveSlideIndex = null; this.prevActiveSlide = null; var index = isNumber(startAt) ? startAt : this.settings.startAt; if (isNode(element)) { var gallery = element.getAttribute('data-gallery'); if (gallery) { this.fullElementsList = this.elements; this.elements = this.getGalleryElements(this.elements, gallery); } if (isNil(index)) { index = this.getElementIndex(element); if (index < 0) { index = 0; } } } if (!isNumber(index)) { index = 0; } this.build(); animateElement(this.overlay, this.settings.openEffect === 'none' ? 'none' : this.settings.cssEfects.fade["in"]); var body = document.body; var scrollBar = window.innerWidth - document.documentElement.clientWidth; if (scrollBar > 0) { var styleSheet = document.createElement('style'); styleSheet.type = 'text/css'; styleSheet.className = 'gcss-styles'; styleSheet.innerText = ".gscrollbar-fixer {margin-right: ".concat(scrollBar, "px}"); document.head.appendChild(styleSheet); addClass(body, 'gscrollbar-fixer'); } addClass(body, 'glightbox-open'); addClass(html, 'glightbox-open'); if (isMobile$1) { addClass(document.body, 'glightbox-mobile'); this.settings.slideEffect = 'slide'; } this.showSlide(index, true); if (this.elements.length === 1) { addClass(this.prevButton, 'glightbox-button-hidden'); addClass(this.nextButton, 'glightbox-button-hidden'); } else { removeClass(this.prevButton, 'glightbox-button-hidden'); removeClass(this.nextButton, 'glightbox-button-hidden'); } this.lightboxOpen = true; this.trigger('open'); if (isFunction(this.settings.onOpen)) { this.settings.onOpen(); } if (isTouch$1 && this.settings.touchNavigation) { touchNavigation(this); } if (this.settings.keyboardNavigation) { keyboardNavigation(this); } } }, { key: "openAt", value: function openAt() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; this.open(null, index); } }, { key: "showSlide", value: function showSlide() { var _this2 = this; var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var first = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; show(this.loader); this.index = parseInt(index); var current = this.slidesContainer.querySelector('.current'); if (current) { removeClass(current, 'current'); } this.slideAnimateOut(); var slideNode = this.slidesContainer.querySelectorAll('.gslide')[index]; if (hasClass(slideNode, 'loaded')) { this.slideAnimateIn(slideNode, first); hide(this.loader); } else { show(this.loader); var slide = this.elements[index]; var slideData = { index: this.index, slide: slideNode, slideNode: slideNode, slideConfig: slide.slideConfig, slideIndex: this.index, trigger: slide.node, player: null }; this.trigger('slide_before_load', slideData); slide.instance.setContent(slideNode, function () { hide(_this2.loader); _this2.resize(); _this2.slideAnimateIn(slideNode, first); _this2.trigger('slide_after_load', slideData); }); } this.slideDescription = slideNode.querySelector('.gslide-description'); this.slideDescriptionContained = this.slideDescription && hasClass(this.slideDescription.parentNode, 'gslide-media'); if (this.settings.preload) { this.preloadSlide(index + 1); this.preloadSlide(index - 1); } this.updateNavigationClasses(); this.activeSlide = slideNode; } }, { key: "preloadSlide", value: function preloadSlide(index) { var _this3 = this; if (index < 0 || index > this.elements.length - 1) { return false; } if (isNil(this.elements[index])) { return false; } var slideNode = this.slidesContainer.querySelectorAll('.gslide')[index]; if (hasClass(slideNode, 'loaded')) { return false; } var slide = this.elements[index]; var type = slide.type; var slideData = { index: index, slide: slideNode, slideNode: slideNode, slideConfig: slide.slideConfig, slideIndex: index, trigger: slide.node, player: null }; this.trigger('slide_before_load', slideData); if (type === 'video' || type === 'external') { setTimeout(function () { slide.instance.setContent(slideNode, function () { _this3.trigger('slide_after_load', slideData); }); }, 200); } else { slide.instance.setContent(slideNode, function () { _this3.trigger('slide_after_load', slideData); }); } } }, { key: "prevSlide", value: function prevSlide() { this.goToSlide(this.index - 1); } }, { key: "nextSlide", value: function nextSlide() { this.goToSlide(this.index + 1); } }, { key: "goToSlide", value: function goToSlide() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; this.prevActiveSlide = this.activeSlide; this.prevActiveSlideIndex = this.index; if (!this.loop() && (index < 0 || index > this.elements.length - 1)) { return false; } if (index < 0) { index = this.elements.length - 1; } else if (index >= this.elements.length) { index = 0; } this.showSlide(index); } }, { key: "insertSlide", value: function insertSlide() { var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1; if (index < 0) { index = this.elements.length; } var slide = new Slide(config, this, index); var data = slide.getConfig(); var slideInfo = extend({}, data); var newSlide = slide.create(); var totalSlides = this.elements.length - 1; slideInfo.index = index; slideInfo.node = false; slideInfo.instance = slide; slideInfo.slideConfig = data; this.elements.splice(index, 0, slideInfo); var addedSlideNode = null; var addedSlidePlayer = null; if (this.slidesContainer) { if (index > totalSlides) { this.slidesContainer.appendChild(newSlide); } else { var existingSlide = this.slidesContainer.querySelectorAll('.gslide')[index]; this.slidesContainer.insertBefore(newSlide, existingSlide); } if (this.settings.preload && this.index == 0 && index == 0 || this.index - 1 == index || this.index + 1 == index) { this.preloadSlide(index); } if (this.index === 0 && index === 0) { this.index = 1; } this.updateNavigationClasses(); addedSlideNode = this.slidesContainer.querySelectorAll('.gslide')[index]; addedSlidePlayer = this.getSlidePlayerInstance(index); slideInfo.slideNode = addedSlideNode; } this.trigger('slide_inserted', { index: index, slide: addedSlideNode, slideNode: addedSlideNode, slideConfig: data, slideIndex: index, trigger: null, player: addedSlidePlayer }); if (isFunction(this.settings.slideInserted)) { this.settings.slideInserted({ index: index, slide: addedSlideNode, player: addedSlidePlayer }); } } }, { key: "removeSlide", value: function removeSlide() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1; if (index < 0 || index > this.elements.length - 1) { return false; } var slide = this.slidesContainer && this.slidesContainer.querySelectorAll('.gslide')[index]; if (slide) { if (this.getActiveSlideIndex() == index) { if (index == this.elements.length - 1) { this.prevSlide(); } else { this.nextSlide(); } } slide.parentNode.removeChild(slide); } this.elements.splice(index, 1); this.trigger('slide_removed', index); if (isFunction(this.settings.slideRemoved)) { this.settings.slideRemoved(index); } } }, { key: "slideAnimateIn", value: function slideAnimateIn(slide, first) { var _this4 = this; var slideMedia = slide.querySelector('.gslide-media'); var slideDesc = slide.querySelector('.gslide-description'); var prevData = { index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, slideNode: this.prevActiveSlide, slideIndex: this.prevActiveSlide, slideConfig: isNil(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].slideConfig, trigger: isNil(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].node, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }; var nextData = { index: this.index, slide: this.activeSlide, slideNode: this.activeSlide, slideConfig: this.elements[this.index].slideConfig, slideIndex: this.index, trigger: this.elements[this.index].node, player: this.getSlidePlayerInstance(this.index) }; if (slideMedia.offsetWidth > 0 && slideDesc) { hide(slideDesc); slideDesc.style.display = ''; } removeClass(slide, this.effectsClasses); if (first) { animateElement(slide, this.settings.cssEfects[this.settings.openEffect]["in"], function () { if (_this4.settings.autoplayVideos) { _this4.slidePlayerPlay(slide); } _this4.trigger('slide_changed', { prev: prevData, current: nextData }); if (isFunction(_this4.settings.afterSlideChange)) { _this4.settings.afterSlideChange.apply(_this4, [prevData, nextData]); } }); } else { var effectName = this.settings.slideEffect; var animIn = effectName !== 'none' ? this.settings.cssEfects[effectName]["in"] : effectName; if (this.prevActiveSlideIndex > this.index) { if (this.settings.slideEffect == 'slide') { animIn = this.settings.cssEfects.slideBack["in"]; } } animateElement(slide, animIn, function () { if (_this4.settings.autoplayVideos) { _this4.slidePlayerPlay(slide); } _this4.trigger('slide_changed', { prev: prevData, current: nextData }); if (isFunction(_this4.settings.afterSlideChange)) { _this4.settings.afterSlideChange.apply(_this4, [prevData, nextData]); } }); } setTimeout(function () { _this4.resize(slide); }, 100); addClass(slide, 'current'); } }, { key: "slideAnimateOut", value: function slideAnimateOut() { if (!this.prevActiveSlide) { return false; } var prevSlide = this.prevActiveSlide; removeClass(prevSlide, this.effectsClasses); addClass(prevSlide, 'prev'); var animation = this.settings.slideEffect; var animOut = animation !== 'none' ? this.settings.cssEfects[animation].out : animation; this.slidePlayerPause(prevSlide); this.trigger('slide_before_change', { prev: { index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, slideNode: this.prevActiveSlide, slideIndex: this.prevActiveSlideIndex, slideConfig: isNil(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].slideConfig, trigger: isNil(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].node, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }, current: { index: this.index, slide: this.activeSlide, slideNode: this.activeSlide, slideIndex: this.index, slideConfig: this.elements[this.index].slideConfig, trigger: this.elements[this.index].node, player: this.getSlidePlayerInstance(this.index) } }); if (isFunction(this.settings.beforeSlideChange)) { this.settings.beforeSlideChange.apply(this, [{ index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }, { index: this.index, slide: this.activeSlide, player: this.getSlidePlayerInstance(this.index) }]); } if (this.prevActiveSlideIndex > this.index && this.settings.slideEffect == 'slide') { animOut = this.settings.cssEfects.slideBack.out; } animateElement(prevSlide, animOut, function () { var container = prevSlide.querySelector('.ginner-container'); var media = prevSlide.querySelector('.gslide-media'); var desc = prevSlide.querySelector('.gslide-description'); container.style.transform = ''; media.style.transform = ''; removeClass(media, 'greset'); media.style.opacity = ''; if (desc) { desc.style.opacity = ''; } removeClass(prevSlide, 'prev'); }); } }, { key: "getAllPlayers", value: function getAllPlayers() { return this.videoPlayers; } }, { key: "getSlidePlayerInstance", value: function getSlidePlayerInstance(index) { var id = 'gvideo' + index; var videoPlayers = this.getAllPlayers(); if (has(videoPlayers, id) && videoPlayers[id]) { return videoPlayers[id]; } return false; } }, { key: "stopSlideVideo", value: function stopSlideVideo(slide) { if (isNode(slide)) { var node = slide.querySelector('.gvideo-wrapper'); if (node) { slide = node.getAttribute('data-index'); } } console.log('stopSlideVideo is deprecated, use slidePlayerPause'); var player = this.getSlidePlayerInstance(slide); if (player && player.playing) { player.pause(); } } }, { key: "slidePlayerPause", value: function slidePlayerPause(slide) { if (isNode(slide)) { var node = slide.querySelector('.gvideo-wrapper'); if (node) { slide = node.getAttribute('data-index'); } } var player = this.getSlidePlayerInstance(slide); if (player && player.playing) { player.pause(); } } }, { key: "playSlideVideo", value: function playSlideVideo(slide) { if (isNode(slide)) { var node = slide.querySelector('.gvideo-wrapper'); if (node) { slide = node.getAttribute('data-index'); } } console.log('playSlideVideo is deprecated, use slidePlayerPlay'); var player = this.getSlidePlayerInstance(slide); if (player && !player.playing) { player.play(); } } }, { key: "slidePlayerPlay", value: function slidePlayerPlay(slide) { var _this$settings$plyr$c; if (isMobile$1 && !((_this$settings$plyr$c = this.settings.plyr.config) !== null && _this$settings$plyr$c !== void 0 && _this$settings$plyr$c.muted)) { return; } if (isNode(slide)) { var node = slide.querySelector('.gvideo-wrapper'); if (node) { slide = node.getAttribute('data-index'); } } var player = this.getSlidePlayerInstance(slide); if (player && !player.playing) { player.play(); if (this.settings.autofocusVideos) { player.elements.container.focus(); } } } }, { key: "setElements", value: function setElements(elements) { var _this5 = this; this.settings.elements = false; var newElements = []; if (elements && elements.length) { each(elements, function (el, i) { var slide = new Slide(el, _this5, i); var data = slide.getConfig(); var slideInfo = extend({}, data); slideInfo.slideConfig = data; slideInfo.instance = slide; slideInfo.index = i; newElements.push(slideInfo); }); } this.elements = newElements; if (this.lightboxOpen) { this.slidesContainer.innerHTML = ''; if (this.elements.length) { each(this.elements, function () { var slide = createHTML(_this5.settings.slideHTML); _this5.slidesContainer.appendChild(slide); }); this.showSlide(0, true); } } } }, { key: "getElementIndex", value: function getElementIndex(node) { var index = false; each(this.elements, function (el, i) { if (has(el, 'node') && el.node == node) { index = i; return true; } }); return index; } }, { key: "getElements", value: function getElements() { var _this6 = this; var list = []; this.elements = this.elements ? this.elements : []; if (!isNil(this.settings.elements) && isArray(this.settings.elements) && this.settings.elements.length) { each(this.settings.elements, function (el, i) { var slide = new Slide(el, _this6, i); var elData = slide.getConfig(); var slideInfo = extend({}, elData); slideInfo.node = false; slideInfo.index = i; slideInfo.instance = slide; slideInfo.slideConfig = elData; list.push(slideInfo); }); } var nodes = false; var selector = this.getSelector(); if (selector) { nodes = document.querySelectorAll(this.getSelector()); } if (!nodes) { return list; } each(nodes, function (el, i) { var slide = new Slide(el, _this6, i); var elData = slide.getConfig(); var slideInfo = extend({}, elData); slideInfo.node = el; slideInfo.index = i; slideInfo.instance = slide; slideInfo.slideConfig = elData; slideInfo.gallery = el.getAttribute('data-gallery'); list.push(slideInfo); }); return list; } }, { key: "getGalleryElements", value: function getGalleryElements(list, gallery) { return list.filter(function (el) { return el.gallery == gallery; }); } }, { key: "getSelector", value: function getSelector() { if (this.settings.elements) { return false; } if (this.settings.selector && this.settings.selector.substring(0, 5) == 'data-') { return "*[".concat(this.settings.selector, "]"); } return this.settings.selector; } }, { key: "getActiveSlide", value: function getActiveSlide() { return this.slidesContainer.querySelectorAll('.gslide')[this.index]; } }, { key: "getActiveSlideIndex", value: function getActiveSlideIndex() { return this.index; } }, { key: "getAnimationClasses", value: function getAnimationClasses() { var effects = []; for (var key in this.settings.cssEfects) { if (this.settings.cssEfects.hasOwnProperty(key)) { var effect = this.settings.cssEfects[key]; effects.push("g".concat(effect["in"])); effects.push("g".concat(effect.out)); } } return effects.join(' '); } }, { key: "build", value: function build() { var _this7 = this; if (this.built) { return false; } var children = document.body.childNodes; var bodyChildElms = []; each(children, function (el) { if (el.parentNode == document.body && el.nodeName.charAt(0) !== '#' && el.hasAttribute && !el.hasAttribute('aria-hidden')) { bodyChildElms.push(el); el.setAttribute('aria-hidden', 'true'); } }); var nextSVG = has(this.settings.svg, 'next') ? this.settings.svg.next : ''; var prevSVG = has(this.settings.svg, 'prev') ? this.settings.svg.prev : ''; var closeSVG = has(this.settings.svg, 'close') ? this.settings.svg.close : ''; var lightboxHTML = this.settings.lightboxHTML; lightboxHTML = lightboxHTML.replace(/{nextSVG}/g, nextSVG); lightboxHTML = lightboxHTML.replace(/{prevSVG}/g, prevSVG); lightboxHTML = lightboxHTML.replace(/{closeSVG}/g, closeSVG); lightboxHTML = createHTML(lightboxHTML); document.body.appendChild(lightboxHTML); var modal = document.getElementById('glightbox-body'); this.modal = modal; var closeButton = modal.querySelector('.gclose'); this.prevButton = modal.querySelector('.gprev'); this.nextButton = modal.querySelector('.gnext'); this.overlay = modal.querySelector('.goverlay'); this.loader = modal.querySelector('.gloader'); this.slidesContainer = document.getElementById('glightbox-slider'); this.bodyHiddenChildElms = bodyChildElms; this.events = {}; addClass(this.modal, 'glightbox-' + this.settings.skin); if (this.settings.closeButton && closeButton) { this.events['close'] = addEvent('click', { onElement: closeButton, withCallback: function withCallback(e, target) { e.preventDefault(); _this7.close(); } }); } if (closeButton && !this.settings.closeButton) { closeButton.parentNode.removeChild(closeButton); } if (this.nextButton) { this.events['next'] = addEvent('click', { onElement: this.nextButton, withCallback: function withCallback(e, target) { e.preventDefault(); _this7.nextSlide(); } }); } if (this.prevButton) { this.events['prev'] = addEvent('click', { onElement: this.prevButton, withCallback: function withCallback(e, target) { e.preventDefault(); _this7.prevSlide(); } }); } if (this.settings.closeOnOutsideClick) { this.events['outClose'] = addEvent('click', { onElement: modal, withCallback: function withCallback(e, target) { if (!_this7.preventOutsideClick && !hasClass(document.body, 'glightbox-mobile') && !closest(e.target, '.ginner-container')) { if (!closest(e.target, '.gbtn') && !hasClass(e.target, 'gnext') && !hasClass(e.target, 'gprev')) { _this7.close(); } } } }); } each(this.elements, function (slide, i) { _this7.slidesContainer.appendChild(slide.instance.create()); slide.slideNode = _this7.slidesContainer.querySelectorAll('.gslide')[i]; }); if (isTouch$1) { addClass(document.body, 'glightbox-touch'); } this.events['resize'] = addEvent('resize', { onElement: window, withCallback: function withCallback() { _this7.resize(); } }); this.built = true; } }, { key: "resize", value: function resize() { var slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; slide = !slide ? this.activeSlide : slide; if (!slide || hasClass(slide, 'zoomed')) { return; } var winSize = windowSize(); var video = slide.querySelector('.gvideo-wrapper'); var image = slide.querySelector('.gslide-image'); var description = this.slideDescription; var winWidth = winSize.width; var winHeight = winSize.height; if (winWidth <= 768) { addClass(document.body, 'glightbox-mobile'); } else { removeClass(document.body, 'glightbox-mobile'); } if (!video && !image) { return; } var descriptionResize = false; if (description && (hasClass(description, 'description-bottom') || hasClass(description, 'description-top')) && !hasClass(description, 'gabsolute')) { descriptionResize = true; } if (image) { if (winWidth <= 768) { var imgNode = image.querySelector('img'); } else if (descriptionResize) { var _this$elements$this$i; var descHeight = description.offsetHeight; var _imgNode = image.querySelector('img'); var slideTriggerNode = (_this$elements$this$i = this.elements[this.index]) === null || _this$elements$this$i === void 0 ? void 0 : _this$elements$this$i.node; var maxHeightValue = '100vh'; if (slideTriggerNode) { var _slideTriggerNode$get; maxHeightValue = (_slideTriggerNode$get = slideTriggerNode.getAttribute('data-height')) !== null && _slideTriggerNode$get !== void 0 ? _slideTriggerNode$get : maxHeightValue; } _imgNode.setAttribute('style', "max-height: calc(".concat(maxHeightValue, " - ").concat(descHeight, "px)")); description.setAttribute('style', "max-width: ".concat(_imgNode.offsetWidth, "px;")); } } if (video) { var ratio = has(this.settings.plyr.config, 'ratio') ? this.settings.plyr.config.ratio : ''; if (!ratio) { var containerWidth = video.clientWidth; var containerHeight = video.clientHeight; var divisor = containerWidth / containerHeight; ratio = "".concat(containerWidth / divisor, ":").concat(containerHeight / divisor); } var videoRatio = ratio.split(':'); var videoWidth = this.settings.videosWidth; var maxWidth = this.settings.videosWidth; if (isNumber(videoWidth) || videoWidth.indexOf('px') !== -1) { maxWidth = parseInt(videoWidth); } else { if (videoWidth.indexOf('vw') !== -1) { maxWidth = winWidth * parseInt(videoWidth) / 100; } else if (videoWidth.indexOf('vh') !== -1) { maxWidth = winHeight * parseInt(videoWidth) / 100; } else if (videoWidth.indexOf('%') !== -1) { maxWidth = winWidth * parseInt(videoWidth) / 100; } else { maxWidth = parseInt(video.clientWidth); } } var maxHeight = maxWidth / (parseInt(videoRatio[0]) / parseInt(videoRatio[1])); maxHeight = Math.floor(maxHeight); if (descriptionResize) { winHeight = winHeight - description.offsetHeight; } if (maxWidth > winWidth || maxHeight > winHeight || winHeight < maxHeight && winWidth > maxWidth) { var vwidth = video.offsetWidth; var vheight = video.offsetHeight; var _ratio = winHeight / vheight; var vsize = { width: vwidth * _ratio, height: vheight * _ratio }; video.parentNode.setAttribute('style', "max-width: ".concat(vsize.width, "px")); if (descriptionResize) { description.setAttribute('style', "max-width: ".concat(vsize.width, "px;")); } } else { video.parentNode.style.maxWidth = "".concat(videoWidth); if (descriptionResize) { description.setAttribute('style', "max-width: ".concat(videoWidth, ";")); } } } } }, { key: "reload", value: function reload() { this.init(); } }, { key: "updateNavigationClasses", value: function updateNavigationClasses() { var loop = this.loop(); removeClass(this.nextButton, 'disabled'); removeClass(this.prevButton, 'disabled'); if (this.index == 0 && this.elements.length - 1 == 0) { addClass(this.prevButton, 'disabled'); addClass(this.nextButton, 'disabled'); } else if (this.index === 0 && !loop) { addClass(this.prevButton, 'disabled'); } else if (this.index === this.elements.length - 1 && !loop) { addClass(this.nextButton, 'disabled'); } } }, { key: "loop", value: function loop() { var loop = has(this.settings, 'loopAtEnd') ? this.settings.loopAtEnd : null; loop = has(this.settings, 'loop') ? this.settings.loop : loop; return loop; } }, { key: "close", value: function close() { var _this8 = this; if (!this.lightboxOpen) { if (this.events) { for (var key in this.events) { if (this.events.hasOwnProperty(key)) { this.events[key].destroy(); } } this.events = null; } return false; } if (this.closing) { return false; } this.closing = true; this.slidePlayerPause(this.activeSlide); if (this.fullElementsList) { this.elements = this.fullElementsList; } if (this.bodyHiddenChildElms.length) { each(this.bodyHiddenChildElms, function (el) { el.removeAttribute('aria-hidden'); }); } addClass(this.modal, 'glightbox-closing'); animateElement(this.overlay, this.settings.openEffect == 'none' ? 'none' : this.settings.cssEfects.fade.out); animateElement(this.activeSlide, this.settings.cssEfects[this.settings.closeEffect].out, function () { _this8.activeSlide = null; _this8.prevActiveSlideIndex = null; _this8.prevActiveSlide = null; _this8.built = false; if (_this8.events) { for (var _key in _this8.events) { if (_this8.events.hasOwnProperty(_key)) { _this8.events[_key].destroy(); } } _this8.events = null; } var body = document.body; removeClass(html, 'glightbox-open'); removeClass(body, 'glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer'); _this8.modal.parentNode.removeChild(_this8.modal); _this8.trigger('close'); if (isFunction(_this8.settings.onClose)) { _this8.settings.onClose(); } var styles = document.querySelector('.gcss-styles'); if (styles) { styles.parentNode.removeChild(styles); } _this8.lightboxOpen = false; _this8.closing = null; }); } }, { key: "destroy", value: function destroy() { this.close(); this.clearAllEvents(); if (this.baseEvents) { this.baseEvents.destroy(); } } }, { key: "on", value: function on(evt, callback) { var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (!evt || !isFunction(callback)) { throw new TypeError('Event name and callback must be defined'); } this.apiEvents.push({ evt: evt, once: once, callback: callback }); } }, { key: "once", value: function once(evt, callback) { this.on(evt, callback, true); } }, { key: "trigger", value: function trigger(eventName) { var _this9 = this; var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var onceTriggered = []; each(this.apiEvents, function (event, i) { var evt = event.evt, once = event.once, callback = event.callback; if (evt == eventName) { callback(data); if (once) { onceTriggered.push(i); } } }); if (onceTriggered.length) { each(onceTriggered, function (i) { return _this9.apiEvents.splice(i, 1); }); } } }, { key: "clearAllEvents", value: function clearAllEvents() { this.apiEvents.splice(0, this.apiEvents.length); } }, { key: "version", value: function version() { return _version; } }]); }();function glightbox() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var instance = new GlightboxInit(options); instance.init(); return instance; } glightbox();