amber.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. paths: {
  17. 'amber': home+'/support',
  18. 'amber_vm': home+'/support',
  19. 'amber_css': home+'/css',
  20. 'amber_lib': home+'/support',
  21. 'amber_core': home+'/js',
  22. 'amber_core/_source': home+'/st',
  23. 'jquery': home+'/support/jQuery/jquery-1.8.2.min',
  24. 'jquery-ui': home+'/support/jQuery/jquery-ui-1.8.16.custom.min'
  25. },
  26. map: {
  27. '*': {
  28. 'css': 'amber_lib/requirejs/require-css-0.0.6/css'
  29. },
  30. 'amber/helios': {
  31. 'jquery-ui': 'amber_lib/jQuery/jquery-ui-1.8.24.custom.min'
  32. }
  33. },
  34. shim: {
  35. 'jquery-ui': {
  36. deps: [ 'jquery' ]
  37. },
  38. 'amber_lib/bootstrap/js/bootstrap': {
  39. deps: [ 'css!amber_lib/bootstrap/css/bootstrap' ]
  40. },
  41. 'amber_lib/CodeMirror/codemirror': {
  42. deps: [ 'css!amber_lib/CodeMirror/codemirror' ]
  43. },
  44. 'amber_lib/jQuery/jquery.textarea': {
  45. deps: [ 'jquery', 'jquery-ui' ]
  46. },
  47. 'amber_lib/CodeMirror/smalltalk': {
  48. deps: [ './codemirror' ]
  49. },
  50. 'amber_lib/CodeMirror/addon/hint/show-hint': {
  51. deps: [ '../../codemirror' ]
  52. },
  53. 'ensure-console': {
  54. exports: 'console'
  55. }
  56. }
  57. };
  58. if (require) {
  59. require.config(config);
  60. return require;
  61. } else {
  62. return config;
  63. }
  64. }(require);