1/* 2 * Bootstrap Image Gallery 3.0.1 3 * https://github.com/blueimp/Bootstrap-Image-Gallery 4 * 5 * Copyright 2013, Sebastian Tschan 6 * https://blueimp.net 7 * 8 * Licensed under the MIT license: 9 * http://www.opensource.org/licenses/MIT 10 */ 11 12/*global define, window */ 13 14(function (factory) { 15 'use strict'; 16 if (typeof define === 'function' && define.amd) { 17 define([ 18 'jquery', 19 './blueimp-gallery' 20 ], factory); 21 } else { 22 factory( 23 window.jQuery, 24 window.blueimp.Gallery 25 ); 26 } 27}(function ($, Gallery) { 28 'use strict'; 29 30 $.extend(Gallery.prototype.options, { 31 useBootstrapModal: true 32 }); 33 34 var close = Gallery.prototype.close, 35 imageFactory = Gallery.prototype.imageFactory, 36 videoFactory = Gallery.prototype.videoFactory, 37 textFactory = Gallery.prototype.textFactory; 38 39 $.extend(Gallery.prototype, { 40 41 modalFactory: function (obj, callback, factoryInterface, factory) { 42 if (!this.options.useBootstrapModal || factoryInterface) { 43 return factory.call(this, obj, callback, factoryInterface); 44 } 45 var that = this, 46 modalTemplate = this.container.children('.modal'), 47 modal = modalTemplate.clone().show() 48 .on('click', function (event) { 49 // Close modal if click is outside of modal-content: 50 if (event.target === modal[0] || 51 event.target === modal.children()[0]) { 52 event.preventDefault(); 53 event.stopPropagation(); 54 that.close(); 55 } 56 }), 57 element = factory.call(this, obj, function (event) { 58 callback({ 59 type: event.type, 60 target: modal[0] 61 }); 62 modal.addClass('in'); 63 }, factoryInterface); 64 modal.find('.modal-title').text(element.title || String.fromCharCode(160)); 65 modal.find('.modal-body').append(element); 66 return modal[0]; 67 }, 68 69 imageFactory: function (obj, callback, factoryInterface) { 70 return this.modalFactory(obj, callback, factoryInterface, imageFactory); 71 }, 72 73 videoFactory: function (obj, callback, factoryInterface) { 74 return this.modalFactory(obj, callback, factoryInterface, videoFactory); 75 }, 76 77 textFactory: function (obj, callback, factoryInterface) { 78 return this.modalFactory(obj, callback, factoryInterface, textFactory); 79 }, 80 81 close: function () { 82 this.container.find('.modal').removeClass('in'); 83 close.call(this); 84 } 85 86 }); 87 88}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.