2
0

jtalk.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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("Parser.js");
  39. loadJS("Compiler.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. if(files) {
  47. for(var i=0; i < files.length; i++) {
  48. loadJS(files[i], prefix);
  49. }
  50. }
  51. loadJS("init.js");
  52. }
  53. window.loadJtalkDeploy = function(files, prefix) {
  54. loadDependencies();
  55. loadJS("boot.js");
  56. loadJS("Kernel.deploy.js");
  57. loadJS("Canvas.deploy.js");
  58. loadJS("JQuery.deploy.js");
  59. if(files){
  60. for(var i=0; i < files.length; i++) {
  61. loadJS(files[i], prefix);
  62. }
  63. }
  64. loadJS("init.js");
  65. loadJS("deploy.js");
  66. }
  67. })();