Created
March 24, 2016 18:19
-
-
Save jonathanheilmann/20bc6bd3649976f479ca to your computer and use it in GitHub Desktop.
jh_magnificpopup: Add filename to description in below right corner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function($) { | |
$('{selector}').each(function() { | |
$(this).magnificPopup({ | |
delegate: 'a:isImageFile', | |
tClose: '<f:translate key="tClose" extensionName="JhMagnificpopup"></f:translate>', | |
type: 'image', | |
tLoading: '<f:translate key="tLoading" extensionName="JhMagnificpopup"></f:translate>', | |
mainClass: '<f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.mainClass" />', | |
gallery: { | |
enabled: <f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.galleryEnabled" />, | |
preload: <f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.galleryPreload" />, | |
navigateByImgClick: <f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.galleryNavigateByImgClick" />, | |
arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', | |
tPrev: '<f:translate key="tPrev" extensionName="JhMagnificpopup"></f:translate>', | |
tNext: '<f:translate key="tNext" extensionName="JhMagnificpopup"></f:translate>', | |
tCounter: '<f:translate key="tCounter" extensionName="JhMagnificpopup"></f:translate>' | |
}, | |
image: { | |
cursor: '<f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.imageCursor" />', | |
titleSrc: function(item) { | |
var res = ''; | |
if (typeof item.el.attr('title') !== typeof undefined && item.el.attr('title') !== '') { | |
res = item.el.attr('title'); | |
} | |
if (typeof item.el.attr('data-image-filename') !== typeof undefined && item.el.attr('data-image-filename') !== '') { | |
var imageFilename = item.el.attr('data-image-filename') | |
imageFilename = imageFilename.substring(0, imageFilename.lastIndexOf('.')); | |
if (res == '') { | |
res = imageFilename; | |
} else { | |
res = res.concat(' · ' + imageFilename); | |
} | |
} | |
return res; | |
}, | |
verticalGap: <f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.imageVerticalGap" />, | |
verticalFit: <f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.imageVerticalFit" />, | |
tError: '<f:translate key="tError" extensionName="JhMagnificpopup"></f:translate>' | |
}, | |
removalDelay: <f:cObject typoscriptObjectPath="plugin.tx_jhmagnificpopup.settings.magnificpopup.templateVariables.removalDelay" /> | |
}); | |
}); | |
})(window.jQuery || window.Zepto); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Override template for mfp javascript (adjust path to your needs) | |
page.jsFooterInline.109.file = fileadmin/[...]/jh_magnificpopup/Templates/TypoScript/Default_filename.html | |
# Add required attributes to image link tag | |
tt_content.image.20.1.params.dataWrap = data-image-filename = "{file:current:name}" | |
tt_content.image.20.1.imageLinkWrap.linkParams.ATagParams.dataWrap = class="magnificpopup" data-image-filename = "{file:current:name}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment