2
0

jtalk.js~ 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* Adapted from Clamato by Avi Bryant. http://www.clamato.net */
  2. (function() {
  3. var scripts = document.getElementsByTagName("script");
  4. var src = scripts[ scripts.length - 1 ].src;
  5. var home = src.split("/").slice(0, -2).join("/") + "/";
  6. function loadJS(name, prefix) {
  7. var prefix = prefix || 'js';
  8. document.write('<script src="' + home + prefix + '/' + name + '" type="text/javascript"></script>');
  9. }
  10. function loadCSS(name, prefix) {
  11. var prefix = prefix || 'css';
  12. var link = document.createElement("link")
  13. link.setAttribute("rel", "stylesheet")
  14. link.setAttribute("type", "text/css")
  15. link.setAttribute("href", home + prefix + '/' + name)
  16. document.getElementsByTagName("head")[0].appendChild(link);
  17. }
  18. function loadDependencies() {
  19. loadJS('lib/jQuery/jquery-1.6.2.min.js');
  20. loadJS('lib/jQuery/jquery-ui-1.8.9.custom.min.js');
  21. }
  22. function loadIDEDependencies() {
  23. loadJS('lib/jQuery/jquery.textarea.js');
  24. loadJS('lib/CodeMirror/lib/codemirror.js');
  25. loadCSS('lib/CodeMirror/lib/codemirror.css', 'js');
  26. loadJS('lib/CodeMirror/mode/smalltalk/smalltalk.js');
  27. loadCSS('lib/CodeMirror/theme/jtalk.css', 'js');
  28. }
  29. window.loadJtalk = function(files, prefix) {
  30. loadDependencies();
  31. loadIDEDependencies();
  32. loadCSS('jtalk.css');
  33. loadCSS('sunit.css');
  34. loadJS("boot.js");
  35. loadJS("Kernel.js");
  36. loadJS("Canvas.js");
  37. loadJS("JQuery.js");
  38. loadJS("Compiler.js");
  39. loadJS("parser.js");
  40. loadJS("IDE.js");
  41. loadJS("SUnit.js");
  42. loadJS("Examples.js");
  43. loadJS("Benchfib.js");
  44. loadJS("Kernel-Tests.js");
  45. loadJS("JQuery-Tests.js");
  46. // loadJS("TrySmalltalk.js");
  47. if(files) {
  48. for(var i=0; i < files.length; i++) {
  49. loadJS(files[i], prefix);
  50. }
  51. }
  52. loadJS("init.js");
  53. }
  54. window.loadJtalkDeploy = function(files, prefix) {
  55. loadDependencies();
  56. loadJS("boot.js");
  57. loadJS("Kernel.deploy.js");
  58. loadJS("Canvas.deploy.js");
  59. loadJS("JQuery.deploy.js");
  60. if(files){
  61. for(var i=0; i < files.length; i++) {
  62. loadJS(files[i], prefix);
  63. }
  64. }
  65. loadJS("init.js");
  66. loadJS("deploy.js");
  67. }
  68. })();