pull/1/head
chriseth 9 years ago
parent 2f0114832c
commit e7fd63756a
  1. 39
      index.html

@ -56,24 +56,23 @@ body {
width: 18ex; width: 18ex;
display: inline-block; display: inline-block;
} }
strong.col1 {
top: -10px;
position: relative;
margin-bottom: 5px;
}
.col2 { .col2 {
width: 60ex; width: 60ex;
display: inline-block;
} }
textarea.col2 { .gethDeployText {
height: 20px;
border-color: #bebebe; border-color: #bebebe;
margin-bottom: 5px; height: 2.5ex;
} }
.runButton { .runButton {
width: 30ex; width: 30ex;
text-align: left; text-align: left;
overflow: hidden; overflow: hidden;
} }
.contractInstance {
margin-left: 2ex;
margin-bottom: 20px;
}
</style> </style>
<script src="libs/jquery-2.1.3.min.js"></script> <script src="libs/jquery-2.1.3.min.js"></script>
<script src="libs/ace.js"></script> <script src="libs/ace.js"></script>
@ -237,7 +236,7 @@ var gethDeploy = function(contractName, interface, bytecode){
return code; return code;
} };
var renderContracts = function(data, source) { var renderContracts = function(data, source) {
$('#output').empty(); $('#output').empty();
@ -245,24 +244,30 @@ var renderContracts = function(data, source) {
var contract = data.contracts[contractName]; var contract = data.contracts[contractName];
var contractOutput = $('<div class="contractOutput"/>') var contractOutput = $('<div class="contractOutput"/>')
.append($('<h3/>').text(contractName)) .append($('<h3/>').text(contractName))
.append(getExecuteInterface(contract, contractName))
.append($('<div/>').text((contract.bytecode.length / 2) + ' bytes')) .append($('<div/>').text((contract.bytecode.length / 2) + ' bytes'))
.append(getExecuteInterface(contract, contractName))
.append(tableRow('Bytecode', contract.bytecode)) .append(tableRow('Bytecode', contract.bytecode))
.append(tableRow('Interface', contract['interface'])) .append(tableRow('Interface', contract['interface']))
.append(textRow('Geth deploy', gethDeploy(contractName.toLowerCase(),contract['interface'],contract.bytecode))) .append(textRow('Geth deploy', gethDeploy(contractName.toLowerCase(),contract['interface'],contract.bytecode)))
.append(getDetails(contract, source, contractName)); .append(getDetails(contract, source, contractName));
$('#output').append(contractOutput); $('#output').append(contractOutput);
} }
$('.col2 input,textarea').click(function() { this.select(); } );
}; };
var tableRow = function(description, data) { var tableRowItems = function(first, second) {
return $('<div/>') return $('<div/>')
.append($('<span class="col1">').text(description)) .append($('<div class="col1">').append(first))
.append($('<input readonly="readonly" class="col2">').val(data)); .append($('<div class="col2">').append(second));
};
var tableRow = function(description, data) {
return tableRowItems(
$('<span/>').text(description),
$('<input readonly="readonly"/>').val(data));
}; };
var textRow = function(description, data) { var textRow = function(description, data) {
return $('<div/>') return tableRowItems(
.append($('<strong class="col1">').text(description)) $('<strong/>').text(description),
.append($('<textarea class="col2" onclick="this.select()">'+data+"</textarea>")); $('<textarea readonly="readonly" class="gethDeployText"/>').val(data));
}; };
var getDetails = function(contract, source, contractName) { var getDetails = function(contract, source, contractName) {
var button = $('<button>Details</button>'); var button = $('<button>Details</button>');
@ -407,7 +412,7 @@ var getExecuteInterface = function(contract, name) {
var funABI = getConstructorInterface(abi); var funABI = getConstructorInterface(abi);
var appendFunctions = function(address) { var appendFunctions = function(address) {
var instance = $('<div/>'); var instance = $('<div class="contractInstance"/>');
instance.append($('<span/>').text('Contract at address ' + address.toString('hex'))); instance.append($('<span/>').text('Contract at address ' + address.toString('hex')));
$.each(abi, function(i, funABI) { $.each(abi, function(i, funABI) {
if (funABI.type != 'function') return; if (funABI.type != 'function') return;

Loading…
Cancel
Save