Skip to content

Commit

Permalink
change for DMSF support: add DMSF file ID to lightbox title // fixes #73
Browse files Browse the repository at this point in the history
  • Loading branch information
tofi86 committed Nov 2, 2019
1 parent 2225162 commit 56fbecf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions assets/javascripts/lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ $(document).ready(function() {
// extract filename from attribute 'data-downloadurl' from closest element with the same 'href'
var href = $(this).attr('href');
var ddUrl = $(this).attr('data-downloadurl');
var dmsfId = href.replace(/.*\/files\/(\d+)\/view/g, '$1');
var filename = "";
var title = ""

Expand Down Expand Up @@ -139,8 +140,8 @@ $(document).ready(function() {
$(this)
.addClass('lightbox')
.attr('data-type', isPdf ? 'iframe' : 'image')
.attr('title', title)
.attr('data-caption', title)
.attr('title', "[" + dmsfId + "] " + title)
.attr('data-caption', "[" + dmsfId + "] " + title)
.attr('data-fancybox', 'dmsf-' + relgroup);
// do not remove 'data-downloadurl' here otherwise the filename extraction crashes for following dmsf thumbnails
}
Expand Down

0 comments on commit 56fbecf

Please sign in to comment.