Remove optional attribute `type` from script tags
Refactor code

* Simplify and make code more consistent / readable.
* Remove / replace the parts of the code that do not work across
  browsers (e.g.: customizable `console.log` messages), or are
  considered bad practices (e.g.: using `void`).