Reusable Accessible Mapping Platform

API Docs for: 4.0.0
Show:

File: src\js\RAMP\RAMP-starter.js

  1. /*global location, $, document */
  2.  
  3. /**
  4. *
  5. *
  6. * @module RAMP
  7. */
  8.  
  9. /**
  10. * RAMPStarter class.
  11. * Performs initial configuration of the dojo config object specifying path to the RAMP modules, detecting locale, and loading the {{#crossLink "Bootstrapper"}}{{/crossLink}} module.
  12. * pipe the locale to dojo.
  13. *
  14. * @class RAMPStarter
  15. * @static
  16. */
  17.  
  18. //required to get draw bar to show in French
  19. var RAMP,
  20. jsFolderPath = "js/",
  21. pathname = location.pathname.replace(/\/[^/]+$/, "") + "/",
  22. htmlNode = $("html"),
  23. dojoConfig;
  24.  
  25. /**
  26. * RAMP global class.
  27. * A general globally available class to hold any RAMP global data. Currently houses any plugins which are not loaded via AMD.
  28. *
  29. * @class RAMP
  30. */
  31. RAMP = {
  32. /**
  33. * Contains a URL that points to the application configuration (JSON format) if it's hosted on a web service.
  34. * This is not required if the application has a JSON config file in the website's folder
  35. * @property configServiceURL
  36. * @type String
  37. */
  38. configServiceURL: "http://localhost:5000/",
  39.  
  40. /**
  41. * The RAMP application config, it should be treated as read only by all modules other than globalStorage and bootstrapper
  42. *
  43. * @property config
  44. * @type Object
  45. */
  46. config: {},
  47.  
  48. /**
  49. * A registry of plugins for RAMP code to reference, these should be loaded and registered by bootstrapper.js
  50. *
  51. * @property plugins
  52. * @type Object
  53. */
  54. plugins: {
  55. featureInfoParser: {}
  56. }
  57. };
  58.  
  59. dojoConfig = {
  60. parseOnLoad: false,
  61. locale: htmlNode.attr("lang"),
  62. async: true,
  63. packages: [
  64. {
  65. name: "ramp",
  66. location: pathname + jsFolderPath + "RAMP/Modules"
  67. },
  68. {
  69. name: "utils",
  70. location: pathname + jsFolderPath + "RAMP/Utils"
  71. },
  72. {
  73. name: "tools",
  74. location: pathname + jsFolderPath + "RAMP/Tools/"
  75. }
  76. ],
  77. fullPluginPath: pathname + jsFolderPath + 'plugins/'
  78. };
  79.  
  80. $(document).ready(function () {
  81. "use strict";
  82. // when loading js file this way, it will NOT show up in the debug panel in Firebug
  83. /*$.getScript(pathname + jsFolderPath + state + "RAMP/bootstrapper.js",
  84. function( data, textStatus, jqxhr ) {
  85. console.log( jqxhr.status ); // 200
  86. });*/
  87.  
  88. // when loading js file this way, it will show up in the debug panel in Firebug
  89. var head = document.getElementsByTagName('head')[0],
  90. script = document.createElement('script');
  91. script.type = 'text/javascript';
  92. script.src = pathname + jsFolderPath + "RAMP/bootstrapper.js";
  93. head.appendChild(script);
  94. });