Reusable Accessible Mapping Platform

API Docs for: 5.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. * A temporary solution to state management. Will be changed
  60. *
  61. * @property state
  62. * @type Object
  63. */
  64. state: {
  65. ui: {
  66. sidePanelOpened: true,
  67. fullscreen: false
  68. }
  69. }
  70. };
  71.  
  72. dojoConfig = {
  73. parseOnLoad: false,
  74. locale: htmlNode.attr("lang"),
  75. async: true,
  76. packages: [
  77. {
  78. name: "ramp",
  79. location: pathname + jsFolderPath + "RAMP/Modules"
  80. },
  81. {
  82. name: "utils",
  83. location: pathname + jsFolderPath + "RAMP/Utils"
  84. },
  85. {
  86. name: "tools",
  87. location: pathname + jsFolderPath + "RAMP/Tools/"
  88. }
  89. ],
  90. fullPluginPath: pathname + jsFolderPath + 'plugins/'
  91. };
  92.  
  93. $(document).ready(function () {
  94. "use strict";
  95. // when loading js file this way, it will NOT show up in the debug panel in Firebug
  96. /*$.getScript(pathname + jsFolderPath + state + "RAMP/bootstrapper.js",
  97. function( data, textStatus, jqxhr ) {
  98. console.log( jqxhr.status ); // 200
  99. });*/
  100.  
  101. // when loading js file this way, it will show up in the debug panel in Firebug
  102. var head = document.getElementsByTagName('head')[0],
  103. script = document.createElement('script');
  104. script.type = 'text/javascript';
  105. script.src = pathname + jsFolderPath + "RAMP/bootstrapper.js";
  106. head.appendChild(script);
  107. });