diff --git a/css/osticket.css b/css/osticket.css index 1638f464cf1e8fb79e2f84866dacecbc9073213f..37cdb26f2846ac6df03cc266bc7b32f0a2785cd6 100644 --- a/css/osticket.css +++ b/css/osticket.css @@ -30,11 +30,12 @@ .non-local-image { display: inline-block; - border: 5px dashed #eee; + border: 3px dashed #eee; + border-radius: 5px; } .non-local-image:after { - background: url(../assets/default/images/logo.png) center left no-repeat; + background: url(../logo.php) center center no-repeat; background-size: cover; content: ""; z-index: -1; diff --git a/include/class.format.php b/include/class.format.php index 38aaec5c9cf33ee6ad7c1b66fb9b07be6353318e..3b841a4a585db66be41e2485acd5cf866b319d00 100644 --- a/include/class.format.php +++ b/include/class.format.php @@ -292,7 +292,7 @@ class Format { function($match) { // Drop embedded classes -- they don't refer to ours $match = preg_replace('/class="[^"]*"/', '', $match); - return sprintf('<div %s class="non-local-image" data-%s %s></div>', + return sprintf('<span %s class="non-local-image" data-%s %s></span>', $match[1], $match[2], $match[3]); }, $text); @@ -371,7 +371,7 @@ class Format { } // Images which are external are rewritten to <div // data-src='url...'/> - elseif ($e == 'div' && $a && isset($a['data-src'])) + elseif ($e == 'span' && $a && isset($a['data-src'])) $a['data-src'] = 'l.php?url='.urlencode($a['data-src']) .'&auth='.$token; // URLs for videos need to route too @@ -390,7 +390,7 @@ class Format { }, 'schemes' => 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; *:file, http, https; src: cid, http, https, data', 'elements' => '*+iframe', - 'spec' => 'div=data-src,width,height', + 'spec' => 'span=data-src,width,height', ); return Format::html($text, $config); } diff --git a/include/client/view.inc.php b/include/client/view.inc.php index 90897fd8a652399e0c75384125612b2c3a63d896..f326e2f29a4a759cb1fb7f4b968593f050bdd301 100644 --- a/include/client/view.inc.php +++ b/include/client/view.inc.php @@ -109,7 +109,12 @@ if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) { $poster = ' '; ?> <table class="thread-entry <?php echo $threadType[$entry['thread_type']]; ?>" cellspacing="0" cellpadding="1" width="800" border="0"> - <tr><th><?php echo Format::db_datetime($entry['created']); ?> <span class="textra"></span><span><?php echo $poster; ?></span></th></tr> + <tr><th><div> +<?php echo Format::db_datetime($entry['created']); ?> + <span class="textra"></span> + <span><?php echo $poster; ?></span> + </div> + </th></tr> <tr><td class="thread-body"><div><?php echo $entry['body']->toHtml(); ?></div></td></tr> <?php if($entry['attachments'] diff --git a/js/osticket.js b/js/osticket.js index fb88521f2dc83ad231f44d3323fc65e5a7998ba2..e3089ab2b25ab18b81439d2253715ee94793073d 100644 --- a/js/osticket.js +++ b/js/osticket.js @@ -124,39 +124,6 @@ $(document).ready(function(){ }); return str; }; -}); - -showImagesInline = function(urls, thread_id) { - var selector = (thread_id == undefined) - ? '.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 && !e.data('wrapped')) { - // Add a hover effect with the filename - var timeout, caption = $('<div class="image-hover">') - .css({'float':e.css('float')}); - e.wrap(caption).parent() - .hover( - function() { - var self = this; - timeout = setTimeout( - function() { $(self).find('.caption').slideDown(250); }, - 500); - }, - function() { - clearTimeout(timeout); - $(this).find('.caption').slideUp(250); - } - ).append($('<div class="caption">') - .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); - } - }); var showNonLocalImage = function(div) { var $div = $(div), @@ -175,7 +142,7 @@ showImagesInline = function(urls, thread_id) { // Optionally show external images $('.thread-entry').each(function(i, te) { var extra = $(te).find('.textra'), - imgs = $(te).find('div.non-local-image[data-src]'); + imgs = $(te).find('.non-local-image[data-src]'); if (!extra) return; if (!imgs.length) return; extra.append($('<a>') @@ -213,4 +180,37 @@ showImagesInline = function(urls, thread_id) { // TODO: Add a hover-button to show just one image }); }); +}); + +showImagesInline = function(urls, thread_id) { + var selector = (thread_id == undefined) + ? '.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 && !e.data('wrapped')) { + // Add a hover effect with the filename + var timeout, caption = $('<div class="image-hover">') + .css({'float':e.css('float')}); + e.wrap(caption).parent() + .hover( + function() { + var self = this; + timeout = setTimeout( + function() { $(self).find('.caption').slideDown(250); }, + 500); + }, + function() { + clearTimeout(timeout); + $(this).find('.caption').slideUp(250); + } + ).append($('<div class="caption">') + .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); + } + }); } diff --git a/scp/css/scp.css b/scp/css/scp.css index 4b92989e6a8d273216e675f966b73cec1e17b14f..345c3b1bee5cae0cb9f2c4e0189d04a65803a62d 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -1561,15 +1561,20 @@ ul.progress li.no small {color:red;} #loading h1, #upgrading h4 { margin: 3px 0 0 0; padding: 0; color: #d80; } #loading, #upgrading { color: white; } +.non-local-image { + display: inline-block; + border: 3px dashed #eee; + border-radius: 5px; +} .non-local-image:after { - background: url(../images/ost-logo.png) center center no-repeat; + background: url(../../logo.php) center center no-repeat; background-size: cover; content: ""; z-index: -1; width: 100%; height: 100%; - display: block; opacity: 0.3; + display: block; } input[type=text]:disabled, input[type=checkbox]:disabled { diff --git a/scp/js/ticket.js b/scp/js/ticket.js index e6f3f06e8a30874122f91d9411bb3051ba402037..19dd87940528b8044ba025b862532b1783fe5f57 100644 --- a/scp/js/ticket.js +++ b/scp/js/ticket.js @@ -404,7 +404,7 @@ var ticket_onload = function($) { // Optionally show external images $('.thread-entry').each(function(i, te) { var extra = $(te).find('.textra'), - imgs = $(te).find('div.non-local-image[data-src]'); + imgs = $(te).find('.non-local-image[data-src]'); if (!extra) return; if (!imgs.length) return; extra.append($('<a>')