1
0

amber.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Amber package loading.
  2. Load this script as well as require.js (works in any order;
  3. either defines 'require', thus passing config, if loaded prior require.js;
  4. or calls require.config, if loaded post require.js).
  5. Usage example:
  6. require(['amber/devel'], function(smalltalk) {
  7. smallralk.initialize();
  8. smalltalk.Browser._open();
  9. });
  10. */
  11. var require;
  12. require = function (require) {
  13. var scripts = document.getElementsByTagName("script");
  14. var src = scripts[ scripts.length - 1 ].src;
  15. var home = resolveViaDOM(src).replace(/\/[^\/]+\/[^\/]+$/, "");
  16. function resolveViaDOM(url) {
  17. var a = document.createElement("a");
  18. a.href = url;
  19. return a.href;
  20. }
  21. var config = {
  22. paths: {
  23. 'amber': home+'/support',
  24. 'amber_vm': home+'/support',
  25. 'amber_css': home+'/css',
  26. 'amber_lib': home+'/support',
  27. 'amber_core': home+'/js',
  28. 'amber_core/_source': home+'/st',
  29. 'jquery': home+'/support/jQuery/jquery-1.8.2.min',
  30. 'jquery-ui': home+'/support/jQuery/jquery-ui-1.8.16.custom.min'
  31. },
  32. map: {
  33. '*': {
  34. 'css': 'amber_lib/requirejs/require-css-0.0.6/css'
  35. },
  36. 'amber/helios': {
  37. 'jquery-ui': 'amber_lib/jQuery/jquery-ui-1.8.24.custom.min'
  38. }
  39. },
  40. shim: {
  41. 'jquery-ui': {
  42. deps: [ 'jquery' ]
  43. },
  44. 'amber_lib/bootstrap/js/bootstrap': {
  45. deps: [ 'css!amber_lib/bootstrap/css/bootstrap' ]
  46. },
  47. 'amber_lib/CodeMirror/codemirror': {
  48. deps: [ 'css!amber_lib/CodeMirror/codemirror' ]
  49. },
  50. 'amber_lib/jQuery/jquery.textarea': {
  51. deps: [ 'jquery', 'jquery-ui' ]
  52. },
  53. 'amber_lib/CodeMirror/smalltalk': {
  54. deps: [ './codemirror' ]
  55. },
  56. 'amber_lib/CodeMirror/addon/hint/show-hint': {
  57. deps: [ '../../codemirror' ]
  58. },
  59. 'ensure-console': {
  60. exports: 'console'
  61. }
  62. }
  63. };
  64. if (require) {
  65. require.config(config);
  66. return require;
  67. } else {
  68. return config;
  69. }
  70. }(require);