1- /// <reference types="imagelightbox" />
2-
1+ import { ImageLightbox } from 'imagelightbox' ;
32import { default as justifiedLayout } from 'justified-layout' ;
43
54import { isError } from '../../isError' ;
@@ -15,7 +14,19 @@ export class Shortcode {
1514 private readonly pageQueryParameter : QueryParameter ;
1615 private readonly pathQueryParameter : QueryParameter ;
1716
18- private lightbox : JQuery = $ ( ) ;
17+ private readonly lightbox = new ImageLightbox ( [ ] , {
18+ allowedTypes : '' ,
19+ animationSpeed : parseInt ( sgdgShortcodeLocalize . preview_speed , 10 ) ,
20+ activity : 'true' === sgdgShortcodeLocalize . preview_activity ,
21+ arrows : 'true' === sgdgShortcodeLocalize . preview_arrows ,
22+ button : 'true' === sgdgShortcodeLocalize . preview_closebutton ,
23+ fullscreen : true ,
24+ gutter : 0 ,
25+ history : true ,
26+ overlay : true ,
27+ caption : 'true' === sgdgShortcodeLocalize . preview_captions ,
28+ quitOnEnd : 'true' === sgdgShortcodeLocalize . preview_quitOnEnd ,
29+ } ) ;
1930 private hasMore = false ;
2031 private path = '' ;
2132 private lastPage = 1 ;
@@ -152,19 +163,6 @@ export class Shortcode {
152163 private get ( ) : void {
153164 this . path = this . pathQueryParameter . get ( ) ;
154165 this . lastPage = parseInt ( this . pageQueryParameter . get ( ) ) || 1 ;
155- this . lightbox = $ ( ) . imageLightbox ( {
156- allowedTypes : '' ,
157- animationSpeed : parseInt ( sgdgShortcodeLocalize . preview_speed , 10 ) ,
158- activity : 'true' === sgdgShortcodeLocalize . preview_activity ,
159- arrows : 'true' === sgdgShortcodeLocalize . preview_arrows ,
160- button : 'true' === sgdgShortcodeLocalize . preview_closebutton ,
161- fullscreen : true ,
162- gutter : 0 ,
163- history : true ,
164- overlay : true ,
165- caption : 'true' === sgdgShortcodeLocalize . preview_captions ,
166- quitOnEnd : 'true' === sgdgShortcodeLocalize . preview_quitOnEnd ,
167- } ) ;
168166 this . container
169167 . find ( '.sgdg-gallery' )
170168 . replaceWith ( '<div class="sgdg-loading"><div></div></div>' ) ;
@@ -347,8 +345,10 @@ export class Shortcode {
347345 } ) ;
348346 this . reflowTimer ( ) ;
349347
350- this . lightbox . addToImageLightbox (
351- this . container . find ( 'a[data-imagelightbox]' )
348+ this . lightbox . addImages (
349+ this . container
350+ . find ( 'a[data-imagelightbox]' )
351+ . get ( ) as Array < HTMLAnchorElement >
352352 ) ;
353353 if ( 'true' === sgdgShortcodeLocalize . page_autoload ) {
354354 $ ( window )
0 commit comments