Created
April 16, 2016 01:15
-
-
Save t0rr3sp3dr0/b691e8279d7640d42d6f3cc42cc6f89c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( ".green-score" ).css( "cursor", "pointer" ).css( "background-color", "#337ab7" ).css( "color", "white" ); | |
$( ".green-score" ).click(function() { | |
$( this ).unbind( "click" ); | |
setTimeout("alert('Processando...');", 1); | |
var self = this; | |
var _id; | |
var _user; | |
var time = $( this ).text().split(' ')[0]; | |
var user = $( this )[0].parentElement.parentElement.getElementsByTagName('td')[1].innerText; | |
$.getJSON( document.URL.replace('/contest/', '/api/contest/') + '/scoreboard', function( data ) { | |
for (e in data.contestants) | |
if (data.contestants[e].name == user) { | |
_user = e; | |
break; | |
} | |
$.getJSON( document.URL.replace('/contest/', '/api/contest/') + '/scoreboard/dynamic', function( data ) { | |
for (e in data.submissions) | |
if (data.submissions[e].contestant == _user && data.submissions[e].time == time) { | |
_id = data.submissions[e]._id; | |
break; | |
} | |
console.log(document.URL.split('contest/')[0] + 'api/submission/get/' + _id); | |
$.getJSON( document.URL.split('contest/')[0] + 'api/submission/get/' + _id, function( data ) { | |
$( self ).click(function() { | |
try { | |
var popup = window.open('text/plain'); | |
popup.document.write('<plaintext>'); | |
popup.document.write(data.code); | |
} | |
catch(err) { | |
alert('Aperte na submissão novamente para abri-la!'); | |
} | |
}); | |
$( self ).click(); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment