diff --git a/assets/css/browser-solidity.css b/assets/css/browser-solidity.css index 207724c333..42d9471432 100644 --- a/assets/css/browser-solidity.css +++ b/assets/css/browser-solidity.css @@ -218,7 +218,7 @@ body { #header #optionViews .pre { word-wrap: break-word; - background-color: #efefef; + background-color: #C6CFF7; font-family: monospace; border-radius: 3px; display: inline-block; @@ -237,7 +237,7 @@ body { } #header #gist { - background-color: #efefef; + background-color: #C6CFF7; font-size: 12px; padding: 0.25em; color: black; diff --git a/assets/js/app.js b/assets/js/app.js index ae3cec0453..176f98b030 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -49,31 +49,31 @@ syncQueryParams(); // ------------------ gist load ---------------- - - function getGistId(str) { - var idr = /[0-9A-Fa-f]{8,}/; - var match = idr.exec(str)[0]; - return match; - } + + function getGistId(str) { + var idr = /[0-9A-Fa-f]{8,}/; + var match = idr.exec(str); + return match ? match[0] : null; + } var queryParams = getQueryParams(); - var loadingFromGist = false; - if (queryParams['gist']) { - var gistId; + var loadingFromGist = false; + if (typeof queryParams['gist'] != undefined) { + var gistId; if (queryParams['gist'] === '') { - var str = prompt("Enter the URL or ID of the Gist you would like to load."); + var str = prompt("Enter the URL or ID of the Gist you would like to load."); if (str !== '') { gistId = getGistId( str ); loadingFromGist = !!gistId; } } else { gistId = queryParams['gist']; - loadingFromGist = !!gistId; - } - $.ajax({ - url: 'https://api.github.com/gists/'+gistId, - jsonp: 'callback', - dataType: 'jsonp', + loadingFromGist = !!gistId; + } + if (loadingFromGist) $.ajax({ + url: 'https://api.github.com/gists/'+gistId, + jsonp: 'callback', + dataType: 'jsonp', success: function(response){ if (response.data) { for (var f in response.data.files) { @@ -249,7 +249,7 @@ var files = {}; var filesArr = getFiles(); - var description = "Created using soleditor: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://chriseth.github.io/browser-solidity/#gist="; + var description = "Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. \n Load this file by pasting this gists URL or ID at https://chriseth.github.io/browser-solidity/#version=" + getQueryParams().version + "&optimize="+ getQueryParams().optimize +"&gist="; for(var f in filesArr) { files[fileNameFromKey(filesArr[f])] = { @@ -734,6 +734,7 @@ var worker = null; var loadVersion = function(version) { $('#version').text("(loading)"); + updateQueryParams({version: version}); var isFirefox = typeof InstallTrigger !== 'undefined'; if (document.location.protocol != 'file:' && Worker !== undefined && isFirefox) { // Workers cannot load js on "file:"-URLs and we get a diff --git a/index.html b/index.html index ccfa36d090..8c6b0eac04 100644 --- a/index.html +++ b/index.html @@ -99,7 +99,7 @@
Publish all open files to an anonymous github gist.
-You can also load a gist by adding the following ?gist=GIST_ID to your url, where GIST_ID is the id of the gist to load.
+You can also load a gist by adding the following #gist=GIST_ID to your url, where GIST_ID is the id of the gist to load.