From cec78611651efab348c60367829826120e983711 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 27 Jun 2019 14:14:20 +0200 Subject: [PATCH 1/2] remove uneeded folder --- extensions/etherscan-general/index.html | 43 ---------- extensions/etherscan-general/index.js | 109 ------------------------ 2 files changed, 152 deletions(-) delete mode 100644 extensions/etherscan-general/index.html delete mode 100644 extensions/etherscan-general/index.js diff --git a/extensions/etherscan-general/index.html b/extensions/etherscan-general/index.html deleted file mode 100644 index c20c036bc0..0000000000 --- a/extensions/etherscan-general/index.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - -
Etherscan - Network Status
-
- -
- - diff --git a/extensions/etherscan-general/index.js b/extensions/etherscan-general/index.js deleted file mode 100644 index cb189cdf8d..0000000000 --- a/extensions/etherscan-general/index.js +++ /dev/null @@ -1,109 +0,0 @@ -/* global XMLHttpRequest */ -var remix = new window.RemixExtension() -var container -var updateBtn -var network -var currentNetWork = '' -var networks = { - 'Main': '', - 'Ropsten': 'ropsten', - 'Kovan': 'kovan', - 'Rinkeby': 'rinkeby' -} - -function load () { - container = document.getElementById('container') - updateBtn = document.getElementById('updateBtn') - network = document.getElementById('network') - - var log = function (call, msg) { - container.innerHTML += '
' + call + ': ' + msg + '
' - } - - updateBtn.addEventListener('click', function () { - container.innerHTML = '' - if (networks[currentNetWork] !== undefined) { - getBlockNumber(log) - getLatestBlockInfo(log) - getGasPrice(log) - } else { - container.innerHTML = 'current network not available through etherscan API' - } - }) - - getToken(function (error, result) { - if (error) console.log(error) - if (!result) { - remix.call('config', 'setConfig', ['config.json', '{ apikey: "" }'], function (error, result) { - if (error) return console.log(error) - }) - } - }) - setInterval(function () { - remix.call('network', 'detectNetWork', [], function (error, result) { - if (error) console.log(error) - if (network.innerHTML !== result[0].name + ' - ' + result[0].id) { - currentNetWork = result[0].name - container.innerHTML = '' - network.innerHTML = result[0].name + ' - ' + result[0].id - } - }) - }, 1000) -} - -function getToken (callback) { - remix.call('config', 'getConfig', ['config.json'], function (error, result) { - if (error) return callback(error) - if (result[0]) { - try { - result = JSON.parse(result[0]) - } catch (e) { - return callback(e.message) - } - callback(null, result.apikey) - } else { - container.innerHTML = 'no api key found' - callback('no api key found') - } - }) -} - -function httpGetAsync (url, callback) { - var xmlHttp = new XMLHttpRequest() - xmlHttp.onreadystatechange = function () { - if (xmlHttp.readyState === 4 && xmlHttp.status === 200) { - callback(xmlHttp.responseText) - } - } - xmlHttp.open('GET', url, true) - xmlHttp.send(null) -} - -function getBlockNumber (callback) { - getToken(function (error, apikey) { - if (error) console.log(error) - httpGetAsync('https://api-' + networks[currentNetWork] + '.etherscan.io/api?module=proxy&action=eth_blockNumber&apikey=' + apikey, function (result) { - callback('latest block number', result) - }) - }) -} - -function getLatestBlockInfo (callback) { - getToken(function (error, apikey) { - if (error) console.log(error) - httpGetAsync('https://api-' + networks[currentNetWork] + '.etherscan.io/api?module=proxy&action=eth_getBlockByNumber&tag=latest&boolean=true&apikey=' + apikey, function (result) { - callback('latest block', result) - }) - }) -} - -function getGasPrice (callback) { - getToken(function (error, apikey) { - if (error) console.log(error) - httpGetAsync('https://api-' + networks[currentNetWork] + '.etherscan.io/api?module=proxy&action=eth_gasPrice&apikey=' + apikey, function (result) { - callback('current gas price', result) - }) - }) -} - -setTimeout(load, 1000) From 22cde50a56d35f7e535f1bfae00ed710f3b38206 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 1 Jul 2019 10:11:52 +0200 Subject: [PATCH 2/2] set isOpen to true only if there s autocomplete item to show --- src/app/ui/auto-complete-popup.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/ui/auto-complete-popup.js b/src/app/ui/auto-complete-popup.js index c26af007e3..5fe9eb1028 100644 --- a/src/app/ui/auto-complete-popup.js +++ b/src/app/ui/auto-complete-popup.js @@ -140,7 +140,6 @@ class AutoCompletePopup { let autoCompleteInput = textList.length > 1 ? textList[textList.length - 1] : textList[0] if (inputString.length >= 2) { // more than 2 letters, start completion - this.isOpen = true this.data._options = [] Commands.allPrograms.forEach(item => { const program = getKeyOf(item) @@ -171,7 +170,7 @@ class AutoCompletePopup { this.removeAutoComplete() return } - + if (this.data._options.length) this.isOpen = true yo.update(this._view, this.render()) return true }