From 54e401d0b2cfe4dcf1d7079d5052038262bce975 Mon Sep 17 00:00:00 2001 From: Anthony Nemoff Date: Fri, 21 Oct 2022 20:24:59 +0200 Subject: [PATCH 1/2] Cleanup trailing whitespaces in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index adcaf6c..87a730d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# MkDocs GLightbox +# MkDocs GLightbox [![PyPI version](https://img.shields.io/pypi/v/mkdocs-glightbox.svg)](https://pypi.org/project/mkdocs-glightbox) [![PyPI downloads](https://img.shields.io/pypi/dm/mkdocs-glightbox.svg)](https://pypi.org/project/mkdocs-glightbox) @@ -43,7 +43,7 @@ GLightbox is a pure javascript lightbox library with mobile support. height: auto zoomable: true draggable: true - skip_classes: + skip_classes: - custom-skip-class-name auto_caption: false caption_position: bottom From 3e7f0b752291fa211482f960e977e5dbc421a0ae Mon Sep 17 00:00:00 2001 From: Anthony Nemoff Date: Fri, 21 Oct 2022 20:28:10 +0200 Subject: [PATCH 2/2] Add support for slide_effect This option corresponds to GLightbox "slideEffect". The default value is unchanged and is "slide". --- README.md | 2 ++ mkdocs_glightbox/plugin.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 87a730d..ba3a766 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ GLightbox is a pure javascript lightbox library with mobile support. touchNavigation: true loop: false effect: zoom + slide_effect: slide width: 100% height: auto zoomable: true @@ -54,6 +55,7 @@ GLightbox is a pure javascript lightbox library with mobile support. | touchNavigation | true | Enable or disable the touch navigation (swipe). | | loop | false | Loop slides on end. | | effect | zoom | Name of the effect on lightbox open. (zoom, fade, none) | + | slide_effect | slide | Name of the effect on lightbox slide. (slide, zoom, fade, none) | | width | 100% | Width for inline elements and iframes. You can use any unit for example 90% or 100vw for full width. | | height | auto | Height for inline elements and iframes. You can use any unit for example 90%, 100vh or auto. | | zoomable | true | Enable or disable zoomable images. | diff --git a/mkdocs_glightbox/plugin.py b/mkdocs_glightbox/plugin.py index dd1584e..68a70b8 100644 --- a/mkdocs_glightbox/plugin.py +++ b/mkdocs_glightbox/plugin.py @@ -19,6 +19,8 @@ class LightboxPlugin(BasePlugin): ("loop", config_options.Type(bool, default=False)), ("effect", config_options.Choice(("zoom", "fade", "none"), default="zoom")), + ("slide_effect", + config_options.Choice(("slide", "zoom", "fade", "none"), default="slide")), ("width", config_options.Type(str, default="100%")), ("height", config_options.Type(str, default="auto")), ("zoomable", config_options.Type(bool, default=True)), @@ -71,6 +73,7 @@ def on_post_page(self, output, page, config, **kwargs): } lb_config['openEffect'] = plugin_config.get('effect', 'zoom') lb_config['closeEffect'] = plugin_config.get('effect', 'zoom') + lb_config['slideEffect'] = plugin_config.get('slide_effect', 'slide') js_code.string = f"const lightbox = GLightbox({json.dumps(lb_config)});" if config[ "theme"].name == "material" or "navigation.instant" in config[