cleanup: wrapped file in an IIFE
- unpolluted global object/namespace
- code is not referenced elsewhere in the project
performance: enable js caching by default
- Caching should be enabled by default.
- We only want to disable it during development.
-- Developers will edit source code:
--- end-users won't.
cleanup: removed unnecessary framework check
- Since we are hosting the JS code, we can guarantee which version will be loaded.
- Throwing an exception on jQuery's load failure isn't needed; the code's going to break hard immediately, anway.
-- At that point (with JS files failing to load), we have bigger problems...
cleanup: removed unreferenced function
- call Math.random() directly
cleanup: abstracted Launcher load logic
- The library already had the ability to specify the js files to be loaded via a query string param on the Launcher.js file.
- This change utilizes it.
-- Now all of the javascript includes are specified in the same place (index.html),
--- instead of burying the defaults in the Launcher library
cleanup: jquery now loaded through Launcher.js
- Replaced $.find with native DOM getElementsByTagName.
- Replaced $.each with native for loops.
performance: load the minified jQuery
fix: syntax
- added missing semicolons
- escaped hyphen in regex class
performance: moved script tag to end of body
- Javascript loads block page rendering, so we move it to the end of the BODY.
-- By this point, the base HTML and CSS have been loaded and can be applied.
cleanup: removed unneed object declaration
- Objects/prototypes are *usually* good ideas,
-- but here it doesn't make sense.
- This script has no state, is passed no variables.
-- It is a one-off executed series of instructions,
--- so a "script", not an object/model definition.
- We never need more than one instance of this
-- (though you could)
-- because it operates directly on the global window.
- The encapsulation originally helped keep
-- the global namespace cleaner.
-- But now we do this more cleanly with an IIFE.
- Conveniently, it's less code and less complicated.
cleanup: removed unnecessary abstraction
- This system may have made sense for scriptaculous,
-- but it's overkill here.
- We want to import a list of javascript files.
-- So we create an array and iterate across.
--- No need to lookup DOM elements,
---- or parsing attribute hrefs w/ regexps
- removed outdated comments
-- Script is no longer based on scriptaculous.
cleanup: removed superfluous function
- We have two lines of logic in the entire library,
-- so a separate function was overkill.
cleanup: renamed "constants"
- These acted like constants, when this was a larger library.
- Now, they are just variables in a quick script,
-- so we update the naming convention back to lower case
cleanup: updated syntax for jslint compatability
- Now each line is under 80 characters
- /*jslint browser: true, indent: 2, maxlen: 80 */
- global: window
- One error remaining:
-- "document.write can be a form of eval."
- Will have to look into another solution for this..
cleanup: variable renamed, simplified syntax
cleanup: moved page initialization to a separate file, instead of inlining it
- this allows the browser to cache more, too