Remove the Javascript code from widgets.py

The Javascript code embedded in the widgets.py file can cause some troubles regarding the order that scripts are being loaded.