render contract if only warnings, and make dismissable

pull/1/head
d11e9 9 years ago
parent a85a9e8458
commit 717c7e922f
  1. 28
      index.html
  2. 34
      stylesheets/browser-solidity.css

@ -334,14 +334,21 @@ THE SOFTWARE.
renderError("Uncaught JavaScript Exception:\n" + exception);
return;
}
if (data['error'] !== undefined)
var noFatalErrors = true; // ie warnings are ok
if (data['error'] !== undefined) {
renderError(data['error']);
if (data['errors'] != undefined)
if (errortype(data['error']) !== 'warning') noFatalErrors = false;
}
if (data['errors'] != undefined) {
$.each(data['errors'], function(i, err) {
renderError(err);
if (errortype(err) !== 'warning') noFatalErrors = false;
});
else
renderContracts(data, input);
}
if (noFatalErrors) renderContracts(data, input);
}
@ -394,9 +401,13 @@ THE SOFTWARE.
// ----------------- compiler output renderer ----------------------
var detailsOpen = {};
function errortype(message) {
return message.match(/^[0-9:]* Warning: /) ? 'warning' : 'error';
}
var renderError = function(message) {
var type = message.match(/^[0-9:]* Warning: /) ? 'warning' : 'error';
var $error = $('<pre class="' + type + '"></pre>').text(message);
var type = errortype(message);
var $error = $('<div class="' + type + '"><pre>' + message + '</pre><div class="close">x</div></div>');
$('#output').append( $error );
var err = message.match(/^:([0-9]*):([0-9]*)/);
if (err && err.length) {
@ -413,6 +424,11 @@ THE SOFTWARE.
editor.focus();
editor.gotoLine(errLine + 1, errCol - 1, true);
});
$error.find('.close').click(function(ev){
ev.preventDefault();
$error.remove();
return false;
});
}
};

@ -185,20 +185,40 @@ body {
margin-bottom: 1em;
}
.error {
background-color: rgba(255, 0, 0, 0.5);
.error,
.warning {
border-radius: 0;
word-wrap: break-word;
border: 1px solid #D00909;
cursor: pointer;
position: relative;
margin: 0.25em;
}
.error pre,
.warning pre {
background-color: transparent;
margin: 0;
font-size: 10px;
}
.error .close,
.warning .close {
font-weight: bold;
position: absolute;
top: 0;
right: 0;
padding: 0.5em;
}
.error {
background-color: rgba(255, 0, 0, 0.5);
border: 1px solid #D00909;
}
.warning {
background-color: rgba(210, 202, 36, 0.5);
border-radius: 0;
word-wrap: break-word;
border: 1px solid #BBB427;
cursor: pointer;
border: 1px solid #BBB427;
}
#ghostbar {

Loading…
Cancel
Save