Optimisations

Outline of work done:
    
* Move all app-related common files to app/ directory.
* Move non-essential files out of app/ (e.g. OFL.txt).
* Use requirejs to load all JS: this reduces the number of script tags and makes the app structure more obvious.
* Remove some unused images (reduces package size).
* Load HTML in two stages: 1) load HTML for the front page; 2) load remaining HTML via an ajax call (NB event handlers are still bound across the DOM once all HTML is loaded). This accelerates the initial page show.
* Split game-specific code into a Game object.
* Move gamesound into its own "class" file.
* Manage sounds through a central Sounds object. This is also used to lazy-load audio files once the DOM is loaded, rather than loading them up-front with the DOM.
* Refer to levels, level-related objects (sounds, game data) and their related DOM elements with a level number, rather than using zero-indexed arrays. This removes the need to add/subtract 1 from the level number to enable correlation between game objects, DOM elements, and game levels.
* Add a grunt build to make and deploy a wgt file to Tizen devices. This also concatenates and minifies JS (using r.js) and CSS, optimises images, and removes unnecessary whitespace from the HTML index file. In addition, it provides a simple web server for testing, and can build a distribution suitable for use as a Chrome extension.
* Use bower to install and track external 3rd party client-side library dependencies.
* Fix the Chrome manifest so the app will load correctly as an extension.
* Fix Makefile and desktop file so Linux installation works.
* Switch to jqmobi rather than jQuery: smaller JS file to load, but with the same API; also, jqmobi performance is better (at least according to http://www.codefessions.com/2012/08/performance-of-jquery-compatible-mobile.html).
* Add a HACKING file to explain deployment options and how to work on the code base.

Effect of optimisations:

* optimised page show time (time to get to a visible page) is 43% of original page show time (using performance.timing, measuring from the first event recorded to DOMContentLoadedEventEnd)
* optimised load time (time to get to a functional page) is 62% of base load time (performance.timing again, measuring from the first recorded event to the last)