Skip to content

Instantly share code, notes, and snippets.

@trebi
Created January 17, 2014 14:46
Show Gist options
  • Save trebi/8474552 to your computer and use it in GitHub Desktop.
Save trebi/8474552 to your computer and use it in GitHub Desktop.
Answer again already answered quizzes in is.muni.cz
javascript: (function(){
document._ans=new Array();
$('table[bgcolor="#CCCC66"] *').hide();
$('table[bgcolor="#CCCC66"]').css({
'border-bottom':'3px ridge','margin':'2px'
});
$("form>p").hide();
$("table[cellspacing='0'] tr").each(
function(i,b){
$(b).children('td:first-child').css('background','transparent').each(function(i,a){
a.score=0
});
$(b).find('img[alt="spr%C3%A1vn%C4%9B"]').hide().each(function(i,a){
document._ans[document._ans.length]=a.parentNode.firstChild.getAttribute('id')
});
$(b).find('img[alt="%C5%A1patn%C4%9B"], img[alt="spr%C3%A1vn%C4%9B"]').hide();
$(b).find(':checked').attr('checked',false)
});
$("form").append("<button id='chkagain'>Opravit</button>");
$("#chkagain").click(function(e){
$('input[type="radio"]').parent().css({
'outline':'none','background':'transparent'
});
e.preventDefault();
$("input:checked").parent().css({
'outline':'1px solid red','background':'#FFDFC8'
});
document._ans.forEach(function(v){
var i=$("#"+v);
if(i.attr('checked')) {
i.parent().css({'outline':'1px solid green','background':'#DFFFC8'});
} else {
i.parent().css({'outline':'1px solid orange','background':'#FFF4C8'});
}
return false
})
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment