deposit: non spaghetti code of the modal_preview.js

Signed-off-by: Georgios Kokosioulis <georgios.kokosioulis@cern.ch>