diff --git a/index.html b/index.html index 1461a72c..42a7891a 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@

diff --git a/playground/libs/FileSaver.min.js b/libs/FileSaver.min.js similarity index 100% rename from playground/libs/FileSaver.min.js rename to libs/FileSaver.min.js diff --git a/playground/libs/ace.js b/libs/ace.js similarity index 100% rename from playground/libs/ace.js rename to libs/ace.js diff --git a/playground/libs/jszip.min.js b/libs/jszip.min.js similarity index 100% rename from playground/libs/jszip.min.js rename to libs/jszip.min.js diff --git a/playground/libs/mode-css.js b/libs/mode-css.js similarity index 100% rename from playground/libs/mode-css.js rename to libs/mode-css.js diff --git a/playground/libs/mode-javascript.js b/libs/mode-javascript.js similarity index 100% rename from playground/libs/mode-javascript.js rename to libs/mode-javascript.js diff --git a/playground/libs/mode-xml.js b/libs/mode-xml.js similarity index 100% rename from playground/libs/mode-xml.js rename to libs/mode-xml.js diff --git a/playground/libs/owl.js b/libs/owl.js similarity index 100% rename from playground/libs/owl.js rename to libs/owl.js diff --git a/playground/libs/theme-monokai.js b/libs/theme-monokai.js similarity index 100% rename from playground/libs/theme-monokai.js rename to libs/theme-monokai.js diff --git a/playground/libs/worker-javascript.js b/libs/worker-javascript.js similarity index 100% rename from playground/libs/worker-javascript.js rename to libs/worker-javascript.js diff --git a/package.json b/package.json index d22e01b6..02ad6ca1 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,6 @@ "name": "owl-playground", "description": "Odoo Web Library", "scripts": { - "start": "python -m SimpleHTTPServer 8001" + "start": "python server.py" } } diff --git a/playground/src/app.js b/playground/app.js similarity index 96% rename from playground/src/app.js rename to playground/app.js index 5243fd9f..7b9d1f63 100644 --- a/playground/src/app.js +++ b/playground/app.js @@ -6,7 +6,7 @@ async function owlSourceCode() { if (owlJS) { return owlJS; } - const result = await fetch("/playground/libs/owl.js"); + const result = await fetch("/libs/owl.js"); owlJS = await result.text(); return owlJS; } @@ -196,7 +196,7 @@ class App extends owl.Component { // inject js const owlScript = doc.createElement("script"); owlScript.type = "text/javascript"; - owlScript.src = "libs/owl.js"; + owlScript.src = "/libs/owl.js"; owlScript.addEventListener("load", () => { const script = doc.createElement("script"); script.type = "text/javascript"; @@ -278,8 +278,8 @@ class App extends owl.Component { } async downloadCode() { - await owl.utils.loadJS("libs/FileSaver.min.js"); - await owl.utils.loadJS("libs/jszip.min.js"); + await owl.utils.loadJS("/libs/FileSaver.min.js"); + await owl.utils.loadJS("/libs/jszip.min.js"); const zip = new JSZip(); @@ -317,7 +317,7 @@ owl.utils.whenReady(startApp);`; //------------------------------------------------------------------------------ document.title = `${document.title} (v${owl._version})`; document.addEventListener("DOMContentLoaded", async function() { - const templates = await owl.utils.loadTemplates("src/templates.xml"); + const templates = await owl.utils.loadTemplates("templates.xml"); const qweb = new owl.QWeb(templates); const env = { qweb }; const app = new App(env); diff --git a/playground/index.html b/playground/index.html index e310cf04..b4b33421 100644 --- a/playground/index.html +++ b/playground/index.html @@ -5,12 +5,12 @@ OWL Playground - - + + - + diff --git a/playground/src/samples.js b/playground/samples.js similarity index 100% rename from playground/src/samples.js rename to playground/samples.js diff --git a/playground/src/templates.xml b/playground/templates.xml similarity index 100% rename from playground/src/templates.xml rename to playground/templates.xml diff --git a/server.py b/server.py new file mode 100644 index 00000000..8f6ab3ce --- /dev/null +++ b/server.py @@ -0,0 +1,20 @@ +import sys +import thread +import webbrowser +import time + +import BaseHTTPServer, SimpleHTTPServer + +def start_server(): + httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', 3600), SimpleHTTPServer.SimpleHTTPRequestHandler) + httpd.serve_forever() + +thread.start_new_thread(start_server,()) +url = 'http://127.0.0.1:3600' +webbrowser.open_new(url) + +while True: + try: + time.sleep(1) + except KeyboardInterrupt: + sys.exit(0) \ No newline at end of file