From b791b9b2340a4aa650e4f40b1e2f4398ab8d273d Mon Sep 17 00:00:00 2001 From: Michael Kapelko Date: Sun, 21 Jul 2019 19:00:02 +0300 Subject: [PATCH] Publish murom 1.0.0 --- murom/murom_1.0.0.html | 372 ++++++++++++++++++++++++++++++----------- 1 file changed, 273 insertions(+), 99 deletions(-) diff --git a/murom/murom_1.0.0.html b/murom/murom_1.0.0.html index a5ea551..f4257f2 100644 --- a/murom/murom_1.0.0.html +++ b/murom/murom_1.0.0.html @@ -78,7 +78,6 @@ padding: 1.5em 1em 1.5em 1em; */ } - #editor { width: 100%; @@ -192,18 +191,14 @@ this.LOG("Parameter key: '" + key + "' value: '" + value + "'"); } this.setupMode(); - if (this.mode == "preview") - { - this.setupPreviewUI(); - } - if (this.mode == "debug") - { - this.setupDebugUI(); - } if (this.mode == "editor") { this.setupEditorUI(); } + if (this.mode == "preview") + { + this.setupPreviewUI(); + } } Tool.prototype.setupDeps = function() { @@ -212,7 +207,21 @@ if (this.mode == "editor") { var self = this; - this.setupEditorMode(); + + this.LOG("Setup editor mode"); + // Initialize ACE editor. + this.editor = window.ace.edit("editor"); + // Set JavaScript language. + this.editor.session.setMode("ace/mode/javascript"); + + // Display script. + const zb64 = this.parameters["zipbase64"]; + if (zb64) + { + const script = zipBase64Decode(zb64); + this.editor.session.setValue(script); + } + this.loadIFrame(zb64); this.run.subscribe(function(){ self.runEditorScript(); }); @@ -225,10 +234,6 @@ { var self = this; this.LOG("Tool.setupGotov"); - if (this.mode == "debug") - { - this.setupDebugMode(); - } if (this.mode == "preview") { this.setupPreviewMode(); @@ -286,35 +291,18 @@ const mode = this.parameters["mode"]; if (mode) { - if (mode == "debug") - { - this.mode = "debug"; - return; - } - else if (mode == "preview") - { - this.mode = "preview"; - return; - } + if (mode == "preview") + { + this.mode = "preview"; + return; + } + } + else + { + this.mode = "editor"; } - this.mode = "editor"; - } - Tool.prototype.setupDebugMode = function() - { - this.LOG("Setup debug mode"); - this.executeScript(); - } - Tool.prototype.setupDebugUI = function() - { - document.body.innerHTML = - '
' + - '' + - '
' + - '
' + - '' + - '
' - ; } + Tool.prototype.setupPreviewMode = function() { this.LOG("Setup preview mode"); @@ -328,23 +316,6 @@ '' ; } - Tool.prototype.setupEditorMode = function() - { - this.LOG("Setup editor mode"); - // Initialize ACE editor. - this.editor = window.ace.edit("editor"); - // Set JavaScript language. - this.editor.session.setMode("ace/mode/javascript"); - - // Display script. - const zb64 = this.parameters["zipbase64"]; - if (zb64) - { - const script = zipBase64Decode(zb64); - this.editor.session.setValue(script); - } - this.loadIFrame(zb64); - } Tool.prototype.setupEditorUI = function() { document.body.innerHTML = @@ -364,7 +335,6 @@ } Tool.prototype.runEditorScript = function() { - this.LOG("runEditorScript"); const script = this.editor.session.getValue(); const zb64 = zipBase64Encode(script); // Update 'zipbase64' argument value each time script is 'run'. @@ -382,9 +352,8 @@ } Tool.prototype.loadIFrame = function(zipBase64Script) { - this.LOG("loadIFrame"); var render = document.getElementById("render"); - var url = this.fileName + "?mode=debug"; + var url = this.fileName + "?mode=preview"; // Pass script to iframe if it's present. if (zipBase64Script) { @@ -7418,17 +7387,9 @@ var Module = { preRun: [], postRun: [], - print: (function() { - var element = document.getElementById('output'); - return function(text) { - if (element) - { - element.value += text + "\n"; - // Scroll to the bottom. - element.scrollTop = element.scrollHeight; - } - }; - })(), + print: function(text) { + console.log(text); + }, printErr: function(text) { console.error(text); }, @@ -7467,51 +7428,125 @@