MTurk Queue Count

Displays the current queue count above the HIT area.

目前为 2015-01-07 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name MTurk Queue Count
  3. // @author Chet Manley
  4. // @version 0.1
  5. // @description Displays the current queue count above the HIT area.
  6. // @include https://www.mturk.com/mturk/*
  7. // @require http://code.jquery.com/jquery-latest.min.js
  8. // @grant none
  9. // @namespace https://greasyfork.org/users/6438
  10. // ==/UserScript==
  11.  
  12.  
  13. // Displays the current queue count above the HIT area.
  14.  
  15. $(document).ready(function () {
  16. console.log('AMT Tools Queue Count loaded');
  17.  
  18. var myHITsURL = 'https://www.mturk.com/mturk/myhits';
  19. var queueCount = '';
  20. var HITsRemainingStr = ' HITs remaining';
  21.  
  22. $.ajax({
  23. async: false,
  24. type: 'GET',
  25. url: myHITsURL,
  26. success: function (data) {
  27. queueCount = $('.title_orange_text', $(data)).text().trim();
  28. }
  29. });
  30.  
  31. if (queueCount.length) {
  32. queueCount = queueCount.split(' of ')[1];
  33. queueCount = queueCount.split(' ')[0];
  34.  
  35. if (parseInt(queueCount) == 1) {
  36. HITsRemainingStr = ' HIT remaining';
  37. }
  38. } else {
  39. HITsRemainingStr = 'Your queue is empty';
  40. }
  41.  
  42. var queueCountStr = queueCount + HITsRemainingStr;
  43.  
  44. $('#theTime').parent().parent().parent().append('< tr><td align="left" valign="top" class="title_orange_text" nowrap="" style="padding-top: 3px; padding-left: 5px;"><b>Queue:</b> <span>' + queueCountStr + '</span></td></tr>');
  45. });