browser extension modifying site’s javascript

I want to make a simple browser extension that would do the following:

Replace hjkl vim keys with jkl; at compiler explorer’s vim-mode.

I figured out that I can open devtools, put a breakpoint somewhere here and
paste the following code in the console

monacoVim.VimMode.Vim.noremap(';', 'l');
monacoVim.VimMode.Vim.noremap('l', 'k');
monacoVim.VimMode.Vim.noremap('k', 'j');
monacoVim.VimMode.Vim.noremap('j', 'h');
monacoVim.VimMode.Vim.noremap('h', ';');

This has the desired effect, however I would like not to have any manual steps. So I would like to write an extension that achieves the same effect.

Apart from compiler explorer I need the approach to be applicable for closed-source sites like hackerrank, so commiting to opensource is not applicable in my case.

How can I write an extension that would modify site’s js the way I described? Or are there any other ways to achieve the desired effect?