AmberRack 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. data/.gitignore +74 -0
  2. data/.rvmrc +4 -0
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +62 -0
  5. data/README.md +17 -0
  6. data/Rakefile +24 -0
  7. data/amber-rack.gemspec +33 -0
  8. data/app/amber_app.rb +35 -0
  9. data/app/javascripts/Benchfib.deploy.js +159 -0
  10. data/app/javascripts/Benchfib.js +159 -0
  11. data/app/javascripts/Canvas.deploy.js +1464 -0
  12. data/app/javascripts/Canvas.js +1464 -0
  13. data/app/javascripts/Compiler.deploy.js +1587 -0
  14. data/app/javascripts/Compiler.js +1587 -0
  15. data/app/javascripts/Examples.deploy.js +800 -0
  16. data/app/javascripts/Examples.js +800 -0
  17. data/app/javascripts/IDE.deploy.js +3457 -0
  18. data/app/javascripts/IDE.js +3457 -0
  19. data/app/javascripts/IDE.js.bak +3420 -0
  20. data/app/javascripts/JQuery.deploy.js +898 -0
  21. data/app/javascripts/JQuery.js +898 -0
  22. data/app/javascripts/Kernel.deploy.js +6761 -0
  23. data/app/javascripts/Kernel.js +6761 -0
  24. data/app/javascripts/Parser.deploy.js +1655 -0
  25. data/app/javascripts/Parser.js +1655 -0
  26. data/app/javascripts/Raphael-Core.js +0 -0
  27. data/app/javascripts/Raphael-Graph.js +0 -0
  28. data/app/javascripts/SUnit.deploy.js +1059 -0
  29. data/app/javascripts/SUnit.js +1059 -0
  30. data/app/javascripts/application.js +2 -0
  31. data/app/javascripts/boot.js +466 -0
  32. data/app/javascripts/init.js +2 -0
  33. data/app/javascripts/jquery-1.4.4.min.js +167 -0
  34. data/app/javascripts/jquery-ui-1.8.9.custom.min.js +781 -0
  35. data/app/javascripts/jquery.textarea.js +267 -0
  36. data/app/javascripts/jtalk.js +78 -0
  37. data/app/javascripts/lib/CodeMirror/LICENSE +19 -0
  38. data/app/javascripts/lib/CodeMirror/README.md +6 -0
  39. data/app/javascripts/lib/CodeMirror/compress.html +92 -0
  40. data/app/javascripts/lib/CodeMirror/css/baboon.png +0 -0
  41. data/app/javascripts/lib/CodeMirror/css/baboon_vector.svg +153 -0
  42. data/app/javascripts/lib/CodeMirror/css/docs.css +154 -0
  43. data/app/javascripts/lib/CodeMirror/demo/activeline.html +72 -0
  44. data/app/javascripts/lib/CodeMirror/demo/changemode.html +51 -0
  45. data/app/javascripts/lib/CodeMirror/demo/complete.html +79 -0
  46. data/app/javascripts/lib/CodeMirror/demo/complete.js +151 -0
  47. data/app/javascripts/lib/CodeMirror/demo/fullscreen.html +158 -0
  48. data/app/javascripts/lib/CodeMirror/demo/marker.html +53 -0
  49. data/app/javascripts/lib/CodeMirror/demo/mustache.html +57 -0
  50. data/app/javascripts/lib/CodeMirror/demo/preview.html +75 -0
  51. data/app/javascripts/lib/CodeMirror/demo/resize.html +44 -0
  52. data/app/javascripts/lib/CodeMirror/demo/runmode.html +50 -0
  53. data/app/javascripts/lib/CodeMirror/demo/search.html +106 -0
  54. data/app/javascripts/lib/CodeMirror/demo/theme.html +53 -0
  55. data/app/javascripts/lib/CodeMirror/index.html +239 -0
  56. data/app/javascripts/lib/CodeMirror/internals.html +389 -0
  57. data/app/javascripts/lib/CodeMirror/lib/codemirror.css +67 -0
  58. data/app/javascripts/lib/CodeMirror/lib/codemirror.js +2144 -0
  59. data/app/javascripts/lib/CodeMirror/lib/overlay.js +51 -0
  60. data/app/javascripts/lib/CodeMirror/lib/runmode.js +27 -0
  61. data/app/javascripts/lib/CodeMirror/manual.html +854 -0
  62. data/app/javascripts/lib/CodeMirror/mode/clike/clike.js +247 -0
  63. data/app/javascripts/lib/CodeMirror/mode/clike/index.html +102 -0
  64. data/app/javascripts/lib/CodeMirror/mode/css/css.js +124 -0
  65. data/app/javascripts/lib/CodeMirror/mode/css/index.html +56 -0
  66. data/app/javascripts/lib/CodeMirror/mode/diff/diff.css +3 -0
  67. data/app/javascripts/lib/CodeMirror/mode/diff/diff.js +13 -0
  68. data/app/javascripts/lib/CodeMirror/mode/diff/index.html +99 -0
  69. data/app/javascripts/lib/CodeMirror/mode/haskell/haskell.js +242 -0
  70. data/app/javascripts/lib/CodeMirror/mode/haskell/index.html +60 -0
  71. data/app/javascripts/lib/CodeMirror/mode/htmlmixed/htmlmixed.js +79 -0
  72. data/app/javascripts/lib/CodeMirror/mode/htmlmixed/index.html +52 -0
  73. data/app/javascripts/lib/CodeMirror/mode/javascript/index.html +78 -0
  74. data/app/javascripts/lib/CodeMirror/mode/javascript/javascript.js +348 -0
  75. data/app/javascripts/lib/CodeMirror/mode/lua/index.html +72 -0
  76. data/app/javascripts/lib/CodeMirror/mode/lua/lua.js +138 -0
  77. data/app/javascripts/lib/CodeMirror/mode/php/index.html +49 -0
  78. data/app/javascripts/lib/CodeMirror/mode/php/php.js +110 -0
  79. data/app/javascripts/lib/CodeMirror/mode/plsql/index.html +63 -0
  80. data/app/javascripts/lib/CodeMirror/mode/plsql/plsql.js +217 -0
  81. data/app/javascripts/lib/CodeMirror/mode/python/LICENSE.txt +21 -0
  82. data/app/javascripts/lib/CodeMirror/mode/python/index.html +123 -0
  83. data/app/javascripts/lib/CodeMirror/mode/python/python.js +321 -0
  84. data/app/javascripts/lib/CodeMirror/mode/rst/index.html +526 -0
  85. data/app/javascripts/lib/CodeMirror/mode/rst/rst.css +75 -0
  86. data/app/javascripts/lib/CodeMirror/mode/rst/rst.js +333 -0
  87. data/app/javascripts/lib/CodeMirror/mode/scheme/index.html +65 -0
  88. data/app/javascripts/lib/CodeMirror/mode/scheme/scheme.js +181 -0
  89. data/app/javascripts/lib/CodeMirror/mode/smalltalk/index.html +56 -0
  90. data/app/javascripts/lib/CodeMirror/mode/smalltalk/smalltalk.js +134 -0
  91. data/app/javascripts/lib/CodeMirror/mode/sparql/index.html +41 -0
  92. data/app/javascripts/lib/CodeMirror/mode/sparql/sparql.js +143 -0
  93. data/app/javascripts/lib/CodeMirror/mode/stex/index.html +96 -0
  94. data/app/javascripts/lib/CodeMirror/mode/stex/stex.js +167 -0
  95. data/app/javascripts/lib/CodeMirror/mode/xml/index.html +42 -0
  96. data/app/javascripts/lib/CodeMirror/mode/xml/xml.js +231 -0
  97. data/app/javascripts/lib/CodeMirror/mode/yaml/index.html +68 -0
  98. data/app/javascripts/lib/CodeMirror/mode/yaml/yaml.js +95 -0
  99. data/app/javascripts/lib/CodeMirror/oldrelease.html +178 -0
  100. data/app/javascripts/lib/CodeMirror/test/index.html +29 -0
  101. data/app/javascripts/lib/CodeMirror/test/test.js +249 -0
  102. data/app/javascripts/lib/CodeMirror/theme/default.css +18 -0
  103. data/app/javascripts/lib/CodeMirror/theme/elegant.css +9 -0
  104. data/app/javascripts/lib/CodeMirror/theme/jtalk.css +21 -0
  105. data/app/javascripts/lib/CodeMirror/theme/neat.css +8 -0
  106. data/app/javascripts/lib/CodeMirror/theme/night.css +20 -0
  107. data/app/javascripts/lib/jQuery/jquery-1.4.4.min.js +167 -0
  108. data/app/javascripts/lib/jQuery/jquery-ui-1.8.9.custom.min.js +781 -0
  109. data/app/javascripts/lib/jQuery/jquery.textarea.js +267 -0
  110. data/app/smalltalk/Canvas.st +481 -0
  111. data/app/smalltalk/IDE.st +1752 -0
  112. data/config.ru +2 -0
  113. data/lib/amber-rack.rb +4 -0
  114. data/lib/amber-rack/version.rb +3 -0
  115. data/public/CodeMirror/LICENSE +19 -0
  116. data/public/CodeMirror/README.md +6 -0
  117. data/public/CodeMirror/compress.html +92 -0
  118. data/public/CodeMirror/css/baboon.png +0 -0
  119. data/public/CodeMirror/css/baboon_vector.svg +153 -0
  120. data/public/CodeMirror/css/docs.css +154 -0
  121. data/public/CodeMirror/demo/activeline.html +72 -0
  122. data/public/CodeMirror/demo/changemode.html +51 -0
  123. data/public/CodeMirror/demo/complete.html +79 -0
  124. data/public/CodeMirror/demo/complete.js +151 -0
  125. data/public/CodeMirror/demo/fullscreen.html +158 -0
  126. data/public/CodeMirror/demo/marker.html +53 -0
  127. data/public/CodeMirror/demo/mustache.html +57 -0
  128. data/public/CodeMirror/demo/preview.html +75 -0
  129. data/public/CodeMirror/demo/resize.html +44 -0
  130. data/public/CodeMirror/demo/runmode.html +50 -0
  131. data/public/CodeMirror/demo/search.html +106 -0
  132. data/public/CodeMirror/demo/theme.html +53 -0
  133. data/public/CodeMirror/index.html +239 -0
  134. data/public/CodeMirror/internals.html +389 -0
  135. data/public/CodeMirror/lib/codemirror.css +67 -0
  136. data/public/CodeMirror/lib/codemirror.js +2144 -0
  137. data/public/CodeMirror/lib/overlay.js +51 -0
  138. data/public/CodeMirror/lib/runmode.js +27 -0
  139. data/public/CodeMirror/manual.html +854 -0
  140. data/public/CodeMirror/mode/clike/clike.js +247 -0
  141. data/public/CodeMirror/mode/clike/index.html +102 -0
  142. data/public/CodeMirror/mode/css/css.js +124 -0
  143. data/public/CodeMirror/mode/css/index.html +56 -0
  144. data/public/CodeMirror/mode/diff/diff.css +3 -0
  145. data/public/CodeMirror/mode/diff/diff.js +13 -0
  146. data/public/CodeMirror/mode/diff/index.html +99 -0
  147. data/public/CodeMirror/mode/haskell/haskell.js +242 -0
  148. data/public/CodeMirror/mode/haskell/index.html +60 -0
  149. data/public/CodeMirror/mode/htmlmixed/htmlmixed.js +79 -0
  150. data/public/CodeMirror/mode/htmlmixed/index.html +52 -0
  151. data/public/CodeMirror/mode/javascript/index.html +78 -0
  152. data/public/CodeMirror/mode/javascript/javascript.js +348 -0
  153. data/public/CodeMirror/mode/lua/index.html +72 -0
  154. data/public/CodeMirror/mode/lua/lua.js +138 -0
  155. data/public/CodeMirror/mode/php/index.html +49 -0
  156. data/public/CodeMirror/mode/php/php.js +110 -0
  157. data/public/CodeMirror/mode/plsql/index.html +63 -0
  158. data/public/CodeMirror/mode/plsql/plsql.js +217 -0
  159. data/public/CodeMirror/mode/python/LICENSE.txt +21 -0
  160. data/public/CodeMirror/mode/python/index.html +123 -0
  161. data/public/CodeMirror/mode/python/python.js +321 -0
  162. data/public/CodeMirror/mode/rst/index.html +526 -0
  163. data/public/CodeMirror/mode/rst/rst.css +75 -0
  164. data/public/CodeMirror/mode/rst/rst.js +333 -0
  165. data/public/CodeMirror/mode/scheme/index.html +65 -0
  166. data/public/CodeMirror/mode/scheme/scheme.js +181 -0
  167. data/public/CodeMirror/mode/smalltalk/index.html +56 -0
  168. data/public/CodeMirror/mode/smalltalk/smalltalk.js +134 -0
  169. data/public/CodeMirror/mode/sparql/index.html +41 -0
  170. data/public/CodeMirror/mode/sparql/sparql.js +143 -0
  171. data/public/CodeMirror/mode/stex/index.html +96 -0
  172. data/public/CodeMirror/mode/stex/stex.js +167 -0
  173. data/public/CodeMirror/mode/xml/index.html +42 -0
  174. data/public/CodeMirror/mode/xml/xml.js +231 -0
  175. data/public/CodeMirror/mode/yaml/index.html +68 -0
  176. data/public/CodeMirror/mode/yaml/yaml.js +95 -0
  177. data/public/CodeMirror/oldrelease.html +178 -0
  178. data/public/CodeMirror/test/index.html +29 -0
  179. data/public/CodeMirror/test/test.js +249 -0
  180. data/public/CodeMirror/theme/default.css +18 -0
  181. data/public/CodeMirror/theme/elegant.css +9 -0
  182. data/public/CodeMirror/theme/jtalk.css +21 -0
  183. data/public/CodeMirror/theme/neat.css +8 -0
  184. data/public/CodeMirror/theme/night.css +20 -0
  185. data/public/css/jtalk.css +362 -0
  186. data/public/css/style.css +456 -0
  187. data/public/css/sunit.css +66 -0
  188. data/public/ide/fork_me.png +0 -0
  189. data/public/ide/screen2.png +0 -0
  190. data/public/ide/style.css +456 -0
  191. data/public/ide/syntax.css +61 -0
  192. data/public/ide/text_header.png +0 -0
  193. data/public/ide/title_container1.png +0 -0
  194. data/public/images/background_box.png +0 -0
  195. data/public/images/background_header.png +0 -0
  196. data/public/images/balloon_header.png +0 -0
  197. data/views/index.haml +66 -0
  198. metadata +341 -0
@@ -0,0 +1,267 @@
1
+ /*
2
+ * Tabby jQuery plugin version 0.12
3
+ *
4
+ * Ted Devito - http://teddevito.com/demos/textarea.html
5
+ *
6
+ * Copyright (c) 2009 Ted Devito
7
+ *
8
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
9
+ * conditions are met:
10
+ *
11
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
12
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
13
+ * in the documentation and/or other materials provided with the distribution.
14
+ * 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written
15
+ * permission.
16
+ *
17
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
19
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
22
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+ *
24
+ */
25
+
26
+ // create closure
27
+
28
+ (function($) {
29
+
30
+ // plugin definition
31
+
32
+ $.fn.tabby = function(options) {
33
+ //debug(this);
34
+ // build main options before element iteration
35
+ var opts = $.extend({}, $.fn.tabby.defaults, options);
36
+ var pressed = $.fn.tabby.pressed;
37
+
38
+ // iterate and reformat each matched element
39
+ return this.each(function() {
40
+ $this = $(this);
41
+
42
+ // build element specific options
43
+ var options = $.meta ? $.extend({}, opts, $this.data()) : opts;
44
+
45
+ $this.bind('keydown',function (e) {
46
+ var kc = $.fn.tabby.catch_kc(e);
47
+ if (16 == kc) pressed.shft = true;
48
+ /*
49
+ because both CTRL+TAB and ALT+TAB default to an event (changing tab/window) that
50
+ will prevent js from capturing the keyup event, we'll set a timer on releasing them.
51
+ */
52
+ if (17 == kc) {pressed.ctrl = true; setTimeout("$.fn.tabby.pressed.ctrl = false;",1000);}
53
+ if (18 == kc) {pressed.alt = true; setTimeout("$.fn.tabby.pressed.alt = false;",1000);}
54
+
55
+ if (9 == kc && !pressed.ctrl && !pressed.alt) {
56
+ e.preventDefault; // does not work in O9.63 ??
57
+ pressed.last = kc; setTimeout("$.fn.tabby.pressed.last = null;",0);
58
+ process_keypress ($(e.target).get(0), pressed.shft, options);
59
+ return false;
60
+ }
61
+
62
+ }).bind('keyup',function (e) {
63
+ if (16 == $.fn.tabby.catch_kc(e)) pressed.shft = false;
64
+ }).bind('blur',function (e) { // workaround for Opera -- http://www.webdeveloper.com/forum/showthread.php?p=806588
65
+ if (9 == pressed.last) $(e.target).one('focus',function (e) {pressed.last = null;}).get(0).focus();
66
+ });
67
+
68
+ });
69
+ };
70
+
71
+ // define and expose any extra methods
72
+ $.fn.tabby.catch_kc = function(e) { return e.keyCode ? e.keyCode : e.charCode ? e.charCode : e.which; };
73
+ $.fn.tabby.pressed = {shft : false, ctrl : false, alt : false, last: null};
74
+
75
+ // private function for debugging
76
+ function debug($obj) {
77
+ if (window.console && window.console.log)
78
+ window.console.log('textarea count: ' + $obj.size());
79
+ };
80
+
81
+ function process_keypress (o,shft,options) {
82
+ var scrollTo = o.scrollTop;
83
+ //var tabString = String.fromCharCode(9);
84
+
85
+ // gecko; o.setSelectionRange is only available when the text box has focus
86
+ if (o.setSelectionRange) gecko_tab (o, shft, options);
87
+
88
+ // ie; document.selection is always available
89
+ else if (document.selection) ie_tab (o, shft, options);
90
+
91
+ o.scrollTop = scrollTo;
92
+ }
93
+
94
+ // plugin defaults
95
+ $.fn.tabby.defaults = {tabString : String.fromCharCode(9)};
96
+
97
+ function gecko_tab (o, shft, options) {
98
+ var ss = o.selectionStart;
99
+ var es = o.selectionEnd;
100
+
101
+ // when there's no selection and we're just working with the caret, we'll add/remove the tabs at the caret, providing more control
102
+ if(ss == es) {
103
+ // SHIFT+TAB
104
+ if (shft) {
105
+ // check to the left of the caret first
106
+ if ("\t" == o.value.substring(ss-options.tabString.length, ss)) {
107
+ o.value = o.value.substring(0, ss-options.tabString.length) + o.value.substring(ss); // put it back together omitting one character to the left
108
+ o.focus();
109
+ o.setSelectionRange(ss - options.tabString.length, ss - options.tabString.length);
110
+ }
111
+ // then check to the right of the caret
112
+ else if ("\t" == o.value.substring(ss, ss + options.tabString.length)) {
113
+ o.value = o.value.substring(0, ss) + o.value.substring(ss + options.tabString.length); // put it back together omitting one character to the right
114
+ o.focus();
115
+ o.setSelectionRange(ss,ss);
116
+ }
117
+ }
118
+ // TAB
119
+ else {
120
+ o.value = o.value.substring(0, ss) + options.tabString + o.value.substring(ss);
121
+ o.focus();
122
+ o.setSelectionRange(ss + options.tabString.length, ss + options.tabString.length);
123
+ }
124
+ }
125
+ // selections will always add/remove tabs from the start of the line
126
+ else {
127
+ // split the textarea up into lines and figure out which lines are included in the selection
128
+ var lines = o.value.split("\n");
129
+ var indices = new Array();
130
+ var sl = 0; // start of the line
131
+ var el = 0; // end of the line
132
+ var sel = false;
133
+ for (var i in lines) {
134
+ el = sl + lines[i].length;
135
+ indices.push({start: sl, end: el, selected: (sl <= ss && el > ss) || (el >= es && sl < es) || (sl > ss && el < es)});
136
+ sl = el + 1;// for "\n"
137
+ }
138
+
139
+ // walk through the array of lines (indices) and add tabs where appropriate
140
+ var modifier = 0;
141
+ for (var i in indices) {
142
+ if (indices[i].selected) {
143
+ var pos = indices[i].start + modifier; // adjust for tabs already inserted/removed
144
+ // SHIFT+TAB
145
+ if (shft && options.tabString == o.value.substring(pos,pos+options.tabString.length)) { // only SHIFT+TAB if there's a tab at the start of the line
146
+ o.value = o.value.substring(0,pos) + o.value.substring(pos + options.tabString.length); // omit the tabstring to the right
147
+ modifier -= options.tabString.length;
148
+ }
149
+ // TAB
150
+ else if (!shft) {
151
+ o.value = o.value.substring(0,pos) + options.tabString + o.value.substring(pos); // insert the tabstring
152
+ modifier += options.tabString.length;
153
+ }
154
+ }
155
+ }
156
+ o.focus();
157
+ var ns = ss + ((modifier > 0) ? options.tabString.length : (modifier < 0) ? -options.tabString.length : 0);
158
+ var ne = es + modifier;
159
+ o.setSelectionRange(ns,ne);
160
+ }
161
+ }
162
+
163
+ function ie_tab (o, shft, options) {
164
+ var range = document.selection.createRange();
165
+
166
+ if (o == range.parentElement()) {
167
+ // when there's no selection and we're just working with the caret, we'll add/remove the tabs at the caret, providing more control
168
+ if ('' == range.text) {
169
+ // SHIFT+TAB
170
+ if (shft) {
171
+ var bookmark = range.getBookmark();
172
+ //first try to the left by moving opening up our empty range to the left
173
+ range.moveStart('character', -options.tabString.length);
174
+ if (options.tabString == range.text) {
175
+ range.text = '';
176
+ } else {
177
+ // if that didn't work then reset the range and try opening it to the right
178
+ range.moveToBookmark(bookmark);
179
+ range.moveEnd('character', options.tabString.length);
180
+ if (options.tabString == range.text)
181
+ range.text = '';
182
+ }
183
+ // move the pointer to the start of them empty range and select it
184
+ range.collapse(true);
185
+ range.select();
186
+ }
187
+
188
+ else {
189
+ // very simple here. just insert the tab into the range and put the pointer at the end
190
+ range.text = options.tabString;
191
+ range.collapse(false);
192
+ range.select();
193
+ }
194
+ }
195
+ // selections will always add/remove tabs from the start of the line
196
+ else {
197
+
198
+ var selection_text = range.text;
199
+ var selection_len = selection_text.length;
200
+ var selection_arr = selection_text.split("\r\n");
201
+
202
+ var before_range = document.body.createTextRange();
203
+ before_range.moveToElementText(o);
204
+ before_range.setEndPoint("EndToStart", range);
205
+ var before_text = before_range.text;
206
+ var before_arr = before_text.split("\r\n");
207
+ var before_len = before_text.length; // - before_arr.length + 1;
208
+
209
+ var after_range = document.body.createTextRange();
210
+ after_range.moveToElementText(o);
211
+ after_range.setEndPoint("StartToEnd", range);
212
+ var after_text = after_range.text; // we can accurately calculate distance to the end because we're not worried about MSIE trimming a \r\n
213
+
214
+ var end_range = document.body.createTextRange();
215
+ end_range.moveToElementText(o);
216
+ end_range.setEndPoint("StartToEnd", before_range);
217
+ var end_text = end_range.text; // we can accurately calculate distance to the end because we're not worried about MSIE trimming a \r\n
218
+
219
+ var check_html = $(o).html();
220
+ $("#r3").text(before_len + " + " + selection_len + " + " + after_text.length + " = " + check_html.length);
221
+ if((before_len + end_text.length) < check_html.length) {
222
+ before_arr.push("");
223
+ before_len += 2; // for the \r\n that was trimmed
224
+ if (shft && options.tabString == selection_arr[0].substring(0,options.tabString.length))
225
+ selection_arr[0] = selection_arr[0].substring(options.tabString.length);
226
+ else if (!shft) selection_arr[0] = options.tabString + selection_arr[0];
227
+ } else {
228
+ if (shft && options.tabString == before_arr[before_arr.length-1].substring(0,options.tabString.length))
229
+ before_arr[before_arr.length-1] = before_arr[before_arr.length-1].substring(options.tabString.length);
230
+ else if (!shft) before_arr[before_arr.length-1] = options.tabString + before_arr[before_arr.length-1];
231
+ }
232
+
233
+ for (var i = 1; i < selection_arr.length; i++) {
234
+ if (shft && options.tabString == selection_arr[i].substring(0,options.tabString.length))
235
+ selection_arr[i] = selection_arr[i].substring(options.tabString.length);
236
+ else if (!shft) selection_arr[i] = options.tabString + selection_arr[i];
237
+ }
238
+
239
+ if (1 == before_arr.length && 0 == before_len) {
240
+ if (shft && options.tabString == selection_arr[0].substring(0,options.tabString.length))
241
+ selection_arr[0] = selection_arr[0].substring(options.tabString.length);
242
+ else if (!shft) selection_arr[0] = options.tabString + selection_arr[0];
243
+ }
244
+
245
+ if ((before_len + selection_len + after_text.length) < check_html.length) {
246
+ selection_arr.push("");
247
+ selection_len += 2; // for the \r\n that was trimmed
248
+ }
249
+
250
+ before_range.text = before_arr.join("\r\n");
251
+ range.text = selection_arr.join("\r\n");
252
+
253
+ var new_range = document.body.createTextRange();
254
+ new_range.moveToElementText(o);
255
+
256
+ if (0 < before_len) new_range.setEndPoint("StartToEnd", before_range);
257
+ else new_range.setEndPoint("StartToStart", before_range);
258
+ new_range.setEndPoint("EndToEnd", range);
259
+
260
+ new_range.select();
261
+
262
+ }
263
+ }
264
+ }
265
+
266
+ // end of closure
267
+ })(jQuery);
@@ -0,0 +1,78 @@
1
+ /* Adapted from Clamato by Avi Bryant. http://www.clamato.net */
2
+
3
+ (function() {
4
+ var scripts = document.getElementsByTagName("script");
5
+ var src = scripts[ scripts.length - 1 ].src;
6
+ var home = src.split("/").slice(0, -2).join("/") + "/";
7
+
8
+ function loadJS(name, prefix) {
9
+ var prefix = prefix || 'javascripts';
10
+ document.write('<script src="' + home + prefix + '/' + name + '" type="text/javascript"></script>');
11
+ }
12
+
13
+ function loadCSS(name, prefix) {
14
+ var prefix = prefix || 'css';
15
+ var link = document.createElement("link")
16
+ link.setAttribute("rel", "stylesheet")
17
+ link.setAttribute("type", "text/css")
18
+ link.setAttribute("href", home + prefix + '/' + name)
19
+ document.getElementsByTagName("head")[0].appendChild(link);
20
+ }
21
+
22
+ function loadDependencies() {
23
+ loadJS('lib/jQuery/jquery-1.4.4.min.js');
24
+ loadJS('lib/jQuery/jquery-ui-1.8.9.custom.min.js');
25
+ }
26
+
27
+ function loadIDEDependencies() {
28
+ loadJS('lib/jQuery/jquery.textarea.js');
29
+ loadJS('lib/CodeMirror/lib/codemirror.js');
30
+ loadCSS('CodeMirror/lib/codemirror.css', '.');
31
+ loadJS('CodeMirror/mode/smalltalk/smalltalk.js', '.');
32
+ loadCSS('CodeMirror/theme/jtalk.css', '.');
33
+ }
34
+
35
+ window.loadJtalk = function(files, prefix) {
36
+ loadDependencies();
37
+ loadIDEDependencies();
38
+ loadCSS('jtalk.css');
39
+ loadCSS('sunit.css');
40
+ loadJS("boot.js");
41
+ loadJS("Kernel.js");
42
+ loadJS("Canvas.js");
43
+ loadJS("JQuery.js");
44
+ loadJS("Parser.js");
45
+ loadJS("Compiler.js");
46
+ loadJS("IDE.js");
47
+ loadJS("SUnit.js");
48
+ loadJS("Examples.js");
49
+ loadJS("Benchfib.js");
50
+ loadJS("Raphael-Core.js");
51
+ loadJS("Raphael-Graph.js");
52
+
53
+ if(files) {
54
+ for(var i=0; i < files.length; i++) {
55
+ loadJS(files[i], prefix);
56
+ }
57
+ }
58
+
59
+ loadJS("init.js");
60
+ }
61
+
62
+ window.loadJtalkDeploy = function(files, prefix) {
63
+ loadDependencies();
64
+ loadJS("boot.js");
65
+ loadJS("Kernel.deploy.js");
66
+ loadJS("Canvas.deploy.js");
67
+ loadJS("JQuery.deploy.js");
68
+
69
+ if(files){
70
+ for(var i=0; i < files.length; i++) {
71
+ loadJS(files[i], prefix);
72
+ }
73
+ }
74
+
75
+ loadJS("init.js");
76
+ smalltalk.setDeploymentMode();
77
+ }
78
+ })();
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2011 by Marijn Haverbeke <marijnh@gmail.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,6 @@
1
+ # CodeMirror 2
2
+
3
+ CodeMirror 2 is a rewrite of [CodeMirror
4
+ 1](http://github.com/marijnh/CodeMirror). The docs live
5
+ [here](http://codemirror.net/manual.html), and the project page is
6
+ [http://codemirror.net/](http://codemirror.net/).
@@ -0,0 +1,92 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>CodeMirror: Compression Helper</title>
5
+ <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans:bold"/>
6
+ <link rel="stylesheet" type="text/css" href="css/docs.css"/>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
8
+ </head>
9
+ <body>
10
+
11
+ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMirror</a></h1>
12
+
13
+ <pre class="grey">
14
+ <img src="css/baboon.png" class="logo" alt="logo"/>/* Script compression
15
+ helper */
16
+ </pre>
17
+
18
+ <p>To optimize loading CodeMirror, especially when including a
19
+ bunch of different modes, it is recommended that you combine and
20
+ minify (and preferably also gzip) the scripts. This page makes
21
+ those first two steps very easy. Simply select the version and
22
+ scripts you need in the form below, and
23
+ click <strong>Compress</strong> to download the minified script
24
+ file.</p>
25
+
26
+ <form id="form" action="http://marijnhaverbeke.nl/uglifyjs" method="post">
27
+ <input type="hidden" id="download" name="download" value="codemirror-compressed.js"/>
28
+ <p>Version: <select id="version" onchange="setVersion(this);" style="padding: 1px">
29
+ <option value="http://codemirror.net/">HEAD</option>
30
+ <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.12;f=">2.12</option>
31
+ <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.11;f=">2.11</option>
32
+ <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.1;f=">2.1</option>
33
+ <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.02;f=">2.02</option>
34
+ <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.01;f=">2.01</option>
35
+ <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.0;f=">2.0</option>
36
+ <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=beta2;f=">beta2</option>
37
+ <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=beta1;f=">beta1</option>
38
+ </select></p>
39
+
40
+ <select multiple="multiple" name="code_url" style="width: 40em;" class="field" id="files">
41
+ <optgroup label="CodeMirror Library">
42
+ <option value="http://codemirror.net/lib/codemirror.js" selected>codemirror.js</option>
43
+ <option value="http://codemirror.net/lib/overlay.js">overlay.js</option>
44
+ <option value="http://codemirror.net/lib/runmode.js">runmode.js</option>
45
+ </optgroup>
46
+ <optgroup label="Modes">
47
+ <option value="http://codemirror.net/mode/javascript/javascript.js">javascript.js</option>
48
+ <option value="http://codemirror.net/mode/xml/xml.js">xml.js</option>
49
+ <option value="http://codemirror.net/mode/css/css.js">css.js</option>
50
+ <option value="http://codemirror.net/mode/htmlmixed/htmlmixed.js">htmlmixed.js</option>
51
+ <option value="http://codemirror.net/mode/clike/clike.js">clike.js</option>
52
+ <option value="http://codemirror.net/mode/python/python.js">python.js</option>
53
+ <option value="http://codemirror.net/mode/php/php.js">php.js</option>
54
+ <option value="http://codemirror.net/mode/haskell/haskell.js">haskell.js</option>
55
+ <option value="http://codemirror.net/mode/diff/diff.js">diff.js</option>
56
+ <option value="http://codemirror.net/mode/stex/stex.js">stex.js</option>
57
+ <option value="http://codemirror.net/mode/smalltalk/smalltalk.js">smalltalk.js</option>
58
+ <option value="http://codemirror.net/mode/rst/rst.js">rst.js</option>
59
+ <option value="http://codemirror.net/mode/plsql/plsql.js">plsql.js</option>
60
+ <option value="http://codemirror.net/mode/lua/lua.js">lua.js</option>
61
+ <option value="http://codemirror.net/mode/scheme/scheme.js">scheme.js</option>
62
+ <option value="http://codemirror.net/mode/yaml/yaml.js">scheme.js</option>
63
+ <option value="http://codemirror.net/mode/sparql/sparql.js">sparql.js</option>
64
+ </optgroup>
65
+ </select></p>
66
+
67
+ <p>
68
+ <button type="submit">Compress</button> with <a href="http://github.com/mishoo/UglifyJS/">UglifyJS</a>
69
+ </p>
70
+
71
+ <p>Custom code to add to the compressed file:<textarea name="js_code" style="width: 100%; height: 15em;" class="field"></textarea></p>
72
+ </form>
73
+
74
+ <script type="text/javascript">
75
+ function setVersion(ver) {
76
+ var urlprefix = ver.options[ver.selectedIndex].value;
77
+ var select = document.getElementById("files"), m;
78
+ for (var optgr = select.firstChild; optgr; optgr = optgr.nextSibling)
79
+ for (var opt = optgr.firstChild; opt; opt = opt.nextSibling) {
80
+ if (opt.nodeName != "OPTION")
81
+ continue;
82
+ else if (m = opt.value.match(/^http:\/\/codemirror.net\/2\/(.*)$/))
83
+ opt.value = urlprefix + m[1];
84
+ else if (m = opt.value.match(/http:\/\/marijnhaverbeke.nl\/git\/codemirror\?a=blob_plain;hb=[^;]+;f=(.*)$/))
85
+ opt.value = urlprefix + m[1];
86
+ }
87
+ }
88
+ </script>
89
+
90
+ </body>
91
+ </html>
92
+