@ -66,13 +66,14 @@ THE SOFTWARE.
< div class = "info" >
< div class = "info" >
< p >
< p >
Version: < span id = "version" > (loading)< / span > < br / >
Version: < span id = "version" > (loading)< / span > < br / >
Change to: < select id = "versionSelector" > < / select > < button id = "gist" title = "Publish all files as public gist on github.com" > Publish all files as public gist< / button > < br / >
Change to: < select id = "versionSelector" > < / select >
< code > tx.origin = < span id = "txorigin" / > < / code >
< / p >
< / p >
< / div >
< / div >
< div id = "optimizeBox" >
< div id = "optimizeBox" >
< label for = "editorWrap" > < input id = "editorWrap" type = "checkbox" > Text Wrap< / label >
< label for = "editorWrap" > < input id = "editorWrap" type = "checkbox" > Text Wrap< / label >
< label for = "optimize" > < input id = "optimize" type = "checkbox" > Enable Optimization< / label >
< label for = "optimize" > < input id = "optimize" type = "checkbox" > Enable Optimization< / label >
< button id = "gist" title = "Publish all files as public gist on github.com" > Publish gist< / button >
< code class = "origin" > tx.origin: < span id = "txorigin" / > < / code >
< span id = "executionContext" >
< span id = "executionContext" >
< label for = "vm" title = "Execution environment does not connect to any node, everything is local and in memory only." >
< label for = "vm" title = "Execution environment does not connect to any node, everything is local and in memory only." >
< input id = "vm" type = "radio" value = "vm" checked name = "executionContext" >
< input id = "vm" type = "radio" value = "vm" checked name = "executionContext" >
@ -144,29 +145,32 @@ THE SOFTWARE.
// ------------------ gist publish --------------
// ------------------ gist publish --------------
$('#gist').click(function(){
$('#gist').click(function(){
if (confirm("Are you sure you want to publish all your files anonymously as a public gist on github.com")) {
//Get Github Authorization Token with proper scope, print to console
var description = "Ethereum Contracts Gist created using soleditor at: https://chriseth.github.io/browser-solidity";
var files = {};
//Create a Gist with token from above
var filesArr = getFiles();
var files = {};
var description = "Ethereum Contracts Gist created using soleditor at: https://chriseth.github.io/browser-solidity";
var filesArr = getFiles();
for(var f in filesArr) { files[fileNameFromKey(filesArr[f])] = { content: localStorage[filesArr[f]] } }
for(var f in filesArr) {
var data = JSON.stringify({
files[fileNameFromKey(filesArr[f])] = {
description: description,
content: localStorage[filesArr[f]]
public: true,
};
files: files
});
$.ajax({
url: 'https://api.github.com/gists',
type: 'POST',
data: data
}).done(function(response) {
if (response.html_url & & confirm("Created a gist at " + response.html_url + " Would you like to open it in a new window?")) {
window.open( response.html_url, '_blank' );
}
}
});
$.ajax({
url: 'https://api.github.com/gists',
type: 'POST',
data: JSON.stringify({
description: description,
public: true,
files: files
})
}).done(function(response) {
if (response.html_url & & confirm("Created a gist at " + response.html_url + " Would you like to open it in a new window?")) {
window.open( response.html_url, '_blank' );
}
});
}
})
})