all this should be migrated to the script view class as it should only be added to page when the script view is active.

try and work it into the script view init method, but make sure that only one is inserted (in case multiple script view objects are created).