mTurk - Show Auto-App time & Link Turkopticon

Shows auto-approval time and links to requester on Turkopticon, on HIT preview pages.

  1. // ==UserScript==
  2. // @name mTurk - Show Auto-App time & Link Turkopticon
  3. // @author antithought
  4. // @description Shows auto-approval time and links to requester on Turkopticon, on HIT preview pages.
  5. // @match https://www.mturk.com/mturk/accept*
  6. // @match https://www.mturk.com/mturk/preview*
  7. // @match https://www.mturk.com/mturk/continue*
  8. // @match https://www.mturk.com/mturk/submit
  9. // @match https://www.mturk.com/mturk/return*
  10. // @require http://code.jquery.com/jquery-latest.min.js
  11. // @version 1.02
  12. // @namespace https://greasyfork.org/users/6438
  13. // ==/UserScript==
  14.  
  15. // Based off https://userscripts-mirror.org/scripts/show/130470
  16.  
  17. this.$ = this.jQuery = jQuery.noConflict(true);
  18.  
  19. if ( document.forms[1] )
  20. {
  21. if ( document.forms[1].action.search(/accept|submit/gi) != -1 ) {
  22. showAutoAppTime();
  23. showRequesterID();
  24. }
  25. }
  26.  
  27. function showAutoAppTime() {
  28. var AutoAppTime = $('[name=hitAutoAppDelayInSeconds]').attr('value');
  29. var top = $(document.getElementById("qualifications.tooltip")).parent().parent();
  30. $(top).append($('<td class="capsule_field_title" align="right" valign="top" nowrap width="100%"><p style="color:#369;">Auto-Approval Time:&nbsp;&nbsp;</p></td>'));
  31. var Days = Math.floor(AutoAppTime / (60*60*24));
  32. var Hours = Math.floor(AutoAppTime / (60*60)%24);
  33. var Mins = Math.floor(AutoAppTime / (60)%60);
  34. var Secs = AutoAppTime % 60;
  35. $(top).append($('<td nowrap>' +
  36. (Days == 0 ? "" : Days + (Days > 1 ? " days " : " day ")) +
  37. (Hours == 0 ? "" : Hours + (Hours > 1 ? " hours " : " hour ")) +
  38. (Mins == 0 ? "" : Mins + (Mins > 1 ? " minutes " : " minute ")) +
  39. (Secs == 0 ? "" : Secs + (Secs > 1 ? " seconds " : " second ")) + '</td>'));
  40. }
  41.  
  42. function showRequesterID() {
  43. var base = "https://turkopticon.ucsd.edu/";
  44. var id = $("input[name=requesterId]").attr("value");
  45. if (!id) {
  46. var src = $("[name=ExternalQuestionIFrame]").attr("src");
  47. var rgx = new RegExp("requesterId=([^&]+?)&", "i");
  48. var match = rgx.exec(src);
  49. if (match != null) { id = match[1]; }
  50. }
  51. document.getElementById('requester.tooltip').innerHTML = '&nbsp;<a href="' + base + (id ? id :
  52. "main/php_search?query=" + $(document.getElementById("requester.tooltip")).parent().next().text().trim().replace(/ /g, "+") ) + '">Requester</a>:';
  53. }