Hit Timer Fixed

This is an edited version of Hit Timer 0.1 that fixes the compatibility issues with Firefox and adds support for auto-accepted HITs. Tested and working in Firefox 26 and Chrome 32.

  1. // ==UserScript==
  2. // @name Hit Timer Fixed
  3. // @namespace http://userscripts.org/users/43629
  4. // @version 0.1
  5. // @description This is an edited version of Hit Timer 0.1 that fixes the compatibility issues with Firefox and adds support for auto-accepted HITs. Tested and working in Firefox 26 and Chrome 32.
  6. // @match https://www.mturk.com/mturk/accept*
  7. // @match https://www.mturk.com/mturk/previewandaccept*
  8. // @match https://www.mturk.com/mturk/statusdetail*
  9. // @match https://www.mturk.com/mturk/submit*
  10. // @copyright 2013+, Ben McMath, Jasmine Branch
  11. // @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15.  
  16.  
  17. if($('#theTime').length > 0)
  18. {
  19. console.log("-=-=-= Found a Timer");
  20. var checker = setInterval(function(){
  21. var hitId = document.getElementsByName("hitId")[1].value;
  22. var theTime = document.getElementById('theTime').textContent;
  23. if(typeof(Storage)!=="undefined")
  24. {
  25. // Yes! localStorage and sessionStorage support!
  26. localStorage.setItem('hitTimer.' + hitId, theTime);
  27. }
  28. else
  29. {
  30. // Sorry! No web storage support..
  31. console.log("-=-=-= Your browser doesn't support local storage, and therefore we can not track the timing of hits");
  32. clearInterval(checker);
  33. }
  34. }, 1000);
  35. }
  36.  
  37. // see if we are on the status page
  38. if(document.getElementsByClassName('IKnowYou').length > 0)
  39. {
  40. setTimeout(loadTimes, 1000);
  41. }
  42.  
  43. function loadTimes()
  44. {
  45. addHeaderColumn();
  46.  
  47. var requesterColumns = document.getElementsByClassName('statusdetailRequesterColumnValue');
  48. for (var i = requesterColumns.length - 1; i >= 0; i--) {
  49. var linkElement = null;
  50. for(var j = requesterColumns[i].children.length -1; j >= 0; j--)
  51. {
  52. if(requesterColumns[i].children[j].tagName = "A")
  53. {
  54. linkElement = requesterColumns[i].children[j];
  55. break;
  56. }
  57. }
  58. if(typeof linkElement != 'undefined')
  59. {
  60. var hitId = linkElement.href.match(/[A-Z0-9]{30}/);
  61. var timeTaken = getTime(hitId);
  62. addTimeTaken(requesterColumns[i], timeTaken);
  63. }
  64. }
  65. }
  66. function addHeaderColumn()
  67. {
  68. var header = document.getElementsByClassName('grayHead');
  69. var timeColumn = document.createElement('th');
  70. var timeTitle = document.createTextNode('Estimated Time Taken');
  71. timeColumn.appendChild(timeTitle);
  72. header[0].appendChild(timeColumn);
  73. }
  74. function getTime(hitId)
  75. {
  76. var timeTaken = localStorage.getItem('hitTimer.' + hitId);
  77. return (timeTaken == null) ? '' : timeTaken;
  78. }
  79. function addTimeTaken(element, timeTaken)
  80. {
  81. var timeColumn = document.createElement('td');
  82. timeColumn.appendChild(document.createTextNode(timeTaken));
  83. element.parentNode.appendChild(timeColumn);
  84. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址