// ----------------- tabbed menu -------------------
// ----------------- tabbed menu -------------------
$('#options li').click(function(ev){
$('#options li').click(function(ev){
var$el=$(this);
var$el=$(this)
selectTab($el);
selectTab($el)
});
})
varselectTab=function(el){
varselectTab=function(el){
varmatch=/[a-z]+View/.exec(el.get(0).className);
varmatch=/[a-z]+View/.exec(el.get(0).className)
if(!match)return;
if(!match)return
varcls=match[0];
varcls=match[0]
if(!el.hasClass('active')){
if(!el.hasClass('active')){
el.parent().find('li').removeClass('active');
el.parent().find('li').removeClass('active')
$('#optionViews').attr('class','').addClass(cls);
$('#optionViews').attr('class','').addClass(cls)
el.addClass('active');
el.addClass('active')
}
}
self.event.trigger('tabChanged',[cls]);
self.event.trigger('tabChanged',[cls])
};
}
// ------------------ 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?')){
if(confirm('Are you sure you want to publish all your files anonymously as a public gist on github.com?')){
varfiles=editor.packageFiles();
varfiles=editor.packageFiles()
vardescription='Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. \n Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version='+queryParams.get().version+'&optimize='+queryParams.get().optimize+'&gist=';
vardescription='Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. \n Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version='+queryParams.get().version+'&optimize='+queryParams.get().optimize+'&gist='
$.ajax({
$.ajax({
url:'https://api.github.com/gists',
url:'https://api.github.com/gists',
...
@@ -122,159 +125,161 @@ var run = function () {
...
@@ -122,159 +125,161 @@ var run = function () {
})
})
}).done(function(response){
}).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?')){
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');
window.open(response.html_url,'_blank')
}
}
});
})
}
}
});
})
$('#copyOver').click(function(){
$('#copyOver').click(function(){
vartarget=prompt(
vartarget=prompt(
'To which other browser-solidity instance do you want to copy over all files?',
'To which other browser-solidity instance do you want to copy over all files?',
if(typeofresp[key]!=='undefined'&&obj[key]!==resp[key]&&confirm('Overwrite "'+utils.fileNameFromKey(key)+'"? Click Ok to overwrite local file with file from cloud. Cancel will push your local file to the cloud.')){
if(typeofresp[key]!=='undefined'&&obj[key]!==resp[key]&&confirm('Overwrite "'+utils.fileNameFromKey(key)+'"? Click Ok to overwrite local file with file from cloud. Cancel will push your local file to the cloud.')){