In order to reduce file size and to optimize the code, the JavaScript used in the mobile versions of the campus map is compiled using Google’s Closure Compiler. The code is a combination of several different source files compiled into the final file. The compiler requires any references to libraries or functions outside of the source files to be defined in extern files.
The main version is compiled from the following source files:
- shuttlemarker.js
- map_mobile_uncompressed.js – main logic for the map
- w3c_geolocation.js – extern file for the W3C Geolocation API now included in the default Closure-compiler externs
- google_maps_api_v3_2.js – extern file for the Google Maps V3 JavaScript API
Opera Mobile Support
Opera Mobile is not an officially supported browser for the Google Maps V3 JavaScript API. However, most of the basic functionality of the map works normally. The major exceptions related to the mobile campus map are the inability to pan the map by dragging and polylines.
In order to overcome these shortcomings, two additional source libraries are included in the opera version of the script:
- canvaspolylines.js – uses the HTML 5 canvas tag to provide basic polyline support in Opera – not needed with KmlLayers
- zoompancontrol.js – adds a small zoom and pan control to compensate for the inability to drag the map
Output Wrapping
The compiled output is wrapped in an anonymous function to prevent the global namespace from being polluted.
Update: 3/31/2010
I’ve now also compiled the main campus map with Closure Compiler. The original source files are:
- Personal and Course Websites to be Discontinued October 1 - June 21, 2024
- How catalog changes will affect your academic website - May 13, 2024
- Partial Site Outage 4-30-24 - April 30, 2024
- Modern Campus Calendar Details - April 2, 2024
- Calendar updates: Training available - March 20, 2024
- Updates: New Modern Campus Calendar - March 7, 2024
- Preview MSU’s new calendar system - January 22, 2024
- Recap: Hello Omni CMS, goodbye Web Press! - March 14, 2023
- Improve your Omni CMS skills at this free training - February 21, 2023
- Celebrate Global Accessibility Awareness Day (GAAD) on May 19 - May 16, 2022