Skip to content

Commit

Permalink
changed server js code to work with codemirror
Browse files Browse the repository at this point in the history
  • Loading branch information
jfontan committed Dec 1, 2011
1 parent 6f72779 commit 854946e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/assets/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function load_url_code() {

} else {

code.value = document.getElementById( 'example' ).text;
code.setValue(document.getElementById( 'example' ).text);
original_code = document.getElementById( 'example' ).text;

}
Expand All @@ -55,7 +55,7 @@ function add_server_buttons() {
}

function set_save_button(visibility) {
if(original_code==code.value)
if(original_code==code.getValue())
saveButton.style.visibility = 'hidden';
else
saveButton.style.visibility = visibility;
Expand Down Expand Up @@ -91,7 +91,7 @@ function save() {
img=get_img(200, 100);

data={
"code": document.getElementById( 'code' ).value,
"code": code.getValue(),
"image": img,
"user": get_user_id()
}
Expand All @@ -113,7 +113,7 @@ function save() {

function load_code(hash) {
$.getJSON('/item/'+hash, function(result) {
code.value=result['code'];
code.setValue(result['code']);
original_code=result['code'];

if(result['parent']) {
Expand Down
16 changes: 16 additions & 0 deletions server/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,22 @@ def save_version(code_id, code)
send_file 'server/assets/helpers.js'
end

get %r{^.*/js/glsl.js$} do
send_file 'static/js/glsl.js'
end

get %r{^.*/js/codemirror.js$} do
send_file 'static/js/codemirror.js'
end

get %r{^.*/css/codemirror.css$} do
send_file 'static/css/codemirror.css'
end

get %r{^.*/css/default.css$} do
send_file 'static/css/default.css'
end

get %r{^.*/js/lzma.js$} do
"\n"
end
Expand Down

0 comments on commit 854946e

Please sign in to comment.