[MTurk Worker] Confirm Return HIT

Prevent accidental returns by adding a prompt when returning a HIT

  1. // ==UserScript==
  2. // @name [MTurk Worker] Confirm Return HIT
  3. // @namespace https://github.com/Kadauchi
  4. // @version 1.0.1
  5. // @description Prevent accidental returns by adding a prompt when returning a HIT
  6. // @author Kadauchi
  7. // @icon http://i.imgur.com/oGRQwPN.png
  8. // @include https://worker.mturk.com/tasks*
  9. // @include https://worker.mturk.com/projects/*/tasks/*?assignment_id=*
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. document.addEventListener(`submit`, (event) => {
  14. const returning = event.target.querySelector(`[value="delete"]`);
  15.  
  16. if (returning) {
  17. event.preventDefault();
  18.  
  19. const c = confirm(`Are you sure you want to return this HIT?\n\nPress OK to return the HIT or press Cancel to continue working on the HIT.`);
  20.  
  21. if (c) {
  22. event.target.submit();
  23. }
  24. }
  25. });
  26. })();