trim the end of script URLs