Guest User

Untitled

a guest
Oct 21st, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. (function(Prototype) {
  2. Prototype.Version;
  3. $('abc');
  4. var marking_labels=[/Q1\s+Correctness/, /Q2\s+Correctness/, /Q3\s+Correctness/];
  5. 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")];
  6. var autotest_labels=[/Question\s+1:\s+(\d+)\/6/,/Question\s+2:\s+(\d+)\/6/,/Question\s+3:\s+(\d+)\/10/];
  7. var contains = function(regex) { return function(element) { return element.textContent.match(regex) } };
  8. var indicies = function(item) { return item[0][item[1]] };
  9. var buttons = function(labels) {
  10. return labels.map(function(regex) {
  11. return $$(".mark_criterion_title_div_level").find(contains(regex)).parentNode.select("td")
  12. })
  13. };
  14. var grades = function(labels) {
  15. return labels.map(function(regex) {
  16. return $$("span").find(contains(regex)).textContent.match(regex)[1]
  17. })
  18. };
  19. document.observe('keydown', function(event) {
  20. if(event.keyCode === Event.KEY_LEFT) {
  21. document.location = $$('.left a')[0].readAttribute('href')
  22. }
  23. if(event.keyCode === Event.KEY_RIGHT) {
  24. document.location = $$('.right a')[0].readAttribute('href')
  25. }
  26. if(event.keyCode === 67) {
  27. Form.Element.setValue($('marking_state'), 'complete')
  28. }
  29. });
  30. buttons(marking_labels).zip(mark_to_tier.zip(grades(autotest_labels)).map(indicies)).map(indicies).invoke("onclick")
  31. }(Prototype));
Add Comment
Please, Sign In to add comment