Files
pathfinder/js/lib/bootstrap-image-gallery.js
Exodus4D 7edf6f5e2d - fixed "system graph" module rendering if there was no data available
- improved "image gallery" initialization on landing page
- added navigation to /setup page
- updated "blueImpGallery" (fixed some bugs after jQuery 3.0 upgrade) 1.15.2 -> 2.21.3
- updated "blueImpGalleryBootstrap"  (fixed some bugs after jQuery 3.0 upgrade)  3.1.1 -> 3.4.2
2016-07-27 18:51:43 +02:00

88 lines
2.8 KiB
JavaScript

/*
* Bootstrap Image Gallery
* https://github.com/blueimp/Bootstrap-Image-Gallery
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
/*global define, window */
;(function (factory) {
'use strict'
if (typeof define === 'function' && define.amd) {
define([
'jquery',
'blueImpGallery'
], factory)
} else {
factory(
window.jQuery,
window.blueimp.Gallery
)
}
}(function ($, Gallery) {
'use strict'
$.extend(Gallery.prototype.options, {
useBootstrapModal: true
})
var close = Gallery.prototype.close
var imageFactory = Gallery.prototype.imageFactory
var videoFactory = Gallery.prototype.videoFactory
var textFactory = Gallery.prototype.textFactory
$.extend(Gallery.prototype, {
modalFactory: function (obj, callback, factoryInterface, factory) {
if (!this.options.useBootstrapModal || factoryInterface) {
return factory.call(this, obj, callback, factoryInterface)
}
var that = this
var modalTemplate = $(this.container).children('.modal')
var modal = modalTemplate.clone().css('display', 'block').on('click', function (event) {
//var modal = modalTemplate.clone().show().on('click', function (event) {
// Close modal if click is outside of modal-content:
if (event.target === modal[0] ||
event.target === modal.children()[0]) {
event.preventDefault()
event.stopPropagation()
that.close()
}
})
var element = factory.call(this, obj, function (event) {
callback({
type: event.type,
target: modal[0]
})
modal.addClass('in')
}, factoryInterface)
modal.find('.modal-title').text(element.title || String.fromCharCode(160))
modal.find('.modal-body').append(element)
return modal[0]
},
imageFactory: function (obj, callback, factoryInterface) {
return this.modalFactory(obj, callback, factoryInterface, imageFactory)
},
videoFactory: function (obj, callback, factoryInterface) {
return this.modalFactory(obj, callback, factoryInterface, videoFactory)
},
textFactory: function (obj, callback, factoryInterface) {
return this.modalFactory(obj, callback, factoryInterface, textFactory)
},
close: function () {
this.container.find('.modal').removeClass('in')
close.call(this)
}
})
}))