Skip to content

Commit

Permalink
diff: added JS-function show_old_src_images()
Browse files Browse the repository at this point in the history
  • Loading branch information
drfho committed Nov 20, 2024
1 parent 3351b10 commit fb57c47
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Products/zms/zpt/versionmanager/manage_undoversionform.zpt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ function remove_curly_braces(str) {
return str.replace(/[\{\}]/g,'');
}

function show_old_src_images() {
$('.diff-container .diff img.tagdiff_replaced[data-old-src]').each(function() {
let $this = $(this);
let img = new Image();
img.src = $this.attr('data-old-src');
img.classList.add('old-src');
$this.before(img);
});
}

function get_htmldiff(container, qualifier) {
let originalContainer = qualifier + '.original';
let changedContainer = qualifier + '.changed';
Expand All @@ -126,6 +136,7 @@ function get_htmldiff(container, qualifier) {
data: data,
success: function(html) {
$('.diff.preview').html(html);
show_old_src_images()
}
});
}
Expand Down Expand Up @@ -289,6 +300,17 @@ $(function() {
text-decoration:none;
border-bottom:1px dotted #008ac7;
}
.diff-container a.tagdiff_replaced {
background-color:#fea;
}
.diff-container img.old-src {
max-width:80px;
max-height:80px;
position:absolute;
margin:-.3rem 0 0 -.3rem;
border:1px solid red;
box-shadow: 0 0 .25rem white;
}
</style>

<footer tal:replace="structure python:here.zmi_body_footer(here,request)">zmi_body_footer</footer>
Expand Down

0 comments on commit fb57c47

Please sign in to comment.