diff --git a/.gitignore b/.gitignore index 1377554e..ee156db6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ *.swp +venv +.DS_Store +.spyproject/ +foundation-6.2.4-complete/ +config.py +__pycache__ diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..997bb9f1 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn app:app --log-file - diff --git a/README.rst b/README.rst index f3f14e63..b65972f3 100644 --- a/README.rst +++ b/README.rst @@ -9,27 +9,38 @@ BBC's micro:bit device (https://en.wikipedia.org/wiki/Micro_Bit). Developer Setup --------------- -This editor works with any modern web browser. +This editor works with any modern web browser. These instructions assume that you have Python 3 installed and you're using some kind of UNIX-y system. If you're on Windows, no fear, all of this is acheivable, you'll just have to tweak the commands slightly. -Assuming you have Python 3 installed you can serve the editor like this:: +Virtual Environment ++++++++++++++++++++ - $ ./show.sh - http://localhost:8000/editor.html - Serving HTTP on 0.0.0.0 port 8000 ... +We're going to create a virtual environment for the Python code to live in. This environment will keep the work you do on this project separate from the rest of your projects. This can be really handy when you have several projects on your computer that all want to use slightly different versions of libraries:: -As the script tells us, point your browser to http://localhost:8000/editor.html. + $ pyvenv venv + (venv) $ source venv/bin/activate + (venv) $ pip install -r requirements.txt -It's also possible to run the editor directly from the file system like this, -for example:: +Running the Code +++++++++++++++++ - $ firefox editor.html +Easy peasy:: -Or by double-clicking on the ``editor.html`` file from your file manager. + (venv) $ python app.py -**IMPORTANT**: When the editor is run from the file system, the "sharing" -button is hidden. Because of security reasons, many local browsers won't allow -it to function correctly unless the editor is properly served from a network -domain rather than directly from the file system. +Then visit http://localhost:5000 to see the editor. + +Enabling Cloud Save/Fork Features ++++++++++++++++++++++++++++++++++ + +The code in the editor can be saved into the "cloud" using GitHub Gists. In order for this to work you have to create a "Personal Access Token" that will be used to authenticate against the GitHub API. See you GitHub account's settings pages for how to do this, you'll need to give your token the "gist" permission. + +Once you have a token you can either save in the environment like this: + + (venv) $ export GITHUB_API_TOKEN=XXX + +Or you can save it into a file called `config.py` that contains: + + GITHUB_API_TOKEN = "XXX" Tests +++++ diff --git a/app.py b/app.py new file mode 100644 index 00000000..f37e75af --- /dev/null +++ b/app.py @@ -0,0 +1,80 @@ +import os +import json + +import requests +from flask import Flask, render_template, jsonify, request +from gist import GistAPI + +app = Flask(__name__) + +try: + app.config.from_object('config') +except ImportError: + pass + +if "GITHUB_API_TOKEN" in os.environ: + app.config.update(GITHUB_API_TOKEN=os.environ["GITHUB_API_TOKEN"]) + + +api = GistAPI(app.config["GITHUB_API_TOKEN"]) + + +@app.route("/") +def editor(): + return render_template("editor.html") + + +@app.route("/help/") +def help(): + return render_template("help.html") + +@app.route("/create//", methods=["POST"]) +def create(file_name): + content = request.get_json()["content"] + html_url = api.create( + desc="Gist containing micro python micro:bit code", + public=True, + files={file_name: {"content": content}}) + gist_id = html_url.split("/").pop() + return jsonify(id=gist_id), 201 + +@app.route("/load//") +def load(gist_id, file_name): + content = api.content(gist_id)[file_name] + return jsonify(content=content) + +@app.route("/explore//", methods=["GET"]) +def explore(gist_id): + authors = [] + info = api.files(gist_id) + for name, details in info.items(): + authors.append(name[:-3]) + return jsonify(authors=authors) + +@app.route("/save//", methods=["POST"]) +def save(gist_id, file_name): + content = request.get_json()["content"] + # We have to call this request manually because the gist api assumes that + # edits happen in the terminal (e.g. using vim) and are then git pushed + # back to GitHub. This isn't true in our case :( + req = requests.Request( + "PATCH", + "https://api.github.com/gists", + headers={ + "Accept-Encoding": "identity, deflate, compress, gzip", + "User-Agent": "python-requests/1.2.0", + "Accept": "application/vnd.github.v3.base64", + }, + params={'access_token': api.token}, + data=json.dumps({ + "files": {file_name: { + "content": content + }} + }) + ) + api.send(req, gist_id) + return jsonify(status="OK") + + +if __name__ == "__main__": + app.run(debug=True) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..77d8c4a8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,12 @@ +click==6.6 +docopt==0.6.2 +Flask==0.11.1 +gunicorn==19.6.0 +itsdangerous==0.24 +Jinja2==2.8 +MarkupSafe==0.23 +python-gist==0.4.1 +python-gnupg==0.3.9 +requests==2.12.1 +simplejson==3.10.0 +Werkzeug==0.11.11 diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 00000000..c0354eef --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +python-3.5.2 diff --git a/show.sh b/show.sh deleted file mode 100755 index 3f7e353d..00000000 --- a/show.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -echo "http://localhost:8000/editor.html" -python3 -m http.server diff --git a/ace/ace.js b/static/ace/ace.js similarity index 100% rename from ace/ace.js rename to static/ace/ace.js diff --git a/ace/ext-beautify.js b/static/ace/ext-beautify.js similarity index 100% rename from ace/ext-beautify.js rename to static/ace/ext-beautify.js diff --git a/ace/ext-chromevox.js b/static/ace/ext-chromevox.js similarity index 100% rename from ace/ext-chromevox.js rename to static/ace/ext-chromevox.js diff --git a/ace/ext-elastic_tabstops_lite.js b/static/ace/ext-elastic_tabstops_lite.js similarity index 100% rename from ace/ext-elastic_tabstops_lite.js rename to static/ace/ext-elastic_tabstops_lite.js diff --git a/ace/ext-emmet.js b/static/ace/ext-emmet.js similarity index 100% rename from ace/ext-emmet.js rename to static/ace/ext-emmet.js diff --git a/ace/ext-error_marker.js b/static/ace/ext-error_marker.js similarity index 100% rename from ace/ext-error_marker.js rename to static/ace/ext-error_marker.js diff --git a/ace/ext-keybinding_menu.js b/static/ace/ext-keybinding_menu.js similarity index 100% rename from ace/ext-keybinding_menu.js rename to static/ace/ext-keybinding_menu.js diff --git a/ace/ext-language_tools.js b/static/ace/ext-language_tools.js similarity index 100% rename from ace/ext-language_tools.js rename to static/ace/ext-language_tools.js diff --git a/ace/ext-linking.js b/static/ace/ext-linking.js similarity index 100% rename from ace/ext-linking.js rename to static/ace/ext-linking.js diff --git a/ace/ext-modelist.js b/static/ace/ext-modelist.js similarity index 100% rename from ace/ext-modelist.js rename to static/ace/ext-modelist.js diff --git a/ace/ext-old_ie.js b/static/ace/ext-old_ie.js similarity index 100% rename from ace/ext-old_ie.js rename to static/ace/ext-old_ie.js diff --git a/ace/ext-searchbox.js b/static/ace/ext-searchbox.js similarity index 100% rename from ace/ext-searchbox.js rename to static/ace/ext-searchbox.js diff --git a/ace/ext-settings_menu.js b/static/ace/ext-settings_menu.js similarity index 100% rename from ace/ext-settings_menu.js rename to static/ace/ext-settings_menu.js diff --git a/ace/ext-spellcheck.js b/static/ace/ext-spellcheck.js similarity index 100% rename from ace/ext-spellcheck.js rename to static/ace/ext-spellcheck.js diff --git a/ace/ext-split.js b/static/ace/ext-split.js similarity index 100% rename from ace/ext-split.js rename to static/ace/ext-split.js diff --git a/ace/ext-static_highlight.js b/static/ace/ext-static_highlight.js similarity index 100% rename from ace/ext-static_highlight.js rename to static/ace/ext-static_highlight.js diff --git a/ace/ext-statusbar.js b/static/ace/ext-statusbar.js similarity index 100% rename from ace/ext-statusbar.js rename to static/ace/ext-statusbar.js diff --git a/ace/ext-textarea.js b/static/ace/ext-textarea.js similarity index 100% rename from ace/ext-textarea.js rename to static/ace/ext-textarea.js diff --git a/ace/ext-themelist.js b/static/ace/ext-themelist.js similarity index 100% rename from ace/ext-themelist.js rename to static/ace/ext-themelist.js diff --git a/ace/ext-whitespace.js b/static/ace/ext-whitespace.js similarity index 100% rename from ace/ext-whitespace.js rename to static/ace/ext-whitespace.js diff --git a/ace/keybinding-emacs.js b/static/ace/keybinding-emacs.js similarity index 100% rename from ace/keybinding-emacs.js rename to static/ace/keybinding-emacs.js diff --git a/ace/keybinding-vim.js b/static/ace/keybinding-vim.js similarity index 100% rename from ace/keybinding-vim.js rename to static/ace/keybinding-vim.js diff --git a/ace/mode-abap.js b/static/ace/mode-abap.js similarity index 100% rename from ace/mode-abap.js rename to static/ace/mode-abap.js diff --git a/ace/mode-abc.js b/static/ace/mode-abc.js similarity index 100% rename from ace/mode-abc.js rename to static/ace/mode-abc.js diff --git a/ace/mode-actionscript.js b/static/ace/mode-actionscript.js similarity index 100% rename from ace/mode-actionscript.js rename to static/ace/mode-actionscript.js diff --git a/ace/mode-ada.js b/static/ace/mode-ada.js similarity index 100% rename from ace/mode-ada.js rename to static/ace/mode-ada.js diff --git a/ace/mode-apache_conf.js b/static/ace/mode-apache_conf.js similarity index 100% rename from ace/mode-apache_conf.js rename to static/ace/mode-apache_conf.js diff --git a/ace/mode-applescript.js b/static/ace/mode-applescript.js similarity index 100% rename from ace/mode-applescript.js rename to static/ace/mode-applescript.js diff --git a/ace/mode-asciidoc.js b/static/ace/mode-asciidoc.js similarity index 100% rename from ace/mode-asciidoc.js rename to static/ace/mode-asciidoc.js diff --git a/ace/mode-assembly_x86.js b/static/ace/mode-assembly_x86.js similarity index 100% rename from ace/mode-assembly_x86.js rename to static/ace/mode-assembly_x86.js diff --git a/ace/mode-autohotkey.js b/static/ace/mode-autohotkey.js similarity index 100% rename from ace/mode-autohotkey.js rename to static/ace/mode-autohotkey.js diff --git a/ace/mode-batchfile.js b/static/ace/mode-batchfile.js similarity index 100% rename from ace/mode-batchfile.js rename to static/ace/mode-batchfile.js diff --git a/ace/mode-c9search.js b/static/ace/mode-c9search.js similarity index 100% rename from ace/mode-c9search.js rename to static/ace/mode-c9search.js diff --git a/ace/mode-c_cpp.js b/static/ace/mode-c_cpp.js similarity index 100% rename from ace/mode-c_cpp.js rename to static/ace/mode-c_cpp.js diff --git a/ace/mode-cirru.js b/static/ace/mode-cirru.js similarity index 100% rename from ace/mode-cirru.js rename to static/ace/mode-cirru.js diff --git a/ace/mode-clojure.js b/static/ace/mode-clojure.js similarity index 100% rename from ace/mode-clojure.js rename to static/ace/mode-clojure.js diff --git a/ace/mode-cobol.js b/static/ace/mode-cobol.js similarity index 100% rename from ace/mode-cobol.js rename to static/ace/mode-cobol.js diff --git a/ace/mode-coffee.js b/static/ace/mode-coffee.js similarity index 100% rename from ace/mode-coffee.js rename to static/ace/mode-coffee.js diff --git a/ace/mode-coldfusion.js b/static/ace/mode-coldfusion.js similarity index 100% rename from ace/mode-coldfusion.js rename to static/ace/mode-coldfusion.js diff --git a/ace/mode-csharp.js b/static/ace/mode-csharp.js similarity index 100% rename from ace/mode-csharp.js rename to static/ace/mode-csharp.js diff --git a/ace/mode-css.js b/static/ace/mode-css.js similarity index 100% rename from ace/mode-css.js rename to static/ace/mode-css.js diff --git a/ace/mode-curly.js b/static/ace/mode-curly.js similarity index 100% rename from ace/mode-curly.js rename to static/ace/mode-curly.js diff --git a/ace/mode-d.js b/static/ace/mode-d.js similarity index 100% rename from ace/mode-d.js rename to static/ace/mode-d.js diff --git a/ace/mode-dart.js b/static/ace/mode-dart.js similarity index 100% rename from ace/mode-dart.js rename to static/ace/mode-dart.js diff --git a/ace/mode-diff.js b/static/ace/mode-diff.js similarity index 100% rename from ace/mode-diff.js rename to static/ace/mode-diff.js diff --git a/ace/mode-django.js b/static/ace/mode-django.js similarity index 100% rename from ace/mode-django.js rename to static/ace/mode-django.js diff --git a/ace/mode-dockerfile.js b/static/ace/mode-dockerfile.js similarity index 100% rename from ace/mode-dockerfile.js rename to static/ace/mode-dockerfile.js diff --git a/ace/mode-dot.js b/static/ace/mode-dot.js similarity index 100% rename from ace/mode-dot.js rename to static/ace/mode-dot.js diff --git a/ace/mode-eiffel.js b/static/ace/mode-eiffel.js similarity index 100% rename from ace/mode-eiffel.js rename to static/ace/mode-eiffel.js diff --git a/ace/mode-ejs.js b/static/ace/mode-ejs.js similarity index 100% rename from ace/mode-ejs.js rename to static/ace/mode-ejs.js diff --git a/ace/mode-elixir.js b/static/ace/mode-elixir.js similarity index 100% rename from ace/mode-elixir.js rename to static/ace/mode-elixir.js diff --git a/ace/mode-elm.js b/static/ace/mode-elm.js similarity index 100% rename from ace/mode-elm.js rename to static/ace/mode-elm.js diff --git a/ace/mode-erlang.js b/static/ace/mode-erlang.js similarity index 100% rename from ace/mode-erlang.js rename to static/ace/mode-erlang.js diff --git a/ace/mode-forth.js b/static/ace/mode-forth.js similarity index 100% rename from ace/mode-forth.js rename to static/ace/mode-forth.js diff --git a/ace/mode-ftl.js b/static/ace/mode-ftl.js similarity index 100% rename from ace/mode-ftl.js rename to static/ace/mode-ftl.js diff --git a/ace/mode-gcode.js b/static/ace/mode-gcode.js similarity index 100% rename from ace/mode-gcode.js rename to static/ace/mode-gcode.js diff --git a/ace/mode-gherkin.js b/static/ace/mode-gherkin.js similarity index 100% rename from ace/mode-gherkin.js rename to static/ace/mode-gherkin.js diff --git a/ace/mode-gitignore.js b/static/ace/mode-gitignore.js similarity index 100% rename from ace/mode-gitignore.js rename to static/ace/mode-gitignore.js diff --git a/ace/mode-glsl.js b/static/ace/mode-glsl.js similarity index 100% rename from ace/mode-glsl.js rename to static/ace/mode-glsl.js diff --git a/ace/mode-golang.js b/static/ace/mode-golang.js similarity index 100% rename from ace/mode-golang.js rename to static/ace/mode-golang.js diff --git a/ace/mode-groovy.js b/static/ace/mode-groovy.js similarity index 100% rename from ace/mode-groovy.js rename to static/ace/mode-groovy.js diff --git a/ace/mode-haml.js b/static/ace/mode-haml.js similarity index 100% rename from ace/mode-haml.js rename to static/ace/mode-haml.js diff --git a/ace/mode-handlebars.js b/static/ace/mode-handlebars.js similarity index 100% rename from ace/mode-handlebars.js rename to static/ace/mode-handlebars.js diff --git a/ace/mode-haskell.js b/static/ace/mode-haskell.js similarity index 100% rename from ace/mode-haskell.js rename to static/ace/mode-haskell.js diff --git a/ace/mode-haxe.js b/static/ace/mode-haxe.js similarity index 100% rename from ace/mode-haxe.js rename to static/ace/mode-haxe.js diff --git a/ace/mode-html.js b/static/ace/mode-html.js similarity index 100% rename from ace/mode-html.js rename to static/ace/mode-html.js diff --git a/ace/mode-html_ruby.js b/static/ace/mode-html_ruby.js similarity index 100% rename from ace/mode-html_ruby.js rename to static/ace/mode-html_ruby.js diff --git a/ace/mode-ini.js b/static/ace/mode-ini.js similarity index 100% rename from ace/mode-ini.js rename to static/ace/mode-ini.js diff --git a/ace/mode-io.js b/static/ace/mode-io.js similarity index 100% rename from ace/mode-io.js rename to static/ace/mode-io.js diff --git a/ace/mode-jack.js b/static/ace/mode-jack.js similarity index 100% rename from ace/mode-jack.js rename to static/ace/mode-jack.js diff --git a/ace/mode-jade.js b/static/ace/mode-jade.js similarity index 100% rename from ace/mode-jade.js rename to static/ace/mode-jade.js diff --git a/ace/mode-java.js b/static/ace/mode-java.js similarity index 100% rename from ace/mode-java.js rename to static/ace/mode-java.js diff --git a/ace/mode-javascript.js b/static/ace/mode-javascript.js similarity index 100% rename from ace/mode-javascript.js rename to static/ace/mode-javascript.js diff --git a/ace/mode-json.js b/static/ace/mode-json.js similarity index 100% rename from ace/mode-json.js rename to static/ace/mode-json.js diff --git a/ace/mode-jsoniq.js b/static/ace/mode-jsoniq.js similarity index 100% rename from ace/mode-jsoniq.js rename to static/ace/mode-jsoniq.js diff --git a/ace/mode-jsp.js b/static/ace/mode-jsp.js similarity index 100% rename from ace/mode-jsp.js rename to static/ace/mode-jsp.js diff --git a/ace/mode-jsx.js b/static/ace/mode-jsx.js similarity index 100% rename from ace/mode-jsx.js rename to static/ace/mode-jsx.js diff --git a/ace/mode-julia.js b/static/ace/mode-julia.js similarity index 100% rename from ace/mode-julia.js rename to static/ace/mode-julia.js diff --git a/ace/mode-latex.js b/static/ace/mode-latex.js similarity index 100% rename from ace/mode-latex.js rename to static/ace/mode-latex.js diff --git a/ace/mode-lean.js b/static/ace/mode-lean.js similarity index 100% rename from ace/mode-lean.js rename to static/ace/mode-lean.js diff --git a/ace/mode-less.js b/static/ace/mode-less.js similarity index 100% rename from ace/mode-less.js rename to static/ace/mode-less.js diff --git a/ace/mode-liquid.js b/static/ace/mode-liquid.js similarity index 100% rename from ace/mode-liquid.js rename to static/ace/mode-liquid.js diff --git a/ace/mode-lisp.js b/static/ace/mode-lisp.js similarity index 100% rename from ace/mode-lisp.js rename to static/ace/mode-lisp.js diff --git a/ace/mode-live_script.js b/static/ace/mode-live_script.js similarity index 100% rename from ace/mode-live_script.js rename to static/ace/mode-live_script.js diff --git a/ace/mode-livescript.js b/static/ace/mode-livescript.js similarity index 100% rename from ace/mode-livescript.js rename to static/ace/mode-livescript.js diff --git a/ace/mode-logiql.js b/static/ace/mode-logiql.js similarity index 100% rename from ace/mode-logiql.js rename to static/ace/mode-logiql.js diff --git a/ace/mode-lsl.js b/static/ace/mode-lsl.js similarity index 100% rename from ace/mode-lsl.js rename to static/ace/mode-lsl.js diff --git a/ace/mode-lua.js b/static/ace/mode-lua.js similarity index 100% rename from ace/mode-lua.js rename to static/ace/mode-lua.js diff --git a/ace/mode-luapage.js b/static/ace/mode-luapage.js similarity index 100% rename from ace/mode-luapage.js rename to static/ace/mode-luapage.js diff --git a/ace/mode-lucene.js b/static/ace/mode-lucene.js similarity index 100% rename from ace/mode-lucene.js rename to static/ace/mode-lucene.js diff --git a/ace/mode-makefile.js b/static/ace/mode-makefile.js similarity index 100% rename from ace/mode-makefile.js rename to static/ace/mode-makefile.js diff --git a/ace/mode-markdown.js b/static/ace/mode-markdown.js similarity index 100% rename from ace/mode-markdown.js rename to static/ace/mode-markdown.js diff --git a/ace/mode-mask.js b/static/ace/mode-mask.js similarity index 100% rename from ace/mode-mask.js rename to static/ace/mode-mask.js diff --git a/ace/mode-matlab.js b/static/ace/mode-matlab.js similarity index 100% rename from ace/mode-matlab.js rename to static/ace/mode-matlab.js diff --git a/ace/mode-maze.js b/static/ace/mode-maze.js similarity index 100% rename from ace/mode-maze.js rename to static/ace/mode-maze.js diff --git a/ace/mode-mel.js b/static/ace/mode-mel.js similarity index 100% rename from ace/mode-mel.js rename to static/ace/mode-mel.js diff --git a/ace/mode-mips_assembler.js b/static/ace/mode-mips_assembler.js similarity index 100% rename from ace/mode-mips_assembler.js rename to static/ace/mode-mips_assembler.js diff --git a/ace/mode-mipsassembler.js b/static/ace/mode-mipsassembler.js similarity index 100% rename from ace/mode-mipsassembler.js rename to static/ace/mode-mipsassembler.js diff --git a/ace/mode-mushcode.js b/static/ace/mode-mushcode.js similarity index 100% rename from ace/mode-mushcode.js rename to static/ace/mode-mushcode.js diff --git a/ace/mode-mysql.js b/static/ace/mode-mysql.js similarity index 100% rename from ace/mode-mysql.js rename to static/ace/mode-mysql.js diff --git a/ace/mode-nix.js b/static/ace/mode-nix.js similarity index 100% rename from ace/mode-nix.js rename to static/ace/mode-nix.js diff --git a/ace/mode-objectivec.js b/static/ace/mode-objectivec.js similarity index 100% rename from ace/mode-objectivec.js rename to static/ace/mode-objectivec.js diff --git a/ace/mode-ocaml.js b/static/ace/mode-ocaml.js similarity index 100% rename from ace/mode-ocaml.js rename to static/ace/mode-ocaml.js diff --git a/ace/mode-pascal.js b/static/ace/mode-pascal.js similarity index 100% rename from ace/mode-pascal.js rename to static/ace/mode-pascal.js diff --git a/ace/mode-perl.js b/static/ace/mode-perl.js similarity index 100% rename from ace/mode-perl.js rename to static/ace/mode-perl.js diff --git a/ace/mode-pgsql.js b/static/ace/mode-pgsql.js similarity index 100% rename from ace/mode-pgsql.js rename to static/ace/mode-pgsql.js diff --git a/ace/mode-php.js b/static/ace/mode-php.js similarity index 100% rename from ace/mode-php.js rename to static/ace/mode-php.js diff --git a/ace/mode-plain_text.js b/static/ace/mode-plain_text.js similarity index 100% rename from ace/mode-plain_text.js rename to static/ace/mode-plain_text.js diff --git a/ace/mode-powershell.js b/static/ace/mode-powershell.js similarity index 100% rename from ace/mode-powershell.js rename to static/ace/mode-powershell.js diff --git a/ace/mode-praat.js b/static/ace/mode-praat.js similarity index 100% rename from ace/mode-praat.js rename to static/ace/mode-praat.js diff --git a/ace/mode-prolog.js b/static/ace/mode-prolog.js similarity index 100% rename from ace/mode-prolog.js rename to static/ace/mode-prolog.js diff --git a/ace/mode-properties.js b/static/ace/mode-properties.js similarity index 100% rename from ace/mode-properties.js rename to static/ace/mode-properties.js diff --git a/ace/mode-protobuf.js b/static/ace/mode-protobuf.js similarity index 100% rename from ace/mode-protobuf.js rename to static/ace/mode-protobuf.js diff --git a/ace/mode-python.js b/static/ace/mode-python.js similarity index 100% rename from ace/mode-python.js rename to static/ace/mode-python.js diff --git a/ace/mode-r.js b/static/ace/mode-r.js similarity index 100% rename from ace/mode-r.js rename to static/ace/mode-r.js diff --git a/ace/mode-rdoc.js b/static/ace/mode-rdoc.js similarity index 100% rename from ace/mode-rdoc.js rename to static/ace/mode-rdoc.js diff --git a/ace/mode-rhtml.js b/static/ace/mode-rhtml.js similarity index 100% rename from ace/mode-rhtml.js rename to static/ace/mode-rhtml.js diff --git a/ace/mode-ruby.js b/static/ace/mode-ruby.js similarity index 100% rename from ace/mode-ruby.js rename to static/ace/mode-ruby.js diff --git a/ace/mode-rust.js b/static/ace/mode-rust.js similarity index 100% rename from ace/mode-rust.js rename to static/ace/mode-rust.js diff --git a/ace/mode-sass.js b/static/ace/mode-sass.js similarity index 100% rename from ace/mode-sass.js rename to static/ace/mode-sass.js diff --git a/ace/mode-scad.js b/static/ace/mode-scad.js similarity index 100% rename from ace/mode-scad.js rename to static/ace/mode-scad.js diff --git a/ace/mode-scala.js b/static/ace/mode-scala.js similarity index 100% rename from ace/mode-scala.js rename to static/ace/mode-scala.js diff --git a/ace/mode-scheme.js b/static/ace/mode-scheme.js similarity index 100% rename from ace/mode-scheme.js rename to static/ace/mode-scheme.js diff --git a/ace/mode-scss.js b/static/ace/mode-scss.js similarity index 100% rename from ace/mode-scss.js rename to static/ace/mode-scss.js diff --git a/ace/mode-sh.js b/static/ace/mode-sh.js similarity index 100% rename from ace/mode-sh.js rename to static/ace/mode-sh.js diff --git a/ace/mode-sjs.js b/static/ace/mode-sjs.js similarity index 100% rename from ace/mode-sjs.js rename to static/ace/mode-sjs.js diff --git a/ace/mode-smarty.js b/static/ace/mode-smarty.js similarity index 100% rename from ace/mode-smarty.js rename to static/ace/mode-smarty.js diff --git a/ace/mode-snippets.js b/static/ace/mode-snippets.js similarity index 100% rename from ace/mode-snippets.js rename to static/ace/mode-snippets.js diff --git a/ace/mode-soy_template.js b/static/ace/mode-soy_template.js similarity index 100% rename from ace/mode-soy_template.js rename to static/ace/mode-soy_template.js diff --git a/ace/mode-space.js b/static/ace/mode-space.js similarity index 100% rename from ace/mode-space.js rename to static/ace/mode-space.js diff --git a/ace/mode-sql.js b/static/ace/mode-sql.js similarity index 100% rename from ace/mode-sql.js rename to static/ace/mode-sql.js diff --git a/ace/mode-sqlserver.js b/static/ace/mode-sqlserver.js similarity index 100% rename from ace/mode-sqlserver.js rename to static/ace/mode-sqlserver.js diff --git a/ace/mode-stylus.js b/static/ace/mode-stylus.js similarity index 100% rename from ace/mode-stylus.js rename to static/ace/mode-stylus.js diff --git a/ace/mode-svg.js b/static/ace/mode-svg.js similarity index 100% rename from ace/mode-svg.js rename to static/ace/mode-svg.js diff --git a/ace/mode-tcl.js b/static/ace/mode-tcl.js similarity index 100% rename from ace/mode-tcl.js rename to static/ace/mode-tcl.js diff --git a/ace/mode-tex.js b/static/ace/mode-tex.js similarity index 100% rename from ace/mode-tex.js rename to static/ace/mode-tex.js diff --git a/ace/mode-text.js b/static/ace/mode-text.js similarity index 100% rename from ace/mode-text.js rename to static/ace/mode-text.js diff --git a/ace/mode-textile.js b/static/ace/mode-textile.js similarity index 100% rename from ace/mode-textile.js rename to static/ace/mode-textile.js diff --git a/ace/mode-toml.js b/static/ace/mode-toml.js similarity index 100% rename from ace/mode-toml.js rename to static/ace/mode-toml.js diff --git a/ace/mode-twig.js b/static/ace/mode-twig.js similarity index 100% rename from ace/mode-twig.js rename to static/ace/mode-twig.js diff --git a/ace/mode-typescript.js b/static/ace/mode-typescript.js similarity index 100% rename from ace/mode-typescript.js rename to static/ace/mode-typescript.js diff --git a/ace/mode-vala.js b/static/ace/mode-vala.js similarity index 100% rename from ace/mode-vala.js rename to static/ace/mode-vala.js diff --git a/ace/mode-vbscript.js b/static/ace/mode-vbscript.js similarity index 100% rename from ace/mode-vbscript.js rename to static/ace/mode-vbscript.js diff --git a/ace/mode-velocity.js b/static/ace/mode-velocity.js similarity index 100% rename from ace/mode-velocity.js rename to static/ace/mode-velocity.js diff --git a/ace/mode-verilog.js b/static/ace/mode-verilog.js similarity index 100% rename from ace/mode-verilog.js rename to static/ace/mode-verilog.js diff --git a/ace/mode-vhdl.js b/static/ace/mode-vhdl.js similarity index 100% rename from ace/mode-vhdl.js rename to static/ace/mode-vhdl.js diff --git a/ace/mode-xml.js b/static/ace/mode-xml.js similarity index 100% rename from ace/mode-xml.js rename to static/ace/mode-xml.js diff --git a/ace/mode-xquery.js b/static/ace/mode-xquery.js similarity index 100% rename from ace/mode-xquery.js rename to static/ace/mode-xquery.js diff --git a/ace/mode-yaml.js b/static/ace/mode-yaml.js similarity index 100% rename from ace/mode-yaml.js rename to static/ace/mode-yaml.js diff --git a/ace/snippets/abap.js b/static/ace/snippets/abap.js similarity index 100% rename from ace/snippets/abap.js rename to static/ace/snippets/abap.js diff --git a/ace/snippets/abc.js b/static/ace/snippets/abc.js similarity index 100% rename from ace/snippets/abc.js rename to static/ace/snippets/abc.js diff --git a/ace/snippets/actionscript.js b/static/ace/snippets/actionscript.js similarity index 100% rename from ace/snippets/actionscript.js rename to static/ace/snippets/actionscript.js diff --git a/ace/snippets/ada.js b/static/ace/snippets/ada.js similarity index 100% rename from ace/snippets/ada.js rename to static/ace/snippets/ada.js diff --git a/ace/snippets/apache_conf.js b/static/ace/snippets/apache_conf.js similarity index 100% rename from ace/snippets/apache_conf.js rename to static/ace/snippets/apache_conf.js diff --git a/ace/snippets/applescript.js b/static/ace/snippets/applescript.js similarity index 100% rename from ace/snippets/applescript.js rename to static/ace/snippets/applescript.js diff --git a/ace/snippets/asciidoc.js b/static/ace/snippets/asciidoc.js similarity index 100% rename from ace/snippets/asciidoc.js rename to static/ace/snippets/asciidoc.js diff --git a/ace/snippets/assembly_x86.js b/static/ace/snippets/assembly_x86.js similarity index 100% rename from ace/snippets/assembly_x86.js rename to static/ace/snippets/assembly_x86.js diff --git a/ace/snippets/autohotkey.js b/static/ace/snippets/autohotkey.js similarity index 100% rename from ace/snippets/autohotkey.js rename to static/ace/snippets/autohotkey.js diff --git a/ace/snippets/batchfile.js b/static/ace/snippets/batchfile.js similarity index 100% rename from ace/snippets/batchfile.js rename to static/ace/snippets/batchfile.js diff --git a/ace/snippets/c9search.js b/static/ace/snippets/c9search.js similarity index 100% rename from ace/snippets/c9search.js rename to static/ace/snippets/c9search.js diff --git a/ace/snippets/c_cpp.js b/static/ace/snippets/c_cpp.js similarity index 100% rename from ace/snippets/c_cpp.js rename to static/ace/snippets/c_cpp.js diff --git a/ace/snippets/cirru.js b/static/ace/snippets/cirru.js similarity index 100% rename from ace/snippets/cirru.js rename to static/ace/snippets/cirru.js diff --git a/ace/snippets/clojure.js b/static/ace/snippets/clojure.js similarity index 100% rename from ace/snippets/clojure.js rename to static/ace/snippets/clojure.js diff --git a/ace/snippets/cobol.js b/static/ace/snippets/cobol.js similarity index 100% rename from ace/snippets/cobol.js rename to static/ace/snippets/cobol.js diff --git a/ace/snippets/coffee.js b/static/ace/snippets/coffee.js similarity index 100% rename from ace/snippets/coffee.js rename to static/ace/snippets/coffee.js diff --git a/ace/snippets/coldfusion.js b/static/ace/snippets/coldfusion.js similarity index 100% rename from ace/snippets/coldfusion.js rename to static/ace/snippets/coldfusion.js diff --git a/ace/snippets/csharp.js b/static/ace/snippets/csharp.js similarity index 100% rename from ace/snippets/csharp.js rename to static/ace/snippets/csharp.js diff --git a/ace/snippets/css.js b/static/ace/snippets/css.js similarity index 100% rename from ace/snippets/css.js rename to static/ace/snippets/css.js diff --git a/ace/snippets/curly.js b/static/ace/snippets/curly.js similarity index 100% rename from ace/snippets/curly.js rename to static/ace/snippets/curly.js diff --git a/ace/snippets/d.js b/static/ace/snippets/d.js similarity index 100% rename from ace/snippets/d.js rename to static/ace/snippets/d.js diff --git a/ace/snippets/dart.js b/static/ace/snippets/dart.js similarity index 100% rename from ace/snippets/dart.js rename to static/ace/snippets/dart.js diff --git a/ace/snippets/diff.js b/static/ace/snippets/diff.js similarity index 100% rename from ace/snippets/diff.js rename to static/ace/snippets/diff.js diff --git a/ace/snippets/django.js b/static/ace/snippets/django.js similarity index 100% rename from ace/snippets/django.js rename to static/ace/snippets/django.js diff --git a/ace/snippets/dockerfile.js b/static/ace/snippets/dockerfile.js similarity index 100% rename from ace/snippets/dockerfile.js rename to static/ace/snippets/dockerfile.js diff --git a/ace/snippets/dot.js b/static/ace/snippets/dot.js similarity index 100% rename from ace/snippets/dot.js rename to static/ace/snippets/dot.js diff --git a/ace/snippets/eiffel.js b/static/ace/snippets/eiffel.js similarity index 100% rename from ace/snippets/eiffel.js rename to static/ace/snippets/eiffel.js diff --git a/ace/snippets/ejs.js b/static/ace/snippets/ejs.js similarity index 100% rename from ace/snippets/ejs.js rename to static/ace/snippets/ejs.js diff --git a/ace/snippets/elixir.js b/static/ace/snippets/elixir.js similarity index 100% rename from ace/snippets/elixir.js rename to static/ace/snippets/elixir.js diff --git a/ace/snippets/elm.js b/static/ace/snippets/elm.js similarity index 100% rename from ace/snippets/elm.js rename to static/ace/snippets/elm.js diff --git a/ace/snippets/erlang.js b/static/ace/snippets/erlang.js similarity index 100% rename from ace/snippets/erlang.js rename to static/ace/snippets/erlang.js diff --git a/ace/snippets/forth.js b/static/ace/snippets/forth.js similarity index 100% rename from ace/snippets/forth.js rename to static/ace/snippets/forth.js diff --git a/ace/snippets/ftl.js b/static/ace/snippets/ftl.js similarity index 100% rename from ace/snippets/ftl.js rename to static/ace/snippets/ftl.js diff --git a/ace/snippets/gcode.js b/static/ace/snippets/gcode.js similarity index 100% rename from ace/snippets/gcode.js rename to static/ace/snippets/gcode.js diff --git a/ace/snippets/gherkin.js b/static/ace/snippets/gherkin.js similarity index 100% rename from ace/snippets/gherkin.js rename to static/ace/snippets/gherkin.js diff --git a/ace/snippets/gitignore.js b/static/ace/snippets/gitignore.js similarity index 100% rename from ace/snippets/gitignore.js rename to static/ace/snippets/gitignore.js diff --git a/ace/snippets/glsl.js b/static/ace/snippets/glsl.js similarity index 100% rename from ace/snippets/glsl.js rename to static/ace/snippets/glsl.js diff --git a/ace/snippets/golang.js b/static/ace/snippets/golang.js similarity index 100% rename from ace/snippets/golang.js rename to static/ace/snippets/golang.js diff --git a/ace/snippets/groovy.js b/static/ace/snippets/groovy.js similarity index 100% rename from ace/snippets/groovy.js rename to static/ace/snippets/groovy.js diff --git a/ace/snippets/haml.js b/static/ace/snippets/haml.js similarity index 100% rename from ace/snippets/haml.js rename to static/ace/snippets/haml.js diff --git a/ace/snippets/handlebars.js b/static/ace/snippets/handlebars.js similarity index 100% rename from ace/snippets/handlebars.js rename to static/ace/snippets/handlebars.js diff --git a/ace/snippets/haskell.js b/static/ace/snippets/haskell.js similarity index 100% rename from ace/snippets/haskell.js rename to static/ace/snippets/haskell.js diff --git a/ace/snippets/haxe.js b/static/ace/snippets/haxe.js similarity index 100% rename from ace/snippets/haxe.js rename to static/ace/snippets/haxe.js diff --git a/ace/snippets/html.js b/static/ace/snippets/html.js similarity index 100% rename from ace/snippets/html.js rename to static/ace/snippets/html.js diff --git a/ace/snippets/html_ruby.js b/static/ace/snippets/html_ruby.js similarity index 100% rename from ace/snippets/html_ruby.js rename to static/ace/snippets/html_ruby.js diff --git a/ace/snippets/ini.js b/static/ace/snippets/ini.js similarity index 100% rename from ace/snippets/ini.js rename to static/ace/snippets/ini.js diff --git a/ace/snippets/io.js b/static/ace/snippets/io.js similarity index 100% rename from ace/snippets/io.js rename to static/ace/snippets/io.js diff --git a/ace/snippets/jack.js b/static/ace/snippets/jack.js similarity index 100% rename from ace/snippets/jack.js rename to static/ace/snippets/jack.js diff --git a/ace/snippets/jade.js b/static/ace/snippets/jade.js similarity index 100% rename from ace/snippets/jade.js rename to static/ace/snippets/jade.js diff --git a/ace/snippets/java.js b/static/ace/snippets/java.js similarity index 100% rename from ace/snippets/java.js rename to static/ace/snippets/java.js diff --git a/ace/snippets/javascript.js b/static/ace/snippets/javascript.js similarity index 100% rename from ace/snippets/javascript.js rename to static/ace/snippets/javascript.js diff --git a/ace/snippets/json.js b/static/ace/snippets/json.js similarity index 100% rename from ace/snippets/json.js rename to static/ace/snippets/json.js diff --git a/ace/snippets/jsoniq.js b/static/ace/snippets/jsoniq.js similarity index 100% rename from ace/snippets/jsoniq.js rename to static/ace/snippets/jsoniq.js diff --git a/ace/snippets/jsp.js b/static/ace/snippets/jsp.js similarity index 100% rename from ace/snippets/jsp.js rename to static/ace/snippets/jsp.js diff --git a/ace/snippets/jsx.js b/static/ace/snippets/jsx.js similarity index 100% rename from ace/snippets/jsx.js rename to static/ace/snippets/jsx.js diff --git a/ace/snippets/julia.js b/static/ace/snippets/julia.js similarity index 100% rename from ace/snippets/julia.js rename to static/ace/snippets/julia.js diff --git a/ace/snippets/latex.js b/static/ace/snippets/latex.js similarity index 100% rename from ace/snippets/latex.js rename to static/ace/snippets/latex.js diff --git a/ace/snippets/lean.js b/static/ace/snippets/lean.js similarity index 100% rename from ace/snippets/lean.js rename to static/ace/snippets/lean.js diff --git a/ace/snippets/less.js b/static/ace/snippets/less.js similarity index 100% rename from ace/snippets/less.js rename to static/ace/snippets/less.js diff --git a/ace/snippets/liquid.js b/static/ace/snippets/liquid.js similarity index 100% rename from ace/snippets/liquid.js rename to static/ace/snippets/liquid.js diff --git a/ace/snippets/lisp.js b/static/ace/snippets/lisp.js similarity index 100% rename from ace/snippets/lisp.js rename to static/ace/snippets/lisp.js diff --git a/ace/snippets/live_script.js b/static/ace/snippets/live_script.js similarity index 100% rename from ace/snippets/live_script.js rename to static/ace/snippets/live_script.js diff --git a/ace/snippets/livescript.js b/static/ace/snippets/livescript.js similarity index 100% rename from ace/snippets/livescript.js rename to static/ace/snippets/livescript.js diff --git a/ace/snippets/logiql.js b/static/ace/snippets/logiql.js similarity index 100% rename from ace/snippets/logiql.js rename to static/ace/snippets/logiql.js diff --git a/ace/snippets/lsl.js b/static/ace/snippets/lsl.js similarity index 100% rename from ace/snippets/lsl.js rename to static/ace/snippets/lsl.js diff --git a/ace/snippets/lua.js b/static/ace/snippets/lua.js similarity index 100% rename from ace/snippets/lua.js rename to static/ace/snippets/lua.js diff --git a/ace/snippets/luapage.js b/static/ace/snippets/luapage.js similarity index 100% rename from ace/snippets/luapage.js rename to static/ace/snippets/luapage.js diff --git a/ace/snippets/lucene.js b/static/ace/snippets/lucene.js similarity index 100% rename from ace/snippets/lucene.js rename to static/ace/snippets/lucene.js diff --git a/ace/snippets/makefile.js b/static/ace/snippets/makefile.js similarity index 100% rename from ace/snippets/makefile.js rename to static/ace/snippets/makefile.js diff --git a/ace/snippets/markdown.js b/static/ace/snippets/markdown.js similarity index 100% rename from ace/snippets/markdown.js rename to static/ace/snippets/markdown.js diff --git a/ace/snippets/mask.js b/static/ace/snippets/mask.js similarity index 100% rename from ace/snippets/mask.js rename to static/ace/snippets/mask.js diff --git a/ace/snippets/matlab.js b/static/ace/snippets/matlab.js similarity index 100% rename from ace/snippets/matlab.js rename to static/ace/snippets/matlab.js diff --git a/ace/snippets/maze.js b/static/ace/snippets/maze.js similarity index 100% rename from ace/snippets/maze.js rename to static/ace/snippets/maze.js diff --git a/ace/snippets/mel.js b/static/ace/snippets/mel.js similarity index 100% rename from ace/snippets/mel.js rename to static/ace/snippets/mel.js diff --git a/ace/snippets/mips_assembler.js b/static/ace/snippets/mips_assembler.js similarity index 100% rename from ace/snippets/mips_assembler.js rename to static/ace/snippets/mips_assembler.js diff --git a/ace/snippets/mipsassembler.js b/static/ace/snippets/mipsassembler.js similarity index 100% rename from ace/snippets/mipsassembler.js rename to static/ace/snippets/mipsassembler.js diff --git a/ace/snippets/mushcode.js b/static/ace/snippets/mushcode.js similarity index 100% rename from ace/snippets/mushcode.js rename to static/ace/snippets/mushcode.js diff --git a/ace/snippets/mysql.js b/static/ace/snippets/mysql.js similarity index 100% rename from ace/snippets/mysql.js rename to static/ace/snippets/mysql.js diff --git a/ace/snippets/nix.js b/static/ace/snippets/nix.js similarity index 100% rename from ace/snippets/nix.js rename to static/ace/snippets/nix.js diff --git a/ace/snippets/objectivec.js b/static/ace/snippets/objectivec.js similarity index 100% rename from ace/snippets/objectivec.js rename to static/ace/snippets/objectivec.js diff --git a/ace/snippets/ocaml.js b/static/ace/snippets/ocaml.js similarity index 100% rename from ace/snippets/ocaml.js rename to static/ace/snippets/ocaml.js diff --git a/ace/snippets/pascal.js b/static/ace/snippets/pascal.js similarity index 100% rename from ace/snippets/pascal.js rename to static/ace/snippets/pascal.js diff --git a/ace/snippets/perl.js b/static/ace/snippets/perl.js similarity index 100% rename from ace/snippets/perl.js rename to static/ace/snippets/perl.js diff --git a/ace/snippets/pgsql.js b/static/ace/snippets/pgsql.js similarity index 100% rename from ace/snippets/pgsql.js rename to static/ace/snippets/pgsql.js diff --git a/ace/snippets/php.js b/static/ace/snippets/php.js similarity index 100% rename from ace/snippets/php.js rename to static/ace/snippets/php.js diff --git a/ace/snippets/plain_text.js b/static/ace/snippets/plain_text.js similarity index 100% rename from ace/snippets/plain_text.js rename to static/ace/snippets/plain_text.js diff --git a/ace/snippets/powershell.js b/static/ace/snippets/powershell.js similarity index 100% rename from ace/snippets/powershell.js rename to static/ace/snippets/powershell.js diff --git a/ace/snippets/praat.js b/static/ace/snippets/praat.js similarity index 100% rename from ace/snippets/praat.js rename to static/ace/snippets/praat.js diff --git a/ace/snippets/prolog.js b/static/ace/snippets/prolog.js similarity index 100% rename from ace/snippets/prolog.js rename to static/ace/snippets/prolog.js diff --git a/ace/snippets/properties.js b/static/ace/snippets/properties.js similarity index 100% rename from ace/snippets/properties.js rename to static/ace/snippets/properties.js diff --git a/ace/snippets/protobuf.js b/static/ace/snippets/protobuf.js similarity index 100% rename from ace/snippets/protobuf.js rename to static/ace/snippets/protobuf.js diff --git a/ace/snippets/python.js b/static/ace/snippets/python.js similarity index 100% rename from ace/snippets/python.js rename to static/ace/snippets/python.js diff --git a/ace/snippets/r.js b/static/ace/snippets/r.js similarity index 100% rename from ace/snippets/r.js rename to static/ace/snippets/r.js diff --git a/ace/snippets/rdoc.js b/static/ace/snippets/rdoc.js similarity index 100% rename from ace/snippets/rdoc.js rename to static/ace/snippets/rdoc.js diff --git a/ace/snippets/rhtml.js b/static/ace/snippets/rhtml.js similarity index 100% rename from ace/snippets/rhtml.js rename to static/ace/snippets/rhtml.js diff --git a/ace/snippets/ruby.js b/static/ace/snippets/ruby.js similarity index 100% rename from ace/snippets/ruby.js rename to static/ace/snippets/ruby.js diff --git a/ace/snippets/rust.js b/static/ace/snippets/rust.js similarity index 100% rename from ace/snippets/rust.js rename to static/ace/snippets/rust.js diff --git a/ace/snippets/sass.js b/static/ace/snippets/sass.js similarity index 100% rename from ace/snippets/sass.js rename to static/ace/snippets/sass.js diff --git a/ace/snippets/scad.js b/static/ace/snippets/scad.js similarity index 100% rename from ace/snippets/scad.js rename to static/ace/snippets/scad.js diff --git a/ace/snippets/scala.js b/static/ace/snippets/scala.js similarity index 100% rename from ace/snippets/scala.js rename to static/ace/snippets/scala.js diff --git a/ace/snippets/scheme.js b/static/ace/snippets/scheme.js similarity index 100% rename from ace/snippets/scheme.js rename to static/ace/snippets/scheme.js diff --git a/ace/snippets/scss.js b/static/ace/snippets/scss.js similarity index 100% rename from ace/snippets/scss.js rename to static/ace/snippets/scss.js diff --git a/ace/snippets/sh.js b/static/ace/snippets/sh.js similarity index 100% rename from ace/snippets/sh.js rename to static/ace/snippets/sh.js diff --git a/ace/snippets/sjs.js b/static/ace/snippets/sjs.js similarity index 100% rename from ace/snippets/sjs.js rename to static/ace/snippets/sjs.js diff --git a/ace/snippets/smarty.js b/static/ace/snippets/smarty.js similarity index 100% rename from ace/snippets/smarty.js rename to static/ace/snippets/smarty.js diff --git a/ace/snippets/snippets.js b/static/ace/snippets/snippets.js similarity index 100% rename from ace/snippets/snippets.js rename to static/ace/snippets/snippets.js diff --git a/ace/snippets/soy_template.js b/static/ace/snippets/soy_template.js similarity index 100% rename from ace/snippets/soy_template.js rename to static/ace/snippets/soy_template.js diff --git a/ace/snippets/space.js b/static/ace/snippets/space.js similarity index 100% rename from ace/snippets/space.js rename to static/ace/snippets/space.js diff --git a/ace/snippets/sql.js b/static/ace/snippets/sql.js similarity index 100% rename from ace/snippets/sql.js rename to static/ace/snippets/sql.js diff --git a/ace/snippets/sqlserver.js b/static/ace/snippets/sqlserver.js similarity index 100% rename from ace/snippets/sqlserver.js rename to static/ace/snippets/sqlserver.js diff --git a/ace/snippets/stylus.js b/static/ace/snippets/stylus.js similarity index 100% rename from ace/snippets/stylus.js rename to static/ace/snippets/stylus.js diff --git a/ace/snippets/svg.js b/static/ace/snippets/svg.js similarity index 100% rename from ace/snippets/svg.js rename to static/ace/snippets/svg.js diff --git a/ace/snippets/tcl.js b/static/ace/snippets/tcl.js similarity index 100% rename from ace/snippets/tcl.js rename to static/ace/snippets/tcl.js diff --git a/ace/snippets/tex.js b/static/ace/snippets/tex.js similarity index 100% rename from ace/snippets/tex.js rename to static/ace/snippets/tex.js diff --git a/ace/snippets/text.js b/static/ace/snippets/text.js similarity index 100% rename from ace/snippets/text.js rename to static/ace/snippets/text.js diff --git a/ace/snippets/textile.js b/static/ace/snippets/textile.js similarity index 100% rename from ace/snippets/textile.js rename to static/ace/snippets/textile.js diff --git a/ace/snippets/toml.js b/static/ace/snippets/toml.js similarity index 100% rename from ace/snippets/toml.js rename to static/ace/snippets/toml.js diff --git a/ace/snippets/twig.js b/static/ace/snippets/twig.js similarity index 100% rename from ace/snippets/twig.js rename to static/ace/snippets/twig.js diff --git a/ace/snippets/typescript.js b/static/ace/snippets/typescript.js similarity index 100% rename from ace/snippets/typescript.js rename to static/ace/snippets/typescript.js diff --git a/ace/snippets/vala.js b/static/ace/snippets/vala.js similarity index 100% rename from ace/snippets/vala.js rename to static/ace/snippets/vala.js diff --git a/ace/snippets/vbscript.js b/static/ace/snippets/vbscript.js similarity index 100% rename from ace/snippets/vbscript.js rename to static/ace/snippets/vbscript.js diff --git a/ace/snippets/velocity.js b/static/ace/snippets/velocity.js similarity index 100% rename from ace/snippets/velocity.js rename to static/ace/snippets/velocity.js diff --git a/ace/snippets/verilog.js b/static/ace/snippets/verilog.js similarity index 100% rename from ace/snippets/verilog.js rename to static/ace/snippets/verilog.js diff --git a/ace/snippets/vhdl.js b/static/ace/snippets/vhdl.js similarity index 100% rename from ace/snippets/vhdl.js rename to static/ace/snippets/vhdl.js diff --git a/ace/snippets/xml.js b/static/ace/snippets/xml.js similarity index 100% rename from ace/snippets/xml.js rename to static/ace/snippets/xml.js diff --git a/ace/snippets/xquery.js b/static/ace/snippets/xquery.js similarity index 100% rename from ace/snippets/xquery.js rename to static/ace/snippets/xquery.js diff --git a/ace/snippets/yaml.js b/static/ace/snippets/yaml.js similarity index 100% rename from ace/snippets/yaml.js rename to static/ace/snippets/yaml.js diff --git a/ace/theme-ambiance.js b/static/ace/theme-ambiance.js similarity index 100% rename from ace/theme-ambiance.js rename to static/ace/theme-ambiance.js diff --git a/ace/theme-chaos.js b/static/ace/theme-chaos.js similarity index 100% rename from ace/theme-chaos.js rename to static/ace/theme-chaos.js diff --git a/ace/theme-chrome.js b/static/ace/theme-chrome.js similarity index 100% rename from ace/theme-chrome.js rename to static/ace/theme-chrome.js diff --git a/ace/theme-clouds.js b/static/ace/theme-clouds.js similarity index 100% rename from ace/theme-clouds.js rename to static/ace/theme-clouds.js diff --git a/ace/theme-clouds_midnight.js b/static/ace/theme-clouds_midnight.js similarity index 100% rename from ace/theme-clouds_midnight.js rename to static/ace/theme-clouds_midnight.js diff --git a/ace/theme-cobalt.js b/static/ace/theme-cobalt.js similarity index 100% rename from ace/theme-cobalt.js rename to static/ace/theme-cobalt.js diff --git a/ace/theme-crimson_editor.js b/static/ace/theme-crimson_editor.js similarity index 100% rename from ace/theme-crimson_editor.js rename to static/ace/theme-crimson_editor.js diff --git a/ace/theme-dawn.js b/static/ace/theme-dawn.js similarity index 100% rename from ace/theme-dawn.js rename to static/ace/theme-dawn.js diff --git a/ace/theme-dreamweaver.js b/static/ace/theme-dreamweaver.js similarity index 100% rename from ace/theme-dreamweaver.js rename to static/ace/theme-dreamweaver.js diff --git a/ace/theme-eclipse.js b/static/ace/theme-eclipse.js similarity index 100% rename from ace/theme-eclipse.js rename to static/ace/theme-eclipse.js diff --git a/ace/theme-github.js b/static/ace/theme-github.js similarity index 100% rename from ace/theme-github.js rename to static/ace/theme-github.js diff --git a/ace/theme-idle_fingers.js b/static/ace/theme-idle_fingers.js similarity index 100% rename from ace/theme-idle_fingers.js rename to static/ace/theme-idle_fingers.js diff --git a/ace/theme-iplastic.js b/static/ace/theme-iplastic.js similarity index 100% rename from ace/theme-iplastic.js rename to static/ace/theme-iplastic.js diff --git a/ace/theme-katzenmilch.js b/static/ace/theme-katzenmilch.js similarity index 100% rename from ace/theme-katzenmilch.js rename to static/ace/theme-katzenmilch.js diff --git a/ace/theme-kr_theme.js b/static/ace/theme-kr_theme.js similarity index 100% rename from ace/theme-kr_theme.js rename to static/ace/theme-kr_theme.js diff --git a/ace/theme-kuroir.js b/static/ace/theme-kuroir.js similarity index 100% rename from ace/theme-kuroir.js rename to static/ace/theme-kuroir.js diff --git a/ace/theme-merbivore.js b/static/ace/theme-merbivore.js similarity index 100% rename from ace/theme-merbivore.js rename to static/ace/theme-merbivore.js diff --git a/ace/theme-merbivore_soft.js b/static/ace/theme-merbivore_soft.js similarity index 100% rename from ace/theme-merbivore_soft.js rename to static/ace/theme-merbivore_soft.js diff --git a/ace/theme-mono_industrial.js b/static/ace/theme-mono_industrial.js similarity index 100% rename from ace/theme-mono_industrial.js rename to static/ace/theme-mono_industrial.js diff --git a/ace/theme-monokai.js b/static/ace/theme-monokai.js similarity index 100% rename from ace/theme-monokai.js rename to static/ace/theme-monokai.js diff --git a/ace/theme-pastel_on_dark.js b/static/ace/theme-pastel_on_dark.js similarity index 100% rename from ace/theme-pastel_on_dark.js rename to static/ace/theme-pastel_on_dark.js diff --git a/ace/theme-solarized_dark.js b/static/ace/theme-solarized_dark.js similarity index 100% rename from ace/theme-solarized_dark.js rename to static/ace/theme-solarized_dark.js diff --git a/ace/theme-solarized_light.js b/static/ace/theme-solarized_light.js similarity index 100% rename from ace/theme-solarized_light.js rename to static/ace/theme-solarized_light.js diff --git a/ace/theme-sqlserver.js b/static/ace/theme-sqlserver.js similarity index 100% rename from ace/theme-sqlserver.js rename to static/ace/theme-sqlserver.js diff --git a/ace/theme-terminal.js b/static/ace/theme-terminal.js similarity index 100% rename from ace/theme-terminal.js rename to static/ace/theme-terminal.js diff --git a/ace/theme-textmate.js b/static/ace/theme-textmate.js similarity index 100% rename from ace/theme-textmate.js rename to static/ace/theme-textmate.js diff --git a/ace/theme-tomorrow.js b/static/ace/theme-tomorrow.js similarity index 100% rename from ace/theme-tomorrow.js rename to static/ace/theme-tomorrow.js diff --git a/ace/theme-tomorrow_night.js b/static/ace/theme-tomorrow_night.js similarity index 100% rename from ace/theme-tomorrow_night.js rename to static/ace/theme-tomorrow_night.js diff --git a/ace/theme-tomorrow_night_blue.js b/static/ace/theme-tomorrow_night_blue.js similarity index 100% rename from ace/theme-tomorrow_night_blue.js rename to static/ace/theme-tomorrow_night_blue.js diff --git a/ace/theme-tomorrow_night_bright.js b/static/ace/theme-tomorrow_night_bright.js similarity index 100% rename from ace/theme-tomorrow_night_bright.js rename to static/ace/theme-tomorrow_night_bright.js diff --git a/ace/theme-tomorrow_night_eighties.js b/static/ace/theme-tomorrow_night_eighties.js similarity index 100% rename from ace/theme-tomorrow_night_eighties.js rename to static/ace/theme-tomorrow_night_eighties.js diff --git a/ace/theme-twilight.js b/static/ace/theme-twilight.js similarity index 100% rename from ace/theme-twilight.js rename to static/ace/theme-twilight.js diff --git a/ace/theme-vibrant_ink.js b/static/ace/theme-vibrant_ink.js similarity index 100% rename from ace/theme-vibrant_ink.js rename to static/ace/theme-vibrant_ink.js diff --git a/ace/theme-xcode.js b/static/ace/theme-xcode.js similarity index 100% rename from ace/theme-xcode.js rename to static/ace/theme-xcode.js diff --git a/ace/worker-coffee.js b/static/ace/worker-coffee.js similarity index 100% rename from ace/worker-coffee.js rename to static/ace/worker-coffee.js diff --git a/ace/worker-css.js b/static/ace/worker-css.js similarity index 100% rename from ace/worker-css.js rename to static/ace/worker-css.js diff --git a/ace/worker-html.js b/static/ace/worker-html.js similarity index 100% rename from ace/worker-html.js rename to static/ace/worker-html.js diff --git a/ace/worker-javascript.js b/static/ace/worker-javascript.js similarity index 100% rename from ace/worker-javascript.js rename to static/ace/worker-javascript.js diff --git a/ace/worker-json.js b/static/ace/worker-json.js similarity index 100% rename from ace/worker-json.js rename to static/ace/worker-json.js diff --git a/ace/worker-lua.js b/static/ace/worker-lua.js similarity index 100% rename from ace/worker-lua.js rename to static/ace/worker-lua.js diff --git a/ace/worker-php.js b/static/ace/worker-php.js similarity index 100% rename from ace/worker-php.js rename to static/ace/worker-php.js diff --git a/ace/worker-xml.js b/static/ace/worker-xml.js similarity index 100% rename from ace/worker-xml.js rename to static/ace/worker-xml.js diff --git a/ace/worker-xquery.js b/static/ace/worker-xquery.js similarity index 100% rename from ace/worker-xquery.js rename to static/ace/worker-xquery.js diff --git a/static/css/style.css b/static/css/style.css index a46acd8c..ce7b0cc4 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -72,9 +72,7 @@ body, input { /* Script info box */ #script-box { margin-right: 1rem; - margin-left: 1rem; - text-align: right; - width: 100%; + margin-left: auto; } #script-name { diff --git a/python-main.js b/static/js/python-main.js similarity index 64% rename from python-main.js rename to static/js/python-main.js index e319ee5d..60d5d2bb 100644 --- a/python-main.js +++ b/static/js/python-main.js @@ -13,13 +13,13 @@ is attached to the div with the referenced id. */ function pythonEditor(id) { // An object that encapsulates the behaviour of the editor. - editor = {}; + var editor = {}; // Represents the ACE based editor. var ACE = ace.edit(id); // The editor is in the tag with the referenced id. ACE.setOptions({ enableSnippets: true // Enable code snippets. - }) + }); ACE.setTheme("ace/theme/kr_theme"); // Make it look nice. ACE.getSession().setMode("ace/mode/python"); // We're editing Python. ACE.getSession().setTabSize(4); // Tab=4 spaces. @@ -39,10 +39,10 @@ function pythonEditor(id) { // Give the editor user input focus. editor.focus = function() { ACE.focus(); - } + }; // Set a handler function to be run if code in the editor changes. - editor.on_change = function(handler) { + editor.onChange = function(handler) { ACE.getSession().on('change', handler); }; @@ -55,7 +55,7 @@ function pythonEditor(id) { // Triggers a snippet by name in the editor. editor.triggerSnippet = function(snippet) { var snippetManager = ace.require("ace/snippets").snippetManager; - var snippet = snippetManager.snippetNameMap.python[snippet]; + snippet = snippetManager.snippetNameMap.python[snippet]; if(snippet) { snippetManager.insertSnippet(ACE, snippet.content); } @@ -107,7 +107,7 @@ function pythonEditor(id) { checksum += chunk[j]; } chunk[4 + 16] = (-checksum) & 0xff; - output.push(':' + hexlify(chunk).toUpperCase()) + output.push(':' + hexlify(chunk).toUpperCase()); } return output.join('\n'); }; @@ -117,7 +117,7 @@ function pythonEditor(id) { var hexlified_python = this.hexlify(this.getCode()); var insertion_point = ":::::::::::::::::::::::::::::::::::::::::::"; return firmware.replace(insertion_point, hexlified_python); - } + }; // Takes a hex blob and turns it into a decoded string. editor.unhexlify = function(data) { @@ -144,7 +144,7 @@ function pythonEditor(id) { } else { return ''; } - } + }; // Given an existing hex file, return the Python script contained therein. editor.extractScript = function(hexfile) { @@ -153,7 +153,7 @@ function pythonEditor(id) { if (start_line > 0) { var lines = hex_lines.slice(start_line + 1, -2); var blob = lines.join('\n'); - if (blob=='') { + if (blob === '') { return ''; } else { return this.unhexlify(blob); @@ -161,10 +161,10 @@ function pythonEditor(id) { } else { return ''; } - } + }; return editor; -}; +} /* The following code contains the various functions that connect the behaviour of @@ -177,24 +177,30 @@ function web_editor() { // Indicates if there are unsaved changes to the content of the editor. var dirty = false; + // Stores the latest gist link but this will be empty at start + var gistID = ""; + + // Temporary ID storage + var id = "" + // Sets the description associated with the code displayed in the UI. function setDescription(x) { - $("#script-description").text(x); + $("#author").val(x); } // Sets the name associated with the code displayed in the UI. function setName(x) { - $("#script-name").text(x); + $("#name").val(x); } // Gets the description associated with the code displayed in the UI. function getDescription() { - return $("#script-description").text(); + return $("#author").val(); } // Gets the name associated with the code displayed in the UI. function getName() { - return $("#script-name").text(); + return $("#name").val(); } // Get the font size of the text currently displayed in the editor. @@ -215,7 +221,7 @@ function web_editor() { fontSize = 46; } setFontSize(fontSize); - }; + } // Sets up the zoom-out functionality. function zoomOut() { @@ -225,7 +231,7 @@ function web_editor() { fontSize = 22; } setFontSize(fontSize); - }; + } // This function is called by TouchDevelop to cause the editor to be initialised. It sets things up so the user sees their code or, in the case of a new program, uses some sane defaults. function setupEditor(message) { @@ -233,13 +239,13 @@ function web_editor() { EDITOR = pythonEditor('editor'); if(!message.name) { // If there's no name, default to something sensible. - setName("microbit") + setName("microbit.py"); } else { setName(message.name); } if (!message.comment) { // If there's no description, default to something sensible. - setDescription("A MicroPython script"); + setDescription(""); } else { setDescription(message.comment); } @@ -266,7 +272,7 @@ function web_editor() { }); window.setTimeout(function () { // What to do if the user changes the content of the editor. - EDITOR.on_change(function () { + EDITOR.onChange(function () { dirty = true; }); }, 1); @@ -286,12 +292,6 @@ function web_editor() { return confirmationMessage; } }); - // Bind the ESCAPE key. - $(document).keyup(function(e) { - if (e.keyCode == 27) { // ESCAPE - $('#link-log').focus(); - } - }); // Bind drag and drop into editor. $('#editor').on('dragover', function(e) { e.preventDefault(); @@ -302,8 +302,6 @@ function web_editor() { e.stopPropagation(); }); $('#editor').on('drop', doDrop); - // Focus on the element with TAB-STATE=1 - $("#command-download").focus(); } // This function describes what to do when the download button is clicked. @@ -315,27 +313,189 @@ function web_editor() { alert("Safari has a bug that means your work will be downloaded as an un-named file. Please rename it to something ending in .hex. Alternatively, use a browser such as Firefox or Chrome. They do not suffer from this bug."); window.open('data:application/octet;charset=utf-8,' + encodeURIComponent(output), '_newtab'); } else { - var filename = getName().replace(" ", "_"); - var blob = new Blob([output], {type: "application/octet-stream"}); - saveAs(blob, filename + ".hex"); + if (author = ""){ + var filename = 'microbit'.replace(" ", "_"); + var blob = new Blob([output], {type: "application/octet-stream"}); + saveAs(blob, filename + ".hex"); + } else { + var filename = getDescription().replace(" ", "_"); + var blob = new Blob([output], {type: "application/octet-stream"}); + saveAs(blob, filename + ".hex"); + } } } // This function describes what to do when the save button is clicked. function doSave() { - var output = EDITOR.getCode(); - var ua = navigator.userAgent.toLowerCase(); - if((ua.indexOf('safari/') > -1) && (ua.indexOf('chrome') == -1)) { - alert("Safari has a bug that means your work will be downloaded as an un-named file. Please rename it to something ending in .py. Alternatively, use a browser such as Firefox or Chrome. They do not suffer from this bug."); - window.open('data:application/octet;charset=utf-8,' + encodeURIComponent(output), '_newtab'); + var icon = $("#command-save i"); + icon.removeClass("fa-download"); + icon.addClass("fa-spin").addClass("fa-spinner"); + + var content = EDITOR.getCode(); + var gistpush = { + "content": content + }; + + if (gistID === "") { + $.ajax({ + type: 'POST', + url: '/create/microbit.py/', + contentType: "application/json", + data: JSON.stringify(gistpush), + success: function(gist, message, raw) { + gistID = gist.id; + var template = $('#save-template').html(); + Mustache.parse(template); + vex.open({ + content: Mustache.render(template, {gistID, gistID}) + }); + icon.addClass("fa-download"); + icon.removeClass("fa-spin").removeClass("fa-spinner"); + } + }); } else { - var filename = getName().replace(" ", "_"); - var blob = new Blob([output], {type: "text/plain"}); - saveAs(blob, filename + ".py"); + if (getDescription() !== "microbit" && getDescription() !== ""){ + $.ajax({ + type: 'POST', + url: '/save/' + gistID + '/' + getDescription() + '.py', + contentType: "application/json", + data: JSON.stringify(gistpush), + success: function(gist, message, raw) { + icon.addClass("fa-download"); + icon.removeClass("fa-spin").removeClass("fa-spinner"); + } + }); + } else { + var template = $('#save-noauthor').html(); + Mustache.parse(template); + vex.open({ + content: Mustache.render(template) + }); + $("#command-saveAuthor").click(function() { + var author = $("#authorName").val(); + console.log(author); + + if (author.length > 0){ + $.ajax({ + type: 'POST', + url: '/save/' + gistID + '/' + author + '.py', + contentType: "application/json", + data: JSON.stringify(gistpush), + success: function(gist, message, raw) { + icon.addClass("fa-download"); + icon.removeClass("fa-spin").removeClass("fa-spinner"); + setDescription(author); + vex.close(); + } + }); + } + + + }); + + icon.addClass("fa-download"); + icon.removeClass("fa-spin").removeClass("fa-spinner"); + } } - dirty = false; } + // This function describes what to do when the load button is clicked. + function doLoad() { + if(gistID === ""){ + var template = $('#load-template').html(); + Mustache.parse(template); + vex.open({ + content: Mustache.render(template) + }); + $("#command-loadID").click(function() { + id = $("#loadID").val(); + vex.close(); + + if(id !== ""){ + gistID = id; + var url = '/load/' + gistID + '/microbit.py'; + $.ajax({ + url: url, + contentType: 'application/json', + success: function(content){ + EDITOR.setCode(content.content); + setDescription(""); + } + }); + } + }); + + if(id !== ""){ + console.log("Ok"); + gistID = id; + var url = '/load/' + gistID + '/microbit.py'; + $.ajax({ + url: url, + contentType: 'application/json', + success: function(content){ + EDITOR.setCode(content.content); + setDescription("microbit"); + } + }); + } + } + if(gistID !== ""){ + var url = '/load/' + gistID + '/microbit.py'; + $.ajax({ + url: url, + contentType: 'application/json', + success: function(content){ + EDITOR.setCode(content.content); + setDescription("microbit"); + } + }); + } + + } + + function doLoadAuthor(author) { + var githubAPI = '/load/' + gistID + '/' + author + '.py'; + + $.getJSON(githubAPI, function(data){ + var unsplit = data.content; + var split = unsplit.split('#~*'); + EDITOR.setCode(split[0]); + var header = split[1].split(','); + setDescription(author); + }); + } + + + // This function describes what to do when the explore button is clicked. + function doExplore() { + if(gistID === ""){ + var template = $('#explore-template-noID').html(); + Mustache.parse(template); + vex.open({ + content: Mustache.render(template) + }); + }else{ + $.ajax({ + url: "/explore/" + gistID +"/", + type: 'GET', + contentType: "application/json", + success: function(info){ + var template = $('#explore-template').html(); + Mustache.parse(template); + + vex.open({ + content: Mustache.render(template, info) + }); + $(".open.author").click(function() { + var author = $(this).data("name") + doLoadAuthor(author) + vex.close() + }); + + } + }); + } + } // This function describes what to do when the snippets button is clicked. function doSnippets() { // Snippets are triggered by typing a keyword followed by pressing TAB. @@ -351,9 +511,9 @@ function web_editor() { description = name.substring(name.indexOf(' - '), name.length); return description.replace(' - ', ''); - } + }; } - } + }; vex.open({ content: Mustache.render(template, context), afterOpen: function(vexContent) { @@ -367,37 +527,6 @@ function web_editor() { }); } - function doShare() { - // Triggered when the user wants to generate a link to share their code. - var template = $('#share-template').html(); - Mustache.parse(template); - var qs_array = []; - qs_array.push('name=' + encodeURIComponent(getName())); - qs_array.push('comment=' + encodeURIComponent(getDescription())); - qs_array.push('code=' + encodeURIComponent(EDITOR.getCode())); - var old_url = window.location.href.split('?'); - var new_url = old_url[0].replace('#', '') + '?' + qs_array.join('&'); - // shortener API - var url = "https://www.googleapis.com/urlshortener/v1/url?key=AIzaSyB2_Cwh5lKUX4a681ZERd3FAt8ijdwbukk"; - $.ajax(url, { - type: "POST", - contentType: 'application/json', - data: JSON.stringify({ - longUrl: new_url - }) - }).done(function( data ) { - console.log(data); - vex.open({ - content: Mustache.render(template, {}) - }) - $('#direct-link').attr('href', data.id); - $('#direct-link').text(data.id); - $('#twitter-button').html(''); - $('#facebook-button').attr('src', 'https://www.facebook.com/plugins/share_button.php?href=' + encodeURIComponent(data.id) + '&layout=button&size=small&mobile_iframe=true&width=59&height=20&appId'); - twttr.widgets.load(); - }); - } - function doDrop(e) { // Triggered when a user drops a file onto the editor. e.stopPropagation(); @@ -410,7 +539,7 @@ function web_editor() { setDescription('Extracted from a Python file'); reader.onload = function(e) { EDITOR.setCode(e.target.result); - } + }; reader.readAsText(file); EDITOR.ACE.gotoLine(EDITOR.ACE.session.getLength()); } else if (ext == 'hex') { @@ -421,7 +550,7 @@ function web_editor() { if (code.length < 8192) { EDITOR.setCode(code); } - } + }; reader.readAsText(file); EDITOR.ACE.gotoLine(EDITOR.ACE.session.getLength()); } @@ -430,28 +559,16 @@ function web_editor() { // Join up the buttons in the user interface with some functions for handling what to do when they're clicked. function setupButtons() { - $("#command-download").click(function () { - doDownload(); - }); - $("#command-save").click(function () { - doSave(); - }); - $("#command-snippet").click(function () { - doSnippets(); - }); - $("#command-share").click(function () { - doShare(); - }); + $("#command-download").click(doDownload); + $("#command-save").click(doSave); + $("#command-load").click(doLoad); + $("#command-explore").click(doExplore); + $("#command-snippet").click(doSnippets); } // Extracts the query string and turns it into an object of key/value pairs. function get_qs_context() { var query_string = window.location.search.substring(1); - if(window.location.href.indexOf("file://") == 0 ) { - // Running from the local file system so switch off network share. - $('#command-share').hide(); - return {}; - } var kv_pairs = query_string.split('&'); var result = {}; for (var i = 0; i < kv_pairs.length; i++) { @@ -463,7 +580,7 @@ function web_editor() { setupEditor(get_qs_context()); setupButtons(); -}; +} // Call the web_editor function to start the editor running. -web_editor(); +web_editor(); \ No newline at end of file diff --git a/editor.html b/templates/editor.html similarity index 99% rename from editor.html rename to templates/editor.html index aff11bbd..84af1b39 100644 --- a/editor.html +++ b/templates/editor.html @@ -1,12 +1,12 @@ - - + Python on the BBC micro:bit - + - - + + - + - - + + - - + + diff --git a/tests.html b/tests.html index 8934be1a..fcac91f9 100644 --- a/tests.html +++ b/tests.html @@ -9,13 +9,13 @@ - - - +