Skip to content

Instantly share code, notes, and snippets.

@kerryChen95
Last active December 29, 2015 02:39
Show Gist options
  • Save kerryChen95/7602226 to your computer and use it in GitHub Desktop.
Save kerryChen95/7602226 to your computer and use it in GitHub Desktop.
UESTC evaluate teaching script
(function evaluate(){
var ifr = document.querySelector('#iframeautoheight'),
ifrDoc = ifr.contentDocument,
selects = ifrDoc.querySelector('#DataGrid1').querySelectorAll('.select'),
i, l,
options,
submitBtn = ifrDoc.querySelector('#Button2');
if( submitBtn.value.search(/提\s*交/) === -1 ){
for(i = 0, l = selects.length; i < l; ++i){
options = selects[i].options;
selects[i].selectedIndex = parseInt(Math.random() * (options.length - 1)) + 1;
}
ifr.addEventListener('load', function onIfrLoad(){
this.removeEventListener('load', onIfrLoad, false);
evaluate();
}, false);
ifrDoc.querySelector('#Button1').click();
}
else if(confirm('完成评教了,要提交吗?')){
submitBtn.click();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment