From a7c4d31cbb6ccae3619e5f008f441d8aeb676c2f Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Fri, 11 Apr 2014 22:12:40 -0500 Subject: [PATCH] Fixup multiple download hovers on inline images --- include/staff/ticket-view.inc.php | 3 ++- scp/js/ticket.js | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index f885a7cef..621365fc4 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -375,7 +375,8 @@ $tcount+= $ticket->getNumNotes(); if ($urls) { ?> <script type="text/javascript"> $(function() { showImagesInline(<?php echo - JsonDataEncoder::encode($urls); ?>); }); + JsonDataEncoder::encode($urls); ?>, <?php echo + $entry['id']; ?>); }); </script> <?php } ?> diff --git a/scp/js/ticket.js b/scp/js/ticket.js index 7199d0829..f16576d6f 100644 --- a/scp/js/ticket.js +++ b/scp/js/ticket.js @@ -414,10 +414,10 @@ showImagesInline = function(urls, thread_id) { ? '.thread-body img[data-cid]' : '.thread-body#thread-id-'+thread_id+' img[data-cid]'; $(selector).each(function(i, el) { - var cid = $(el).data('cid').toLowerCase(), - info = urls[cid], - e = $(el); - if (info) { + var e = $(el), + cid = e.data('cid').toLowerCase(), + info = urls[cid]; + if (info && !e.data('wrapped')) { // Add a hover effect with the filename var timeout, caption = $('<div class="image-hover">') .css({'float':e.css('float')}); @@ -437,6 +437,7 @@ showImagesInline = function(urls, thread_id) { .append('<span class="filename">'+info.filename+'</span>') .append('<a href="'+info.download_url+'" class="action-button"><i class="icon-download-alt"></i> Download</a>') ); + e.data('wrapped', true); } }); } -- GitLab