Update script.js

Updated javascript for iOS 7.