Load the local soljson.js if the list (soljsonSources) isn't present

pull/1/head
Alex Beregszaszi 8 years ago
parent 8d94032167
commit 29ed1bd3dd
  1. 24
      src/app.js
  2. 7
      src/app/compiler.js

@ -330,12 +330,18 @@ var run = function () {
// var soljsonSources is provided by bin/list.js
$('option', '#versionSelector').remove();
$.each(soljsonSources, function (i, file) {
if (file) {
var version = file.replace(/soljson-(.*).js/, '$1');
$('#versionSelector').append(new Option(version, file));
}
});
if (window.soljsonSources !== undefined) {
$.each(soljsonSources, function (i, file) {
if (file) {
var version = file.replace(/soljson-(.*).js/, '$1');
$('#versionSelector').append(new Option(version, file));
}
});
}
// always include the local version
$('#versionSelector').append(new Option('latest local version', 'soljson.js'));
$('#versionSelector').change(function () {
queryParams.update({ version: $('#versionSelector').val() });
loadVersion($('#versionSelector').val());
@ -452,7 +458,11 @@ var run = function () {
}
};
loadVersion(queryParams.get().version || 'soljson-latest.js');
if (window.soljsonSources !== undefined) {
loadVersion(queryParams.get().version || 'soljson-latest.js');
} else {
loadVersion('soljson.js');
}
document.querySelector('#optimize').addEventListener('change', function () {
queryParams.update({ optimize: document.querySelector('#optimize').checked });

@ -118,7 +118,12 @@ function Compiler (editor, renderer, queryParams, handleGithubCall, outputField,
}
this.loadVersion = function (usingWorker, version, setVersionText) {
var url = 'https://ethereum.github.io/solc-bin/bin/' + version;
var url;
if (version !== 'soljson.js') {
url = 'https://ethereum.github.io/solc-bin/bin/' + version;
} else {
url = 'soljson.js';
}
console.log('Loading ' + url + ' ' + (usingWorker ? 'with worker' : 'without worker'));
if (usingWorker) {

Loading…
Cancel
Save