Greasy Fork is available in English.

Relevance Groupon on Mturk

Hides instructions, auto opens link, when radio is clicked new window closes and hit submits.

  1. // ==UserScript==
  2. // @name Relevance Groupon on Mturk
  3. // @version 1.0
  4. // @description Hides instructions, auto opens link, when radio is clicked new window closes and hit submits.
  5. // @author Cristo
  6. // @include https://s3.amazonaws.com/mturk_bulk/*
  7. // @copyright 2012+, You
  8. // @namespace https://greatest.deepsurf.us/users/1973
  9. // ==/UserScript==
  10.  
  11. if (window.location.toString().indexOf("ASSIGNMENT_ID_NOT_AVAILABLE") === -1){
  12. var page = document.getElementById("mturk_form");
  13. var instructions = page.getElementsByClassName("panel panel-primary")[0];
  14. var site = page.getElementsByTagName("a")[1].href;
  15. var inputs = page.getElementsByTagName("input");
  16. var sub = document.getElementById("submitButton");
  17. instructions.style.display = "none";
  18. var but = document.createElement("input");
  19. but.type = "button";
  20. but.value = "Instructions";
  21. instructions.parentNode.insertBefore(but, instructions.nextSibling);
  22. var newWidth;
  23. var newLeft;
  24. var windowTo;
  25. var windowEnd = window.screenX + window.outerWidth;
  26. var leftSpace = window.screenX;
  27. var rightSpace = screen.width - windowEnd;
  28. if (leftSpace > rightSpace) {
  29. newWidth = window.screenX;
  30. newLeft = "0";
  31. } else {
  32. newWidth = screen.width - windowEnd;
  33. newLeft = windowEnd;
  34. }
  35. windowTo = 'width=' + newWidth;
  36. windowTo += ', height=' + screen.height;
  37. windowTo += ', top=' + "0";
  38. windowTo += ', left=' + newLeft;
  39. var newin = window.open(site, "name", windowTo);
  40. document.addEventListener( "click", cas, false );
  41. function cas (d) {
  42. if(d.target == but){
  43. if(instructions.style.display == "none") {
  44. instructions.style.display = "block";
  45. } else if (instructions.style.display == "block") {
  46. instructions.style.display = "none";
  47. }
  48. }
  49. if(d.target == inputs[2]){
  50. newin.close();
  51. sub.click();
  52. }
  53. if(d.target == inputs[3]){
  54. newin.close();
  55. sub.click();
  56. }
  57. }
  58. }