Update script.js

Main update for today button and algorithm refactoring