Merge pull request #4831 from gdpelican/image-gallery
FEATURE: Use image gallery functionality in magnific
This commit is contained in:
commit
64787e7fa4
|
@ -2,18 +2,19 @@ import loadScript from 'discourse/lib/load-script';
|
||||||
import { escapeExpression } from 'discourse/lib/utilities';
|
import { escapeExpression } from 'discourse/lib/utilities';
|
||||||
|
|
||||||
export default function($elem) {
|
export default function($elem) {
|
||||||
$("a.lightbox", $elem).each(function(i, e) {
|
if (!$elem) { return; }
|
||||||
loadScript("/javascripts/jquery.magnific-popup-min.js").then(function() {
|
loadScript("/javascripts/jquery.magnific-popup.min.js").then(function() {
|
||||||
const $e = $(e);
|
const spoilers = $elem.find('.spoiler a.lightbox, .spoiled a.lightbox');
|
||||||
// do not lightbox spoiled images
|
$elem.find('a.lightbox').not(spoilers).magnificPopup({
|
||||||
if ($e.parents(".spoiler").length > 0 || $e.parents(".spoiled").length > 0) { return; }
|
|
||||||
|
|
||||||
$e.magnificPopup({
|
|
||||||
type: "image",
|
type: "image",
|
||||||
closeOnContentClick: false,
|
closeOnContentClick: false,
|
||||||
removalDelay: 300,
|
removalDelay: 300,
|
||||||
mainClass: "mfp-zoom-in",
|
mainClass: "mfp-zoom-in",
|
||||||
|
|
||||||
|
gallery: {
|
||||||
|
enabled: true
|
||||||
|
},
|
||||||
|
|
||||||
callbacks: {
|
callbacks: {
|
||||||
open() {
|
open() {
|
||||||
const wrap = this.wrap,
|
const wrap = this.wrap,
|
||||||
|
@ -44,5 +45,4 @@ export default function($elem) {
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -39,7 +39,7 @@
|
||||||
//= require plugin_tests
|
//= require plugin_tests
|
||||||
//= require_self
|
//= require_self
|
||||||
//
|
//
|
||||||
//= require jquery.magnific-popup-min.js
|
//= require jquery.magnific-popup.min.js
|
||||||
|
|
||||||
window.inTestEnv = true;
|
window.inTestEnv = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue