adapt original note resizing js code