From 3ea5bca755842321ad3ec1a2b706c630bc9b6d39 Mon Sep 17 00:00:00 2001 From: Jian Date: Sun, 6 Oct 2019 22:32:21 +1100 Subject: [PATCH] Added flag to turn off image featherlight --- exampleSite/content/cont/markdown.en.md | 8 ++++++++ static/js/hugo-learn.js | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/exampleSite/content/cont/markdown.en.md b/exampleSite/content/cont/markdown.en.md index b961bcdd77..c4ff55f972 100644 --- a/exampleSite/content/cont/markdown.en.md +++ b/exampleSite/content/cont/markdown.en.md @@ -663,3 +663,11 @@ Add a HTTP `classes` parameter to the link image to add CSS classes. `shadow`and ![stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg?classes=border,shadow) ``` ![stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg?width=40pc&classes=border,shadow) + +### Lightbox + +Add a HTTP `featherlight` parameter to the link image to disable lightbox. By default lightbox is enabled using the featherlight.js plugin. You can disable this by defining `featherlight` to `false`. + +```markdown +![Minion](https://octodex.github.com/images/minion.png?featherlight=false) +``` diff --git a/static/js/hugo-learn.js b/static/js/hugo-learn.js index 5bd763603b..5fad00a46f 100644 --- a/static/js/hugo-learn.js +++ b/static/js/hugo-learn.js @@ -21,8 +21,13 @@ var images = $("div#body-inner img").not(".inline"); // Wrap image inside a featherlight (to get a full size view in a popup) images.wrap(function(){ var image =$(this); - if (!image.parent("a").length) { - return ""; + var o = getUrlParameter(image[0].src); + var f = o['featherlight']; + // IF featherlight is false, do not use feather light + if (f != 'false') { + if (!image.parent("a").length) { + return ""; + } } });