Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(Prototype) {
- Prototype.Version;
- $('abc');
- var marking_labels=[/Q1\s+Correctness/, /Q2\s+Correctness/, /Q3\s+Correctness/];
- var mark_to_tier=[$w("0 1 2 2 3 3 4"),$w("0 1 2 2 3 3 4"),$w("0 1 1 2 2 2 2 3 3 3 4")];
- var autotest_labels=[/Question\s+1:\s+(\d+)\/6/,/Question\s+2:\s+(\d+)\/6/,/Question\s+3:\s+(\d+)\/10/];
- var contains = function(regex) { return function(element) { return element.textContent.match(regex) } };
- var indicies = function(item) { return item[0][item[1]] };
- var buttons = function(labels) {
- return labels.map(function(regex) {
- return $$(".mark_criterion_title_div_level").find(contains(regex)).parentNode.select("td")
- })
- };
- var grades = function(labels) {
- return labels.map(function(regex) {
- return $$("span").find(contains(regex)).textContent.match(regex)[1]
- })
- };
- document.observe('keydown', function(event) {
- if(event.keyCode === Event.KEY_LEFT) {
- document.location = $$('.left a')[0].readAttribute('href')
- }
- if(event.keyCode === Event.KEY_RIGHT) {
- document.location = $$('.right a')[0].readAttribute('href')
- }
- if(event.keyCode === 67) {
- Form.Element.setValue($('marking_state'), 'complete')
- }
- });
- buttons(marking_labels).zip(mark_to_tier.zip(grades(autotest_labels)).map(indicies)).map(indicies).invoke("onclick")
- }(Prototype));
Add Comment
Please, Sign In to add comment