Revert "remove estimated ram use stuff as it is no longer possible"

This reverts commit 2e675a338b.
This commit is contained in:
Isaac Connor 2021-05-06 09:54:06 -04:00
parent f4bbacb3f4
commit 0adc2d96d6
1 changed files with 13 additions and 0 deletions

View File

@ -48,6 +48,7 @@ function updateMonitorDimensions(element) {
form.elements['newMonitor[Height]'].value = dimensions[1];
}
}
update_estimated_ram_use();
return false;
}
@ -139,6 +140,9 @@ function initPage() {
form.submit();
};
});
document.querySelectorAll('input[name="newMonitor[ImageBufferCount]"],input[name="newMonitor[Width]"],input[name="newMonitor[Height]"]').forEach(function(el) {
el.oninput = window['update_estimated_ram_use'].bind(el);
});
document.querySelectorAll('select[name="newMonitor[Function]"]').forEach(function(el) {
el.onchange = function() {
@ -306,6 +310,15 @@ function random_WebColour() {
);
}
function update_estimated_ram_use() {
var buffer_count = document.querySelectorAll('input[name="newMonitor[ImageBufferCount]"]')[0].value;
var width = document.querySelectorAll('input[name="newMonitor[Width]"]')[0].value;
var height = document.querySelectorAll('input[name="newMonitor[Height]"]')[0].value;
var colours = document.querySelectorAll('select[name="newMonitor[Colours]"]')[0].value;
document.getElementById('estimated_ram_use').innerHTML = human_filesize(buffer_count * width * height * colours, 0);
}
function updateLatitudeAndLongitude(latitude, longitude) {
var form = document.getElementById('contentForm');
form.elements['newMonitor[Latitude]'].value = latitude;