diff --git a/js/index.js b/js/index.js
index 803250c..213a2b4 100644
--- a/js/index.js
+++ b/js/index.js
@@ -215,7 +215,7 @@ var WWW = (function(undefined) {
$('#uuid').val(uuid);
}
- function set_content(data, xhr) {
+ function set_content(data, xhr, id) {
if (xhr.getResponseHeader('etag') == null) {
try {
@@ -229,6 +229,18 @@ var WWW = (function(undefined) {
if (ct.startsWith("text/")) {
$('#content').val(data);
return;
+ } else if (ct.startsWith("image/")) {
+ var link = $('')
+ .attr('href', 'https://ptpb.pw/' + id)
+ .attr('target', '_blank')
+ .attr('title', 'Opens in a new window');
+
+ var img = $('
')
+ .attr('src', 'https://ptpb.pw/' + id)
+ .attr('height', '10%')
+ .attr('width', '30%');
+
+ alert_new().append(alert_title('image loaded', $(link).append(img)));
} else {
alert_new().append(alert_title('status', 'cowardly refusing to display C-T: ' + ct));
}
@@ -354,7 +366,7 @@ $(function() {
spinner.removeClass('hidden');
api.paste.get(id).done(function(data, status, xhr) {
- app.set_content(data, xhr);
+ app.set_content(data, xhr, id);
spinner.addClass('hidden');
});