Merge pull request #224 from ethereum/query-params

Resolve the confusing behaviour of QueryParams
pull/1/head
chriseth 8 years ago committed by GitHub
commit f9c2dc6469
  1. 19
      src/app.js

@ -53,15 +53,6 @@ var run = function () {
loadFiles(filesToLoad); loadFiles(filesToLoad);
} }
// ------------------ query params (hash) ----------------
function syncQueryParams () {
$('#optimize').attr('checked', (queryParams.get().optimize === 'true'));
}
window.onhashchange = syncQueryParams;
syncQueryParams();
// -------- check file upload capabilities ------- // -------- check file upload capabilities -------
if (!(window.File || window.FileReader || window.FileList || window.Blob)) { if (!(window.File || window.FileReader || window.FileList || window.Blob)) {
@ -488,10 +479,7 @@ var run = function () {
previousInput = ''; previousInput = '';
setVersionText(version); setVersionText(version);
compiler.compile(); compiler.compile();
initWithQueryParams();
});
function initWithQueryParams () {
if (queryParams.get().endpointurl) { if (queryParams.get().endpointurl) {
executionContext.setEndPointUrl(queryParams.get().endpointurl); executionContext.setEndPointUrl(queryParams.get().endpointurl);
} }
@ -501,7 +489,7 @@ var run = function () {
if (queryParams.get().debugtx) { if (queryParams.get().debugtx) {
startdebugging(queryParams.get().debugtx); startdebugging(queryParams.get().debugtx);
} }
} });
function startdebugging (txHash) { function startdebugging (txHash) {
transactionDebugger.debug(txHash); transactionDebugger.debug(txHash);
@ -513,7 +501,7 @@ var run = function () {
} }
function loadVersion (version) { function loadVersion (version) {
queryParams.update({version: version}); queryParams.update({ version: version });
var url; var url;
if (version === 'builtin') { if (version === 'builtin') {
url = 'soljson.js'; url = 'soljson.js';
@ -531,6 +519,9 @@ var run = function () {
} }
} }
// set default
$('#optimize').attr('checked', (queryParams.get().optimize === 'true'));
document.querySelector('#optimize').addEventListener('change', function () { document.querySelector('#optimize').addEventListener('change', function () {
queryParams.update({ optimize: document.querySelector('#optimize').checked }); queryParams.update({ optimize: document.querySelector('#optimize').checked });
compiler.compile(); compiler.compile();

Loading…
Cancel
Save