diff --git a/web/skins/classic/views/js/monitor.js b/web/skins/classic/views/js/monitor.js index aa595a31f..bcc4681bb 100644 --- a/web/skins/classic/views/js/monitor.js +++ b/web/skins/classic/views/js/monitor.js @@ -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;