This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/resize/script.js

20 lines
568 B
JavaScript
Raw Normal View History

2020-03-02 17:12:43 +00:00
document.addEventListener('DOMContentLoaded', () => {
2017-09-17 14:09:25 +00:00
var original_width = $("#original_width").val();
var original_height = $("#original_height").val();
$("#resize_width").change(function() {
if($("#resize_aspect").prop("checked")) {
$("#resize_height").val(
Math.round($("#resize_width").val() / original_width * original_height)
);
}
});
$("#resize_height").change(function() {
if($("#resize_aspect").prop("checked")) {
$("#resize_width").val(
Math.round($("#resize_height").val() / original_height * original_width)
);
}
});
});