allow loading gists

pull/1/head
d11e9 9 years ago
parent 1438054a19
commit fb3420b00d
  1. 23
      index.html

@ -141,6 +141,27 @@ THE SOFTWARE.
compile();
}
// ------------------ gist load ----------------
var location_hash_params = window.location.hash.substr(1).split("=");
if (location_hash_params.length == 2 && location_hash_params[0] == 'gist') {
$.ajax({
url: 'https://api.github.com/gists/'+location_hash_params[1],
jsonp: 'callback',
dataType: 'jsonp',
success: function(response){
if (response.data) {
for(var f in response.data.files) {
window.localStorage[fileKey(f)] = response.data.files[f].content;
}
updateFiles();
}
}
})
}
// ------------------ gist publish --------------
$('#gist').click(function(){
@ -148,7 +169,7 @@ THE SOFTWARE.
var files = {};
var filesArr = getFiles();
var description = "Ethereum Contracts Gist created using soleditor at: https://chriseth.github.io/browser-solidity";
var description = "Ethereum Contracts Gist created using soleditor at: https://chriseth.github.io/browser-solidity to load gist in soleditor append #gist=gistid to the url, where gistid is the id in this gist url.";
for(var f in filesArr) {
files[fileNameFromKey(filesArr[f])] = {

Loading…
Cancel
Save