Update scripts.js

add sorting of 'inactive' events