jtalk.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.4.4.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("Parser.js");
  39. loadJS("Compiler.js");
  40. loadJS("IDE.js");
  41. loadJS("SUnit.js");
  42. loadJS("Examples.js");
  43. loadJS("Benchfib.js");
  44. if(files) {
  45. for(var i=0; i < files.length; i++) {
  46. loadJS(files[i], prefix);
  47. }
  48. }
  49. loadJS("init.js");
  50. }
  51. window.loadJtalkDeploy = function(files, prefix) {
  52. loadDependencies();
  53. loadJS("boot.js");
  54. loadJS("Kernel.deploy.js");
  55. loadJS("Canvas.deploy.js");
  56. loadJS("JQuery.deploy.js");
  57. if(files){
  58. for(var i=0; i < files.length; i++) {
  59. loadJS(files[i], prefix);
  60. }
  61. }
  62. loadJS("init.js");
  63. smalltalk.setDeploymentMode();
  64. }
  65. })();