amber-in-browser.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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': '..',
  19. 'jquery': 'jQuery/jquery-1.8.2.min',
  20. 'jquery-ui': 'jQuery/jquery-ui-1.8.16.custom.min',
  21. 'smalltalk': '../boot'
  22. },
  23. map: {
  24. '*': {
  25. 'css': 'require-css-0.0.6/css'
  26. }
  27. },
  28. shim: {
  29. 'CodeMirror/smalltalk': {
  30. deps: [ 'CodeMirror/codemirror']
  31. },
  32. 'CodeMirror/addon/hint/show-hint': {
  33. deps: [ 'CodeMirror/codemirror']
  34. },
  35. 'smalltalk': {
  36. exports: 'smalltalk'
  37. },
  38. 'nil': {
  39. deps: [ 'smalltalk' ],
  40. exports: 'nil'
  41. }
  42. },
  43. deps: [
  44. 'jquery', 'es5-shim-2.0.2/es5-shim.min', 'es5-shim-2.0.2/es5-sham.min', 'smalltalk'
  45. ]
  46. };
  47. if (require) {
  48. require.config(config);
  49. return require;
  50. } else {
  51. return config;
  52. }
  53. }(require);