amber.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* Amber package loading
  2. usage example:
  3. TODO
  4. */
  5. var require;
  6. require = function (require) {
  7. var scripts = document.getElementsByTagName("script");
  8. var src = scripts[ scripts.length - 1 ].src;
  9. var home = resolveViaDOM(src).replace(/\/[^\/]+$/, "");
  10. function resolveViaDOM(url) {
  11. var a = document.createElement("a");
  12. a.href = url;
  13. return a.href;
  14. }
  15. var config = {
  16. baseUrl: home,
  17. paths: {
  18. 'amber_set': '.',
  19. 'amber_vm': '.',
  20. 'amber': '../js',
  21. 'amber/_source': '../st',
  22. 'jquery': 'jQuery/jquery-1.8.2.min',
  23. 'jquery-ui': 'jQuery/jquery-ui-1.8.16.custom.min'
  24. },
  25. map: {
  26. '*': {
  27. 'css': 'requirejs/require-css-0.0.6/css'
  28. },
  29. 'amber_set/full-devel-helios': {
  30. 'jquery-ui': 'jQuery/jquery-ui-1.8.24.custom.min'
  31. }
  32. },
  33. shim: {
  34. 'jquery-ui': {
  35. deps: [ 'jquery' ]
  36. },
  37. 'bootstrap/js/bootstrap': {
  38. deps: [ 'css!bootstrap/css/bootstrap' ]
  39. },
  40. 'CodeMirror/codemirror': {
  41. deps: [ 'css!CodeMirror/codemirror' ]
  42. },
  43. 'jQuery/jquery.textarea': {
  44. deps: [ 'jquery', 'jquery-ui' ]
  45. },
  46. 'CodeMirror/smalltalk': {
  47. deps: [ './codemirror' ]
  48. },
  49. 'CodeMirror/addon/hint/show-hint': {
  50. deps: [ '../../codemirror' ]
  51. },
  52. 'ensure-console': {
  53. exports: 'console'
  54. },
  55. 'amber/Kernel-Objects.deploy': {
  56. deps: []
  57. },
  58. 'amber/Kernel-Classes.deploy': {
  59. deps: [ './Kernel-Objects.deploy' ]
  60. },
  61. 'amber/Kernel-Methods.deploy': {
  62. deps: [ './Kernel-Objects.deploy' ]
  63. },
  64. 'amber/Kernel-Collections.deploy': {
  65. deps: [ './Kernel-Objects.deploy' ]
  66. },
  67. 'amber/Kernel-Infrastructure.deploy': {
  68. deps: [ './Kernel-Collections.deploy' ]
  69. },
  70. 'amber/Kernel-Exceptions.deploy': {
  71. deps: [ './Kernel-Objects.deploy' ]
  72. },
  73. 'amber/Kernel-Transcript.deploy': {
  74. deps: [ './Kernel-Objects.deploy' ]
  75. },
  76. 'amber/Kernel-Announcements.deploy': {
  77. deps: [ './Kernel-Objects.deploy' ]
  78. },
  79. 'amber/Canvas.deploy': {
  80. deps: [ './Kernel-Objects.deploy' ]
  81. },
  82. }
  83. };
  84. if (require) {
  85. require.config(config);
  86. return require;
  87. } else {
  88. return config;
  89. }
  90. }(require);