diff --git a/WebContent/routing.js b/WebContent/OSRM.Routing.js similarity index 100% rename from WebContent/routing.js rename to WebContent/OSRM.Routing.js diff --git a/WebContent/OSRM.base.js b/WebContent/OSRM.base.js index 8555c073f..6fab319cd 100644 --- a/WebContent/OSRM.base.js +++ b/WebContent/OSRM.base.js @@ -28,17 +28,20 @@ OSRM.G = OSRM.GLOBALS; // abbreviations OSRM.C = OSRM.CONSTANTS; -// [convenience function] declare one class to be a subclass of another class -OSRM._inheritFromHelper = function() {}; +// declare one class to be a subclass of another class +// (runs anonymous function to prevent local functions cluttering global namespace) +(function() { +var _inheritFromHelper = function() {}; OSRM.inheritFrom = function( sub_class, base_class ) { - OSRM._inheritFromHelper.prototype = base_class.prototype; - sub_class.prototype = new OSRM._inheritFromHelper(); + _inheritFromHelper.prototype = base_class.prototype; + sub_class.prototype = new _inheritFromHelper(); sub_class.prototype.constructor = sub_class; sub_class.prototype.base = base_class.prototype; }; +}()); -// [convenience function] extend prototypes of a class -> used to add member values and functions +// 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]; diff --git a/WebContent/main.html b/WebContent/main.html index 2b5ba7740..c53a8e78f 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -56,7 +56,7 @@ or see http://www.gnu.org/licenses/agpl.txt. - +