added OSRM.CONSTANTS, OSRM.GLOBALS for better structuring,

improved comments in OSRM.base.js and OSRM.config.js
This commit is contained in:
DennisSchiefer 2012-03-17 14:45:04 +01:00
parent 9567a7e38c
commit 9adb590ce7
2 changed files with 9 additions and 6 deletions

View File

@ -16,13 +16,16 @@ or see http://www.gnu.org/licenses/agpl.txt.
*/
// OSRM base class
// [has to loaded before all other OSRM classes]
// [has to be loaded before all other OSRM classes]
OSRM = {};
var OSRM = {};
OSRM.VERSION = '0.1.1';
OSRM.CONSTANTS = {};
OSRM.DEFAULTS = {};
OSRM.GLOBALS = {};
// inheritance helper function (convenience function)
// [convenience function] declare one class to be a subclass of another class
OSRM._inheritFromHelper = function() {};
OSRM.inheritFrom = function( sub_class, base_class ) {
OSRM._inheritFromHelper.prototype = base_class.prototype;
@ -32,7 +35,7 @@ OSRM.inheritFrom = function( sub_class, base_class ) {
};
// class prototype extending helper function (convenience function)
// [convenience function] extend prototypes of a class -> used to add member values and functions
OSRM.extend = function( target_class, properties ) {
for( property in properties ) {
target_class.prototype[property] = properties[property];
@ -40,7 +43,7 @@ OSRM.extend = function( target_class, properties ) {
};
// usage:
// [usage of convenience functions]
// SubClass = function() {
// SubClass.prototype.base.constructor.apply(this, arguments);
// }

View File

@ -21,7 +21,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
OSRM.DEFAULTS = {
HOST_ROUTING_URL: 'http://router.project-osrm.org/viaroute',
HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/',
WEBSITE_URL: document.URL.replace(/#*\?.*/i,""),
WEBSITE_URL: document.URL.replace(/#*(\?.*|$)/i,""), // truncates URL before first ?, and removes tailing #
JSONP_TIMEOUT: 5000,
ZOOM_LEVEL: 14,
ONLOAD_LATITUDE: 48.84,