Skip to content

Commit c869eb2

Browse files
committed
Fix bug for class icon-download
1 parent 3bc7e18 commit c869eb2

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

app/assets/javascripts/lightbox.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
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) {

init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
name 'Lightbox3 Plugin (Support Redmine 6 or higher)'
4242
author 'tomy'
4343
description 'This is a plugin for Redmine to preview image and PDF attachments in a lightbox'
44-
version '1.0.0'
44+
version '1.1.0'
4545
url 'https://redmine-tw.net'
4646
author_url 'https://github.com/tomy-shen'
4747

0 commit comments

Comments
 (0)