[MTurk Worker] Workspace Expander

Expands accepted HITs to fill the browser viewport, scrolls to the HIT and focuses it.

  1. // ==UserScript==
  2. // @name [MTurk Worker] Workspace Expander
  3. // @namespace https://github.com/Kadauchi
  4. // @version 1.0.5
  5. // @description Expands accepted HITs to fill the browser viewport, scrolls to the HIT and focuses it.
  6. // @author Kadauchi
  7. // @icon http://i.imgur.com/oGRQwPN.png
  8. // @include https://worker.mturk.com/projects/*/tasks/*?assignment_id=*
  9. // @include https://worker.mturk.com/projects/*
  10. // ==/UserScript==
  11.  
  12. function expandWorkspace() {
  13. const captcha = document.querySelector('img[src^="https://opfcaptcha-prod.s3.amazonaws.com/"]');
  14. const workspace = document.querySelector('#MainContent');
  15. const taskRow = document.querySelector('.task-row');
  16. const taskPreview = document.querySelector('.task-preview');
  17. const iframeContainer = document.querySelector('.task-row > .col-xs-12');
  18. const iframe = document.querySelector('.task-question-iframe-container');
  19.  
  20. if (!captcha) {
  21. if (workspace) {
  22. workspace.style.height = '100vh';
  23. workspace.scrollIntoView();
  24. }
  25.  
  26. if (taskRow) {
  27. taskRow.style.height = '100vh';
  28. taskRow.scrollIntoView();
  29. }
  30.  
  31. if (taskPreview) {
  32. taskPreview.style.height = '100%';
  33. taskPreview.scrollIntoView();
  34. }
  35.  
  36. if (iframeContainer) {
  37. iframeContainer.style.height = `100%`;
  38. iframeContainer.scrollIntoView();
  39. }
  40.  
  41. if (iframe) {
  42. iframe.style.height = `100%`;
  43. iframe.scrollIntoView();
  44. iframe.querySelector('iframe').focus();
  45. }
  46. }
  47. }
  48.  
  49. function moveFooters() {
  50. const hr = document.querySelector('hr.footer-horizontal-rule');
  51. const div = document.querySelector('div.work-pipeline-bottom-bar');
  52. const footer = document.querySelector('footer');
  53.  
  54. document.body.insertBefore(hr, footer);
  55. document.body.insertBefore(div, footer);
  56. }
  57.  
  58. expandWorkspace();
  59. moveFooters()