From d84ccd0a5edcd845e6cbbb4085688a2ca44457b9 Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Sun, 6 Aug 2017 17:00:40 +0200 Subject: [PATCH] support for DMSF plugin thumbnails // fixes #40 Adds the `thumbnail` class to DMSF thumbnails created by the DMSF thumbnail macro: `{{dmsftn(123)}}` # Conflicts solved by tofi86 # assets/javascripts/lightbox.js --- assets/javascripts/lightbox.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/assets/javascripts/lightbox.js b/assets/javascripts/lightbox.js index 1b7b3ea..f14f8fb 100644 --- a/assets/javascripts/lightbox.js +++ b/assets/javascripts/lightbox.js @@ -20,6 +20,16 @@ $(document).ready(function() { return 'thumbnails-' + $(this).closest('div.journal').attr('id'); }); + // #40 DMSF support: add class="thumbnail" to DMSF macro thumbnails + $("a[data-downloadurl][href^='/dmsf/files/'][href$='/view']").each(function(i, obj) { + $(this).attr('class', 'thumbnail') + .attr('data-fancybox-type', 'image') + .attr('title', $(this).attr('data-downloadurl').split(':')[1]) + .removeAttr('target') + .removeAttr('data-downloadurl'); + }); + + // Add Fancybox to image links $("div.attachments a.lightbox," + "div.attachments a.lightbox_preview," + "div.journal ul.details a[href$='.png']," + @@ -40,6 +50,7 @@ $(document).ready(function() { closeSpeed : 150 }); + // Add Fancybox to PDF links $("div.attachments a.pdf").fancybox({ prevEffect : 'none', nextEffect : 'none',