---
regenerate: true
---
{% capture cache %}
{% comment %}
# -----------------------------------------------------------------------------
# ~/assets/themes/j1/extentions/light_gallery/js/j1_adapter_lightgallery.js
# Liquid JS Template to create the J1 Adapter for LightGallery
#
# Product/Info:
# https://jekyll.one
#
# Copyright (C) 2019 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# For details, see https://jekyll.one
#
# -----------------------------------------------------------------------------
# {{ config | debug }}
# -----------------------------------------------------------------------------
{% endcomment %}
/*
# -----------------------------------------------------------------------------
# ~/assets/themes/j1/extentions/light_gallery/js/j1_adapter_lightgallery.js
# JS Adapter for LightGallery
#
# Product/Info:
# https://jekyll.one
# https://sachinchoolur.github.io/lightGallery
# https://github.com/sachinchoolur/lightGallery
#
# Copyright (C) 2019 Juergen Adams
# Copyright (C) 2016 Sachin Choolur
#
# J1 Template is licensed under the MIT License.
# For details, see https://jekyll.one
# LightGallery FREE for PERSONAL use is licensed under the GNU AGPLv3
# For details, see https://sachinchoolur.github.io/lightGallery
# LightGallery COMMERCIAL for BUSINESS use is licensed under LG Commercial License
# For details, see: https://site.uplabs.com/posts/lightgallery-plugin
#
# -----------------------------------------------------------------------------
# Adapter generated: {{site.time}}
# -----------------------------------------------------------------------------
*/
'use strict';
{% comment %} Liquid procedures
--------------------------------------------------------------- {% endcomment %}
{% comment %} Variables
--------------------------------------------------------------- {% endcomment %}
{% assign environment = site.environment %}
{% assign config = site.data.apps.j1_bootstrap_gallery %}
{% comment %} Main
--------------------------------------------------------------- {% endcomment %}
j1.BsGallery = (function (j1, window) {
var environment = '{{environment}}'; // Set environment
var state = 'not_started';
var logger;
var logText;
return {
// Initialize
init: function ( options ) {
logger = log4javascript.getLogger("j1.BSGallery.adapter");
this.settings = $.extend({}, options);
{% if environment == 'development' %}
logText = 'start gallery initialization';
logger.info(logText);
state = 'started';
logger.info('state: ' + state); // Set|Log status
{% endif %}
this.lgInit();
return;
}, // END init
// ---------------------------------------------------------------------
// Load AJAX data and initialize the gallery
// ---------------------------------------------------------------------
// ToDo:
lgInit: function () {
logger = log4javascript.getLogger("j1.LightGallery.lgInit");
{% for item in config.galleries %}
{% if item.gallery.enabled %}
{% comment %} Set (
|
) container id for the placement of HTML markup {% endcomment %}
{% assign container_id = item.gallery.id %}
{% capture gallery_id %}{{item.gallery.id}}_ul{% endcapture %}
{% capture bs_gallery_class %}bsg_{{item.gallery.id}}{% endcapture %}
{% comment %} Initialize J1 base gallery options {% endcomment %}
{% assign css_classes = item.gallery.css_classes %}
{% assign gallery_title = item.gallery.title %}
{% assign gallery_type = item.gallery.type %}
{% assign thumb_items = item.gallery.thumb_items %}
{% assign thumb_spacing = item.gallery.thumb_spacing %}
{% assign thumb_bordered = item.gallery.thumb_bordered %}
{% assign thumb_animate = item.gallery.thumb_animate %}
{% comment %} // Calculate BS grid size for the thumbnails {% endcomment %}
{% assign column_width_md = 12 | divided_by:thumb_items %}
// Create an gallery instance if {{ container_id }} exists
if ( $('#{{ container_id }}').length ) {
{% if environment == 'development' %}
logText = 'gallery on ID #{{ container_id }} is being initialized';
logger.info(logText);
state = 'running';
logger.info('state: ' + state); // Set|Log status
{% endif %}
// Place HTML markup for the title
{% if gallery_title %}
var gallery_title = '
{{gallery_title}}
';
$('#{{ container_id }}').before( gallery_title );
{% endif %}
$('#{{ container_id }}').addClass("lightgallery ");
{% if thumb_animate %}
// Add animation
$('#{{ container_id }}').addClass("lg-animate");
// $('#{{ container_id }}').removeClass("lg-animate");
{% endif %}
// Calculate individual CSS styles for gallery thumbnails
var style = '';
style += ' \n';
$('head').append( style );
{% if gallery_type == "image" %}
// Collect image gallery data from data file (jsonPath)
$.getJSON( '{{config.jsonPath}}', function (data) {
var content = '';
//content += '
' + '\n';
content += '
' + '\n';
for ( var i in data["{{item.gallery.id}}"] ) {
var img = data["{{item.gallery.id}}"][i].img;
var caption = data["{{item.gallery.id}}"][i].caption;
content += '
';
{% elsif gallery_type == "video-html5" or gallery_type == "video-online" %}
var play_button = '/assets/themes/j1/extensions/light_gallery/img/icons/play-button.png';
// Collect html5 video gallery data from data file (jsonPath)
$.getJSON( '{{config.jsonPath}}', function (data) {
{% if gallery_type == "video-html5" %}
var hidden_video_div = '';
for ( var i in data["{{item.gallery.id}}"] ) {
var video = data["{{item.gallery.id}}"][i].video_path + '/' + data["{{item.gallery.id}}"][i].video;
var poster = data["{{item.gallery.id}}"][i].image_path + '/' + data["{{item.gallery.id}}"][i].poster;
var caption = data["{{item.gallery.id}}"][i].captions_lightbox;
var video_id = data["{{item.gallery.id}}"][i].video_id;
var video_type = video.substr(video.lastIndexOf('.') + 1);
hidden_video_div += '
' + '\n';
for ( var i in data["{{item.gallery.id}}"] ) {
{% if gallery_type == "video-html5" %}
var video_id = data["{{item.gallery.id}}"][i].video_id;
{% endif %}
{% if gallery_type == "video-online" %}
var video = data["{{item.gallery.id}}"][i].video;
{% endif %}
var poster = data["{{item.gallery.id}}"][i].image_path + '/' + data["{{item.gallery.id}}"][i].poster;
var caption = data["{{item.gallery.id}}"][i].captions_lightbox;
//content += '