22 * Lightbox3 for Redmine 6 - Universal Compatibility Version
33 * This script is designed to work with both Redmine 6.0.x and 6.1.x,
44 * especially handling the different HTML structures for journal attachments.
5+ *
6+ * UPDATE: The applyLightbox function now explicitly ignores download icon links.
57 */
68$ ( document ) . ready ( function ( ) {
79
@@ -11,7 +13,8 @@ $(document).ready(function() {
1113 var href = $link . attr ( 'href' ) || "" ;
1214 var text = $link . text ( ) || "" ;
1315
14- if ( $link . hasClass ( 'delete' ) || $link . hasClass ( 'icon-del' ) || href === "" ) {
16+ // THE KEY CHANGE IS HERE: We added a new condition to ignore download icons.
17+ if ( $link . hasClass ( 'delete' ) || $link . hasClass ( 'icon-del' ) || $link . hasClass ( 'icon-download' ) || href === "" ) {
1518 return ;
1619 }
1720
@@ -34,8 +37,6 @@ $(document).ready(function() {
3437 } ) ;
3538
3639 // 2. Journal / Notes Section - The key compatibility fix
37- // This selector now includes patterns for BOTH Redmine 6.0.x and 6.1.x.
38- // It will find the correct links in either environment.
3940 var journalAttachmentSelectors = [
4041 'div.journal ul.details a[href*="/attachments/"]:not(.icon-download)' , // Redmine 6.0.x filename links
4142 'div.journal div.thumbnails a' , // Redmine 6.0.x thumbnail links
@@ -46,8 +47,6 @@ $(document).ready(function() {
4647 $ ( journalAttachmentSelectors ) . each ( function ( ) {
4748 var $link = $ ( this ) ;
4849 var wrongHref = $link . attr ( 'href' ) ;
49-
50- // Find the filename from either img alt/title or the link text itself.
5150 var filename = $link . find ( 'img' ) . attr ( 'alt' ) || $link . find ( 'img' ) . attr ( 'title' ) || $link . text ( ) . trim ( ) ;
5251
5352 if ( wrongHref && filename ) {
0 commit comments