From 6b67270e79c75f4f2b1980de5fea3c1e1abab364 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 1 Jun 2015 17:16:20 +0200 Subject: [PATCH] Persisting details. --- index.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 72e85071cb..e060f09c85 100644 --- a/index.html +++ b/index.html @@ -166,6 +166,8 @@ var onChange = function() { editor.getSession().on('change', onChange); document.querySelector('#optimize').addEventListener('change', compile); +var detailsOpen = {}; + var renderError = function(message) { $('#output').empty().append($('
').text(message));
 };
@@ -179,7 +181,7 @@ var renderContracts = function(data, source) {
             .append(tableRow('Bytecode', contract.bytecode))
             .append(tableRow('Interface', contract['interface']))
             .append(tableRow('Solidity Interface', contract.solidity_interface))
-            .append(getDetails(contract, source));
+            .append(getDetails(contract, source, contractName));
         $('#output').append(contractOutput);
     }
 };
@@ -188,7 +190,7 @@ var tableRow = function(description, data) {
         .append($('').text(description))
         .append($('').val(data));
 };
-var getDetails = function(contract, source) {
+var getDetails = function(contract, source, contractName) {
     var button = $('');
     var details = $('
') .append(tableRow('Opcodes', contract.opcodes)); @@ -202,7 +204,9 @@ var getDetails = function(contract, source) { details.append($('Assembly')); var assembly = $('
').text(formatAssemblyText(contract.assembly, '', source));
     details.append(assembly);
-    button.click(function() { details.toggle(); });
+    button.click(function() { detailsOpen[contractName] = !detailsOpen[contractName]; details.toggle(); });
+    if (detailsOpen[contractName])
+        details.show();
     return $('
').append(button).append(details); }; var formatGasEstimates = function(data) {