From 7d5cfbb9d29b0ff2be773217c7aeaf2ab4eee310 Mon Sep 17 00:00:00 2001 From: ninabreznik Date: Sun, 4 Jun 2017 03:28:22 +0200 Subject: [PATCH 1/3] Changed vmin to em for font-size --- assets/css/universal-dapp.css | 6 ++-- src/app/editor.js | 2 +- src/universal-dapp.js | 57 ++++++++++++++++++----------------- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/assets/css/universal-dapp.css b/assets/css/universal-dapp.css index b7571ce29d..85c07e029c 100644 --- a/assets/css/universal-dapp.css +++ b/assets/css/universal-dapp.css @@ -80,11 +80,9 @@ } .udapp .output .result .debugTx { - position: absolute; - top: 0.4em; - right: 1.4em; height: 1.5em; width: 2.5em; + margin-top: 1em; } .udapp .output .result:last-child { @@ -202,7 +200,7 @@ } .udapp .contractProperty button.debug { - width: 21px; + width: 12em; } .udapp .contractProperty button:disabled { diff --git a/src/app/editor.js b/src/app/editor.js index c3c84b0adb..04dea49401 100644 --- a/src/app/editor.js +++ b/src/app/editor.js @@ -19,7 +19,7 @@ var css = csjs` } .ace-editor { top : 4px; - font-size : 2vmin; + font-size : 1.1em; width : 100%; } ` diff --git a/src/universal-dapp.js b/src/universal-dapp.js index 72136ed3ef..dcddfd432d 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -281,25 +281,27 @@ UniversalDApp.prototype.getContractByName = function (contractName) { UniversalDApp.prototype.getCreateInterface = function ($container, contract) { var self = this - var $createInterface = $('
') + var createInterface = yo`
` if (self.options.removable) { - var $close = $('
') - $close.click(function () { self.$el.remove() }) - $createInterface.append($close) + var close = yo`
` + function remove () { + self.$el.remove() + } + createInterface.appendChild(close) } var $publishButton = $(`') + var $button = $('') $button.click(function () { self.event.trigger('debugRequested', [result]) }) @@ -545,7 +546,7 @@ UniversalDApp.prototype.getCallButton = function (args) { var getDebugCall = function (result) { var $debugTx = $('
') - var $button = $('') + var $button = $('') $button.click(function () { self.event.trigger('debugRequested', [result]) }) @@ -554,7 +555,7 @@ UniversalDApp.prototype.getCallButton = function (args) { } var getGasUsedOutput = function (result, vmResult) { - var $gasUsed = $('
') + var $gasUsed = $('
') var caveat = lookupOnly ? '(caveat)' : '' var gas if (result.gasUsed) { @@ -585,9 +586,9 @@ UniversalDApp.prototype.getCallButton = function (args) { var getOutput = function () { var $result = $('
') - var $close = $('
') - $close.click(function () { $result.remove() }) - $result.append($close) + var close = yo`
` + function remove () { $result.remove() } + $result.get(0).appendChild(close) return $result } var clearOutput = function ($result) { From be55361a44f0aa03933c0fa02ee189b821b1682f Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 6 Jun 2017 11:48:43 +0200 Subject: [PATCH 2/3] increase/decrease editor font size --- src/app.js | 5 ++++- src/app/editor.js | 4 ++++ src/app/file-panel.js | 13 +++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/app.js b/src/app.js index f10fe21caa..4e5ab92b75 100644 --- a/src/app.js +++ b/src/app.js @@ -196,7 +196,10 @@ var run = function () { var FilePanelAPI = { createName: createNonClashingName, switchToFile: switchToFile, - event: this.event + event: this.event, + editorFontSize: function (incr) { + editor.editorFontSize(incr) + } } var filePanel = new FilePanel(FilePanelAPI, files) // TODO this should happen inside file-panel.js diff --git a/src/app/editor.js b/src/app/editor.js index 04dea49401..76c53c647f 100644 --- a/src/app/editor.js +++ b/src/app/editor.js @@ -63,6 +63,10 @@ function Editor (editorElement) { editor.session.setBreakpoint(row, css) } + this.editorFontSize = function (incr) { + editor.setFontSize(editor.getFontSize() + incr) + } + function createSession (content) { var s = new ace.EditSession(content, 'ace/mode/javascript') s.setUndoManager(new ace.UndoManager()) diff --git a/src/app/file-panel.js b/src/app/file-panel.js index e1e0fc02f9..8bfe50903b 100644 --- a/src/app/file-panel.js +++ b/src/app/file-panel.js @@ -70,6 +70,13 @@ var css = csjs` top : 0; bottom : 0; } + .changeeditorfontsize { + padding: 10px; + } + .changeeditorfontsize i { + display: block; + color: #111111; + } ` var limit = 60 @@ -95,6 +102,10 @@ function filepanel (appAPI, files) { ` : ''} + + + + @@ -108,6 +119,8 @@ function filepanel (appAPI, files) { var events = new EventManager() var element = template() + element.querySelector('.increditorsize').addEventListener('click', () => { appAPI.editorFontSize(1) }) + element.querySelector('.decreditorsize').addEventListener('click', () => { appAPI.editorFontSize(-1) }) // TODO please do not add custom javascript objects, which have no // relation to the DOM to DOM nodes element.events = events From 2b741c691e42ac1e31c5c5c4a82f24e7a09c19ed Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 6 Jun 2017 17:05:38 +0200 Subject: [PATCH 3/3] use javascript functions instead of jquery --- src/universal-dapp.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/universal-dapp.js b/src/universal-dapp.js index dcddfd432d..21208d13a0 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -307,12 +307,12 @@ UniversalDApp.prototype.getCreateInterface = function ($container, contract) { // FIXME: maybe have a flag for this in the JSON? // FIXME: maybe fix getInstanceInterface() below for this case if (contract.bytecode.length === 0) { - var $createButton = $newButton.find('.constructor .call') + var $createButton = $newButton.querySelector('.constructor .call') // NOTE: we must show the button to have CSS properly lined up - $createButton.text('Create') - $createButton.attr('disabled', 'disabled') - $createButton.attr('title', 'This contract does not implement all functions and thus cannot be created.') + $createButton.innerText = 'Create' + $createButton.setAttribute('disabled', 'disabled') + $createButton.setAttribute('title', 'This contract does not implement all functions and thus cannot be created.') } if ((contract.metadata === undefined) || (contract.metadata.length === 0)) {