User blog comment:Benjaminthewill123123/Has anyone else ever considered/used this?/@comment-2200849-20130424210831

Hey, here are some suggestions.

First, I think you should implement a mechanism for users to be able to customize the scripts they would like to load. Currently, your settings are hardcoded, so the users have no way of adding their own scripts, or removing others.

The universally accepted way to create this&mdash;also as per the MediaWiki coding conventions would be to create your widget in its own namespace, i.e. a subset of the global window object, or execute it with an Immediately-Invoked-Function-Expression (iffy). In this particular case, you could go for a hybrid approach, reading the configuration values from an object and performing the actions themselves in the iffy.

Aside of the stylistic and technical conventions I'd linked to, here are some technical tips. First, the way you are currently checking for the namespace could be better implemented with, as you are only working with one variable. Checking whether the script has loaded can be debated, but what is certain is that it'd be better to make it silently fail instead of displaying an alert box, which most users will probably be surprised by. A graceful way to do so would be to log the error to the web console with console.log or $.log.